[-] BO : fixed bug #PSCFV-6000 - added check if zip uploaded is a real module in AdminModules

This commit is contained in:
vAugagneur committed 2012-12-10 11:16:33 +01:00
1 parent 221667a80d
commit 25229b51ae
1 file changed
+6 -1
+6 -1
View File
@@ -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);
} }