fixing unzip/untar/ungzip from panel

This commit is contained in:
Benjamin Sonntag 2015-04-22 16:09:07 +02:00
parent 5fd5e4837e
commit f8c5872c99
3 changed files with 28 additions and 17 deletions

View File

@ -141,7 +141,6 @@ if (!empty($formu) && $formu) {
}
if (isset($actextract) && $actextract) {
print _("extracting...")."<br />\n"; flush();
if ($bro->ExtractFile($R. '/' . $fileextract, $R)) {
echo "<p class=\"alert alert-danger\">";
print $err->errstr();

View File

@ -666,25 +666,24 @@ class m_bro {
$err->raise("bro",_("File or folder name is incorrect"));
return 1;
}
$file=escapeshellarg($file);
$dest_to_fix=$dest;
$dest=escapeshellarg($dest);
#$dest_to_fix=str_replace(getuserpath(),'',$dest);
// TODO new version of tar supports `tar xf ...` so there is no
// need to specify the compression format
exec("tar -xf ".escapeshellarg($file)." -C ".escapeshellarg($dest), $void, $ret);
if ($ret) {
exec("tar -xjf ".escapeshellarg($file)." -C ".escapeshellarg($dest), $void, $ret);
$lfile=strtolower($file);
if (substr($lfile,-4)==".tar" || substr($lfile,-8)==".tar.bz2" || substr($lfile,-7)==".tar.gz" || substr($lfile,-6)==".tar.z") {
// TODO new version of tar supports `tar xf ...` so there is no
// need to specify the compression format
echo "<p>"._("Uncompressing through TAR")."</p><pre style=\"overflow: scroll; height: 200px\">";
passthru("tar -xf ".escapeshellarg($file)." -C ".escapeshellarg($dest)." 2>&1", $ret);
}
if ($ret) {
$cmd="unzip -o ".escapeshellarg($file)." -d ".escapeshellarg($dest);
exec($cmd, $void, $ret);
if (substr($lfile,-4)==".zip") {
echo "<p>"._("Uncompressing through UNZIP")."</p><pre style=\"overflow: scroll; height: 200px\">";
$cmd="unzip -o ".escapeshellarg($file)." -d ".escapeshellarg($dest)." 2>&1";
passthru($cmd, $ret);
}
if ($ret) {
$cmd="gunzip ".escapeshellarg($file);
exec($cmd, $void, $ret);
if (substr($lfile,-3)==".gz") {
echo "<p>"._("Uncompressing through GUNZIP")."</p><pre style=\"overflow: scroll; height: 200px\">";
$cmd="gunzip ".escapeshellarg($file)." 2>&1";
passthru($cmd, $ret);
}
echo "</pre>";
if ($ret) {
$err->raise("bro",_("I cannot find a way to extract the file %s, it is an unsupported compressed format"), $file);
}

13
debian/changelog vendored
View File

@ -1,3 +1,16 @@
alternc (3.1.4) oldstable; urgency=low
* ensure that values in sub_domaines are prefixed by / for hosting subdomains
* adding enable_original_recipient=no to postfix
* adding tail log view + order by DATE last files in logs
* fix ;;; END ALTERNC zones bug
* proposal (not enabled by default) of error.log per vhost
* default message size limit to 100M, no mailbox size limit in postfix
* fix removal of awstats-package crontab in favor of AlternC's one
* fix unzip/untar/ungzip of files from the browser (double escapeshellarg)
-- Benjamin Sonntag <benjamin@sonntag.fr> Mon, 20 Apr 2015 18:00:12 +0200
alternc (3.1.3) oldstable; urgency=low
* fix opendkim listening on *