';
$location = str_replace("|", "/", xssClean($_GET['location'], "html"));
if ("/" === $location) {
$location = "";
};
$dirArray = $filesArray = $finalArray = [];
// Get dir/file list over FTP
if (isset($ftpSite)) {
$ftpClass->ftpStart();
// Show user warning if no good connection
if (!$ftpConn || !$ftpLogin) {
die('');
exit;
}
// Get our simple and detailed lists and close the FTP connection
$ftpList = $ftpClass->ftpGetList($ftpConn, $ftpRoot . $location);
$finalArray = $ftpList['simpleList'];
$ftpItems = $ftpList['detailedList'];
$ftpClass->ftpEnd();
// or get local list
} else {
$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;
}
}
// Only applicable for local dir, ignoring ICEcoder's dir
if (!isset($ftpSite) && $docRoot . $iceRoot . $location . "/" . $entry === $docRoot . $ICEcoderDir) {
$canAdd = false;
}
if ("." !== $entry && ".." !== $entry && $canAdd) {
if (!isset($ftpSite)) {
is_dir($docRoot . $iceRoot . $location . "/".$entry)
? array_push($dirArray, $location . "/" . $entry)
: array_push($filesArray, $location . "/" . $entry);
} else {
"directory" === $ftpItems[$entry]['type']
? 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]);
if (!isset($ftpSite)) {
$type = is_dir($docRoot . $iceRoot . $fileFolderName) ? "folder" : "file";
} else {
$type = "directory" === $ftpItems[basename($fileFolderName)]['type'] ? "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")." ";
if (!isset($ftpSite)) {
$thisPermVal = "Windows" !== $serverType ? intval(substr(sprintf('%o', fileperms($docRoot . $iceRoot . $fileFolderName)), -3)) : 0;
} else {
// Work out perms value
$thisPermVal = 0;
$r = $ftpItems[basename($fileFolderName)]['rights'];
// Owner
$thisPermVal += "r" === substr($r,1,1) ? 400 : 0;
$thisPermVal += "w" === substr($r,2,1) ? 200 : 0;
$thisPermVal += "x" === substr($r,3,1) ? 100 : 0;
// Group
$thisPermVal += "r" === substr($r,4,1) ? 40 : 0;
$thisPermVal += "w" === substr($r,5,1) ? 20 : 0;
$thisPermVal += "x" === substr($r,6,1) ? 10 : 0;
// Public
$thisPermVal += "r" === substr($r,7,1) ? 4 : 0;
$thisPermVal += "w" === substr($r,8,1) ? 2 : 0;
$thisPermVal += "x" === substr($r,9,1) ? 1 : 0;
}
$permColors = 777 === $thisPermVal ? 'background: #800; color: #eee' : 'color: #888';
echo '';
echo 0 !== $thisPermVal ? $thisPermVal : '';
echo "\n";
}
echo ' ';
?>