// Fixed potential warning

This commit is contained in:
Damien Metzger committed 2013-11-28 14:29:40 +01:00
1 parent cb9d00352f
commit 35fc864e0b
1 file changed
+16 -16
+16 -16
View File
@@ -627,23 +627,23 @@ class AdminModulesControllerCore extends AdminController
{ {
$file = $f['file']; $file = $f['file'];
$content = Tools::file_get_contents(_PS_ROOT_DIR_.$file); $content = Tools::file_get_contents(_PS_ROOT_DIR_.$file);
$xml = @simplexml_load_string($content, null, LIBXML_NOCDATA); if ($xml = @simplexml_load_string($content, null, LIBXML_NOCDATA))
foreach ($xml->module as $modaddons) foreach ($xml->module as $modaddons)
if ($name == $modaddons->name && isset($modaddons->id) && ($this->logged_on_addons || $f['loggedOnAddons'] == 0)) if ($name == $modaddons->name && isset($modaddons->id) && ($this->logged_on_addons || $f['loggedOnAddons'] == 0))
{ {
$download_ok = false; $download_ok = false;
if ($f['loggedOnAddons'] == 0) if ($f['loggedOnAddons'] == 0)
if (file_put_contents(_PS_MODULE_DIR_.$modaddons->name.'.zip', Tools::addonsRequest('module', array('id_module' => pSQL($modaddons->id))))) if (file_put_contents(_PS_MODULE_DIR_.$modaddons->name.'.zip', Tools::addonsRequest('module', array('id_module' => pSQL($modaddons->id)))))
$download_ok = true; $download_ok = true;
elseif ($f['loggedOnAddons'] == 1 && $this->logged_on_addons) elseif ($f['loggedOnAddons'] == 1 && $this->logged_on_addons)
if (file_put_contents(_PS_MODULE_DIR_.$modaddons->name.'.zip', Tools::addonsRequest('module', array('id_module' => pSQL($modaddons->id), 'username_addons' => pSQL(trim($this->context->cookie->username_addons)), 'password_addons' => pSQL(trim($this->context->cookie->password_addons)))))) if (file_put_contents(_PS_MODULE_DIR_.$modaddons->name.'.zip', Tools::addonsRequest('module', array('id_module' => pSQL($modaddons->id), 'username_addons' => pSQL(trim($this->context->cookie->username_addons)), 'password_addons' => pSQL(trim($this->context->cookie->password_addons))))))
$download_ok = true; $download_ok = true;
if (!$download_ok) if (!$download_ok)
$this->errors[] = $this->l('Error on downloading the lastest version'); $this->errors[] = $this->l('Error on downloading the lastest version');
elseif (!$this->extractArchive(_PS_MODULE_DIR_.$modaddons->name.'.zip', false)) elseif (!$this->extractArchive(_PS_MODULE_DIR_.$modaddons->name.'.zip', false))
$this->errors[] = $this->l(sprintf("Module %s can't be upgraded: ", $modaddons->name)); $this->errors[] = $this->l(sprintf("Module %s can't be upgraded: ", $modaddons->name));
} }
} }
} }