';
$location = str_replace("|", "/", xssClean($_GET['location'], "html"));
if ("/" === $location) {
$location = "";
};
$dirArray = $filesArray = [];
$finalArray = scanDir($scanDir . $location);
foreach($finalArray as $entry) {
$canAdd = true;
for ($i = 0; $i < count($_SESSION['bannedFiles']); $i++) {
if ("" != str_replace("*", "", $_SESSION['bannedFiles'][$i]) && false !== strpos($entry, str_replace("*", "", $_SESSION['bannedFiles'][$i]))) {
$canAdd = false;
}
}
// Ignore ICEcoder's dir
if ($docRoot . $iceRoot . $location . "/" . $entry === $docRoot . $ICEcoderDir) {
$canAdd = false;
}
if ("." !== $entry && ".." !== $entry && $canAdd) {
is_dir($docRoot . $iceRoot . $location . "/".$entry)
? array_push($dirArray, $location . "/" . $entry)
: array_push($filesArray, $location . "/" . $entry);
}
}
natcasesort($dirArray);
natcasesort($filesArray);
$finalArray = array_merge($dirArray, $filesArray);
for ($i = 0; $i < count($finalArray); $i++) {
$fileFolderName = str_replace("\\", "/", $finalArray[$i]);
$type = is_dir($docRoot . $iceRoot . $fileFolderName) ? "folder" : "file";
if ("file" === $type) {
// Get extension (prefix 'ext-' to prevent invalid classes from extensions that begin with numbers)
$ext = "ext-" . pathinfo($docRoot . $iceRoot . $fileFolderName, PATHINFO_EXTENSION);
}
if (0 === $i) {echo "\n";}
if ($i === count($finalArray) - 1 && isset($_GET['location'])) {
echo "
";
}
$class = "folder" === $type ? 'pft-directory' : 'pft-file ' . strtolower($ext);
$loadParam = "folder" === $type ? "true" : "false";
echo " ".xssClean(basename($fileFolderName),"html")." ";
$thisPermVal = "Windows" !== $serverType
? intval(substr(sprintf('%o', fileperms($docRoot . $iceRoot . $fileFolderName)), -3))
: 0;
$permColors = 777 === $thisPermVal ? 'background: #800; color: #eee' : 'color: #888';
echo '';
echo 0 !== $thisPermVal ? $thisPermVal : '';
echo "\n";
}
echo ' ';
?>