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

This commit is contained in:
vAugagneur
2012-12-10 11:16:33 +01:00
parent 221667a80d
commit 25229b51ae
+6 -1
View File
@@ -340,6 +340,7 @@ class AdminModulesControllerCore extends AdminController
protected function extractArchive($file, $redirect = true)
{
$pathinfo = pathinfo($file);
$success = false;
if (substr($file, -4) == '.zip')
{
@@ -356,9 +357,13 @@ class AdminModulesControllerCore extends AdminController
else
$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);
if ($success && $redirect)
if (!count($this->errors) && $success && $redirect)
Tools::redirectAdmin(self::$currentIndex.'&conf=8'.'&token='.$this->token);
}