"directory" Nom du dossier level => 0-n Niveau du dossier (0=racine 1,2 ...) put => "/sub/sub/directory" Contenu de la variable post à ajouter pour la balise A si ="" c'est le dossier courant. Si probleme, positionne $errbrowsefold Sinon, retourne le tableau et $maxlevel contient le nombre maximum de sous-dossiers. */ include("../class/config.php"); // FIXME Refaire ce truc hein... $fields = array ( "caller" => array ("request", "string", ""), "select" => array ("request", "string", ""), "curdir" => array ("request", "string", ""), "lastcurdir" => array ("request", "string", ""), "file" => array ("request", "string", ""), ); getFields($fields); function _subbrowse($curdir,$pos,$level) { global $maxlevel,$root,$brlist; if ($level>$maxlevel) $maxlevel=$level; $rot=substr($curdir,0,$pos); $next=@strpos($curdir,"/",$pos+1); $nextstr=substr($curdir,$pos+1,$next-$pos-1); $c=opendir($root.$rot); $i=0; $tmp = array(); while ($r=readdir($c)) { if (is_dir($root.$rot."/".$r) && $r!="." && $r!="..") { $tmp[$i++]=$r; } } sort($tmp); foreach ($tmp as $r) { /* Ajout */ $brlist[]=array("dir"=>$r,"level"=>$level,"put"=> ife($curdir==$rot."/".$r."/","",$rot."/".$r)); if ($r==$nextstr) { _subbrowse($curdir,$next,$level+1); } } } function browseforfolder($curdir) { global $maxlevel,$root,$brlist; $maxlevel=0; $pat=explode("/",$curdir); $brlist=array(array("dir"=>"/","level"=>0,"put"=> ife($curdir=="/","","/") )); _subbrowse($curdir,0,1); return $brlist; } $root="/var/alternc/html/".substr($mem->user["login"],0,1)."/".$mem->user["login"]."/"; // pour utiliser 'la ou est browseforfolder', mettre dirname($HTTP_SERVER_VARS["PATH_TRANSLATED"]); if (substr($file,0,1)!="/") $file="/".$file; if (substr($file,-1)!="/") $file.="/"; if (!$file) $file="/"; $errbrowsefold=0; /* Erreur lors de la création d'un dossier */ $brlist=array(); /* Liste des dossiers ... */ $maxlevel=0; if (isset($select) && $select) { /* Go ahead, let's send the javascript ...*/ ?>
"; if ($val["put"]!="") { ?> | "; if ($val["put"]!="") { echo "".$val["dir"].""; } else { echo "".$val["dir"].""; } echo "\n\n"; } } // OK ? ?> |