Changeset 2088

Show
Ignore:
Timestamp:
01/22/08 04:23:26 (11 months ago)
Author:
anarcat
Message:

make UploadFile?() return the uploaded path
make ExtractFile? extract in the same directory as the archive by default

Files:

Legend:

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

    r2087 r2088  
    391391   * bien ĂȘtre un fichier d'upload. 
    392392   * @param string $R Dossier dans lequel on upload le fichier 
     393   * @returns the path where the file resides or false if upload failed 
    393394   */ 
    394395  function UploadFile($R) { 
     
    406407        move_uploaded_file($_FILES['userfile']['tmp_name'], $absolute."/".$_FILES['userfile']['name']); 
    407408      } else { 
    408         $err->log("bro","uploadfile","Tentative d'attaque : ".$_FILES['userfile']['tmp_name']); 
    409       } 
    410     } 
     409            $err->log("bro","uploadfile","Tentative d'attaque : ".$_FILES['userfile']['tmp_name']); 
     410        return false; 
     411      } 
     412    } 
     413    return $absolute."/".$_FILES['userfile']['name']; 
    411414  } 
    412415 
     
    414417   * Extract an archive by using GNU and non-GNU tools 
    415418   * @param string $file is the full or relative path to the archive 
    416    * @param string $dest is the path of the extract destination 
     419   * @param string $dest is the path of the extract destination, the 
     420   * same directory as the archive by default 
    417421   * @return boolean != 0 on error 
    418422   */ 
    419   function ExtractFile($file, $dest="./"
     423  function ExtractFile($file, $dest=null
    420424  { 
    421425    global $err; 
    422426    static $i=0, $ret; 
    423427    $file = $this->convertabsolute($file,0); 
    424     $dest = $this->convertabsolute($dest,0); 
     428    if (is_null($dest)) { 
     429      $dest = dirname($file); 
     430    } else { 
     431      $dest = $this->convertabsolute($dest,0); 
     432    } 
    425433    if (!$file || !$dest) { 
    426434      $err->raise("bro",1);