[-] MO : #PSCFV-2357 - Fix bug with error displaying
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@15367 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -202,7 +202,7 @@ class ThemeInstallator extends Module
|
||||
$this->to_enable = false;
|
||||
$this->to_disable = false;
|
||||
$this->to_install = false;
|
||||
$this->errors = false;
|
||||
$this->errors = array();
|
||||
if ($this->page == 'exportPage' && Tools::isSubmit('exportTheme') && ($id_theme = Tools::getValue('mainTheme')))
|
||||
{
|
||||
$theme = new Theme($id_theme);
|
||||
@@ -219,24 +219,24 @@ class ThemeInstallator extends Module
|
||||
if (Tools::isSubmit('submitImport1'))
|
||||
{
|
||||
if ($_FILES['themearchive']['error'] || !file_exists($_FILES['themearchive']['tmp_name']))
|
||||
$this->errors .= parent::displayError($this->l('An error has occurred during the file upload.'));
|
||||
$this->errors[] = parent::displayError($this->l('An error has occurred during the file upload.'));
|
||||
else if (substr($_FILES['themearchive']['name'], -4) != '.zip')
|
||||
$this->errors .= parent::displayError($this->l('Only zip files are allowed'));
|
||||
$this->errors[] = parent::displayError($this->l('Only zip files are allowed'));
|
||||
else if (!rename($_FILES['themearchive']['tmp_name'], ARCHIVE_NAME))
|
||||
$this->errors .= parent::displayError($this->l('An error has occurred during the file copy.'));
|
||||
$this->errors[] = parent::displayError($this->l('An error has occurred during the file copy.'));
|
||||
else if (Tools::ZipTest(ARCHIVE_NAME))
|
||||
$this->page = 2;
|
||||
else
|
||||
$this->errors .= parent::displayError($this->l('Zip file seems to be broken'));
|
||||
$this->errors[] = parent::displayError($this->l('Zip file seems to be broken'));
|
||||
}
|
||||
else if (Tools::isSubmit('submitImport2'))
|
||||
{
|
||||
if (!Validate::isModuleUrl($url = Tools::getValue('linkurl'), $this->errors))
|
||||
$this->errors .= parent::displayError($this->l('Only zip files are allowed'));
|
||||
if (!Validate::isModuleUrl($url = Tools::getValue('linkurl'), $tmp)) // $tmp is not used, because we don't care about the error output of isModuleUrl
|
||||
$this->errors[] = parent::displayError($this->l('Only zip files are allowed'));
|
||||
else if (!copy($url, ARCHIVE_NAME))
|
||||
$this->errors .= parent::displayError($this->l('Error during the file download'));
|
||||
$this->errors[] = parent::displayError($this->l('Error during the file download'));
|
||||
else if (Tools::ZipTest(ARCHIVE_NAME))
|
||||
$this->errors .= parent::displayError($this->l('Zip file seems to be broken'));
|
||||
$this->errors[] = parent::displayError($this->l('Zip file seems to be broken'));
|
||||
else
|
||||
$this->page = 2;
|
||||
}
|
||||
@@ -244,13 +244,13 @@ class ThemeInstallator extends Module
|
||||
{
|
||||
$filename = _IMPORT_FOLDER_.Tools::getValue('ArchiveName');
|
||||
if (substr($filename, -4) != '.zip')
|
||||
$this->errors .= parent::displayError($this->l('Only zip files are allowed'));
|
||||
$this->errors[] = parent::displayError($this->l('Only zip files are allowed'));
|
||||
else if (!copy($filename, ARCHIVE_NAME))
|
||||
$this->errors .= parent::displayError($this->l('An error has occurred during the file copy.'));
|
||||
$this->errors[] = parent::displayError($this->l('An error has occurred during the file copy.'));
|
||||
else if (Tools::ZipTest(ARCHIVE_NAME))
|
||||
$this->page = 2;
|
||||
else
|
||||
$this->errors .= parent::displayError($this->l('Zip file seems to be broken'));
|
||||
$this->errors[] = parent::displayError($this->l('Zip file seems to be broken'));
|
||||
}
|
||||
else if (Tools::isSubmit('prevThemes'))
|
||||
$this->page = 2;
|
||||
@@ -262,7 +262,7 @@ class ThemeInstallator extends Module
|
||||
{
|
||||
if (!Tools::ZipExtract(ARCHIVE_NAME, _IMPORT_FOLDER_))
|
||||
{
|
||||
$this->errors .= parent::displayError($this->l('Error during zip extraction'));
|
||||
$this->errors[] = parent::displayError($this->l('Error during zip extraction'));
|
||||
$this->page = 1;
|
||||
}
|
||||
}
|
||||
@@ -272,7 +272,7 @@ class ThemeInstallator extends Module
|
||||
{
|
||||
if (!self::checkXmlFields())
|
||||
{
|
||||
$this->errors .= parent::displayError($this->l('Bad configuration file'));
|
||||
$this->errors[] = parent::displayError($this->l('Bad configuration file'));
|
||||
$this->page = 1;
|
||||
}
|
||||
else
|
||||
@@ -353,7 +353,7 @@ class ThemeInstallator extends Module
|
||||
self::_displayForm4();
|
||||
break;
|
||||
}
|
||||
return $this->errors.$this->_msg.$this->_html;
|
||||
return join($this->errors, '').$this->_msg.$this->_html;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user