2) { // To ignore . and .. directories
if($first_call) {
// Root Directory
$dirRep = str_replace("\\","/",$directory);
$link = str_replace("[link]", "$dirRep/", $return_link);
$link = str_replace("//","/",$link);
$fileAtts = "";
if ($serverType=="Linux") {
//$ownerInfo = posix_getpwuid(fileowner($link));
$ownerInfo = "ME";
$chmodInfo = substr(sprintf('%o', fileperms($link)), -4);
if ($ownerInfo!="nobody"&&(substr($chmodInfo, -1)!=2&&substr($chmodInfo, -1)!=3&&substr($chmodInfo, -1)!=6&&substr($chmodInfo, -1)!=7)) {
$fileAtts = "
";
}
}
$fileManager = "
";
$fileManager .= "- / [ROOT] ".$fileAtts."";
$fileManager .= $fileManager .= fileManager_dir("$directory/", $return_link ,false);
$fileManager .= "
";
$first_call = false;
} else {
$fileManager = "";
}
foreach( $file as $this_file ) {
$bannedFile=false;
for ($i=0;$i";
}
}
$fileManager .= "- " . htmlspecialchars($this_file) . " ".$fileAtts."";
$fileManager .= fileManager_dir("$directory/$this_file", $return_link , false);
$fileManager .= "
";
} else {
// File
// Get extension (prefix 'ext-' to prevent invalid classes from extensions that begin with numbers)
$ext = "ext-" . substr($this_file, strrpos($this_file, ".") + 1);
$dirRep = str_replace("\\","/",$directory);
$link = str_replace("[link]", "$dirRep/" . urlencode($this_file), $return_link);
$link = str_replace("//","/",$link);
$restrictedFile=false;
for ($i=0;$i";
}
}
$fileManager .= "- " . htmlspecialchars($this_file) . " ".$fileAtts."
";
} else {
if ($_SESSION['userLevel'] == 0) {
$fileAtts = "
";
$fileManager .= "- [HIDDEN] ".$fileAtts."
";
} else {
$fileAtts = "
";
$fileManager .= "- " . htmlspecialchars($this_file) . " ".$fileAtts."
";
}
}
}
}
}
$fileManager .= "
";
}
return $fileManager;
}
// For PHP4 compatibility
function php4_scandir($dir) {
$dh = opendir($dir);
while( false !== ($filename = readdir($dh)) ) {
$files[] = $filename;
}
sort($files);
return($files);
}
?>
ICE Coder File Manager