';
$location = str_replace("|","/",$_GET['location']);
if ($location=="/") {$location = "";};
$dirArray = $filesArray = $finalArray = array();
// Get dir/file list over FTP
if (isset($ftpSite)) {
// Establish connection, result, maybe use pasv and alert error if no good connection
$ftpConn = ftp_connect($ftpHost);
$ftpLogin = ftp_login($ftpConn, $ftpUser, $ftpPass);
if ($ftpPasv) {
ftp_pasv($ftpConn, true);
}
if (!$ftpConn || !$ftpLogin) {
die('');
exit;
}
// Get our simple and detailed lists and close the FTP connection
$ftpList = ftpGetList($ftpConn, $ftpRoot.$location);
$finalArray = $ftpList['simpleList'];
$ftpItems = $ftpList['detailedList'];
ftp_close($ftpConn);
// or get local list
} else {
$finalArray = scanDir($scanDir.$location);
}
foreach($finalArray as $entry) {
$canAdd = true;
for ($i=0;$i
\n";}
if ($i==count($finalArray)-1 && isset($_GET['location'])) {
echo "\n";
}
$type == "folder" ? $class = 'pft-directory' : $class = 'pft-file '.strtolower($ext);
$loadParam = $type == "folder" ? "true" : "false";
echo " ".xssClean(basename($fileFolderName),"html")." ";
if (!isset($ftpSite)) {
$thisPermVal = $serverType=="Linux" ? substr(sprintf('%o', fileperms($docRoot.$iceRoot.$fileFolderName)), -3) : '';
} else {
// Work out perms value
$thisPermVal = 0;
$r = $ftpItems[basename($fileFolderName)]['rights'];
// Owner
$thisPermVal += substr($r,1,1) == "r" ? 400 : 0;
$thisPermVal += substr($r,2,1) == "w" ? 200 : 0;
$thisPermVal += substr($r,3,1) == "x" ? 100 : 0;
// Group
$thisPermVal += substr($r,4,1) == "r" ? 40 : 0;
$thisPermVal += substr($r,5,1) == "w" ? 20 : 0;
$thisPermVal += substr($r,6,1) == "x" ? 10 : 0;
// Public
$thisPermVal += substr($r,7,1) == "r" ? 4 : 0;
$thisPermVal += substr($r,8,1) == "w" ? 2 : 0;
$thisPermVal += substr($r,9,1) == "x" ? 1 : 0;
}
$permColors = $thisPermVal == 777 ? 'background: #800; color: #eee' : 'color: #888';
echo '';
echo $thisPermVal;
echo "\n";
}
echo ' ';
if (!isset($ftpSite) && $_SESSION['githubDiff']) {
// Show the loading screen until we're done comparing files with GitHub
echo "";
$i=0;
$dirListArray = $dirSHAArray = $dirTypeArray = array();
// For each of the files in our local path...
for ($i=0; $i