diff --git a/modules/themeinstallator/themeinstallator.js b/modules/themeinstallator/themeinstallator.js
index 93439c591..0fafb7897 100644
--- a/modules/themeinstallator/themeinstallator.js
+++ b/modules/themeinstallator/themeinstallator.js
@@ -99,7 +99,6 @@ $('document').ready(function()
if (themes.length > 0)
{
var count = 0;
- while (themes_id[count] != null && count < 10)
- addVariation(themes_id[count++]);
+ addVariation(themes_id[theme_selected]);
}
});
diff --git a/modules/themeinstallator/themeinstallator.php b/modules/themeinstallator/themeinstallator.php
index 94dff3ab8..51574067a 100644
--- a/modules/themeinstallator/themeinstallator.php
+++ b/modules/themeinstallator/themeinstallator.php
@@ -102,14 +102,14 @@ class ThemeInstallator extends Module
{
$files = scandir($dirname);
foreach ($files as $file)
- if ($file != '.' && $file != '..')
+ if ($file != '.' && $file != '..')
{
if (is_dir($dirname.'/'.$file))
self::deleteDirectory($dirname.'/'.$file);
else if (file_exists($dirname.'/'.$file))
unlink($dirname.'/'.$file);
}
- rmdir($dirname);
+ rmdir($dirname);
}
private function recurseCopy($src, $dst)
@@ -600,8 +600,8 @@ class ThemeInstallator extends Module
if ($variation != $theme_directory)
$theme_directory .= $variation;
- if (empty($theme_directory))
- $theme_directory = str_replace(' ', '', (string)$this->xml['name']);
+ if (empty($theme_directory))
+ $theme_directory = str_replace(' ', '', (string)$this->xml['name']);
$target_dir = _PS_ALL_THEMES_DIR_.$theme_directory;
@@ -920,8 +920,8 @@ class ThemeInstallator extends Module
{
$theme = new SimpleXMLElement('');
$theme->addAttribute('version', Tools::getValue('version'));
- $theme->addAttribute('name', Tools::htmlentitiesUTF8(Tools::getValue('theme_name')));
- $theme->addAttribute('directory', Tools::htmlentitiesUTF8(Tools::getValue('theme_directory')));
+ $theme->addAttribute('name', Tools::htmlentitiesUTF8(Tools::getValue('theme_name')));
+ $theme->addAttribute('directory', Tools::htmlentitiesUTF8(Tools::getValue('theme_directory')));
$author = $theme->addChild('author');
$author->addAttribute('name', Tools::htmlentitiesUTF8(Tools::getValue('author_name')));
$author->addAttribute('email', Tools::htmlentitiesUTF8(Tools::getValue('email')));
@@ -1069,14 +1069,16 @@ class ThemeInstallator extends Module
*/
private function getHookState()
{
- foreach ($this->to_install as $string)
- foreach ($this->hook_list as $tmp)
- if ($tmp['name_module'] == $string)
- $this->to_hook[] = $string.';'.$tmp['name_hook'].';'.$tmp['position'].';'.$tmp['exceptions'];
- foreach ($this->to_enable as $string)
- foreach ($this->hook_list as $tmp)
- if ($tmp['name_module'] == $string)
- $this->to_hook[] = $string.';'.$tmp['name_hook'].';'.$tmp['position'].';'.$tmp['exceptions'];
+ if ($this->to_install !== false)
+ foreach ($this->to_install as $string)
+ foreach ($this->hook_list as $tmp)
+ if ($tmp['name_module'] == $string)
+ $this->to_hook[] = $string.';'.$tmp['name_hook'].';'.$tmp['position'].';'.$tmp['exceptions'];
+ if ($this->to_enable !== false)
+ foreach ($this->to_enable as $string)
+ foreach ($this->hook_list as $tmp)
+ if ($tmp['name_module'] == $string)
+ $this->to_hook[] = $string.';'.$tmp['name_hook'].';'.$tmp['position'].';'.$tmp['exceptions'];
}
/*
@@ -1100,9 +1102,6 @@ class ThemeInstallator extends Module
private function getThemeVariations()
{
// @todo check theme variation pertinence
- $from = Tools::getValue('compa_from');
- $to = Tools::getValue('compa_to');
- $this->variations[] = Tools::getValue('theme_name').'¤'.Tools::getValue('mainTheme').'¤'.$from.'¤'.$to;
$count = 0;
while (Tools::isSubmit('myvar_'.++$count))
{
@@ -1176,7 +1175,7 @@ class ThemeInstallator extends Module
private function checkNames()
{
$author = Tools::getValue('author_name');
- $name = Tools::getValue('theme_name');
+ $name = Tools::getValue('theme_name');
$count = 0;
if (!$author || !Validate::isGenericName($author) || strlen($author) > MAX_NAME_LENGTH)
@@ -1271,7 +1270,7 @@ class ThemeInstallator extends Module
$theme = new Theme($id_theme);
$theme_name = Tools::getValue('theme_name') ? Tools::getValue('theme_name') : $theme->name;
- $theme_directory = Tools::getValue('theme_directory') ? Tools::getValue('theme_directory') : $theme->directory;
+ $theme_directory = Tools::getValue('theme_directory') ? Tools::getValue('theme_directory') : $theme->directory;
$this->_html .= '