Closes #1723 with a more elegant solution

This commit is contained in:
Benjamin Sonntag 2006-08-28 12:13:38 +00:00
parent db7fe71e68
commit e2cf5f71b2
1 changed files with 18 additions and 15 deletions

View File

@ -95,7 +95,8 @@ class m_bro {
if (substr($dir,0,strlen($root))!=$root) { if (substr($dir,0,strlen($root))!=$root) {
return false; return false;
} if ($strip) { }
if ($strip) {
$dir=substr($dir,strlen($root)); $dir=substr($dir,strlen($root));
} else { } else {
// si on ne strip pas, il faut enlever le chemin réel // si on ne strip pas, il faut enlever le chemin réel
@ -258,13 +259,17 @@ class m_bro {
* @return boolean TRUE si le dossier a été créé, FALSE si une erreur s'est produite. * @return boolean TRUE si le dossier a été créé, FALSE si une erreur s'est produite.
*/ */
function CreateDir($dir,$file) { function CreateDir($dir,$file) {
global $db,$cuid; global $db,$cuid,$err;
$absolute=$this->convertabsolute($dir,0);
$file=ssla($file); $file=ssla($file);
if (!file_exists($absolute."/".$file)) { $absolute=$this->convertabsolute($dir."/".$file,0);
mkdir($absolute."/".$file,00777); if ($absolute && !file_exists($absolute)) {
mkdir($absolute,00777);
$db->query("UPDATE browser SET crff=1 WHERE uid='$cuid';");
return true;
} else {
$err->raise("bro",1);
return false;
} }
$db->query("UPDATE browser SET crff=1 WHERE uid='$cuid';");
} }
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
@ -275,18 +280,16 @@ class m_bro {
*/ */
function CreateFile($dir,$file) { function CreateFile($dir,$file) {
global $db,$err,$cuid; global $db,$err,$cuid;
$absolute=$this->convertabsolute($dir,0); $file=ssla($file);
if (!$absolute) { $absolute=$this->convertabsolute($dir."/".$file,0);
if ($absolute && !file_exists($absolute)) {
touch($absolute);
$db->query("UPDATE browser SET crff=0 WHERE uid='$cuid';");
return true;
} else {
$err->raise("bro",1); $err->raise("bro",1);
return false; 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);
}
$db->query("UPDATE browser SET crff=0 WHERE uid='$cuid';");
} }
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */