Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development

This commit is contained in:
François Gaillard
2013-04-11 10:28:49 +02:00
33 changed files with 329 additions and 312 deletions
+1 -1
View File
@@ -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))');
}
+3 -3
View File
@@ -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, "<IfModule mod_security.c>\nSecFilterEngine Off\nSecFilterScanPOST Off\n</IfModule>\n");
// RewriteEngine
fwrite($write_fd, "<IfModule mod_rewrite.c>\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, "<IfModule mod_security.c>\nSecFilterEngine Off\nSecFilterScanPOST Off\n</IfModule>");
fwrite($write_fd, "RewriteEngine on\n");
if (!$medias)
+1 -1
View File
@@ -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
+5 -6
View File
@@ -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);
}
/**
+11 -10
View File
@@ -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
+7 -5
View File
@@ -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)
+18 -8
View File
@@ -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 = '<ul>';
foreach($assign as $product)
{
$links .= '<li>';
$links .= '<a href="'.$product['link'].'">'.Tools::htmlentitiesUTF8($product['name']).'</a>';
if (isset($product['deadline']))
$links .= '&nbsp;'.Tools::htmlentitiesUTF8(Tools::displayError('expires on')).'&nbsp;'.$product['deadline'];
if (isset($product['downloadable']))
$links .= '&nbsp;'.Tools::htmlentitiesUTF8(sprintf(Tools::displayError('downloadable %d time(s)'), (int)$product['downloadable']));
$links .= '</li>';
}
$links .= '<ul>';
$data = array(
'{lastname}' => $customer->lastname,
'{firstname}' => $customer->firstname,