From 39985f4de4182a0b66c1102cd17aaee1c73d3e6b Mon Sep 17 00:00:00 2001 From: Camille Lafitte Date: Fri, 21 Jul 2006 21:59:16 +0000 Subject: [PATCH] =?UTF-8?q?see=20#738=20Ajout=20d'une=20m=C3=A9thode=20dir?= =?UTF-8?q?=5Flocal()=20dans=20functions.php.=20Permet=20de=20supprimer=20?= =?UTF-8?q?les=20pr=C3=A9fixes=20../=20et=20/,=20ne=20v=C3=A9rifie=20pas?= =?UTF-8?q?=20si=20le=20chemin=20est=20du=20genre=20*/../*.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bureau/class/functions.php | 21 +++++++++++++++++++++ bureau/class/m_bro.php | 2 ++ 2 files changed, 23 insertions(+) diff --git a/bureau/class/functions.php b/bureau/class/functions.php index 4cc76865..236ccde4 100644 --- a/bureau/class/functions.php +++ b/bureau/class/functions.php @@ -376,4 +376,25 @@ function duration_list($name, $selected=0) { return $res; } +/* ----------------------------------------------------------------- */ +/** Remet un chemin en position locale + * retire ../ ou / au besoin + * @file string chemin du repertoire ou du fichier + * @return string chemin du repertoir en position local + * @access private + */ + function dir_local($file) { + //recherche la chaine commençant aprés ../ ou / + preg_match('`^(/|../)(.*)`',$file,$res); + echo $file."
"; + print_r($res); + echo "
"; + if ($res) { + return $res[2]; + } else { + return $file; + } + } + + ?> diff --git a/bureau/class/m_bro.php b/bureau/class/m_bro.php index a0a24bbc..ccd4cb33 100644 --- a/bureau/class/m_bro.php +++ b/bureau/class/m_bro.php @@ -281,6 +281,8 @@ class m_bro { return false; } $file=ssla($file); + //force la création au niveau de $dir uniquement + $file = dir_local($file); if (!file_exists($absolute."/".$file)) { touch($absolute."/".$file); }