adaptation du code de copie de fichier:
* desactiver le code de copie par http:// pour l'instant * utilise escapeshellarg() au lieu de addslashes() pour echapper les arguments * utiliser le bon systeme de message d'erreurs * ajouter -p a l'appel de cp
This commit is contained in:
parent
6160112864
commit
3de628ccb2
|
@ -424,6 +424,10 @@ class m_bro {
|
||||||
static $i=0, $ret;
|
static $i=0, $ret;
|
||||||
$file = $this->convertabsolute($file,0);
|
$file = $this->convertabsolute($file,0);
|
||||||
$dest = $this->convertabsolute($dest,0);
|
$dest = $this->convertabsolute($dest,0);
|
||||||
|
if (!$file || !$dest) {
|
||||||
|
$err->raise("bro",1);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if ($i == 0) {
|
if ($i == 0) {
|
||||||
#TODO new version of tar supports `tar xf ...` so there is no
|
#TODO new version of tar supports `tar xf ...` so there is no
|
||||||
# need to specify the compression format
|
# need to specify the compression format
|
||||||
|
@ -474,6 +478,10 @@ class m_bro {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XXX: Disabled functionality until audit is completed
|
||||||
|
*/
|
||||||
|
/*
|
||||||
if (substr($src, 0, 7) == "http://") {
|
if (substr($src, 0, 7) == "http://") {
|
||||||
$filename = basename($src);
|
$filename = basename($src);
|
||||||
$extractdir = tempnam("/tmp", "brouteur");
|
$extractdir = tempnam("/tmp", "brouteur");
|
||||||
|
@ -523,24 +531,29 @@ class m_bro {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// Last step // Copy -R
|
// Last step // Copy -R
|
||||||
$src = addslashes($src);
|
$src = escapeshellarg($this->convertabsolute($src));
|
||||||
$dest = addslashes($dest);
|
$dest = escapeshellarg($this->convertabsolute($dest));
|
||||||
|
if (!$src || !$dest) {
|
||||||
|
$err->raise("bro",1);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
/* XXX: UNIX-specific because of that slash */
|
||||||
$array = explode('/', $dest);
|
$array = explode('/', $dest);
|
||||||
$dir = "";
|
$dir = "";
|
||||||
foreach ($array as $v) {
|
foreach ($array as $v) {
|
||||||
$dir .= "$v/";
|
$dir .= "$v/";
|
||||||
@mkdir($dest);
|
@mkdir($dest);
|
||||||
}
|
}
|
||||||
#TODO write a recursive copy function(?)
|
#TODO write a recursive copy function(?)
|
||||||
exec("cp -Rf '$src'/* '$dest'", $void, $ret);
|
exec("cp -Rpf '$src'/* '$dest'", $void, $ret);
|
||||||
if ($ret) {
|
if ($ret) {
|
||||||
$error = _("Errors happened while copying the source to destination.");
|
$err->raise("bro","Errors happened while copying the source to destination.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$error = _("The web application has been successfully installed.");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue