diff --git a/admin-dev/themes/default/template/controllers/cart_rules/form.js b/admin-dev/themes/default/template/controllers/cart_rules/form.js index bad35e93d..ff7c38d9a 100644 --- a/admin-dev/themes/default/template/controllers/cart_rules/form.js +++ b/admin-dev/themes/default/template/controllers/cart_rules/form.js @@ -84,6 +84,13 @@ function addCartRuleOption(item) function updateProductRuleShortDescription(item) { + /******* For IE: put a product in condition on cart rules *******/ + if(typeof String.prototype.trim !== 'function') { + String.prototype.trim = function() { + return this.replace(/^\s+|\s+$/g, ''); + } + } + var id1 = $(item).attr('id').replace('_add', '').replace('_remove', ''); var id2 = id1.replace('_select', ''); var length = $('#' + id1 + '_2 option').length; diff --git a/admin-dev/themes/default/template/controllers/login/content.tpl b/admin-dev/themes/default/template/controllers/login/content.tpl index b1cfff216..784fdec19 100755 --- a/admin-dev/themes/default/template/controllers/login/content.tpl +++ b/admin-dev/themes/default/template/controllers/login/content.tpl @@ -22,91 +22,79 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} - - -
-
- {if isset($errors)} -

{if $nbErrors > 1}{l s='There are %d errors.' sprintf=$nbErrors}{else}{l s='There is %d error.' sprintf=$nbErrors}{/if}

-
    - {foreach from=$errors item="error"} -
  1. {$error}
  2. - {/foreach} -
- {/if} -
-
- {if isset($warningSslMessage)} -
- {$warningSslMessage} -
- {/if} -
-

{$shop_name}

- {if !isset($wrong_folder_name) && !isset($wrong_install_name)} -
-
- - -
- -
- - -
- -
- - -

- -

- -

- {l s='Lost password?'} -

-
-
- -
- -
-

{l s='Forgot your password?'}

-

{l s='In order to receive your access code by email, please enter the address you provided during the registration process.'}

- -
- - -
- -
- - -

- -

- -

- -

-
-
-
- {else} -
-

{l s='For security reasons, you cannot connect to the Back Office until after you have:'}

-
    - {if isset($wrong_install_name) && $wrong_install_name == true}
  • {l s='deleted the /install folder'}
  • {/if} - {if isset($wrong_folder_name) && $wrong_folder_name == true}
  • {l s='renamed the /admin folder (e.g. /admin%d)' sprintf=$randomNb}
  • {/if} -
- {if isset($wrong_folder_name) && $wrong_folder_name == true}

{l s='Please then access this page by the new URL (e.g. http://www.yoursite.com/admin%d)' sprintf=$randomNb}

{/if} -
- {/if} -
-

© 2005 - {$smarty.now|date_format:"%Y"} Copyright by PrestaShop. all rights reserved.

-
+ +
+
+{if isset($errors)} +

{if $nbErrors > 1}{l s='There are %d errors.' sprintf=$nbErrors}{else}{l s='There is %d error.' sprintf=$nbErrors}{/if}

+
    + {foreach from=$errors item="error"} +
  1. {$error}
  2. + {/foreach} +
+{/if} +
+
+{if isset($warningSslMessage)} +
{$warningSslMessage}
+{/if} +
+

{$shop_name}

+{if !isset($wrong_folder_name) && !isset($wrong_install_name)} +
+
+ + +
+
+ + +
+
+ +

+ +

+

+ {l s='Lost password?'} +

+
+
+ +
+
+

{l s='Forgot your password?'}

+

{l s='In order to receive your access code by email, please enter the address you provided during the registration process.'}

+
+ + +
+
+ +

+ +

+

+ +

+
+
+
+{else} +
+

{l s='For security reasons, you cannot connect to the Back Office until after you have:'}

+
    + {if isset($wrong_install_name) && $wrong_install_name == true}
  • {l s='deleted the /install folder'}
  • {/if} + {if isset($wrong_folder_name) && $wrong_folder_name == true}
  • {l s='renamed the /admin folder (e.g. %s)' sprintf=$randomNb}
  • {/if} +
+

{l s='Please then access this page by the new URL (e.g. %s)' sprintf=$adminUrl}

+
+{/if} +
+

© 2005 - {$smarty.now|date_format:"%Y"} Copyright by PrestaShop. all rights reserved.

+
\ No newline at end of file diff --git a/admin-dev/themes/default/template/controllers/orders/_customized_data.tpl b/admin-dev/themes/default/template/controllers/orders/_customized_data.tpl index d6ca1cf6f..7e5b10b7e 100755 --- a/admin-dev/themes/default/template/controllers/orders/_customized_data.tpl +++ b/admin-dev/themes/default/template/controllers/orders/_customized_data.tpl @@ -22,22 +22,23 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} -{if $product.customizedDatas} - - - {if isset($product.image) && $product.image->id}{$product.image_tag}{else}--{/if} +{if $product['customizedDatas']} + + + + {if isset($product['image']) && $product['image']->id|intval}{$product['image_tag']}{else}--{/if} - + {$product['product_name']} - {l s='Customized'}
{if ($product['product_reference'])}{l s='Ref:'} {$product['product_reference']}
{/if} {if ($product['product_supplier_reference'])}{l s='Ref Supplier:'} {$product['product_supplier_reference']}{/if}
- {displayPrice price=$product['product_price_wt'] currency=$currency->id} + {displayPrice price=$product['product_price_wt'] currency=$currency->id|intval} {if $can_edit} @@ -49,32 +50,37 @@ {if $stock_management} - {/if} {if ($order->getTaxCalculationMethod() == $smarty.const.PS_TAX_EXC)} - {displayPrice price=Tools::ps_round($product['product_price'] * $product['customizationQuantityTotal'], 2) currency=$currency->id} + {displayPrice price=Tools::ps_round($product['product_price'] * $product['customizationQuantityTotal'], 2) currency=$currency->id|intval} {else} - {displayPrice price=Tools::ps_round($product['product_price_wt'] * $product['customizationQuantityTotal'], 2) currency=$currency->id} + {displayPrice price=Tools::ps_round($product['product_price_wt'] * $product['customizationQuantityTotal'], 2) currency=$currency->id|intval} {/if} + +   +   - - {l s='Edit'} - - - {l s='Delete'} - + {if ($can_edit && !$order->hasBeenDelivered())} + + {l s='Edit'} + + + {l s='Delete'} + + {/if} - {foreach $product.customizedDatas as $customizationPerAddress} + {foreach $product['customizedDatas'] as $customizationPerAddress} {foreach $customizationPerAddress as $customizationId => $customization} - - + + {foreach $customization.datas as $type => $datas} {if ($type == Product::CUSTOMIZE_FILE)} @@ -93,7 +99,7 @@ {$customization['quantity']} {if $can_edit} {/if} @@ -104,36 +110,38 @@ {if ($order->getTaxCalculationMethod() == $smarty.const.PS_TAX_EXC)} - {displayPrice price=Tools::ps_round($product['product_price'] * $customization['quantity'], 2) currency=$currency->id} + {displayPrice price=Tools::ps_round($product['product_price'] * $customization['quantity'], 2) currency=$currency->id|intval} {else} - {displayPrice price=Tools::ps_round($product['product_price_wt'] * $customization['quantity'], 2) currency=$currency->id} + {displayPrice price=Tools::ps_round($product['product_price_wt'] * $customization['quantity'], 2) currency=$currency->id|intval} {/if} - - + + {if ((!$order->hasBeenDelivered() OR Configuration::get('PS_ORDER_RETURN')) AND (int)($customization['quantity_returned']) < (int)($customization['quantity']))} - = $product['product_quantity'])}disabled="disabled" {/if}/> + = $product['product_quantity'])}disabled="disabled" {/if}/> {else} -- {/if} {if ($customization['quantity_returned'] + $customization['quantity_refunded'] >= $customization['quantity'])} - + {elseif (!$order->hasBeenDelivered() OR Configuration::get('PS_ORDER_RETURN'))} - 0/{$customization['quantity']-$customization['quantity_refunded']} + 0/{$customization['quantity']-$customization['quantity_refunded']} {/if} -
{l s='Quantity:'}
+
{l s='Quantity:'}
0/{$customization['quantity']-$customization['quantity_refunded']}
-
{l s='Amount:'}
{$currency->prefix}{$currency->suffix}
- - +
{l s='Amount:'}
{$currency->prefix}{$currency->suffix}
+ {if ($can_edit && !$order->hasBeenDelivered())} + + + {/if} {/foreach} {/foreach} diff --git a/admin-dev/themes/default/template/footer.tpl b/admin-dev/themes/default/template/footer.tpl index 425e970fe..8caf2c64a 100644 --- a/admin-dev/themes/default/template/footer.tpl +++ b/admin-dev/themes/default/template/footer.tpl @@ -22,33 +22,31 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} - -
 
-
-
 
+
 
+ +
 
+ +{if $display_footer} +{hook h="displayBackOfficeFooter"} + - - {* ajaxBox allows*} - - {/if} -
- - + + +{* ajaxBox allows*} +{/if} +
+ + \ No newline at end of file diff --git a/admin-dev/themes/default/template/header.tpl b/admin-dev/themes/default/template/header.tpl index 9a3eb0b07..dc80e8831 100644 --- a/admin-dev/themes/default/template/header.tpl +++ b/admin-dev/themes/default/template/header.tpl @@ -82,7 +82,6 @@ {/foreach} {/if} - {if isset($displayBackOfficeHeader)} @@ -91,16 +90,15 @@ - {if isset($brightness)} +{if isset($brightness)} - {/if} +{/if} {if $display_header}
{l s='Loading...'}
-
0}style="margin:auto;width:{$bo_width}px"{/if}>
{* begin HEADER *} @@ -108,7 +106,7 @@
{$shop_name}
- {if {$show_new_orders} == 1} +{if {$show_new_orders} == 1}
0 @@ -120,8 +118,8 @@

{l s='Show all orders'}

- {/if} - {if ($show_new_customers == 1)} +{/if} +{if ($show_new_customers == 1)}
0 @@ -133,8 +131,8 @@

{l s='Show all customers'}

- {/if} - {if {$show_new_messages} == 1} +{/if} +{if {$show_new_messages} == 1}
0 @@ -146,9 +144,8 @@

{l s='Show all messages'}

- {/if} +{/if}
-
{l s='Welcome,'} {$first_name} {$last_name}
@@ -157,14 +154,13 @@
  • {l s='My preferences'}
  •  
  • {l s='logout'}
  • - {if {$base_url}} -
  •  
  • - {l s='View my shop'} - {/if} +{if {$base_url}} +
  •  
  • + {l s='View my shop'} +{/if}
    - - - {if count($quick_access) > 0} +{if count($quick_access) > 0}
    - {/if} - {if isset($displayBackOfficeTop)} - {$displayBackOfficeTop} - {/if} +{/if} +{if isset($displayBackOfficeTop)}{$displayBackOfficeTop}{/if} {* end header_infos*} - - {/if} - {/foreach} +{/if} +{/foreach} - {/if} - {* end header*} - + {* end header*} +{/if}
    - {if $display_header && $install_dir_exists} -
    - {l s='For security reasons, you must also:'} {l s='delete the /install folder'} -
    - {/if} - - {if $display_header && $is_multishop && $shop_list && ($multishop_context & Shop::CONTEXT_GROUP || $multishop_context & Shop::CONTEXT_SHOP)} -
    - {l s='Multistore configuration for'} - {$shop_list} -
    - {/if} +{if $display_header && $install_dir_exists} +
    + {l s='For security reasons, you must also:'} {l s='delete the /install folder'} +
    +{/if} +{if $display_header && $is_multishop && $shop_list && ($multishop_context & Shop::CONTEXT_GROUP || $multishop_context & Shop::CONTEXT_SHOP)} +
    + {l s='Multistore configuration for'} {$shop_list} +
    +{/if} \ No newline at end of file diff --git a/admin-dev/themes/default/template/layout.tpl b/admin-dev/themes/default/template/layout.tpl index 3481179da..10ca2fd13 100644 --- a/admin-dev/themes/default/template/layout.tpl +++ b/admin-dev/themes/default/template/layout.tpl @@ -47,7 +47,6 @@ {/if}
    {/if} - {if isset($informations) && count($informations) && $informations}
    @@ -60,7 +59,6 @@

    {/if} - {if isset($confirmations) && count($confirmations) && $confirmations}
    {foreach $confirmations as $conf} @@ -68,7 +66,6 @@ {/foreach}

    {/if} - {if count($warnings)}
    @@ -94,6 +91,5 @@ {/if}
    {/if} - {$page} -{include file='footer.tpl'} +{include file='footer.tpl'} \ No newline at end of file diff --git a/classes/Hook.php b/classes/Hook.php index a5fbbd35d..994c452f5 100644 --- a/classes/Hook.php +++ b/classes/Hook.php @@ -276,7 +276,7 @@ class HookCore extends ObjectModel { $sql->where(Module::getPaypalIgnore()); if (Validate::isLoadedObject($context->country)) - $sql->where('(h.name = "displayPayment" AND (SELECT id_country FROM '._DB_PREFIX_.'module_country mc WHERE mc.id_module = m.id_module AND id_country = '.(int)$context->country->id.' LIMIT 1) = '.(int)$context->country->id.')'); + $sql->where('(h.name = "displayPayment" AND (SELECT id_country FROM '._DB_PREFIX_.'module_country mc WHERE mc.id_module = m.id_module AND id_country = '.(int)$context->country->id.' AND id_shop = '.(int)$context->shop->id.' LIMIT 1) = '.(int)$context->country->id.')'); if (Validate::isLoadedObject($context->currency)) $sql->where('(h.name = "displayPayment" AND (SELECT id_currency FROM '._DB_PREFIX_.'module_currency mcr WHERE mcr.id_module = m.id_module AND id_currency IN ('.(int)$context->currency->id.', -2) LIMIT 1) IN ('.(int)$context->currency->id.', -2))'); } diff --git a/classes/Tools.php b/classes/Tools.php index 211ce26ba..763d0198b 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -1564,6 +1564,9 @@ class ToolsCore fwrite($write_fd, "# .htaccess automaticaly generated by PrestaShop e-commerce open-source solution\n"); fwrite($write_fd, "# http://www.prestashop.com - http://www.prestashop.com/forums\n\n"); + if ($disable_modsec) + fwrite($write_fd, "\nSecFilterEngine Off\nSecFilterScanPOST Off\n\n"); + // RewriteEngine fwrite($write_fd, "\n"); @@ -1571,9 +1574,6 @@ class ToolsCore if ($disable_multiviews) fwrite($write_fd, "\n# Disable Multiviews\nOptions -Multiviews\n\n"); - if ($disable_modsec) - fwrite($write_fd, "\nSecFilterEngine Off\nSecFilterScanPOST Off\n"); - fwrite($write_fd, "RewriteEngine on\n"); if (!$medias) diff --git a/classes/Translate.php b/classes/Translate.php index c98be204f..549158861 100644 --- a/classes/Translate.php +++ b/classes/Translate.php @@ -129,7 +129,7 @@ class TranslateCore static $translations_merged = array(); $name = $module instanceof Module ? $module->name : $module; - if (!isset($translations_merged[$name])) + if (!isset($translations_merged[$name]) && isset(Context::getContext()->language)) { $filesByPriority = array( // Translations in theme diff --git a/classes/cache/Cache.php b/classes/cache/Cache.php index b4ee3de1d..9343f04e7 100755 --- a/classes/cache/Cache.php +++ b/classes/cache/Cache.php @@ -205,7 +205,6 @@ abstract class CacheCore foreach ($this->keys as $k => $ttl) if (preg_match('#^'.$pattern.'$#', $k)) $keys[] = $k; - } // Delete keys @@ -235,13 +234,13 @@ abstract class CacheCore if (is_null($this->sql_tables_cached)) { - $this->sql_tables_cached = $this->get(self::SQL_TABLES_NAME); + $this->sql_tables_cached = $this->get(_COOKIE_IV_.self::SQL_TABLES_NAME); if (!is_array($this->sql_tables_cached)) $this->sql_tables_cached = array(); } // Store query results in cache if this query is not already cached - $key = md5($query); + $key = md5(_COOKIE_IV_.$query); if ($this->exists($key)) return true; $this->set($key, $result); @@ -251,7 +250,7 @@ abstract class CacheCore foreach ($tables as $table) if (!isset($this->sql_tables_cached[$table][$key])) $this->sql_tables_cached[$table][$key] = true; - $this->set(self::SQL_TABLES_NAME, $this->sql_tables_cached); + $this->set(_COOKIE_IV_.self::SQL_TABLES_NAME, $this->sql_tables_cached); } protected function getTables($string) @@ -271,7 +270,7 @@ abstract class CacheCore { if (is_null($this->sql_tables_cached)) { - $this->sql_tables_cached = $this->get(self::SQL_TABLES_NAME); + $this->sql_tables_cached = $this->get(_COOKIE_IV_.self::SQL_TABLES_NAME); if (!is_array($this->sql_tables_cached)) $this->sql_tables_cached = array(); } @@ -287,7 +286,7 @@ abstract class CacheCore } unset($this->sql_tables_cached[$table]); } - $this->set(self::SQL_TABLES_NAME, $this->sql_tables_cached); + $this->set(_COOKIE_IV_.self::SQL_TABLES_NAME, $this->sql_tables_cached); } /** diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php index 93e11818c..d8b39b224 100644 --- a/classes/controller/AdminController.php +++ b/classes/controller/AdminController.php @@ -443,7 +443,8 @@ class AdminControllerCore extends Controller if (isset($_GET) && !empty($_GET) && isset($this->table)) foreach ($_GET as $key => $value) if (stripos($key, $this->table.'OrderBy') === 0 || stripos($key, $this->table.'Orderway') === 0) - $this->context->cookie->$key = $value; + $this->context->cookie->{$prefix.$key} = $value; + $filters = $this->context->cookie->getFamily($prefix.$this->table.'Filter_'); foreach ($filters as $key => $value) { @@ -885,11 +886,11 @@ class AdminControllerCore extends Controller if (isset($this->context->cookie->{'submitFilter'.$this->table})) unset($this->context->cookie->{'submitFilter'.$this->table}); - if (isset($this->context->cookie->{$this->table.'Orderby'})) - unset($this->context->cookie->{$this->table.'Orderby'}); + if (isset($this->context->cookie->{$prefix.$this->table.'Orderby'})) + unset($this->context->cookie->{$prefix.$this->table.'Orderby'}); - if (isset($this->context->cookie->{$this->table.'Orderway'})) - unset($this->context->cookie->{$this->table.'Orderway'}); + if (isset($this->context->cookie->{$prefix.$this->table.'Orderway'})) + unset($this->context->cookie->{$prefix.$this->table.'Orderway'}); unset($_POST); $this->_filter = false; @@ -2045,11 +2046,11 @@ class AdminControllerCore extends Controller if (!Validate::isTableOrIdentifier($this->table)) throw new PrestaShopException(sprintf('Table name %s is invalid:', $this->table)); - + $prefix = str_replace(array('admin', 'controller'), '', Tools::strtolower(get_class($this))); if (empty($order_by)) { - if ($this->context->cookie->{$this->table.'Orderby'}) - $order_by = $this->context->cookie->{$this->table.'Orderby'}; + if ($this->context->cookie->{$prefix.$this->table.'Orderby'}) + $order_by = $this->context->cookie->{$prefix.$this->table.'Orderby'}; elseif ($this->_orderBy) $order_by = $this->_orderBy; else @@ -2058,8 +2059,8 @@ class AdminControllerCore extends Controller if (empty($order_way)) { - if ($this->context->cookie->{$this->table.'Orderway'}) - $order_way = $this->context->cookie->{$this->table.'Orderway'}; + if ($this->context->cookie->{$prefix.$this->table.'Orderway'}) + $order_way = $this->context->cookie->{$prefix.$this->table.'Orderway'}; elseif ($this->_orderWay) $order_way = $this->_orderWay; else diff --git a/classes/module/Module.php b/classes/module/Module.php index 3037a56a8..a0d67a78b 100644 --- a/classes/module/Module.php +++ b/classes/module/Module.php @@ -139,8 +139,9 @@ abstract class ModuleCore public function __construct($name = null, Context $context = null) { // Load context and smarty - $this->context = $context ? $context : Context::getContext(); - $this->smarty = $this->context->smarty->createData($this->context->smarty); + $this->context = $context ? $context : Context::getContext(); + if (is_object($this->context->smarty)) + $this->smarty = $this->context->smarty->createData($this->context->smarty); // If the module has no name we gave him its id as name if ($this->name == null) @@ -152,8 +153,9 @@ abstract class ModuleCore // If cache is not generated, we generate it if (self::$modules_cache == null && !is_array(self::$modules_cache)) { - // Join clause is done to check if the module is activated in current shop context - $sql_limit_shop = 'SELECT COUNT(*) FROM `'._DB_PREFIX_.'module_shop` ms WHERE m.`id_module` = ms.`id_module` AND ms.`id_shop` = '.(int)Context::getContext()->shop->id; + // Join clause is done to check if the module is activated in current shop context + $sql_limit_shop = 'SELECT COUNT(*) FROM `'._DB_PREFIX_.'module_shop` ms WHERE m.`id_module` = ms.`id_module` AND ms.`id_shop` = '.((is_object(Context::getContext()->shop) && $id = (int)Context::getContext()->shop->id) ? $id : 1); + $sql = 'SELECT m.`id_module`, m.`name`, ('.$sql_limit_shop.') as total FROM `'._DB_PREFIX_.'module` m'; // Result is cached @@ -1595,7 +1597,7 @@ abstract class ModuleCore { if ($name === null) $name = $this->name; - return $name.'|'.(int)$this->context->shop->id.'_'.(int)Group::getCurrent()->id.'_'.(int)$this->context->language->id; + return $name.'|'.(int)$this->context->shop->id.'|'.(int)Group::getCurrent()->id.'|'.(int)$this->context->language->id; } public function display($file, $template, $cacheId = null, $compileId = null) diff --git a/classes/order/OrderHistory.php b/classes/order/OrderHistory.php index 0af2e1535..9601af2f3 100644 --- a/classes/order/OrderHistory.php +++ b/classes/order/OrderHistory.php @@ -117,20 +117,30 @@ class OrderHistoryCore extends ObjectModel { $assign[$key]['name'] = $product_download->display_filename; $dl_link = $product_download->getTextLink(false, $virtual_product['download_hash']) - .'&id_order='.$order->id + .'&id_order='.(int)$order->id .'&secure_key='.$order->secure_key; $assign[$key]['link'] = $dl_link; - if ($virtual_product['download_deadline'] != '0000-00-00 00:00:00') - $assign[$key]['deadline'] = Tools::displayDate($virtual_product['download_deadline'], $order->id_lang); + if ($virtual_product['date_expiration'] != '0000-00-00 00:00:00') + $assign[$key]['deadline'] = Tools::displayDate($virtual_product['date_expiration '], $order->id_lang); if ($product_download->nb_downloadable != 0) - $assign[$key]['downloadable'] = $product_download->nb_downloadable; + $assign[$key]['downloadable'] = (int)$product_download->nb_downloadable; } } + $customer = new Customer((int)$order->id_customer); - $context->smarty->assign('virtualProducts', $assign); - $context->smarty->assign('id_order', $order->id); - $iso = Language::getIsoById((int)($order->id_lang)); - $links = $context->smarty->fetch(_PS_MAIL_DIR_.$iso.'/download-product.tpl'); + + $links = '