Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2020-02-26 21:11:20 +01:00
commit 08c0507de2
2 changed files with 12 additions and 3 deletions

View File

@ -418,8 +418,17 @@ class SeedDMS_Extension_Mgr {
$this->errmsgs[] = "Cannot create temp. extension directory";
return false;
}
$cmd = "cd ".$newdir."; unzip ".$file;
exec($cmd);
$zip = new ZipArchive;
$res = $zip->open($file);
if ($res === TRUE) {
$zip->extractTo($newdir);
$zip->close();
} else {
$this->errmsgs[] = "Cannot open extension file";
return false;
}
// $cmd = "cd ".$newdir."; unzip ".$file;
// exec($cmd);
/* Check if extension is complete and fullfills the constraints */
if(!self::checkExtension($newdir)) {

View File

@ -78,7 +78,7 @@ elseif ($action == "upload") { /* {{{ */
if($_FILES['userfile']['error']) {
UI::exitError(getMLText("admin_tools"),getMLText("error_occured"));
}
if($_FILES['userfile']['type'] != 'application/zip') {
if(!in_array($_FILES['userfile']['type'], array('application/zip', 'application/x-zip-compressed'))) {
UI::exitError(getMLText("admin_tools"),getMLText("error_occured"));
}
// $extMgr = new SeedDMS_Extension_Mgr($settings->_rootDir."/ext", $settings->_cacheDir);