#-------------------------------------------------- Cet indexeur de fichiers créé en php par Brian Donovan, www.lophty.com est bien pratique pour éviter d'avoir l'horrible page "Index of..." noire et blanche par défaut des serveurs Apache. Elle permet une complète personnalisation des couleurs par une feuille de styles CSS fournie, et d'être traduite. Il suffit de recopier le répertoire indexerfiles et l'index.php dans chacun de vos répertoires à lister. Voici son code remanié : #-------------------------------------------------- $thisPageFilesDir."file.gif", 'height' => '13', 'width' => '13'); $dirImageProps = array('filepath' => $thisPageFilesDir."dir.gif", 'height' => '13', 'width' => '13'); $bulletImgsArr = array('fileImg' => $fileImgProps, 'dirImg' => $dirImageProps); $dontListFiles = array($thisFileName, $bulletImgsArr['dirImg']['filepath'], $bulletImgsArr['fileImg']['filepath'], $thisPageCssFile); $dontListDirs = array($thisPageFilesDir, "cgi-bin", "indexerfiles"); function getThisDirName($url, $serverName) { $afterCutOne = substr($url, 0, strrpos($url, "/")); $afterCutTwo = substr($afterCutOne, strrpos($afterCutOne, "/") - strlen($afterCutOne) + 1); if ($afterCutTwo == '') { return $serverName; } else { return $afterCutTwo; } } function isort($a,$b) { if(ord(strtolower($a)) == ord(strtolower($b))) return 0; return (ord(strtolower($a))< ord(strtolower($b))) ? -1: 1; } function isortMultiD($a,$b) { if(ord(strtolower($a[count($a) - 1])) == ord(strtolower($b[count ($b) - 1]))) { if(ord(strtolower($a[0])) == ord(strtolower($b[0]))) return 0; return (ord(strtolower($a[0]))< ord(strtolower($b[0]))) ? -1: 1; } return (ord(strtolower($a[count ($a) - 1])) < ord(strtolower($b[count ($b)]))) ? -1: 1; } function indexdirThisDir() { global $bulletImgsArr; global $dontListFiles; global $dontListDirs; $numHiddenDirs = 0; $numHiddenFiles = 0; $dirsArr = array(); $filesArr = array(); $this_dir_handle=opendir('.'); # get a handle on the current directory while (false!==($fileORdir = readdir($this_dir_handle))) { if ($fileORdir != "." && $fileORdir != "..") { if(is_dir($fileORdir)== false) { $thisFileNoShow = 0; for ($i = 0; $i < count($dontListFiles); $i++) { if($fileORdir == $dontListFiles[$i]) { $thisFileNoShow = 1; $numHiddenFiles++; break; } } if($thisFileNoShow == 0) { $fileNameAndextensionArr = explode(".", $fileORdir); array_push ($filesArr, $fileNameAndextensionArr); } } else { $thisDirNoShow = 0; for ($i = 0; $i < count($dontListDirs); $i++) { if($fileORdir == $dontListDirs[$i]) { $thisDirNoShow = 1; $numHiddenDirs++; break; } } if($thisDirNoShow == 0) { array_push ($dirsArr, $fileORdir); } } } } closedir($this_dir_handle); /* #-------------------------------------------------- ICI vient le texte Cette page contient... #-------------------------------------------------- */ $listingHTML .= "
Fichier | Taille (kb) | Derniere modification |
".$fileSizeInKb." | ".$fileLastMod." |