Remove redundant full tree code

No longer need to consider depths as we are getting folder/file listings
for 1 branch at a time. For this reason, the opening UL will always be
block and the closing one shown when it's the last item and $GET
location is available (ie, not the root).
This commit is contained in:
Matt Pass
2013-03-02 16:28:46 +00:00
parent cc306475b2
commit 0569a4b633

View File

@@ -6,7 +6,6 @@ if (!isset($ICEcoder['root'])) {
if (!$_SESSION['loggedIn']) {
header("Location: ../");
}
$lastPath="";
$fileCount=0;
$fileBytes=0;
$dirCount=0;
@@ -45,14 +44,9 @@ for ($i=0;$i<count($finalArray);$i++) {
// Get extension (prefix 'ext-' to prevent invalid classes from extensions that begin with numbers)
$ext = "ext-".pathinfo($docRoot.$iceRoot.$fileFolderName, PATHINFO_EXTENSION);
}
$thisDepth = count(explode("/",$fileFolderName));
$lastDepth = count(explode("/",$lastPath));
$ulDisplay = $i==0 ? ' style="display: block"' : ' style="display: none"';
if ($thisDepth > $lastDepth) {echo "<ul".$ulDisplay.">\n";}
if ($thisDepth < $lastDepth) {
for ($j=$lastDepth;$j>$thisDepth;$j--) {
echo "</ul>\n";
}
if ($i==0) {echo "<ul style=\"display: block\">\n";}
if ($i==count($finalArray)-1 && isset($_GET['location'])) {
echo "</ul>\n";
}
$type == "folder" ? $class = 'pft-directory' : $class = 'pft-file '.strtolower($ext);
$loadParam = $type == "folder" ? "true" : "false";
@@ -60,7 +54,6 @@ for ($i=0;$i<count($finalArray);$i++) {
echo '<span style="color: #888; font-size: 8px" id="'.str_replace($docRoot,"",str_replace("/","|",$fileFolderName)).'_perms">';
echo $serverType=="Linux" ? substr(sprintf('%o', fileperms($docRoot.$iceRoot.$fileFolderName)), -3) : '';
echo "</span></a></li>\n";
$lastPath = $fileFolderName;
}
if (isset($_GET['location'])) {