[-] BO : fixed bug #PSCFV-6000 - added check if zip uploaded is a real module in AdminModules
This commit is contained in:
1 parent
eb451604af
commit
1b71add855
1 file changed
+6
-1
@@ -340,6 +340,7 @@ class AdminModulesControllerCore extends AdminController
|
|||||||
|
|
||||||
protected function extractArchive($file, $redirect = true)
|
protected function extractArchive($file, $redirect = true)
|
||||||
{
|
{
|
||||||
|
$pathinfo = pathinfo($file);
|
||||||
$success = false;
|
$success = false;
|
||||||
if (substr($file, -4) == '.zip')
|
if (substr($file, -4) == '.zip')
|
||||||
{
|
{
|
||||||
@@ -356,9 +357,13 @@ class AdminModulesControllerCore extends AdminController
|
|||||||
else
|
else
|
||||||
$this->errors[] = Tools::displayError('Error while extracting module (file may be corrupted).');
|
$this->errors[] = Tools::displayError('Error while extracting module (file may be corrupted).');
|
||||||
}
|
}
|
||||||
|
//check if it's a real module
|
||||||
|
if (!Module::getInstanceByName($pathinfo['filename']))
|
||||||
|
$this->errors[] = Tools::displayError('The Zip file you uploaded is not a module');
|
||||||
|
|
||||||
|
|
||||||
@unlink($file);
|
@unlink($file);
|
||||||
if ($success && $redirect)
|
if (!count($this->errors) && $success && $redirect)
|
||||||
Tools::redirectAdmin(self::$currentIndex.'&conf=8'.'&token='.$this->token);
|
Tools::redirectAdmin(self::$currentIndex.'&conf=8'.'&token='.$this->token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user