mirror of
https://github.com/Studio-42/elFinder
synced 2026-06-08 12:37:09 +00:00
src build elFinder-2.1-69d68ac
This commit is contained in:
@@ -5690,24 +5690,24 @@ abstract class elFinderVolumeDriver {
|
||||
|
||||
if ($ctar == 0) {
|
||||
$arcs['create']['application/x-tar'] = array('cmd' => 'tar', 'argc' => '-cf', 'ext' => 'tar');
|
||||
$arcs['extract']['application/x-tar'] = array('cmd' => 'tar', 'argc' => '-xf', 'ext' => 'tar');
|
||||
$arcs['extract']['application/x-tar'] = array('cmd' => 'tar', 'argc' => '-xf', 'ext' => 'tar', 'toSpec' => '-C ');
|
||||
unset($o);
|
||||
$test = $this->procExec('gzip --version', $o, $c);
|
||||
if ($c == 0) {
|
||||
$arcs['create']['application/x-gzip'] = array('cmd' => 'tar', 'argc' => '-czf', 'ext' => 'tgz');
|
||||
$arcs['extract']['application/x-gzip'] = array('cmd' => 'tar', 'argc' => '-xzf', 'ext' => 'tgz');
|
||||
$arcs['extract']['application/x-gzip'] = array('cmd' => 'tar', 'argc' => '-xzf', 'ext' => 'tgz', 'toSpec' => '-C ');
|
||||
}
|
||||
unset($o);
|
||||
$test = $this->procExec('bzip2 --version', $o, $c);
|
||||
if ($c == 0) {
|
||||
$arcs['create']['application/x-bzip2'] = array('cmd' => 'tar', 'argc' => '-cjf', 'ext' => 'tbz');
|
||||
$arcs['extract']['application/x-bzip2'] = array('cmd' => 'tar', 'argc' => '-xjf', 'ext' => 'tbz');
|
||||
$arcs['extract']['application/x-bzip2'] = array('cmd' => 'tar', 'argc' => '-xjf', 'ext' => 'tbz', 'toSpec' => '-C ');
|
||||
}
|
||||
unset($o);
|
||||
$test = $this->procExec('xz --version', $o, $c);
|
||||
if ($c == 0) {
|
||||
$arcs['create']['application/x-xz'] = array('cmd' => 'tar', 'argc' => '-cJf', 'ext' => 'xz');
|
||||
$arcs['extract']['application/x-xz'] = array('cmd' => 'tar', 'argc' => '-xJf', 'ext' => 'xz');
|
||||
$arcs['extract']['application/x-xz'] = array('cmd' => 'tar', 'argc' => '-xJf', 'ext' => 'xz', 'toSpec' => '-C ');
|
||||
}
|
||||
}
|
||||
unset($o);
|
||||
@@ -5718,7 +5718,7 @@ abstract class elFinderVolumeDriver {
|
||||
unset($o);
|
||||
$this->procExec('unzip --help', $o, $c);
|
||||
if ($c == 0) {
|
||||
$arcs['extract']['application/zip'] = array('cmd' => 'unzip', 'argc' => '', 'ext' => 'zip');
|
||||
$arcs['extract']['application/zip'] = array('cmd' => 'unzip', 'argc' => '', 'ext' => 'zip', 'toSpec' => '-d ');
|
||||
}
|
||||
unset($o);
|
||||
$this->procExec('rar --version', $o, $c);
|
||||
@@ -5729,26 +5729,26 @@ abstract class elFinderVolumeDriver {
|
||||
unset($o);
|
||||
$test = $this->procExec('unrar', $o, $c);
|
||||
if ($c==0 || $c == 7) {
|
||||
$arcs['extract']['application/x-rar'] = array('cmd' => 'unrar', 'argc' => 'x -y', 'ext' => 'rar');
|
||||
$arcs['extract']['application/x-rar'] = array('cmd' => 'unrar', 'argc' => 'x -y', 'ext' => 'rar', 'toSpec' => '');
|
||||
}
|
||||
}
|
||||
unset($o);
|
||||
$this->procExec('7za --help', $o, $c);
|
||||
if ($c == 0) {
|
||||
$arcs['create']['application/x-7z-compressed'] = array('cmd' => '7za', 'argc' => 'a', 'ext' => '7z');
|
||||
$arcs['extract']['application/x-7z-compressed'] = array('cmd' => '7za', 'argc' => 'x -y', 'ext' => '7z');
|
||||
$arcs['extract']['application/x-7z-compressed'] = array('cmd' => '7za', 'argc' => 'x -y', 'ext' => '7z', 'toSpec' => '-o');
|
||||
|
||||
if (empty($arcs['create']['application/zip'])) {
|
||||
$arcs['create']['application/zip'] = array('cmd' => '7za', 'argc' => 'a -tzip', 'ext' => 'zip');
|
||||
}
|
||||
if (empty($arcs['extract']['application/zip'])) {
|
||||
$arcs['extract']['application/zip'] = array('cmd' => '7za', 'argc' => 'x -tzip -y', 'ext' => 'zip');
|
||||
$arcs['extract']['application/zip'] = array('cmd' => '7za', 'argc' => 'x -tzip -y', 'ext' => 'zip', 'toSpec' => '-o');
|
||||
}
|
||||
if (empty($arcs['create']['application/x-tar'])) {
|
||||
$arcs['create']['application/x-tar'] = array('cmd' => '7za', 'argc' => 'a -ttar', 'ext' => 'tar');
|
||||
}
|
||||
if (empty($arcs['extract']['application/x-tar'])) {
|
||||
$arcs['extract']['application/x-tar'] = array('cmd' => '7za', 'argc' => 'x -ttar -y', 'ext' => 'tar');
|
||||
$arcs['extract']['application/x-tar'] = array('cmd' => '7za', 'argc' => 'x -ttar -y', 'ext' => 'tar', 'toSpec' => '-o');
|
||||
}
|
||||
} else if (substr(PHP_OS,0,3) === 'WIN') {
|
||||
// check `7z` for Windows server.
|
||||
@@ -5756,19 +5756,19 @@ abstract class elFinderVolumeDriver {
|
||||
$this->procExec('7z', $o, $c);
|
||||
if ($c == 0) {
|
||||
$arcs['create']['application/x-7z-compressed'] = array('cmd' => '7z', 'argc' => 'a', 'ext' => '7z');
|
||||
$arcs['extract']['application/x-7z-compressed'] = array('cmd' => '7z', 'argc' => 'x -y', 'ext' => '7z');
|
||||
$arcs['extract']['application/x-7z-compressed'] = array('cmd' => '7z', 'argc' => 'x -y', 'ext' => '7z', 'toSpec' => '-o');
|
||||
|
||||
if (empty($arcs['create']['application/zip'])) {
|
||||
$arcs['create']['application/zip'] = array('cmd' => '7z', 'argc' => 'a -tzip', 'ext' => 'zip');
|
||||
}
|
||||
if (empty($arcs['extract']['application/zip'])) {
|
||||
$arcs['extract']['application/zip'] = array('cmd' => '7z', 'argc' => 'x -tzip -y', 'ext' => 'zip');
|
||||
$arcs['extract']['application/zip'] = array('cmd' => '7z', 'argc' => 'x -tzip -y', 'ext' => 'zip', 'toSpec' => '-o');
|
||||
}
|
||||
if (empty($arcs['create']['application/x-tar'])) {
|
||||
$arcs['create']['application/x-tar'] = array('cmd' => '7z', 'argc' => 'a -ttar', 'ext' => 'tar');
|
||||
}
|
||||
if (empty($arcs['extract']['application/x-tar'])) {
|
||||
$arcs['extract']['application/x-tar'] = array('cmd' => '7z', 'argc' => 'x -ttar -y', 'ext' => 'tar');
|
||||
$arcs['extract']['application/x-tar'] = array('cmd' => '7z', 'argc' => 'x -ttar -y', 'ext' => 'tar', 'toSpec' => '-o');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5888,26 +5888,40 @@ abstract class elFinderVolumeDriver {
|
||||
/**
|
||||
* Unpack archive
|
||||
*
|
||||
* @param string $path archive path
|
||||
* @param array $arc archiver command and arguments (same as in $this->archivers)
|
||||
* @param bool $remove remove archive ( unlink($path) )
|
||||
* @param string $path archive path
|
||||
* @param array $arc archiver command and arguments (same as in $this->archivers)
|
||||
* @param bool|string $mode bool: remove archive ( unlink($path) ) | string: extract to directory
|
||||
* @return void
|
||||
* @author Dmitry (dio) Levashov
|
||||
* @author Alexey Sukhotin
|
||||
* @author Naoki Sawada
|
||||
**/
|
||||
protected function unpackArchive($path, $arc, $remove = true) {
|
||||
$dir = dirname($path);
|
||||
protected function unpackArchive($path, $arc, $mode = true) {
|
||||
if (is_string($mode)) {
|
||||
$dir = $mode;
|
||||
$chdir = null;
|
||||
$remove = false;
|
||||
} else {
|
||||
$dir = dirname($path);
|
||||
$chdir = $dir;
|
||||
$remove = $mode;
|
||||
}
|
||||
$dir = realpath($dir);
|
||||
$path = realpath($path);
|
||||
if ($arc['cmd'] === 'phpfunction') {
|
||||
if (is_callable($arc['argc'])) {
|
||||
call_user_func_array($arc['argc'], array($path, $dir));
|
||||
}
|
||||
} else {
|
||||
$cwd = getcwd();
|
||||
if (chdir($dir)) {
|
||||
$cmd = $arc['cmd'].' '.$arc['argc'].' '.escapeshellarg(basename($path));
|
||||
if (!$chdir || chdir($dir)) {
|
||||
if ($chdir) {
|
||||
$cmd = $arc['cmd'].' '.$arc['argc'].' '.escapeshellarg(basename($path));
|
||||
} else {
|
||||
$cmd = $arc['cmd'].' '.$arc['argc'].' '.escapeshellarg($path).' '.$arc['toSpec'].escapeshellarg($dir);
|
||||
}
|
||||
$this->procExec($cmd, $o, $c);
|
||||
chdir($cwd);
|
||||
$chdir && chdir($cwd);
|
||||
}
|
||||
}
|
||||
$remove && unlink($path);
|
||||
|
||||
Reference in New Issue
Block a user