Changeset 1727

Show
Ignore:
Timestamp:
08/28/06 14:13:38 (2 years ago)
Author:
benjamin
Message:

Closes #1723 with a more elegant solution

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • alternc/trunk/bureau/class/m_bro.php

    r1723 r1727  
    9696    if (substr($dir,0,strlen($root))!=$root) { 
    9797      return false; 
    98     } if ($strip) { 
     98    }  
     99    if ($strip) { 
    99100      $dir=substr($dir,strlen($root)); 
    100101    } else { 
     
    259260   */ 
    260261  function CreateDir($dir,$file) { 
    261     global $db,$cuid; 
    262     $absolute=$this->convertabsolute($dir,0); 
     262    global $db,$cuid,$err; 
    263263    $file=ssla($file); 
    264     if (!file_exists($absolute."/".$file)) { 
    265       mkdir($absolute."/".$file,00777); 
    266     } 
    267     $db->query("UPDATE browser SET crff=1 WHERE uid='$cuid';"); 
     264    $absolute=$this->convertabsolute($dir."/".$file,0); 
     265    if ($absolute && !file_exists($absolute)) { 
     266      mkdir($absolute,00777); 
     267      $db->query("UPDATE browser SET crff=1 WHERE uid='$cuid';"); 
     268      return true; 
     269    } else { 
     270      $err->raise("bro",1); 
     271      return false; 
     272    } 
    268273  } 
    269274 
     
    276281  function CreateFile($dir,$file) { 
    277282    global $db,$err,$cuid; 
    278     $absolute=$this->convertabsolute($dir,0); 
    279     if (!$absolute) { 
    280       $err->raise("bro",1); 
    281       return false; 
    282     } 
    283283    $file=ssla($file); 
    284     //force la création au niveau de $dir uniquement 
    285     $file = dir_local($file); 
    286     if (!file_exists($absolute."/".$file)) { 
    287       touch($absolute."/".$file); 
    288     } 
    289     $db->query("UPDATE browser SET crff=0 WHERE uid='$cuid';"); 
     284    $absolute=$this->convertabsolute($dir."/".$file,0); 
     285    if ($absolute && !file_exists($absolute)) { 
     286      touch($absolute); 
     287      $db->query("UPDATE browser SET crff=0 WHERE uid='$cuid';"); 
     288      return true; 
     289    } else { 
     290      $err->raise("bro",1); 
     291      return false; 
     292    } 
    290293  } 
    291294