"; ?>
isDot()) continue; //if ($fileinfo->isFile()) continue; if (strpos("{$fileinfo}", ".") === 0) continue; if (strpos("{$fileinfo}", "index.html") === 0) continue; $pos1 = strpos($fileinfo->getRealPath(), $htdocs); $pat = dirname(dirname(substr($fileinfo->getRealPath(), $pos1+7))); $pippo = $fileinfo->getRealPath(); if ($pat == ".") { $pat = "";} $retval[] = [ 'name' => "{$fileinfo}", 'lastmod' => date("Y-m-d H:i:s", $fileinfo->getMTime()), 'type' => ($fileinfo->getType() == "dir") ? "dir" : mime_content_type($fileinfo->getRealPath()), 'size' => $fileinfo->getSize(), 'path' => $pat //$fileinfo->getRealPath() ]; } /* foreach($d as $fileinfo) { // skip hidden files if ($fileinfo->isDot()) continue; if ($fileinfo->isDir()) continue; if (strpos("{$fileinfo}", ".") === 0) continue; if (strpos("{$fileinfo}", "index.html") === 0) continue; $pos1 = strpos($fileinfo->getRealPath(), $htdocs); $pat = dirname(dirname(substr($fileinfo->getRealPath(), $pos1+7))); $pippo = $fileinfo->getRealPath(); $retval[] = [ 'name' => "{$fileinfo}", 'lastmod' => date("Y-m-d H:i:s", $fileinfo->getMTime()), 'type' => ($fileinfo->getType() == "dir") ? "dir" : mime_content_type($fileinfo->getRealPath()), 'size' => $fileinfo->getSize(), 'path' => $pat //$fileinfo->getRealPath() ]; }*/ if (count($retval) == 0) { foreach($d as $fileinfo) { // skip hidden files if (strpos("{$fileinfo}", "index.html") === 0) { $pos1 = strpos($fileinfo->getRealPath(), $htdocs); $pat = dirname(dirname(substr($fileinfo->getRealPath(), $pos1+7))); $pippo = $fileinfo->getRealPath(); $retval[] = [ 'name' => "{$fileinfo}", 'lastmod' => date("Y-m-d H:i:s", $fileinfo->getMTime()), 'type' => "FAKE", 'size' => $fileinfo->getSize(), 'path' => $pat //$fileinfo->getRealPath() ]; } } } usort($retval, "my_custom_sort"); return $retval; } function my_custom_sort($a, $b) { if (($a['type'] == "dir") and ($b['type'] == "dir")) { return $a['name'] > $b['name']; } elseif ($a['type'] == "dir") { return -1; } elseif ($b['type'] == "dir") { return 1; } else { return $a['name'] > $b['name']; } return 0; } ?>

"; echo ""; echo ""; echo ""; echo "\n"; foreach($files as $file) { if ($file['type'] == "FAKE") continue; echo ""; $icon = "/icons/unknown.gif"; $ALT = "[ ]"; if (strpos($file['type'], "application/x") === 0) { $icon = "/morandini/autoindex_files/compressed.gif"; } elseif ($file['type'] == "dir") { $icon = "/morandini/autoindex_files/folder.gif"; $ALT = "[DIR]"; } elseif (strpos($file['type'], "text/") === 0) { $icon = "/morandini/autoindex_files/text.gif"; $ALT = "[TXT]"; } elseif (strpos($file['type'], "application/pdf") === 0) { $icon = "/morandini/autoindex_files/a.gif"; $ALT = "[PDF]"; } elseif (strpos($file['type'], "application/postscript") === 0) { $icon = "/morandini/autoindex_files/a.gif"; $ALT = "[PS]"; } echo ""; echo ""; echo ""; //echo ""; //echo ""; //echo ""; echo "\n"; } ?>
Directory listing
[ICO] Name Last modified

\"[DIR]\"..
\"$ALT\"{$file['name']}{$file['lastmod']} {$file['type']} {$file['path']} -