diff --git a/.gitattributes b/.gitattributes index e22388e8..a30af3ba 100644 --- a/.gitattributes +++ b/.gitattributes @@ -134,6 +134,7 @@ bureau/admin/bro_pref.php -text bureau/admin/bro_tgzdown.php -text bureau/admin/bro_view.php -text bureau/admin/browseforfolder.php -text +bureau/admin/browseforfolder2.php -text bureau/admin/cron.php -text bureau/admin/dom_add.php -text bureau/admin/dom_defdel.php -text diff --git a/bureau/admin/browseforfolder2.php b/bureau/admin/browseforfolder2.php new file mode 100644 index 00000000..0ddbe056 --- /dev/null +++ b/bureau/admin/browseforfolder2.php @@ -0,0 +1,174 @@ + "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", ""), + "bid" => 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=getuserpath(); +// 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 ($val["put"]!="") { + ?> + | + + | + "; + if ($val["put"]!="") { + echo "".$val["dir"].""; + } else { + echo "".$val["dir"].""; + } + echo "\n\n"; + } +} // OK ? +?> + |