From e83da9c5799947806e19b066962e72c7215915e9 Mon Sep 17 00:00:00 2001 From: Alan Garcia Date: Thu, 24 Jan 2013 11:25:15 +0000 Subject: [PATCH] =?UTF-8?q?Patch=20pour=20une=20plus=20zoli=20boite=20de?= =?UTF-8?q?=20s=C3=A9lection=20de=20r=C3=A9pertoires?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitattributes | 1 + bureau/admin/browseforfolder2.php | 174 ++++++++++++++++++++++++++++++ bureau/admin/dom_edit.inc.php | 7 +- bureau/admin/ftp_edit.php | 8 +- bureau/admin/sql_bck.php | 8 +- bureau/class/functions.php | 48 ++++++++- 6 files changed, 227 insertions(+), 19 deletions(-) create mode 100644 bureau/admin/browseforfolder2.php 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; +?> + + + +Recherche d'un dossier + + + + + + +

+"; + /* Retour : */ + echo ""._("Back to the root folder")."
"; +} else { + /* Sinon, tout va bien, on affiche le tableau */ + reset($ar); +?> +
+

+ + + + +
+ +" class="inb" onclick="retour();" />  +" class="inb" onclick="window.parent.jQuery('#').dialog('close');" />  +

+
+ + + +\n"; + for ($i=0;$i<$val["level"];$i++) + echo ""; + if ($val["put"]!="") { + ?> + + + + "; + if ($val["put"]!="") { + echo "".$val["dir"].""; + } else { + echo "".$val["dir"].""; + } + echo "\n\n"; + } +} // OK ? +?> +
+ + diff --git a/bureau/admin/dom_edit.inc.php b/bureau/admin/dom_edit.inc.php index 60cb0e73..f9fde4c9 100644 --- a/bureau/admin/dom_edit.inc.php +++ b/bureau/admin/dom_edit.inc.php @@ -80,11 +80,8 @@ $dom->unlock(); break; case "DIRECTORY": ?> - + diff --git a/bureau/admin/ftp_edit.php b/bureau/admin/ftp_edit.php index 30afa54d..0b78e9d0 100644 --- a/bureau/admin/ftp_edit.php +++ b/bureau/admin/ftp_edit.php @@ -73,11 +73,9 @@ if (isset($error) && $error) { " size="20" maxlength="64" /> - + +

+ diff --git a/bureau/admin/sql_bck.php b/bureau/admin/sql_bck.php index bd0acf44..4dbc9441 100644 --- a/bureau/admin/sql_bck.php +++ b/bureau/admin/sql_bck.php @@ -91,12 +91,8 @@ if (is_array($r)) { - " /> - + " /> + diff --git a/bureau/class/functions.php b/bureau/class/functions.php index cbce2854..7654d745 100644 --- a/bureau/class/functions.php +++ b/bureau/class/functions.php @@ -433,12 +433,16 @@ function eoption($values,$cur,$info="") { * * Use the charset of the current language for transcription */ -function ehe($str) { +function ehe($str,$affiche=1) { global $charset; - echo htmlspecialchars($str,ENT_QUOTES,$charset); + $retour = htmlspecialchars($str,ENT_QUOTES,$charset); + if ($affiche) { + echo $retour; + } else { + return $retour; + } } - /* Get the Fields of the posted form from $_REQUEST or POST or GET * and check their type */ @@ -602,6 +606,7 @@ function create_pass($length = 8){ define("DEFAULT_PASS_SIZE", 8); +/* Affiche un bouton qui permet de generer automatiquement des mots de passes */ function display_div_generate_password($pass_size=DEFAULT_PASS_SIZE, $fields_to_fill1="", $fields_to_fill2="") { $id=rand(1,1000); echo "