// Merge -> revision 9288

This commit is contained in:
rMalie
2011-10-12 16:04:28 +00:00
parent a6f2eb5639
commit a07c14fafd
32 changed files with 1529 additions and 633 deletions
+3 -3
View File
@@ -243,12 +243,12 @@ class AdminSelfUpgrade extends AdminSelfTab
$this->_fieldsAutoUpgrade['PS_AUTOUP_KEEP_TRAD'] = array(
'title' => $this->l('Keep translations'), 'cast' => 'intval', 'validation' => 'isBool',
'type' => 'bool', 'desc'=>$this->l('If set too yes, you will keep all your translations'),
'type' => 'bool', 'desc'=>$this->l('If set to yes, you will keep all your translations'),
);
$this->_fieldsAutoUpgrade['PS_AUTOUP_CUSTOM_MOD_DESACT'] = array(
'title' => $this->l('Desactivate custom modules'), 'cast' => 'intval', 'validation' => 'isBool',
'type' => 'bool', 'desc'=>$this->l('If you don\'t desactivate your modules, you can have some compatibility problem and the Modules page might not load correctly.'),
'title' => $this->l('Deactivate custom modules'), 'cast' => 'intval', 'validation' => 'isBool',
'type' => 'bool', 'desc'=>$this->l('If you don\'t deactivate your modules, you can have some compatibility problems and the Modules page might not load correctly.'),
);
// allow manual mode only for dev
if (defined('_PS_MODE_DEV_') AND _PS_MODE_DEV_)
+88 -338
View File
@@ -1,6 +1,4 @@
<?php
if(!defined('_PS_DISPLAY_COMPATIBILITY_WARNING_'))
define('_PS_DISPLAY_COMPATIBILITY_WARNING_',false);
/*
* 2007-2011 PrestaShop
*
@@ -26,9 +24,14 @@ if(!defined('_PS_DISPLAY_COMPATIBILITY_WARNING_'))
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
if (!defined('_PS_DISPLAY_COMPATIBILITY_WARNING_'))
define('_PS_DISPLAY_COMPATIBILITY_WARNING_', false);
if(!class_exists('Tools14',false))
{
class Tools14Core
class Tools14
{
protected static $file_exists_cache = array();
protected static $_forceCompile;
@@ -62,7 +65,10 @@ class Tools14Core
if (strpos($url, $baseUri) !== FALSE && strpos($url, $baseUri) == 0)
$url = substr($url, strlen($baseUri));
$explode = explode('?', $url, 2);
$url = $link->getPageLink($explode[0], true);
// don't use ssl if url is home page
// used when logout for example
$useSSL = !empty($url);
$url = $link->getPageLink($explode[0], $useSSL);
if (isset($explode[1]))
$url .= '?'.$explode[1];
$baseUri = '';
@@ -213,7 +219,13 @@ class Tools14Core
*/
public static function usingSecureMode()
{
return !(empty($_SERVER['HTTPS']) OR strtolower($_SERVER['HTTPS']) == 'off');
if (isset($_SERVER['HTTPS']))
return ($_SERVER['HTTPS'] == 1 || strtolower($_SERVER['HTTPS']) == 'on');
// $_SERVER['SSL'] exists only in some specific configuration
if (isset($_SERVER['SSL']))
return ($_SERVER['SSL'] == 1 || strtolower($_SERVER['SSL']) == 'on');
return false;
}
/**
@@ -466,18 +478,13 @@ class Tools14Core
*/
public static function displayDate($date, $id_lang, $full = false, $separator = '-')
{
if (!$date OR !strtotime($date))
if (!$date OR !($time = strtotime($date)))
return $date;
if (!Validate::isDate($date) OR !Validate::isBool($full))
die (self::displayError('Invalid date'));
$tmpTab = explode($separator, substr($date, 0, 10));
$hour = ' '.substr($date, -8);
$language = Language::getLanguage((int)($id_lang));
if ($language AND strtolower($language['iso_code']) == 'fr')
return ($tmpTab[2].'-'.$tmpTab[1].'-'.$tmpTab[0].($full ? $hour : ''));
else
return ($tmpTab[0].'-'.$tmpTab[1].'-'.$tmpTab[2].($full ? $hour : ''));
$language = Language::getLanguage((int)$id_lang);
return date($full ? $language['date_format_full'] : $language['date_format_lite'], $time);
}
/**
@@ -490,8 +497,8 @@ class Tools14Core
public static function safeOutput($string, $html = false)
{
if (!$html)
$string = @htmlentities(strip_tags($string), ENT_QUOTES, 'utf-8');
return $string;
$string = strip_tags($string);
return @Tools::htmlentitiesUTF8($string, ENT_QUOTES);;
}
public static function htmlentitiesUTF8($string, $type = ENT_QUOTES)
@@ -537,7 +544,8 @@ class Tools14Core
/**
* Display an error according to an error code
*
* @param integer $code Error code
* @param string $string Error message
* @param boolean $htmlentities By default at true for parsing error message with htmlentities
*/
public static function displayError($string = 'Fatal error', $htmlentities = true)
{
@@ -636,6 +644,7 @@ class Tools14Core
/* Categories specifics meta tags */
elseif ($id_category = self::getValue('id_category'))
{
$page_number = (int)self::getValue('p');
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
SELECT `name`, `meta_title`, `meta_description`, `meta_keywords`, `description`
FROM `'._DB_PREFIX_.'category_lang`
@@ -644,6 +653,13 @@ class Tools14Core
{
if (empty($row['meta_description']))
$row['meta_description'] = strip_tags($row['description']);
// Paginate title
if (!empty($row['meta_title']))
$row['meta_title'] = $row['meta_title'].(!empty($page_number) ? ' ('.$page_number.')' : '').' - '.Configuration::get('PS_SHOP_NAME');
else
$row['meta_title'] = $row['name'].(!empty($page_number) ? ' ('.$page_number.')' : '').' - '.Configuration::get('PS_SHOP_NAME');
return self::completeMetaTags($row, $row['name']);
}
}
@@ -651,6 +667,7 @@ class Tools14Core
/* Manufacturers specifics meta tags */
elseif ($id_manufacturer = self::getValue('id_manufacturer'))
{
$page_number = (int)self::getValue('p');
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
SELECT `name`, `meta_title`, `meta_description`, `meta_keywords`
FROM `'._DB_PREFIX_.'manufacturer_lang` ml
@@ -660,9 +677,9 @@ class Tools14Core
{
if (empty($row['meta_description']))
$row['meta_description'] = strip_tags($row['meta_description']);
if (!empty($row['meta_title']))
$row['meta_title'] = $row['meta_title'].' - '.Configuration::get('PS_SHOP_NAME');
return self::completeMetaTags($row, $row['name']);
$row['meta_title'] .= $row['name'] . (!empty($page_number) ? ' ('.$page_number.')' : '');
$row['meta_title'] .= ' - '.Configuration::get('PS_SHOP_NAME');
return self::completeMetaTags($row, $row['meta_title']);
}
}
@@ -739,11 +756,11 @@ class Tools14Core
{
global $cookie;
if ($metaTags['meta_title'] == NULL)
if (empty($metaTags['meta_title']))
$metaTags['meta_title'] = $defaultValue.' - '.Configuration::get('PS_SHOP_NAME');
if ($metaTags['meta_description'] == NULL)
if (empty($metaTags['meta_description']))
$metaTags['meta_description'] = Configuration::get('PS_META_DESCRIPTION', (int)($cookie->id_lang)) ? Configuration::get('PS_META_DESCRIPTION', (int)($cookie->id_lang)) : '';
if ($metaTags['meta_keywords'] == NULL)
if (empty($metaTags['meta_keywords']))
$metaTags['meta_keywords'] = Configuration::get('PS_META_KEYWORDS', (int)($cookie->id_lang)) ? Configuration::get('PS_META_KEYWORDS', (int)($cookie->id_lang)) : '';
return $metaTags;
}
@@ -957,6 +974,29 @@ class Tools14Core
$str = mb_strtolower($str, 'utf-8');
$str = trim($str);
$str = self::replaceAccentedChars($str);
// Remove all non-whitelist chars.
$str = preg_replace('/[^a-zA-Z0-9\s\'\:\/\[\]-]/','', $str);
$str = preg_replace('/[\s\'\:\/\[\]-]+/',' ', $str);
$str = preg_replace('/[ ]/','-', $str);
$str = preg_replace('/[\/]/','-', $str);
// If it was not possible to lowercase the string with mb_strtolower, we do it after the transformations.
// This way we lose fewer special chars.
$str = strtolower($str);
return $str;
}
/**
* Replace all accented chars by their equivalent non accented chars.
*
* @param string $str
* @return string
*/
public static function replaceAccentedChars($str)
{
$str = preg_replace('/[\x{0105}\x{0104}\x{00E0}\x{00E1}\x{00E2}\x{00E3}\x{00E4}\x{00E5}]/u','a', $str);
$str = preg_replace('/[\x{00E7}\x{010D}\x{0107}\x{0106}]/u','c', $str);
$str = preg_replace('/[\x{010F}]/u','d', $str);
@@ -974,17 +1014,6 @@ class Tools14Core
$str = preg_replace('/[\x{017C}\x{017A}\x{017B}\x{0179}\x{017E}]/u','z', $str);
$str = preg_replace('/[\x{00E6}]/u','ae', $str);
$str = preg_replace('/[\x{0153}]/u','oe', $str);
// Remove all non-whitelist chars.
$str = preg_replace('/[^a-zA-Z0-9\s\'\:\/\[\]-]/','', $str);
$str = preg_replace('/[\s\'\:\/\[\]-]+/',' ', $str);
$str = preg_replace('/[ ]/','-', $str);
$str = preg_replace('/[\/]/','-', $str);
// If it was not possible to lowercase the string with mb_strtolower, we do it after the transformations.
// This way we lose fewer special chars.
$str = strtolower($str);
return $str;
}
@@ -1228,15 +1257,20 @@ class Tools14Core
return self::$file_exists_cache[$filename];
}
public static function file_get_contents($url, $useIncludePath = false, $streamContext = NULL)
public static function file_get_contents($url, $useIncludePath = false, $streamContext = NULL, $curlTimeOut = 5)
{
if ($streamContext == NULL)
$streamContext = @stream_context_create(array('http' => array('timeout' => 5)));
if (in_array(ini_get('allow_url_fopen'), array('On', 'on', '1')))
return file_get_contents($url, $useIncludePath, $streamContext);
elseif (function_exists('curl_init'))
return @file_get_contents($url, $useIncludePath, $streamContext);
elseif (function_exists('curl_init') && in_array(ini_get('allow_url_fopen'), array('On', 'on', '1')))
{
$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, $curlTimeOut);
curl_setopt($curl, CURLOPT_TIMEOUT, $curlTimeOut);
$content = curl_exec($curl);
curl_close($curl);
return $content;
@@ -1248,11 +1282,7 @@ class Tools14Core
public static function simplexml_load_file($url, $class_name = null)
{
if (in_array(ini_get('allow_url_fopen'), array('On', 'on', '1')))
return simplexml_load_file($url, $class_name);
elseif (function_exists('curl_init'))
{
return simplexml_load_string(Tools::file_get_contents($url), $class_name);
}
else
return false;
}
@@ -1721,18 +1751,12 @@ class Tools14Core
$tab['RewriteRule']['content']['^c/([0-9]+)(\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*\.jpg$'] = 'img/c/$1$2.jpg [L]';
$tab['RewriteRule']['content']['^c/([a-zA-Z-]+)/[a-zA-Z0-9-]+\.jpg$'] = 'img/c/$1.jpg [L]';
$tab['RewriteRule']['content']['^([0-9]+)\-[a-zA-Z0-9-]*\.html'] = 'product.php?id_product=$1 [QSA,L]';
$tab['RewriteRule']['content']['^([0-9]+)\-[a-zA-Z0-9-]*'] = 'category.php?id_category=$1 [QSA,L]';
$tab['RewriteRule']['content']['^[a-zA-Z0-9-]*/([0-9]+)\-[a-zA-Z0-9-]*\.html'] = 'product.php?id_product=$1 [QSA,L]';
$tab['RewriteRule']['content']['^([0-9]+)__([a-zA-Z0-9-]*)'] = 'supplier.php?id_supplier=$1 [QSA,L]';
$tab['RewriteRule']['content']['^([0-9]+)_([a-zA-Z0-9-]*)'] = 'manufacturer.php?id_manufacturer=$1 [QSA,L]';
$tab['RewriteRule']['content']['^content/([0-9]+)\-([a-zA-Z0-9-]*)'] = 'cms.php?id_cms=$1 [QSA,L]';
$tab['RewriteRule']['content']['^content/category/([0-9]+)\-([a-zA-Z0-9-]*)'] = 'cms.php?id_cms_category=$1 [QSA,L]';
if ($multilang)
{
$tab['RewriteRule']['content']['^([a-z]{2})/[a-zA-Z0-9-]*/([0-9]+)\-[a-zA-Z0-9-]*\.html'] = 'product.php?id_product=$2&isolang=$1 [QSA,L]';
$tab['RewriteRule']['content']['^([a-z]{2})/([0-9]+)\-[a-zA-Z0-9-]*\.html'] = 'product.php?id_product=$2&isolang=$1 [QSA,L]';
$tab['RewriteRule']['content']['^([a-z]{2})/([0-9]+)\-[a-zA-Z0-9-]*(/[a-zA-Z0-9-]*)+'] = 'category.php?id_category=$2&isolang=$1&noredirect=1 [QSA,L]';
$tab['RewriteRule']['content']['^([a-z]{2})/([0-9]+)\-[a-zA-Z0-9-]*'] = 'category.php?id_category=$2&isolang=$1 [QSA,L]';
$tab['RewriteRule']['content']['^([a-z]{2})/content/([0-9]+)\-[a-zA-Z0-9-]*'] = 'cms.php?isolang=$1&id_cms=$2 [QSA,L]';
$tab['RewriteRule']['content']['^([a-z]{2})/content/category/([0-9]+)\-[a-zA-Z0-9-]*'] = 'cms.php?isolang=$1&id_cms_category=$2 [QSA,L]';
@@ -1745,6 +1769,9 @@ class Tools14Core
$tab['RewriteRule']['content']['^([0-9]+)\-[a-zA-Z0-9-]*\.html'] = 'product.php?id_product=$1 [QSA,L]';
$tab['RewriteRule']['content']['^[a-zA-Z0-9-]*/([0-9]+)\-[a-zA-Z0-9-]*\.html'] = 'product.php?id_product=$1 [QSA,L]';
// Notice : the id_category rule has to be after product rules.
// If not, category with number in their name will result a bug
$tab['RewriteRule']['content']['^([0-9]+)\-[a-zA-Z0-9-]*(/[a-zA-Z0-9-]*)+'] = 'category.php?id_category=$1&noredirect=1 [QSA,L]';
$tab['RewriteRule']['content']['^([0-9]+)\-[a-zA-Z0-9-]*'] = 'category.php?id_category=$1 [QSA,L]';
$tab['RewriteRule']['content']['^([0-9]+)__([a-zA-Z0-9-]*)'] = 'supplier.php?id_supplier=$1 [QSA,L]';
$tab['RewriteRule']['content']['^([0-9]+)_([a-zA-Z0-9-]*)'] = 'manufacturer.php?id_manufacturer=$1 [QSA,L]';
@@ -2058,14 +2085,26 @@ FileETag INode MTime Size
* @param string $type by|way
* @param string $value If no index given, use default order from admin -> pref -> products
*/
public static function getProductsOrder($type, $value = null)
public static function getProductsOrder($type, $value = null, $prefix = false)
{
switch ($type)
{
case 'by' :
$orderByPrefix = '';
if($prefix) {
if ($value == 'id_product' || $value == 'date_add' || $value == 'price')
$orderByPrefix = 'p.';
elseif ($value == 'name')
$orderByPrefix = 'pl.';
elseif ($value == 'manufacturer')
$orderByPrefix = 'm.';
elseif ($value == 'position' || empty($value))
$orderByPrefix = 'cp.';
}
$value = (is_null($value) || $value === false || $value === '') ? (int)Configuration::get('PS_PRODUCTS_ORDER_BY') : $value;
$list = array(0 => 'name', 1 => 'price', 2 => 'date_add', 3 => 'date_upd', 4 => 'position', 5 => 'manufacturer_name', 6 => 'quantity');
return ((isset($list[$value])) ? $list[$value] : ((in_array($value, $list)) ? $value : 'position'));
return $orderByPrefix.((isset($list[$value])) ? $list[$value] : ((in_array($value, $list)) ? $value : 'position'));
break;
case 'way' :
@@ -2208,292 +2247,3 @@ FileETag INode MTime Size
}
}
// if FB class is already loaded, just enable it. else, enable it only if fb.php exists and is loaded
if (!defined('PS_USE_FIREPHP') AND class_exists('FB',false))
define('PS_USE_FIREPHP',true);
elseif (file_exists(dirname(__FILE__).DIRECTORY_SEPARATOR.'fb.php'))
{
if (!defined('PS_USE_FIREPHP'))
{
require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'fb.php');
define('PS_USE_FIREPHP',true);
}
else
define('PS_USE_FIREPHP',false);
}
else
if(!defined('PS_USE_FIREPHP'))
define('PS_USE_FIREPHP',class_exists('FB',false));
class Tools14 extends Tools14Core
{
/**
* Redirect user to another page after 5 sec
*
* @param string $url Desired URL
* @param string $baseUri Base URI (optional)
*/
public static function redirect($url, $baseUri = __PS_BASE_URI__)
{
if (strpos($url, 'http://') === FALSE && strpos($url, 'https://') === FALSE)
{
global $link;
if (strpos($url, $baseUri) !== FALSE && strpos($url, $baseUri) == 0)
$url = substr($url, strlen($baseUri));
$explode = explode('?', $url);
$url = $link->getPageLink($explode[0], true);
if (isset($explode[1]))
$url .= '?'.$explode[1];
$baseUri = '';
}
if (isset($_SERVER['HTTP_REFERER']) AND ($url == $_SERVER['HTTP_REFERER']))
header('Refresh: 5; url='.$_SERVER['HTTP_REFERER']);
else
header('Refresh: 5; url='.$baseUri.$url);
echo '<h1>Redirection automatique dans 5 secondes</h1><a href='.$url.'>'.$url.'</a>';
exit;
}
/**
* Redirect url wich allready PS_BASE_URI after 5 sec
*
* @param string $url Desired URL
*/
public static function redirectLink($url)
{
if (!preg_match('@^https?://@i', $url))
{
global $link;
if (strpos($url, __PS_BASE_URI__) !== FALSE && strpos($url, __PS_BASE_URI__) == 0)
$url = substr($url, strlen(__PS_BASE_URI__));
$explode = explode('?', $url);
$url = $link->getPageLink($explode[0]);
if (isset($explode[1]))
$url .= '?'.$explode[1];
}
header('Refresh: 5; url='.$url);
echo '<h1>Redirection automatique dans 5 secondes</h1><a href='.$url.'>'.$url.'</a>';
exit;
}
/**
* Redirect user to another admin page after 5 sec
*
* @param string $url Desired URL
*/
public static function redirectAdmin($url)
{
header('Refresh: 5; url='.$url);
echo '<h1>Redirection automatique dans 5 secondes</h1><a href='.$url.'>'.$url.'</a>';
exit;
}
/**
* Display an error with detailed object
* (display in firefox console if Firephp is enabled)
*
* @param mixed $object
* @param boolean $kill
* @return $object if $kill = false;
*/
public static function dieObject($object, $kill = true)
{
if (PS_USE_FIREPHP)
FB::error($object);
else
return parent::dieObject($object,$kill);
if ($kill)
die('END');
return $object;
}
/**
* ALIAS OF dieObject() - Display an error with detailed object
* (display in firefox console if Firephp is enabled)
*
* @param object $object Object to display
*/
public static function d($obj, $kill = true)
{
if (PS_USE_FIREPHP)
FB::error($obj);
else
parent::d($obj,$kill);
if ($kill)
die('END');
return $object;
}
/**
* ALIAS OF dieObject() - Display an error with detailed object but don't stop the execution
* (display in firefox console if Firephp is enabled)
*
* @param object $object Object to display
*/
public static function p($object)
{
if (PS_USE_FIREPHP)
FB::info($object);
else
return parent::p($object);
return $object;
}
/**
* Display a warning message indicating that the method is deprecated
* (display in firefox console if Firephp is enabled)
*/
public static function displayAsDeprecated()
{
if (_PS_DISPLAY_COMPATIBILITY_WARNING_)
{
$backtrace = debug_backtrace();
$callee = next($backtrace);
if (PS_USE_FIREPHP)
FB::warn('Function <strong>'.$callee['function'].'()</strong> is deprecated in <strong>'.$callee['file'].'</strong> on line <strong>'.$callee['line'].'</strong><br />', 'Deprecated method');
else
trigger_error('Function <strong>'.$callee['function'].'()</strong> is deprecated in <strong>'.$callee['file'].'</strong> on line <strong>'.$callee['line'].'</strong><br />', E_USER_WARNING);
$message = Tools::displayError('The function').' '.$callee['function'].' ('.Tools::displayError('Line').' '.$callee['line'].') '.Tools::displayError('is deprecated and will be removed in the next major version.');
Logger::addLog($message, 3, $callee['class']);
}
}
/**
* Display a warning message indicating that the parameter is deprecated
* (display in firefox console if Firephp is enabled)
*/
public static function displayParameterAsDeprecated($parameter)
{
if (_PS_DISPLAY_COMPATIBILITY_WARNING_)
{
$backtrace = debug_backtrace();
$callee = next($backtrace);
trigger_error('Parameter <strong>'.$parameter.'</strong> in function <strong>'.$callee['function'].'()</strong> is deprecated in <strong>'.$callee['file'].'</strong> on line <strong>'.$callee['Line'].'</strong><br />', E_USER_WARNING);
if (PS_USE_FIREPHP)
FB::trace('Parameter <strong>'.$parameter.'</strong> in function <strong>'.$callee['function'].'()</strong> is deprecated in <strong>'.$callee['file'].'</strong> on line <strong>'.$callee['Line'].'</strong><br />', 'deprecated parameter');
else
$message = Tools::displayError('The parameter').' '.$parameter.' '.Tools::displayError(' in function ').' '.$callee['function'].' ('.Tools::displayError('Line').' '.$callee['Line'].') '.Tools::displayError('is deprecated and will be removed in the next major version.');
Logger::addLog($message, 3, $callee['class']);
}
}
/**
* use of FirePHP::error() if allowed
*
* @param mixed $obj
* @param string $label
* @return void
*/
public static function error($obj, $label = '')
{
if (PS_USE_FIREPHP)
FB::error($obj, $label);
}
/**
* use of FirePHP::warn() if allowed
*
* @param mixed $obj
* @param string $label
* @return void
*/
public static function warn($obj, $label = '')
{
if (PS_USE_FIREPHP)
FB::warn($obj, $label);
}
/**
* use of FirePHP::info() if allowed
*
* @param mixed $obj
* @param string $label
* @return void
*/
public static function info($obj, $label = '')
{
if (PS_USE_FIREPHP)
FB::info($obj, $label);
}
/**
* use of FirePHP::log() if allowed
*
* @param mixed $obj
* @param string $label
* @return void
*/
public static function log($obj, $label = '')
{
if (PS_USE_FIREPHP)
FB::log($obj,$label);
}
/**
* display debug_backtrace()
* (display in firefox console if Firephp is enabled)
*
* @param mixed $obj
* @return void
*/
public static function trace($obj = NULL, $label = '')
{
if (PS_USE_FIREPHP)
FB::trace($obj, $label);
else{
Tools::p($obj);
echo'<pre><h1>'.$label.'</h1><br/>';
debug_print_backtrace();
echo '</pre>';
}
}
}
// Add some convenient shortcut
if (!function_exists('error'))
{
function error($obj, $label = ''){
return Tools::error($obj, $label);
}
}
if (!function_exists('warn'))
{
function warn($obj, $label = ''){
return Tools::warn($obj,$label);
}
}
if (!function_exists('info'))
{
function info($obj, $label = ''){
return Tools::info($obj, $label);
}
}
if (!function_exists('log'))
{
function log($obj, $label = ''){
return Tools::log($obj, $label);
}
}
if (!function_exists('trace'))
{
function trace($obj, $label = ''){
return Tools::trace($obj, $label);
}
}
@@ -0,0 +1,28 @@
{*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registred Trademark & Property of PrestaShop SA
*}
<div id="product_list" class="clear">
<p class="warning">{l s='There are no products.'}</p>
</div>
@@ -18,7 +18,7 @@ if (!Tools::getValue('ajax'))
}
// Return a content without waiting the end of index execution
header('Location: '.Tools::getProtocol().Tools::getHttpHost().'/modules/blocklayered/blocklayered-price-indexer.php?token='.Tools::getValue('token') .'&return_message='.(int)Tools::getValue('cursor'));
header('Location: '.Tools::getProtocol().Tools::getHttpHost().__PS_BASE_URI__.'modules/blocklayered/blocklayered-price-indexer.php?token='.Tools::getValue('token') .'&return_message='.(int)Tools::getValue('cursor'));
flush();
}
if(Tools::getValue('full'))
+3
View File
@@ -73,3 +73,6 @@
#layered_block_left ul li .disabled {
color: #666;
}
#product_list .warning {
margin-top: 13px;
}
+7
View File
@@ -242,8 +242,12 @@ function reloadContent(params_plus)
data += '&orderby='+splitData[0]+'&orderway='+splitData[1];
}
var slideUp = true;
if(params_plus == undefined)
{
params_plus = '';
slideUp = false;
}
// Get nb items per page
var n = '';
@@ -311,6 +315,9 @@ function reloadContent(params_plus)
current_friendly_url = '#/';
window.location = current_friendly_url;
lockLocationChecking = true;
if(slideUp)
$.scrollTo('#product_list', 400);
}
});
ajaxQueries.push(ajaxQuery);
+45 -10
View File
@@ -858,7 +858,7 @@ class BlockLayered extends Module
if (($nbProducts > 0 && !$full || $cursor < $nbProducts && $full) && !$ajax)
{
$token = substr(Tools::encrypt('blocklayered/index'), 0, 10);
if (!Tools::file_get_contents(Tools::getProtocol().Tools::getHttpHost().'/modules/blocklayered/blocklayered-price-indexer.php?token='.$token.'&cursor='.(int)$cursor.'&full='.(int)$full))
if (!Tools::file_get_contents(Tools::getProtocol().Tools::getHttpHost().__PS_BASE_URI__.'modules/blocklayered/blocklayered-price-indexer.php?token='.$token.'&cursor='.(int)$cursor.'&full='.(int)$full))
self::indexPrices((int)$cursor, (int)$full);
return $cursor;
}
@@ -1025,6 +1025,11 @@ class BlockLayered extends Module
{
global $smarty, $cookie;
// No filters => module disable
if ($filterBlock = $this->getFilterBlock($this->getSelectedFilters()))
if ($filterBlock['nbr_filterBlocks'] == 0)
return false;
if (Tools::getValue('id_category', Tools::getValue('id_category_layered', 1)) == 1)
return;
@@ -1034,7 +1039,6 @@ class BlockLayered extends Module
$categoryTitle = (empty($category->meta_title[$idLang])?$category->name[$idLang]:$category->meta_title[$idLang]);
// Generate meta title and meta description
$filterBlock = self::getFilterBlock($this->getSelectedFilters());
$title = '';
if (is_array($filterBlock['title_values']))
foreach ($filterBlock['title_values'] as $key => $val)
@@ -1056,6 +1060,7 @@ class BlockLayered extends Module
$this->context->controller->addJs($this->_path.'blocklayered.js');
$this->context->controller->addJqueryUI('ui.slider');
$this->context->controller->addCSS($this->_path.'blocklayered.css', 'all');
Tools::addJS(_PS_JS_DIR_.'jquery/jquery.scrollTo-1.4.2-min.js');
}
public function hookFooter($params)
@@ -2090,13 +2095,15 @@ class BlockLayered extends Module
INNER JOIN '._DB_PREFIX_.'attribute_group_lang agl
ON agl.id_attribute_group = lpa.id_attribute_group
AND agl.id_lang = '.(int)$cookie->id_lang.'
LEFT JOIN '._DB_PREFIX_.'category_product cp ON (cp.id_product = p.id_product)
INNER JOIN '._DB_PREFIX_.'category c ON (c.id_category = cp.id_category AND c.nleft >= '.(int)$parent->nleft.' AND c.nright <= '.(int)$parent->nright.')
LEFT JOIN '._DB_PREFIX_.'layered_indexable_attribute_group_lang_value liagl
ON (liagl.id_attribute_group = lpa.id_attribute_group AND liagl.id_lang = '.(int)$cookie->id_lang.')
LEFT JOIN '._DB_PREFIX_.'layered_indexable_attribute_lang_value lial
ON (lial.id_attribute = lpa.id_attribute AND lial.id_lang = '.(int)$cookie->id_lang.') ';
$sqlQuery['where'] = 'WHERE a.id_attribute_group = '.(int)$filter['id_value'].' ';
$sqlQuery['where'] = 'WHERE a.id_attribute_group = '.(int)$filter['id_value'].'
AND p.id_product IN (
SELECT id_product
FROM '._DB_PREFIX_.'category_product cp
INNER JOIN '._DB_PREFIX_.'category c ON (c.id_category = cp.id_category AND c.nleft >= '.(int)$parent->nleft.' AND c.nright <= '.(int)$parent->nright.')) ';
$sqlQuery['group'] = '
GROUP BY lpa.id_attribute
ORDER BY id_attribute_group, id_attribute';
@@ -2143,10 +2150,16 @@ class BlockLayered extends Module
if (method_exists('BlockLayered', $methodName) &&
(!in_array($filter['type'], array('price', 'weight')) && $filter['type'] != $filterTmp['type'] || $filter['type'] == $filterTmp['type']))
{
if ($filter['type'] == $filterTmp['type'])
$subQueryFilter = self::$methodName(array(), $filter['type'] == $filterTmp['type']);
if ($filter['type'] == $filterTmp['type'] && $filter['id_value'] == $filterTmp['id_value'])
$subQueryFilter = self::$methodName(array(), true);
else
$subQueryFilter = self::$methodName(@$selectedFilters[$filterTmp['type']], $filter['type'] == $filterTmp['type']);
{
if (!is_null($filterTmp['id_value']))
$selected_filters_cleaned = $this->cleanFilterByIdValue(@$selectedFilters[$filterTmp['type']], $filterTmp['id_value']);
else
$selected_filters_cleaned = @$selectedFilters[$filterTmp['type']];
$subQueryFilter = self::$methodName($selected_filters_cleaned, $filter['type'] == $filterTmp['type']);
}
foreach ($subQueryFilter as $key => $value)
$sqlQuery[$key] .= $value;
}
@@ -2471,12 +2484,29 @@ class BlockLayered extends Module
return $cache;
}
public function cleanFilterByIdValue($attributes, $id_value)
{
$selected_filters = array();
if (is_array($attributes))
foreach ($attributes as $attribute)
{
$attribute_data = explode('_', $attribute);
if ($attribute_data[0] == $id_value)
$selected_filters[] = $attribute_data[1];
}
return $selected_filters;
}
public function generateFiltersBlock($selectedFilters)
{
global $smarty;
if($filterBlock = $this->getFilterBlock($selectedFilters))
{
$smarty->assign($this->getFilterBlock($selectedFilters));
if ($filterBlock['nbr_filterBlocks'] == 0)
return false;
$smarty->assign($filterBlock);
return $this->display(__FILE__, 'blocklayered.tpl');
}
else
@@ -2795,10 +2825,15 @@ class BlockLayered extends Module
else
$categoryCount = '';
if ($nbProducts == 0)
$product_list_tpl = 'blocklayered-no-products.tpl';
else
$product_list_tpl = _PS_THEME_DIR_.'product-list.tpl';
/* We are sending an array in jSon to the .js controller, it will update both the filters and the products zones */
return Tools::jsonEncode(array(
'filtersBlock' => $this->generateFiltersBlock($selectedFilters),
'productList' => $smarty->fetch(_PS_THEME_DIR_.'product-list.tpl'),
'productList' => $smarty->fetch($product_list_tpl),
'pagination' => $smarty->fetch(_PS_THEME_DIR_.'pagination.tpl'),
'categoryCount' => $categoryCount));
}
+1
View File
@@ -2,6 +2,7 @@
global $_MODULE;
$_MODULE = array();
$_MODULE['<{blocklayered}prestashop>blocklayered-no-products_5c9838becf9bbce28ba90a7426daf171'] = 'Il n\'y a pas de produits.';
$_MODULE['<{blocklayered}prestashop>blocklayered_84241e458cdd5162745500a59a3680f3'] = 'Bloc navigation à facettes';
$_MODULE['<{blocklayered}prestashop>blocklayered_2d08fa8e157fe3f1875402cbd98aee1b'] = 'Affiche un bloc avec les filtres de la navigation à facettes';
$_MODULE['<{blocklayered}prestashop>blocklayered_af1b98adf7f686b84cd0b443e022b7a0'] = 'Catégories';
+1 -1
View File
@@ -2,7 +2,7 @@
<module>
<name>ebay</name>
<displayName><![CDATA[eBay]]></displayName>
<version><![CDATA[1.3]]></version>
<version><![CDATA[1.3.1]]></version>
<description><![CDATA[Open your shop on the eBay market place !]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[market_place]]></tab>
+11 -8
View File
@@ -59,7 +59,7 @@ class Ebay extends Module
{
$this->name = 'ebay';
$this->tab = 'market_place';
$this->version = '1.3';
$this->version = '1.3.1';
$this->author = 'PrestaShop';
parent::__construct ();
$this->displayName = $this->l('eBay');
@@ -913,7 +913,7 @@ class Ebay extends Module
return '<p><b>'.$this->l('You have to configure "General Settings" tab before using this tab.').'</b></p><br />';
// Load categories only if necessary
if (Db::getInstance()->getValue('SELECT COUNT(`id_ebay_category_configuration`) FROM `'._DB_PREFIX_.'ebay_category_configuration`') > 4 && Tools::getValue('section') != 'category')
if (Db::getInstance()->getValue('SELECT COUNT(`id_ebay_category_configuration`) FROM `'._DB_PREFIX_.'ebay_category_configuration`') >= 1 && Tools::getValue('section') != 'category')
return '<p align="center"><b>'.$this->l('Your categories have already been configured.').'</b></p>
<form action="index.php?tab='.Tools::safeOutput($_GET['tab']).'&configure='.Tools::safeOutput($_GET['configure']).'&token='.Tools::safeOutput($_GET['token']).'&tab_module='.Tools::safeOutput($_GET['tab_module']).'&module_name='.Tools::safeOutput($_GET['module_name']).'&id_tab=2&section=category" method="post" class="form">
<p align="center"><input class="button" name="submitSave" type="submit" value="'.$this->l('See Categories').'" /></p></form>';
@@ -1281,10 +1281,12 @@ class Ebay extends Module
eBaySyncProduct(option);
}
var counter = 0;
function eBaySyncProduct(option)
{
counter++;
$.ajax({
url: \''._MODULE_DIR_.'ebay/ajax/eBaySyncProduct.php?token='.Configuration::get('EBAY_SECURITY_TOKEN').'&option=\'+option+\'&time='.pSQL(date('Ymdhis').rand()).'\',
url: \''._MODULE_DIR_.'ebay/ajax/eBaySyncProduct.php?token='.Configuration::get('EBAY_SECURITY_TOKEN').'&option=\'+option+\'&time='.pSQL(date('Ymdhis')).'\'+counter,
success: function(data)
{
tab = data.split("|");
@@ -1554,9 +1556,9 @@ class Ebay extends Module
$images = $product->getImages($this->id_lang);
foreach ($images as $image)
{
$pictures[] = str_replace('https://', 'http://', $prefix.$this->context->link->getImageLink('', $product->id.'-'.$image['id_image'], null));
$picturesMedium[] = str_replace('https://', 'http://', $prefix.$this->context->link->getImageLink('', $product->id.'-'.$image['id_image'], 'medium'));
$picturesLarge[] = str_replace('https://', 'http://', $prefix.$this->context->link->getImageLink('', $product->id.'-'.$image['id_image'], 'large'));
$pictures[] = str_replace('https://', 'http://', $prefix.$this->context->link->getImageLink('ebay', $product->id.'-'.$image['id_image'], 'large'));
$picturesMedium[] = str_replace('https://', 'http://', $prefix.$this->context->link->getImageLink('ebay', $product->id.'-'.$image['id_image'], 'medium'));
$picturesLarge[] = str_replace('https://', 'http://', $prefix.$this->context->link->getImageLink('ebay', $product->id.'-'.$image['id_image'], 'large'));
}
// Load Variations
@@ -1618,6 +1620,7 @@ class Ebay extends Module
'name' => str_replace('&', '&amp;', $product->name),
'brand' => $product->manufacturer_name,
'description' => $product->description,
'description_short' => $product->description_short,
'price' => $price,
'quantity' => $product->quantity,
'categoryId' => $categoryDefaultCache[$product->id_category_default]['id_category_ref'],
@@ -1644,8 +1647,8 @@ class Ebay extends Module
// Load eBay Description
$datas['description'] = str_replace(
array('{DESCRIPTION}', '{EBAY_IDENTIFIER}', '{EBAY_SHOP}', '{SLOGAN}', '{PRODUCT_NAME}'),
array($datas['description'], Configuration::get('EBAY_IDENTIFIER'), Configuration::get('EBAY_SHOP'), '', $product->name),
array('{DESCRIPTION_SHORT}', '{DESCRIPTION}', '{EBAY_IDENTIFIER}', '{EBAY_SHOP}', '{SLOGAN}', '{PRODUCT_NAME}'),
array($datas['description_short'], $datas['description'], Configuration::get('EBAY_IDENTIFIER'), Configuration::get('EBAY_SHOP'), '', $product->name),
Configuration::get('EBAY_PRODUCT_TEMPLATE')
);
+1 -1
View File
@@ -303,7 +303,7 @@ class importerosc extends ImportModule
foreach($combinations as& $combination)
{
$combination['association'] = array('product_attribute_combination' => array($combination['options_values_id'] => $combination['id_product_attribute']));
unset($combination['options_values_price']);
unset($combination['options_values_id']);
}
return $this->autoFormat($combinations, $identifier);
}
+1 -1
View File
@@ -64,7 +64,7 @@ class AdminMondialRelay extends AdminTab
$html .= '<div class="error">'.
$this->l('Thanks to kindly correct the following errors on ').
' <a href="index.php?tab=AdminContact&token='.Tools::getAdminToken('AdminContact'.
(int)(Tab::getIdFromClassName('AdminContact')).(int)$this->context->id_employee).'" style="color:#f00;">'.
(int)Tab::getIdFromClassName('AdminContact').(int)$this->context->id_employee).'" style="color:#f00;">&nbsp;'.
$this->l('the contact page').'</a>:<ul>';
foreach($errorListTicket as $type => $error)
$html .= '<li>'.$type.': '.$error.'</li>';
+1
View File
@@ -46,6 +46,7 @@ $_MODULE['<{mondialrelay}prestashop>mondialrelay_c888438d14855d7d96a2724ee9c306b
$_MODULE['<{mondialrelay}prestashop>mondialrelay_07213a0161f52846ab198be103b5ab43'] = 'erreurs';
$_MODULE['<{mondialrelay}prestashop>mondialrelay_cb5e100e5a9a3e7f6d1fd97512215282'] = 'erreur';
$_MODULE['<{mondialrelay}prestashop>mondialrelay_350c1cc4343826a89f08a33bb49c6d98'] = 'Configuration du Module Mondial Relay';
$_MODULE['<{mondialrelay}prestashop>mondialrelay_192a5439bcfb850e8885cd4b5e01ced4'] = 'Essayez de désactiver le cache et de forcer la compilation smarty si vous rencontrez le moindre problème après une mise à jour du module';
$_MODULE['<{mondialrelay}prestashop>mondialrelay_d21a9f93917604d5490ad529a7cf1ff9'] = 'Pour créer un transporteur Mondial Relay';
$_MODULE['<{mondialrelay}prestashop>mondialrelay_c6a2e6af5fff47adb3afd780b97d9b4b'] = 'Remplissez et sauvegarder vos paramètres Mondial Relay';
$_MODULE['<{mondialrelay}prestashop>mondialrelay_94fbe32464fcfa902feed9f256439833'] = 'Créez un transporteur via le formulaire ‘’ajouter un transporteur’’ ci-dessous';
+14 -25
View File
@@ -540,37 +540,26 @@ class MondialRelay extends Module
{
}
/*
** Update the carrier id to use the new one if changed
*/
public function hookupdateCarrier($params)
{
// TODO : History shipping
/*if ((int)($params['id_carrier']) != (int)($params['carrier']->id))
if ((int)($params['id_carrier']) != (int)($params['carrier']->id))
{
$serviceSelected = Db::getInstance()->getRow('SELECT * FROM `'._DB_PREFIX_.'mr_method` WHERE `id_carrier` = '.(int)$params['id_carrier']);
$update = array('id_carrier' => (int)($params['carrier']->id), 'id_carrier_history' => pSQL($serviceSelected['id_carrier_history'].'|'.(int)($params['carrier']->id)));
Db::getInstance()->autoExecute(_DB_PREFIX_.'mr_method', $update, 'UPDATE', '`id_carrier` = '.(int)$params['id_carrier']);
}*/
// TODO : Delete for shipping history
$new_carrier = $params['carrier'];
// Depends of the Prestashop version, the matches key isn't the same
if ((_PS_VERSION_ >= '1.4' && $new_carrier->external_module_name == 'mondialrelay') ||
$new_carrier->name = 'mondialrelay')
{
$mr_data = Db::getInstance()->getRow('
SELECT *
FROM `'._DB_PREFIX_.'mr_method`
WHERE `id_carrier` = '.(int)($params['id_carrier']));
Db::getInstance()->execute('
INSERT INTO `'._DB_PREFIX_.'mr_method`
(mr_Name, mr_Pays_list, mr_ModeCol, mr_ModeLiv, mr_ModeAss, id_carrier)
VALUES (
"'.pSQL($mr_data['mr_Name']).'",
"'.pSQL($mr_data['mr_Pays_list']).'",
"'.pSQL($mr_data['mr_ModeCol']).'",
"'.pSQL($mr_data['mr_ModeLiv']).'",
"'.pSQL($mr_data['mr_ModeAss']).'",
'.(int)($new_carrier->id).')');
(
SELECT
mr_Name,
mr_Pays_list,
mr_ModeCol,
mr_ModeLiv,
mr_ModeAss,
"'.(int)$params['carrier']->id.'"
FROM `'._DB_PREFIX_.'mr_method`
WHERE id_carrier ='.(int)$params['id_carrier'].')');
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 164 KiB

+1 -1
View File
@@ -36,7 +36,7 @@ class Ogone extends PaymentModule
{
$this->name = 'ogone';
$this->tab = 'payments_gateways';
$this->version = '2.1';
$this->version = '2.2';
parent::__construct();
+1 -1
View File
@@ -401,7 +401,7 @@ class PrestaFraud extends Module
$order->addChild('payment_name', $paymentModule->displayName);
$order->addChild('payment_type', (int)$configured_payments[$paymentModule->id]);
$order->addChild('order_date', $params['order']->date_add);
$order->addChild('order_ip_address', $this->_getIpByCart($id_cart));
$order->addChild('order_ip_address', $this->_getIpByCart((int)$params['order']->id_cart));
$carrier = new Carrier((int)$params['order']->id_carrier);
$carrier_infos = $order->addChild('carrier_infos');
+2 -2
View File
@@ -3,7 +3,7 @@
include_once('../../config/config.inc.php');
include_once('../../init.php');
include_once('../../modules/shopimporter/shopimporter.php');
ini_set('display_errors', 'off');
$moduleName = Tools::getValue('moduleName');
@@ -210,4 +210,4 @@ if (Tools::isSubmit('displayConfigConnector'))
die($importModule->displayConfigConnector());
}
}
?>
?>