From 8fcbdc8ea0a2864f4e2ac05aa994cb0771065b78 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Wed, 20 Feb 2013 09:32:19 +0000 Subject: [PATCH] Reinstate files.php only Stupid line breaks --- files.php | 312 +++++++++++++++++++++++++++--------------------------- 1 file changed, 156 insertions(+), 156 deletions(-) diff --git a/files.php b/files.php index 0859565..afdfdfc 100644 --- a/files.php +++ b/files.php @@ -1,157 +1,157 @@ - - - - - -ICEcoder v <?php echo $ICEcoder["versionNo"];?> file manager - - - - - - - -
- -getPathname(), $b->getPathname()); -} - -// Class to put forward the values for sorting -class SortingIterator implements IteratorAggregate { - private $iterator = null; - public function __construct(Traversable $iterator, $callback) { - $array = iterator_to_array($iterator); - usort($array, $callback); - $this->iterator = new ArrayIterator($array); - } - public function getIterator() { - return $this->iterator; - } -} - -class IgnorantRecursiveDirectoryIterator extends RecursiveDirectoryIterator { - function getChildren() { - try { - if (!isset($GLOBALS['ICEcoder']['bannedPaths']) || - !in_array($this->key(), $GLOBALS['ICEcoder']['bannedPaths'])) { - return parent::getChildren(); - } else { - return new RecursiveArrayIterator(array()); - } - } catch(UnexpectedValueException $e) { - return new RecursiveArrayIterator(array()); - } - } -} - -// Get a full list of dirs & files and begin sorting using above class & function -$objectList = new SortingIterator(new RecursiveIteratorIterator(new IgnorantRecursiveDirectoryIterator($docRoot.$iceRoot), RecursiveIteratorIterator::SELF_FIRST), 'alphasort'); - -// With that done, create arrays for out final ordered list and a temp container of files -$finalArray = $tempArray = array(); - -// To start, push folders from object into finalArray, files into tempArray -foreach ($objectList as $objectRef) { - $fileFolderName = substr($objectRef->getPathname(), strlen($docRoot.$iceRoot)); - $canAdd = true; - for ($i=0;$igetFilename()!="." && $objectRef->getFilename()!=".." && $fileFolderName[strlen($fileFolderName)-1]!="/" && $canAdd) { - $fileFolderName!="/" && is_dir($docRoot.$iceRoot.$fileFolderName) - ? array_push($finalArray,$fileFolderName) - : array_push($tempArray,$fileFolderName); - } -} - -// Now push root files onto the end of finalArray and splice from the temp, leaving only files that reside in subdirs -for ($i=0;$i'; -} -?> -
    -
  • - -        -/ - - - - -
  • - $lastDepth) {echo "
      \n";} - if ($thisDepth < $lastDepth) { - for ($j=$lastDepth;$j>$thisDepth;$j--) { - echo "
    \n"; - } - } - if ($serverType=="Linux") { - $chmodInfo = substr(sprintf('%o', fileperms($docRoot.$iceRoot.$fileFolderName)), -3); - $fileAtts = ''.$chmodInfo.''; - } - $type == "folder" ? $class = 'pft-directory' : $class = 'pft-file '.strtolower($ext); - echo "
  •         ".basename($fileFolderName)." ".$fileAtts."\n"; - if ($i\n";} - $lastPath = $fileFolderName; -} -echo "
\n\n"; - - // Output the JS vars - echo ""; -?> - - - - - + + + + + +ICEcoder v <?php echo $ICEcoder["versionNo"];?> file manager + + + + + + + +
+ +getPathname(), $b->getPathname()); +} + +// Class to put forward the values for sorting +class SortingIterator implements IteratorAggregate { + private $iterator = null; + public function __construct(Traversable $iterator, $callback) { + $array = iterator_to_array($iterator); + usort($array, $callback); + $this->iterator = new ArrayIterator($array); + } + public function getIterator() { + return $this->iterator; + } +} + +class IgnorantRecursiveDirectoryIterator extends RecursiveDirectoryIterator { + function getChildren() { + try { + if (!isset($GLOBALS['ICEcoder']['bannedPaths']) || + !in_array($this->key(), $GLOBALS['ICEcoder']['bannedPaths'])) { + return parent::getChildren(); + } else { + return new RecursiveArrayIterator(array()); + } + } catch(UnexpectedValueException $e) { + return new RecursiveArrayIterator(array()); + } + } +} + +// Get a full list of dirs & files and begin sorting using above class & function +$objectList = new SortingIterator(new RecursiveIteratorIterator(new IgnorantRecursiveDirectoryIterator($docRoot.$iceRoot), RecursiveIteratorIterator::SELF_FIRST), 'alphasort'); + +// With that done, create arrays for out final ordered list and a temp container of files +$finalArray = $tempArray = array(); + +// To start, push folders from object into finalArray, files into tempArray +foreach ($objectList as $objectRef) { + $fileFolderName = substr($objectRef->getPathname(), strlen($docRoot.$iceRoot)); + $canAdd = true; + for ($i=0;$igetFilename()!="." && $objectRef->getFilename()!=".." && $fileFolderName[strlen($fileFolderName)-1]!="/" && $canAdd) { + $fileFolderName!="/" && is_dir($docRoot.$iceRoot.$fileFolderName) + ? array_push($finalArray,$fileFolderName) + : array_push($tempArray,$fileFolderName); + } +} + +// Now push root files onto the end of finalArray and splice from the temp, leaving only files that reside in subdirs +for ($i=0;$i'; +} +?> +
    +
  • + +        +/ + + + + +
  • + $lastDepth) {echo "
      \n";} + if ($thisDepth < $lastDepth) { + for ($j=$lastDepth;$j>$thisDepth;$j--) { + echo "
    \n"; + } + } + if ($serverType=="Linux") { + $chmodInfo = substr(sprintf('%o', fileperms($docRoot.$iceRoot.$fileFolderName)), -3); + $fileAtts = ''.$chmodInfo.''; + } + $type == "folder" ? $class = 'pft-directory' : $class = 'pft-file '.strtolower($ext); + echo "
  •         ".basename($fileFolderName)." ".$fileAtts."\n"; + if ($i\n";} + $lastPath = $fileFolderName; +} +echo "
\n\n"; + + // Output the JS vars + echo ""; +?> + + + + + \ No newline at end of file