Changeset 2078

Show
Ignore:
Timestamp:
01/22/08 02:36:39 (7 months ago)
Author:
anarcat
Message:

various fixes to the imported functions:

  • respect our function naming convention
  • remove unrar code as I do not trust it for now
  • use convertabsolute() instead of addslashes() to sanitize the paths

See #1043.

Files:

Legend:

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

    r2077 r2078  
    420420   * @return boolean != 0 on error 
    421421   */ 
    422   function brouteur_extract($file, $dest="./") 
     422  function ExtractFile($file, $dest="./") 
    423423  { 
    424424    static $i=0, $ret; 
    425     $file = addslashes($file); 
    426     $dest = addslashes($dest); 
     425    $file = $this->convertabsolute($file,0); 
     426    $dest = $this->convertabsolute($dest,0); 
    427427    if ($i == 0) { 
    428428#TODO new version of tar supports `tar xf ...` so there is no 
     
    433433    } else if ($i == 2) { 
    434434      exec("unzip '$file' -d '$dest'", $void, $ret); 
    435     } else if ($i == 3) { 
    436 #FIXME I suck at extracting a rar archive to a specified directory 
    437 #      but I think unrar just sucks <TM> 
    438       $rarfile = ereg_replace('[a-z0-9]+', '..', $dest)."/$file"; 
    439       exec("mkdir -p '$dest'"); 
    440       exec("cd '$dest' && unrar x -o+ '$rarfile'", $void, $ret); 
    441435    } else { 
    442436      return $ret; 
     
    445439    if ($ret) { 
    446440      $i++; 
    447       brouteur_extract($file, $dest); 
     441      $this->ExtractFile($file, $dest); 
    448442    } 
    449443    return $ret; 
     
    460454   * @return boolean false on error 
    461455   */ 
    462   function brouteur_copy($name, $src, $dest) 
     456  function CopyFile($name, $src, $dest) 
    463457  { 
    464458    global $error, $db;