|
|
|
|
|
|
$director) {
// ignore the parent directory '..' when printing the contents of the root directory
if (!strcmp($director, "..") && !strcmp($dirpath, ".")) {
continue;
}
// variable used to select row background color
$j++;
// array to keep each directory's stats
$dta = stat($director);
// the directories are treated this way...
// except '..' which has a different icon from the other directories
if (strcmp($director, "..")) {
echo "";
if ($SHOW_ICON) {
echo " | ";
}
echo "[".$director."]";
if (((time() - $dta[9]) / 1E+5) < $new_period) {
echo " $msg_new";
}
echo " | ";
echo " | ";
if ($SHOW_SIZE) {
echo "<DIR> | ";
}
if ($SHOW_MODIFIED) {
echo "".date("d.m.Y H:i", $dta[9])." | ";
}
if ($SHOW_DESCRIPTION) {
echo " | ";
}
echo "
";
} else {
echo "";
if ($SHOW_ICON) {
echo " | ";
}
echo "[".$director."] | ";
echo " | ";
if ($SHOW_SIZE) {
echo "<DIR> | ";
}
if ($SHOW_MODIFIED) {
echo "".date("d.m.Y H:i", $dta[9])." | ";
}
if ($SHOW_DESCRIPTION) {
echo " | ";
}
echo "
";
}
// clear the stats of the entry
clearstatcache();
}
// read each element of the files array
foreach($fisiere as $key => $file) {
$j++;
// array to keep each directory's stats
$dta = stat($file);
// split the filename into name and extension
$split_name_ext = explode(".", $file);
// store the file extension
$extensie = (count($split_name_ext)-1 != 0) ? $split_name_ext[count($split_name_ext)-1] : "";
// store the lowercased extenosion
$lextensie = strtolower($extensie);
// if there is a custom icon and descrpition for this type of files
// use them instead of the default ones
if (array_key_exists($lextensie, $exts)) {
$descriere = $exts[$lextensie][0];
$iconita = $exts[$lextensie][1];
} else {
// these are the default icon and description
$descriere = "";
$iconita = "unknown.gif";
}
echo "";
// print the icon
if ($SHOW_ICON) {
echo " | ";
}
// print the filename
if (in_array($lextensie, $not_to_be_dloaded)) {
// for the files that should not be downloaded use a direct link
echo "".$split_name_ext[0];
} else {
// for the files that should be downloaded use the 'download.php' script
echo " | ".$split_name_ext[0];
}
for($i = 1; $i < count($split_name_ext) - 1; $i++) {
echo (".$split_name_ext[$i]");
}
echo "";
// print '$msg_new' for new files
if ( ((time() - $dta[9]) / 1E+5) < $new_period) {
echo " $msg_new ";
}
echo " | ";
// print the extension
echo "";
echo $extensie;
echo " | ";
// print the file size
if ($SHOW_SIZE) {
echo "";
printf("%.2f KB", $dta[7]/1024);
echo " | ";
}
// print the date the file was last modified
if ($SHOW_MODIFIED) {
echo "".date("d.m.Y H:i", $dta[9])." | ";
}
// print the file type description
if ($SHOW_DESCRIPTION) {
echo "".$descriere." | ";
}
echo "
";
// clear the stats of the entry
clearstatcache();
}
?>