// revert from r11699

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11702 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
aFolletete
2011-12-22 21:56:00 +00:00
parent 16861c4d03
commit d2f89e79ba
19 changed files with 170 additions and 167 deletions
+25 -10
View File
@@ -323,7 +323,7 @@ class ThemeInstallator extends Module
if (_PS_MODE_DEMO_)
{
return '<div class="error">'.Tools::displayError('This functionnality has been disabled.').'</div>';
}
self::init_defines();
if (!Tools::isSubmit('cancelExport') AND $this->page == 'exportPage')
@@ -392,14 +392,30 @@ class ThemeInstallator extends Module
}
}
private function updateImages($id_theme)
private function updateImages()
{
foreach ($this->xml->images->image as $row)
{
Db::getInstance()->execute('
INSERT INTO `'._DB_PREFIX_.'image_type` (`id_theme`, `name`, `width`, `height`, `products`, `categories`, `manufacturers`, `suppliers`, `scenes`)
VALUES ('.(int)$id_theme.',
$foo = Db::getInstance()->getRow('
SELECT name FROM `'._DB_PREFIX_.'image_type` i
WHERE i.name LIKE \''.pSQL($row['name']).'\'');
if ((int)(Tools::getValue('imagesConfig')) == 1 AND $foo)
continue ;
if ($foo)
Db::getInstance()->execute('
UPDATE `'._DB_PREFIX_.'image_type` i
SET `width` = '.(int)($row['width']).',
`height` = '.(int)($row['height']).',
`products` = '.($row['products'] == 'true' ? 1 : 0).',
`categories` = '.($row['categories'] == 'true' ? 1 : 0).',
`manufacturers` = '.($row['manufacturers'] == 'true' ? 1 : 0).',
`suppliers` = '.($row['suppliers'] == 'true' ? 1 : 0).',
`scenes` = '.($row['scenes'] == 'true' ? 1 : 0).'
WHERE i.name LIKE \''.pSQL($row['name']).'\'');
else
Db::getInstance()->execute('
INSERT INTO `'._DB_PREFIX_.'image_type` (`name`, `width`, `height`, `products`, `categories`, `manufacturers`, `suppliers`, `scenes`)
VALUES (
\''.pSQL($row['name']).'\',
'.(int)($row['width']).',
'.(int)($row['height']).',
@@ -524,13 +540,12 @@ class ThemeInstallator extends Module
}
}
}
if ((int)(Tools::getValue('imagesConfig')) != 3 AND self::updateImages())
$msg .= '<br /><b>'.$this->l('Images have been correctly updated in database').'</b><br />';
$theme = new Theme();
$theme->name = (string)$this->xml['name'];
$theme->add();
if ((int)(Tools::getValue('imagesConfig')) != 3 AND self::updateImages((int)$theme->id))
$msg .= '<br /><b>'.$this->l('Images have been correctly updated in database').'</b><br />';
$this->_msg .= parent::displayConfirmation($msg);
$this->_html .= '
<input type="submit" class="button" name="submitThemes" value="'.$this->l('Previous').'" />