|
Téléchargements de documents :
';
}
}
// echo 'profdep='.$profdep.' ';
//on compte le nb de / au lancement
if ($profdep == 0) {
$profdep= substr_count($path, '/');
}
if (is_dir($path)) {
//on definit le nom du dossier à afficher
if (substr($path, -1, 1) =='/') { //si ça finit par un slash on le vire pr avoir le nom du dossier
$dirnam = substr($path, 0,(strlen($path)-1)); //on vire le dernier shash
} else {
$dirnam = substr($path, 0,(strlen($path))); //on garde le nom du dossier comme ça
$path.= '/'; //et on ajoute un slash a la fin du path pr avoir d chemins ok
}
$dirnam = strrchr($dirnam, "/"); // on recup le nom du dernier dossier
$dirnam = str_replace (array('/'), array(''), $dirnam); // on vire le 1er shash
//echo 'yo='.$dirnam ;
//echo ' ';
if(!in_array($dirnam, $dir_interdits)) { //on verrifie que le dossier fait pas partie des interdits
echo '- '.$dirnam.'
'."\n";
if ($dh = @opendir($path)) {
while (($file = readdir($dh)) !== false) {
if (($file != '.') && ($file != '..') && ($file != '...')) {
if (is_dir($path . $file)) {
if (substr_count($path . $file, '/')-$profdep < $profondeur) {
listingDir(($path . $file . '/'), $ext_interdites, $dir_interdits, $file_interdits, $profondeur, $profdep);
}
} else {
//on chope l'extension et le nom du fichier
$tabfile = explode('.', $file);
$nomfile = $tabfile[0];
$extfi = $tabfile[1];
if(!in_array($extfi, $ext_interdites) && !in_array($file, $file_interdits)) { //on verif les extensions & fichiers interdits
$path_doc=str_replace('/home/cgtems/www/commun/docs/','',$path);
echo ' '. $file.''."\n";
}
}
}
}
closedir($dh);
echo ' '."\n";
}
}
}elseif (is_file($path)) {
echo ''.$path.' ';
}
}
listingDir('/home/cgtems/www/commun/docs/.', array('txt', 'sql', 'fla'), array('css', 'admin'), array('index.php', '.htaccess', '.htpasswd'), 5);
?>
|
|