[-] MO : #PSCFV-2349 - Fix bugs with theme export
This commit is contained in:
@@ -99,7 +99,6 @@ $('document').ready(function()
|
|||||||
if (themes.length > 0)
|
if (themes.length > 0)
|
||||||
{
|
{
|
||||||
var count = 0;
|
var count = 0;
|
||||||
while (themes_id[count] != null && count < 10)
|
addVariation(themes_id[theme_selected]);
|
||||||
addVariation(themes_id[count++]);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -102,14 +102,14 @@ class ThemeInstallator extends Module
|
|||||||
{
|
{
|
||||||
$files = scandir($dirname);
|
$files = scandir($dirname);
|
||||||
foreach ($files as $file)
|
foreach ($files as $file)
|
||||||
if ($file != '.' && $file != '..')
|
if ($file != '.' && $file != '..')
|
||||||
{
|
{
|
||||||
if (is_dir($dirname.'/'.$file))
|
if (is_dir($dirname.'/'.$file))
|
||||||
self::deleteDirectory($dirname.'/'.$file);
|
self::deleteDirectory($dirname.'/'.$file);
|
||||||
else if (file_exists($dirname.'/'.$file))
|
else if (file_exists($dirname.'/'.$file))
|
||||||
unlink($dirname.'/'.$file);
|
unlink($dirname.'/'.$file);
|
||||||
}
|
}
|
||||||
rmdir($dirname);
|
rmdir($dirname);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function recurseCopy($src, $dst)
|
private function recurseCopy($src, $dst)
|
||||||
@@ -600,8 +600,8 @@ class ThemeInstallator extends Module
|
|||||||
if ($variation != $theme_directory)
|
if ($variation != $theme_directory)
|
||||||
$theme_directory .= $variation;
|
$theme_directory .= $variation;
|
||||||
|
|
||||||
if (empty($theme_directory))
|
if (empty($theme_directory))
|
||||||
$theme_directory = str_replace(' ', '', (string)$this->xml['name']);
|
$theme_directory = str_replace(' ', '', (string)$this->xml['name']);
|
||||||
|
|
||||||
$target_dir = _PS_ALL_THEMES_DIR_.$theme_directory;
|
$target_dir = _PS_ALL_THEMES_DIR_.$theme_directory;
|
||||||
|
|
||||||
@@ -920,8 +920,8 @@ class ThemeInstallator extends Module
|
|||||||
{
|
{
|
||||||
$theme = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><!-- Copyright Prestashop --><theme></theme>');
|
$theme = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><!-- Copyright Prestashop --><theme></theme>');
|
||||||
$theme->addAttribute('version', Tools::getValue('version'));
|
$theme->addAttribute('version', Tools::getValue('version'));
|
||||||
$theme->addAttribute('name', Tools::htmlentitiesUTF8(Tools::getValue('theme_name')));
|
$theme->addAttribute('name', Tools::htmlentitiesUTF8(Tools::getValue('theme_name')));
|
||||||
$theme->addAttribute('directory', Tools::htmlentitiesUTF8(Tools::getValue('theme_directory')));
|
$theme->addAttribute('directory', Tools::htmlentitiesUTF8(Tools::getValue('theme_directory')));
|
||||||
$author = $theme->addChild('author');
|
$author = $theme->addChild('author');
|
||||||
$author->addAttribute('name', Tools::htmlentitiesUTF8(Tools::getValue('author_name')));
|
$author->addAttribute('name', Tools::htmlentitiesUTF8(Tools::getValue('author_name')));
|
||||||
$author->addAttribute('email', Tools::htmlentitiesUTF8(Tools::getValue('email')));
|
$author->addAttribute('email', Tools::htmlentitiesUTF8(Tools::getValue('email')));
|
||||||
@@ -1069,14 +1069,16 @@ class ThemeInstallator extends Module
|
|||||||
*/
|
*/
|
||||||
private function getHookState()
|
private function getHookState()
|
||||||
{
|
{
|
||||||
foreach ($this->to_install as $string)
|
if ($this->to_install !== false)
|
||||||
foreach ($this->hook_list as $tmp)
|
foreach ($this->to_install as $string)
|
||||||
if ($tmp['name_module'] == $string)
|
foreach ($this->hook_list as $tmp)
|
||||||
$this->to_hook[] = $string.';'.$tmp['name_hook'].';'.$tmp['position'].';'.$tmp['exceptions'];
|
if ($tmp['name_module'] == $string)
|
||||||
foreach ($this->to_enable as $string)
|
$this->to_hook[] = $string.';'.$tmp['name_hook'].';'.$tmp['position'].';'.$tmp['exceptions'];
|
||||||
foreach ($this->hook_list as $tmp)
|
if ($this->to_enable !== false)
|
||||||
if ($tmp['name_module'] == $string)
|
foreach ($this->to_enable as $string)
|
||||||
$this->to_hook[] = $string.';'.$tmp['name_hook'].';'.$tmp['position'].';'.$tmp['exceptions'];
|
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()
|
private function getThemeVariations()
|
||||||
{
|
{
|
||||||
// @todo check theme variation pertinence
|
// @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;
|
$count = 0;
|
||||||
while (Tools::isSubmit('myvar_'.++$count))
|
while (Tools::isSubmit('myvar_'.++$count))
|
||||||
{
|
{
|
||||||
@@ -1176,7 +1175,7 @@ class ThemeInstallator extends Module
|
|||||||
private function checkNames()
|
private function checkNames()
|
||||||
{
|
{
|
||||||
$author = Tools::getValue('author_name');
|
$author = Tools::getValue('author_name');
|
||||||
$name = Tools::getValue('theme_name');
|
$name = Tools::getValue('theme_name');
|
||||||
$count = 0;
|
$count = 0;
|
||||||
|
|
||||||
if (!$author || !Validate::isGenericName($author) || strlen($author) > MAX_NAME_LENGTH)
|
if (!$author || !Validate::isGenericName($author) || strlen($author) > MAX_NAME_LENGTH)
|
||||||
@@ -1271,7 +1270,7 @@ class ThemeInstallator extends Module
|
|||||||
$theme = new Theme($id_theme);
|
$theme = new Theme($id_theme);
|
||||||
|
|
||||||
$theme_name = Tools::getValue('theme_name') ? Tools::getValue('theme_name') : $theme->name;
|
$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 .= '
|
$this->_html .= '
|
||||||
<fieldset>
|
<fieldset>
|
||||||
@@ -1362,12 +1361,14 @@ class ThemeInstallator extends Module
|
|||||||
var select_default = "'.$this->l('Choose a theme').'";
|
var select_default = "'.$this->l('Choose a theme').'";
|
||||||
var themes = Array();
|
var themes = Array();
|
||||||
var themes_id = Array();
|
var themes_id = Array();
|
||||||
|
var theme_selected = '.Tools::getValue('id_theme').';
|
||||||
';
|
';
|
||||||
$id = 0;
|
$id = 0;
|
||||||
foreach ($this->theme_list as $row)
|
foreach ($this->theme_list as $row)
|
||||||
{
|
{
|
||||||
if (!is_dir(_PS_ALL_THEMES_DIR_.$row) || !file_exists(_PS_ALL_THEMES_DIR_.$row.'/index.tpl') || $row == 'prestashop' || $row == Tools::getValue('mainTheme'))
|
if (!is_dir(_PS_ALL_THEMES_DIR_.$row) || !file_exists(_PS_ALL_THEMES_DIR_.$row.'/index.tpl') || $row == 'prestashop' || $row == Tools::getValue('mainTheme'))
|
||||||
continue ;
|
continue ;
|
||||||
|
|
||||||
$this->_html .= 'themes['.$id.'] = "'.$row.'";';
|
$this->_html .= 'themes['.$id.'] = "'.$row.'";';
|
||||||
$this->_html .= 'themes_id['.$id.'] = '.$id.';';
|
$this->_html .= 'themes_id['.$id.'] = '.$id.';';
|
||||||
$id++;
|
$id++;
|
||||||
|
|||||||
Reference in New Issue
Block a user