// REVERT MERGE
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@7761 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
+3
-31
@@ -159,8 +159,6 @@ abstract class AdminTabCore
|
||||
protected $_includeVars = false;
|
||||
protected $_includeContainer = true;
|
||||
|
||||
public $ajax = false;
|
||||
|
||||
public static $tabParenting = array(
|
||||
'AdminProducts' => 'AdminCatalog',
|
||||
'AdminCategories' => 'AdminCatalog',
|
||||
@@ -235,14 +233,6 @@ abstract class AdminTabCore
|
||||
return str_replace('"', '"', ($addslashes ? addslashes($str) : stripslashes($str)));
|
||||
}
|
||||
|
||||
/**
|
||||
* ajaxDisplay is the default ajax return sytem
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function displayAjax()
|
||||
{
|
||||
}
|
||||
/**
|
||||
* Manage page display (form, list...)
|
||||
*/
|
||||
@@ -516,24 +506,6 @@ abstract class AdminTabCore
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* ajaxPreProcess is a method called in ajax-tab.php before displayConf().
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxPreProcess()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* ajaxProcess is the default handle method for request with ajax-tab.php
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxProcess()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage page processing
|
||||
*/
|
||||
@@ -1135,9 +1107,9 @@ abstract class AdminTabCore
|
||||
public function displayConf()
|
||||
{
|
||||
if ($conf = Tools::getValue('conf'))
|
||||
echo '
|
||||
<div class="conf">
|
||||
<img src="../img/admin/ok2.png" alt="" /> '.$this->_conf[(int)($conf)].'
|
||||
echo '<div class="conf">
|
||||
<img src="../img/admin/ok2.png" />
|
||||
'.$this->_conf[(int)($conf)].'
|
||||
</div>';
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@ class AliasCore extends ObjectModel
|
||||
FROM `'._DB_PREFIX_.'alias`
|
||||
WHERE `search` LIKE \''.pSQL($search).'\'');
|
||||
}
|
||||
|
||||
|
||||
public function getAliases()
|
||||
{
|
||||
$aliases = Db::getInstance()->ExecuteS('
|
||||
|
||||
@@ -37,7 +37,7 @@ class AttachmentCore extends ObjectModel
|
||||
public $position;
|
||||
|
||||
protected $fieldsRequired = array('file', 'mime');
|
||||
protected $fieldsSize = array('file' => 40, 'mime' => 128, 'file_name' => 128);
|
||||
protected $fieldsSize = array('file' => 40, 'mime' => 64, 'file_name' => 128);
|
||||
protected $fieldsValidate = array('file' => 'isGenericName', 'mime' => 'isCleanHtml', 'file_name' => 'isGenericName');
|
||||
|
||||
protected $fieldsRequiredLang = array('name');
|
||||
|
||||
+2
-10
@@ -1232,10 +1232,7 @@ class CartCore extends ObjectModel
|
||||
{
|
||||
$moduleName = $carrier->external_module_name;
|
||||
$module = Module::getInstanceByName($moduleName);
|
||||
|
||||
if (Validate::isLoadedObject($module))
|
||||
{
|
||||
if (array_key_exists('id_carrier', $module))
|
||||
if (key_exists('id_carrier', $module))
|
||||
$module->id_carrier = $carrier->id;
|
||||
if($carrier->need_range)
|
||||
$shipping_cost = $module->getOrderShippingCost($this, $shipping_cost);
|
||||
@@ -1246,9 +1243,6 @@ class CartCore extends ObjectModel
|
||||
if ($shipping_cost === false)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
// Apply tax
|
||||
if (isset($carrierTax))
|
||||
@@ -1333,7 +1327,7 @@ class CartCore extends ObjectModel
|
||||
|
||||
$groups = Customer::getGroupsStatic($this->id_customer);
|
||||
|
||||
if (($discountObj->id_customer OR $discountObj->id_group) AND ((($this->id_customer != $discountObj->id_customer) OR ($this->id_customer == 0)) AND !in_array($discountObj->id_group, $groups)))
|
||||
if (($discountObj->id_customer OR $discountObj->id_group) AND ($this->id_customer != $discountObj->id_customer AND !in_array($discountObj->id_group, $groups)))
|
||||
{
|
||||
if (!$customer->isLogged())
|
||||
return Tools::displayError('You cannot use this voucher.').' - '.Tools::displayError('Please log in.');
|
||||
@@ -1705,8 +1699,6 @@ class CartCore extends ObjectModel
|
||||
{
|
||||
$carrier = new Carrier((int)$id_carrier, Configuration::get('PS_LANG_DEFAULT'));
|
||||
$shippingMethod = $carrier->getShippingMethod();
|
||||
if (!$carrier->range_behavior)
|
||||
return true;
|
||||
|
||||
if ($shippingMethod == Carrier::SHIPPING_METHOD_FREE)
|
||||
return true;
|
||||
|
||||
+22
-14
@@ -179,16 +179,6 @@ class CategoryCore extends ObjectModel
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ObjectModel::toggleStatus()
|
||||
*/
|
||||
public function toggleStatus()
|
||||
{
|
||||
$result = parent::toggleStatus();
|
||||
Module::hookExec('categoryUpdate');
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursive scan of subcategories
|
||||
*
|
||||
@@ -604,19 +594,37 @@ class CategoryCore extends ObjectModel
|
||||
* @param int $id_lang
|
||||
* @return array
|
||||
*/
|
||||
public static function getChildrenWithNbSelectedSubCat($id_parent, $selectedCat, $id_lang)
|
||||
public static function getChildrenWithNbSelectedSubCatForProduct($id_parent, $id_product = 0, $ids_categories = null, $id_lang)
|
||||
{
|
||||
$categories_product_str = '';
|
||||
if ($id_product)
|
||||
{
|
||||
$categories_product = Db::getInstance()->ExecuteS('
|
||||
SELECT `id_category`
|
||||
FROM `'._DB_PREFIX_.'category_product`
|
||||
WHERE `id_product` = '.(int)$id_product);
|
||||
if (sizeof($categories_product))
|
||||
foreach ($categories_product as $category_product)
|
||||
$categories_product_str .= $category_product['id_category'].',';
|
||||
}
|
||||
else
|
||||
{
|
||||
$categories_product = array();
|
||||
$categories_product_str = $ids_categories;
|
||||
}
|
||||
$categories_product_str = rtrim($categories_product_str, ',');
|
||||
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
SELECT c.`id_category`, c.`level_depth`, cl.`name`, IF((
|
||||
SELECT c.`id_category`, cl.`name`, IF((
|
||||
SELECT COUNT(*)
|
||||
FROM `'._DB_PREFIX_.'category` c2
|
||||
WHERE c2.`id_parent` = c.`id_category`
|
||||
) > 0, 1, 0) AS has_children, '.($selectedCat ? '(
|
||||
) > 0, 1, 0) AS has_children, '.($categories_product_str ? '(
|
||||
SELECT count(c3.`id_category`)
|
||||
FROM `'._DB_PREFIX_.'category` c3
|
||||
WHERE c3.`nleft` > c.`nleft`
|
||||
AND c3.`nright` < c.`nright`
|
||||
AND c3.`id_category` IN ('.$selectedCat.')
|
||||
AND c3.`id_category` IN ('.$categories_product_str.')
|
||||
)' : '0').' AS nbSelectedSubCat
|
||||
FROM `'._DB_PREFIX_.'category` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON c.`id_category` = cl.`id_category`
|
||||
|
||||
@@ -1,198 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 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/osl-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/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class CompareProduct extends ObjectModel
|
||||
{
|
||||
public $id;
|
||||
|
||||
public $id_product;
|
||||
|
||||
public $id_guest;
|
||||
|
||||
public $id_customer;
|
||||
|
||||
public $date_add;
|
||||
|
||||
public $date_upd;
|
||||
|
||||
protected $fieldRequired = array(
|
||||
'id_product',
|
||||
'id_guest',
|
||||
'id_customer');
|
||||
|
||||
protected $fieldsValidate = array(
|
||||
'id_product' => 'isUnsignedInt',
|
||||
'id_guest' => 'isUnsignedInt',
|
||||
'id_customer' => 'isUnsignedInt'
|
||||
);
|
||||
|
||||
protected $table = 'compare_product';
|
||||
|
||||
protected $identifier = 'id_compare_product';
|
||||
|
||||
|
||||
/**
|
||||
* Get all compare products of the guest
|
||||
* @param int $id_guest
|
||||
* @return array
|
||||
*/
|
||||
public static function getGuestCompareProducts($id_guest)
|
||||
{
|
||||
$results = Db::getInstance()->ExecuteS('
|
||||
SELECT DISTINCT `id_product`
|
||||
FROM `'._DB_PREFIX_.'compare_product`
|
||||
WHERE `id_guest` = '.(int)($id_guest));
|
||||
|
||||
$compareProducts = null;
|
||||
|
||||
foreach($results as $result)
|
||||
$compareProducts[] = $result['id_product'];
|
||||
|
||||
return $compareProducts;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a compare product for the guest
|
||||
* @param int $id_guest, int $id_product
|
||||
* @return boolean
|
||||
*/
|
||||
public static function addGuestCompareProduct($id_guest, $id_product)
|
||||
{
|
||||
return Db::getInstance()->Execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'compare_product` (`id_product`, `id_guest`, `date_add`, `date_upd`)
|
||||
VALUES ('.(int)($id_product).', '.(int)($id_guest).', NOW(), NOW())
|
||||
');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove a compare product for the guest
|
||||
* @param int $id_guest, int $id_product
|
||||
* @return boolean
|
||||
*/
|
||||
public static function removeGuestCompareProduct($id_guest, $id_product)
|
||||
{
|
||||
return Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'compare_product` WHERE `id_guest` = '.(int)($id_guest).' AND `id_product` = '.(int)($id_product));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the number of compare products of the guest
|
||||
* @param int $id_guest
|
||||
* @return int
|
||||
*/
|
||||
public static function getGuestNumberProducts($id_guest)
|
||||
{
|
||||
return (int)(Db::getInstance()->getValue('
|
||||
SELECT count(`id_compare_product`)
|
||||
FROM `'._DB_PREFIX_.'compare_product`
|
||||
WHERE `id_guest` = '.(int)($id_guest)));;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get all comapare products of the customer
|
||||
* @param int $id_customer
|
||||
* @return array
|
||||
*/
|
||||
public static function getCustomerCompareProducts($id_customer)
|
||||
{
|
||||
$results = Db::getInstance()->ExecuteS('
|
||||
SELECT DISTINCT `id_product`
|
||||
FROM `'._DB_PREFIX_.'compare_product`
|
||||
WHERE `id_customer` = '.(int)($id_customer));
|
||||
|
||||
$compareProducts = null;
|
||||
|
||||
foreach($results as $result)
|
||||
$compareProducts[] = $result['id_product'];
|
||||
|
||||
return $compareProducts;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a compare product for the customer
|
||||
* @param int $id_customer, int $id_product
|
||||
* @return boolean
|
||||
*/
|
||||
public static function addCustomerCompareProduct($id_customer, $id_product)
|
||||
{
|
||||
return Db::getInstance()->Execute('INSERT INTO `'._DB_PREFIX_.'compare_product` (`id_product`, `id_customer`, `date_add`, `date_upd`) VALUES ('.(int)($id_product).', '.(int)($id_customer).', NOW(), NOW())');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove a compare product for the customer
|
||||
* @param int $id_customer, int $id_product
|
||||
* @return boolean
|
||||
*/
|
||||
public static function removeCustomerCompareProduct($id_customer, $id_product)
|
||||
{
|
||||
return Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'compare_product` WHERE `id_customer` = '.(int)($id_customer).' AND `id_product` = '.(int)($id_product));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the number of compare products of the customer
|
||||
* @param int $id_customer
|
||||
* @return int
|
||||
*/
|
||||
public static function getCustomerNumberProducts($id_customer)
|
||||
{
|
||||
return (int)(Db::getInstance()->getValue('
|
||||
SELECT count(`id_compare_product`)
|
||||
FROM `'._DB_PREFIX_.'compare_product`
|
||||
WHERE `id_customer` = '.(int)($id_customer)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clean entries which are older than the period
|
||||
* @param string $period
|
||||
* @return void
|
||||
*/
|
||||
public static function cleanCompareProducts($period = 'week')
|
||||
{
|
||||
if ($period === 'week')
|
||||
$interval = '1 WEEK';
|
||||
elseif ($period === 'month')
|
||||
$interval = '1 MONTH';
|
||||
elseif ($period === 'year')
|
||||
$interval = '1 YEAR';
|
||||
else
|
||||
return;
|
||||
|
||||
if ($interval != null)
|
||||
{
|
||||
Db::getInstance()->Execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'compare_product`
|
||||
WHERE date_upd < DATE_SUB(NOW(), INTERVAL '.pSQL($interval).')');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,230 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 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/osl-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/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class ConfigurationTestCore
|
||||
{
|
||||
static function check($tests)
|
||||
{
|
||||
$res = array();
|
||||
foreach ($tests AS $key => $test)
|
||||
$res[$key] = self::run($key, $test);
|
||||
return $res;
|
||||
}
|
||||
|
||||
static function run($ptr, $arg = 0)
|
||||
{
|
||||
if (call_user_func(array('ConfigurationTest', 'test_'.$ptr), $arg))
|
||||
return ('ok');
|
||||
return ('fail');
|
||||
}
|
||||
|
||||
// Misc functions
|
||||
static function test_phpversion()
|
||||
{
|
||||
return version_compare(substr(phpversion(), 0, 3), '5.0', '>=');
|
||||
}
|
||||
|
||||
static function test_mysql_support()
|
||||
{
|
||||
return function_exists('mysql_connect');
|
||||
}
|
||||
|
||||
static function test_magicquotes()
|
||||
{
|
||||
return !ini_get('magic_quotes_gpc');
|
||||
}
|
||||
|
||||
static function test_upload()
|
||||
{
|
||||
return ini_get('file_uploads');
|
||||
}
|
||||
|
||||
static function test_fopen()
|
||||
{
|
||||
return ini_get('allow_url_fopen');
|
||||
}
|
||||
|
||||
static function test_system($funcs)
|
||||
{
|
||||
foreach ($funcs AS $func)
|
||||
if (!function_exists($func))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
static function test_gd()
|
||||
{
|
||||
return function_exists('imagecreatetruecolor');
|
||||
}
|
||||
|
||||
static function test_register_globals()
|
||||
{
|
||||
return !ini_get('register_globals');
|
||||
}
|
||||
|
||||
static function test_gz()
|
||||
{
|
||||
if (function_exists('gzencode'))
|
||||
return !(@gzencode('dd') === false);
|
||||
return false;
|
||||
}
|
||||
|
||||
// is_writable dirs
|
||||
static function test_dir($dir, $recursive = false)
|
||||
{
|
||||
if (!file_exists($dir) OR !$dh = opendir($dir))
|
||||
return false;
|
||||
$dummy = rtrim($dir, '/').'/'.uniqid();
|
||||
if (@file_put_contents($dummy, 'test'))
|
||||
{
|
||||
@unlink($dummy);
|
||||
if (!$recursive)
|
||||
return true;
|
||||
}
|
||||
elseif (!is_writable($dir))
|
||||
return false;
|
||||
if ($recursive)
|
||||
{
|
||||
while (($file = readdir($dh)) !== false)
|
||||
if (@filetype($dir.$file) == 'dir' AND $file != '.' AND $file != '..')
|
||||
if (!self::test_dir($dir.$file, true))
|
||||
return false;
|
||||
}
|
||||
closedir($dh);
|
||||
return true;
|
||||
}
|
||||
|
||||
// is_writable files
|
||||
static function test_file($file)
|
||||
{
|
||||
return (file_exists($file) AND is_writable($file));
|
||||
}
|
||||
|
||||
static function test_config_dir($dir)
|
||||
{
|
||||
return self::test_dir($dir);
|
||||
}
|
||||
|
||||
static function test_sitemap($dir)
|
||||
{
|
||||
return self::test_file($dir);
|
||||
}
|
||||
|
||||
static function test_root_dir($dir)
|
||||
{
|
||||
return self::test_dir($dir);
|
||||
}
|
||||
|
||||
static function test_log_dir($dir)
|
||||
{
|
||||
return self::test_dir($dir);
|
||||
}
|
||||
|
||||
static function test_admin_dir($dir)
|
||||
{
|
||||
return self::test_dir($dir);
|
||||
}
|
||||
|
||||
static function test_img_dir($dir)
|
||||
{
|
||||
return self::test_dir($dir, true);
|
||||
}
|
||||
|
||||
static function test_module_dir($dir)
|
||||
{
|
||||
return self::test_dir($dir, true);
|
||||
}
|
||||
|
||||
static function test_tools_dir($dir)
|
||||
{
|
||||
return self::test_dir($dir);
|
||||
}
|
||||
|
||||
static function test_cache_dir($dir)
|
||||
{
|
||||
return self::test_dir($dir);
|
||||
}
|
||||
|
||||
static function test_tools_v2_dir($dir)
|
||||
{
|
||||
return self::test_dir($dir);
|
||||
}
|
||||
|
||||
static function test_cache_v2_dir($dir)
|
||||
{
|
||||
return self::test_dir($dir);
|
||||
}
|
||||
|
||||
static function test_download_dir($dir)
|
||||
{
|
||||
return self::test_dir($dir);
|
||||
}
|
||||
|
||||
static function test_mails_dir($dir)
|
||||
{
|
||||
return self::test_dir($dir, true);
|
||||
}
|
||||
|
||||
static function test_translations_dir($dir)
|
||||
{
|
||||
return self::test_dir($dir, true);
|
||||
}
|
||||
|
||||
static function test_theme_lang_dir($dir)
|
||||
{
|
||||
if (!file_exists($dir))
|
||||
return true;
|
||||
return self::test_dir($dir, true);
|
||||
}
|
||||
|
||||
static function test_theme_cache_dir($dir)
|
||||
{
|
||||
if (!file_exists($dir))
|
||||
return true;
|
||||
return self::test_dir($dir, true);
|
||||
}
|
||||
|
||||
static function test_customizable_products_dir($dir)
|
||||
{
|
||||
return self::test_dir($dir);
|
||||
}
|
||||
|
||||
static function test_virtual_products_dir($dir)
|
||||
{
|
||||
return self::test_dir($dir);
|
||||
}
|
||||
|
||||
static function test_mcrypt()
|
||||
{
|
||||
return function_exists('mcrypt_encrypt');
|
||||
}
|
||||
|
||||
static function test_dom()
|
||||
{
|
||||
return extension_loaded('Dom');
|
||||
}
|
||||
}
|
||||
@@ -1,118 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 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/osl-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/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
/*
|
||||
* TODO : move HTML code in template files
|
||||
*/
|
||||
|
||||
class HelperCore
|
||||
{
|
||||
public static $translationsKeysForAdminCategorieTree = array(
|
||||
'Home', 'selected', 'selecteds', 'Collapse All', 'Expand All', 'Check All', 'Uncheck All'
|
||||
);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type $trads values of translations keys
|
||||
* For the moment, translation are not automatic
|
||||
* @param type $selected_cat array of selected categories
|
||||
* Format
|
||||
* Array
|
||||
(
|
||||
[0] => 1
|
||||
[1] => 2
|
||||
)
|
||||
* OR
|
||||
Array
|
||||
(
|
||||
[1] => Array
|
||||
(
|
||||
[id_category] => 1
|
||||
[name] => Home page
|
||||
[link_rewrite] => home
|
||||
)
|
||||
)
|
||||
* @param type $input_name name of input
|
||||
* @return string
|
||||
*/
|
||||
public static function renderAdminCategorieTree($trads, $selected_cat = array(), $input_name = 'categoryBox')
|
||||
{
|
||||
$html = '
|
||||
<script src="../js/jquery/treeview/jquery.treeview.js" type="text/javascript"></script>
|
||||
<script src="../js/jquery/treeview/jquery.treeview.async.js" type="text/javascript"></script>
|
||||
<script src="../js/jquery/treeview/jquery.treeview.edit.js" type="text/javascript"></script>
|
||||
<script src="../js/admin-categories-tree.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
var inputName = "'.$input_name.'";
|
||||
var selectedCat = "'.implode(',', array_keys($selected_cat)).'";
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
var selectedLabel = \''.$trads['selected'].'\';
|
||||
var home = \''.$trads['Home'].'\';
|
||||
</script>
|
||||
<link type="text/css" rel="stylesheet" href="../css/jquery.treeview.css" />
|
||||
';
|
||||
|
||||
$html .= '
|
||||
<div style="background-color:#F4E6C9; width:99%;padding:5px 0 5px 5px;">
|
||||
<a href="#" id="collapse_all" >'.$trads['Collapse All'].'</a>
|
||||
- <a href="#" id="expand_all" >'.$trads['Expand All'].'</a>
|
||||
- <a href="#" id="check_all" >'.$trads['Check All'].'</a>
|
||||
- <a href="#" id="uncheck_all" >'.$trads['Uncheck All'].'</a>
|
||||
</div>
|
||||
';
|
||||
|
||||
$home_is_selected = false;
|
||||
foreach($selected_cat AS $cat)
|
||||
{
|
||||
if (is_array($cat))
|
||||
{
|
||||
if ($cat['id_category'] != 1)
|
||||
$html .= '<input type="hidden" name="'.$input_name.'[]" value="'.$cat['id_category'].'" >';
|
||||
else
|
||||
$home_is_selected = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($cat != 1)
|
||||
$html .= '<input type="hidden" name="'.$input_name.'[]" value="'.$cat.'" >';
|
||||
else
|
||||
$home_is_selected = true;
|
||||
}
|
||||
}
|
||||
$html .= '
|
||||
<ul id="categories-treeview" class="filetree">
|
||||
<li id="1" class="hasChildren">
|
||||
<span class="folder"> <input type="checkbox" name="'.$input_name.'[]" value="1" '.($home_is_selected ? 'checked' : '').' onclick="clickOnCategoryBox($(this));" /> '.$trads['Home'].'</span>
|
||||
<ul>
|
||||
<li><span class="placeholder"> </span></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>';
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
+3
-58
@@ -452,17 +452,7 @@ class ImageCore extends ObjectModel
|
||||
public function createImgFolder()
|
||||
{
|
||||
if (!file_exists(_PS_PROD_IMG_DIR_.$this->getImgFolder()))
|
||||
{
|
||||
// Apparently sometimes mkdir cannot set the rights, and sometimes chmod can't. Trying both.
|
||||
$success = @mkdir(_PS_PROD_IMG_DIR_.$this->getImgFolder(), 0755, true)
|
||||
|| @chmod(_PS_PROD_IMG_DIR_.$this->getImgFolder(), 0755);
|
||||
|
||||
// Create an index.php file in the new folder
|
||||
if ($success
|
||||
&& !file_exists(_PS_PROD_IMG_DIR_.$this->getImgFolder().'index.php')
|
||||
&& file_exists($this->source_index))
|
||||
return @copy($this->source_index, _PS_PROD_IMG_DIR_.$this->getImgFolder().'index.php');
|
||||
}
|
||||
return @mkdir(_PS_PROD_IMG_DIR_.$this->getImgFolder(), 0755, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -521,51 +511,6 @@ class ImageCore extends ObjectModel
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function testFileSystem()
|
||||
{
|
||||
$safe_mode = ini_get('safe_mode');
|
||||
if ($safe_mode)
|
||||
return false;
|
||||
$folder1 = _PS_PROD_IMG_DIR_.'testfilesystem/';
|
||||
$test_folder = $folder1.'testsubfolder/';
|
||||
if (file_exists($test_folder))
|
||||
{
|
||||
@rmdir($test_folder);
|
||||
@rmdir($folder1);
|
||||
}
|
||||
if (file_exists($test_folder))
|
||||
return false;
|
||||
@mkdir($test_folder, 0755, true);
|
||||
@chmod($test_folder, 0755);
|
||||
if (!is_writeable($test_folder))
|
||||
return false;
|
||||
@rmdir($test_folder);
|
||||
@rmdir($folder1);
|
||||
if (file_exists($folder1))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the path where a product image should be created (without file format)
|
||||
*
|
||||
* @return string path
|
||||
*/
|
||||
public function getPathForCreation()
|
||||
{
|
||||
if (!$this->id)
|
||||
return false;
|
||||
if (Configuration::get('PS_LEGACY_IMAGES'))
|
||||
{
|
||||
if (!$this->id_product)
|
||||
return false;
|
||||
$path = $this->id_product.'-'.$this->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$path = $this->getImgPath();
|
||||
$this->createImgFolder();
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
-12
@@ -103,8 +103,7 @@ class LanguageCore extends ObjectModel
|
||||
return ($resUpdateSQL AND Tools::generateHtaccess(dirname(__FILE__).'/../.htaccess',
|
||||
(int)(Configuration::get('PS_REWRITING_SETTINGS')),
|
||||
(int)(Configuration::get('PS_HTACCESS_CACHE_CONTROL')),
|
||||
Configuration::get('PS_HTACCESS_SPECIFIC'),
|
||||
(int)Configuration::get('PS_HTACCESS_DISABLE_MULTIVIEWS')
|
||||
Configuration::get('PS_HTACCESS_SPECIFIC')
|
||||
));
|
||||
}
|
||||
|
||||
@@ -119,8 +118,7 @@ class LanguageCore extends ObjectModel
|
||||
return (Tools::generateHtaccess(dirname(__FILE__).'/../.htaccess',
|
||||
(int)(Configuration::get('PS_REWRITING_SETTINGS')),
|
||||
(int)(Configuration::get('PS_HTACCESS_CACHE_CONTROL')),
|
||||
Configuration::get('PS_HTACCESS_SPECIFIC'),
|
||||
(int)Configuration::get('PS_HTACCESS_DISABLE_MULTIVIEWS')
|
||||
Configuration::get('PS_HTACCESS_SPECIFIC')
|
||||
));
|
||||
}
|
||||
|
||||
@@ -292,8 +290,7 @@ class LanguageCore extends ObjectModel
|
||||
|
||||
foreach($tables as $table)
|
||||
foreach($table as $t)
|
||||
if ($t != _DB_PREFIX_.'configuration_lang')
|
||||
$langTables[] = $t;
|
||||
$langTables[] = $t;
|
||||
|
||||
Db::getInstance()->Execute('SET @id_lang_default = (SELECT c.`value` FROM `'._DB_PREFIX_.'configuration` c WHERE c.`name` = \'PS_LANG_DEFAULT\' LIMIT 1)');
|
||||
$return = true;
|
||||
@@ -406,8 +403,7 @@ class LanguageCore extends ObjectModel
|
||||
return Tools::generateHtaccess(dirname(__FILE__).'/../.htaccess',
|
||||
(int)(Configuration::get('PS_REWRITING_SETTINGS')),
|
||||
(int)(Configuration::get('PS_HTACCESS_CACHE_CONTROL')),
|
||||
Configuration::get('PS_HTACCESS_SPECIFIC'),
|
||||
(int)Configuration::get('PS_HTACCESS_DISABLE_MULTIVIEWS')
|
||||
Configuration::get('PS_HTACCESS_SPECIFIC')
|
||||
);
|
||||
}
|
||||
|
||||
@@ -430,8 +426,7 @@ class LanguageCore extends ObjectModel
|
||||
Tools::generateHtaccess(dirname(__FILE__).'/../.htaccess',
|
||||
(int)(Configuration::get('PS_REWRITING_SETTINGS')),
|
||||
(int)(Configuration::get('PS_HTACCESS_CACHE_CONTROL')),
|
||||
Configuration::get('PS_HTACCESS_SPECIFIC'),
|
||||
(int)Configuration::get('PS_HTACCESS_DISABLE_MULTIVIEWS')
|
||||
Configuration::get('PS_HTACCESS_SPECIFIC')
|
||||
);
|
||||
|
||||
return $result;
|
||||
@@ -571,8 +566,7 @@ class LanguageCore extends ObjectModel
|
||||
return Tools::generateHtaccess(dirname(__FILE__).'/../.htaccess',
|
||||
(int)(Configuration::get('PS_REWRITING_SETTINGS')),
|
||||
(int)(Configuration::get('PS_HTACCESS_CACHE_CONTROL')),
|
||||
Configuration::get('PS_HTACCESS_SPECIFIC'),
|
||||
(int)Configuration::get('PS_HTACCESS_DISABLE_MULTIVIEWS')
|
||||
Configuration::get('PS_HTACCESS_SPECIFIC')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,6 @@ class ManufacturerCore extends ObjectModel
|
||||
|
||||
protected $webserviceParameters = array(
|
||||
'fields' => array(
|
||||
'active' => array(),
|
||||
'link_rewrite' => array('getter' => 'getLink', 'setter' => false),
|
||||
),
|
||||
'associations' => array(
|
||||
@@ -375,19 +374,16 @@ class ManufacturerCore extends ObjectModel
|
||||
$ids = array();
|
||||
foreach ($id_addresses as $id)
|
||||
$ids[] = (int)$id['id'];
|
||||
$result1 = (Db::getInstance()->ExecuteS('
|
||||
Db::getInstance()->ExecuteS('
|
||||
UPDATE `'._DB_PREFIX_.'address`
|
||||
SET id_manufacturer = 0
|
||||
WHERE id_manufacturer = '.(int)$this->id.'
|
||||
AND deleted = 0') !== false);
|
||||
$result2 = true;
|
||||
if (count($ids))
|
||||
$result2 = (Db::getInstance()->ExecuteS('
|
||||
AND deleted = 0');
|
||||
return (Db::getInstance()->ExecuteS('
|
||||
UPDATE `'._DB_PREFIX_.'address`
|
||||
SET id_customer = 0, id_supplier = 0, id_manufacturer = '.(int)$this->id.'
|
||||
WHERE id_address IN('.implode(',', $ids).')
|
||||
AND deleted = 0') !== false);
|
||||
return ($result1 && $result2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+19
-26
@@ -523,11 +523,6 @@ abstract class ModuleCore
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function configXmlStringFormat($string)
|
||||
{
|
||||
return str_replace('\'', '\\\'', Tools::htmlentitiesDecodeUTF8($string));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return available modules
|
||||
*
|
||||
@@ -572,12 +567,12 @@ abstract class ModuleCore
|
||||
$item->warning = '';
|
||||
foreach ($xml_module as $k => $v)
|
||||
$item->$k = (string) $v;
|
||||
$item->displayName = Module::findTranslation($xml_module->name, self::configXmlStringFormat($xml_module->displayName), (string)$xml_module->name);
|
||||
$item->description = Module::findTranslation($xml_module->name, self::configXmlStringFormat($xml_module->description), (string)$xml_module->name);
|
||||
$item->author = Module::findTranslation($xml_module->name, self::configXmlStringFormat($xml_module->author), (string)$xml_module->name);
|
||||
$item->displayName = Module::findTranslation($xml_module->name, $xml_module->displayName, (string)$xml_module->name);
|
||||
$item->description = Module::findTranslation($xml_module->name, $xml_module->description, (string)$xml_module->name);
|
||||
$item->author = Module::findTranslation($xml_module->name, $xml_module->author, (string)$xml_module->name);
|
||||
|
||||
if (isset($xml_module->confirmUninstall))
|
||||
$item->confirmUninstall = Module::findTranslation($xml_module->name, self::configXmlStringFormat($xml_module->confirmUninstall), (string)$xml_module->name);
|
||||
$item->confirmUninstall = Module::findTranslation($xml_module->name, $xml_module->confirmUninstall, (string)$xml_module->name);
|
||||
|
||||
$item->active = 0;
|
||||
$moduleList[$moduleListCursor] = $item;
|
||||
@@ -797,22 +792,8 @@ abstract class ModuleCore
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$hookArgs = array('cookie' => $context->cookie, 'cart' => $context->cart);
|
||||
$billing = new Address((int)($context->cart->id_address_invoice));
|
||||
$output = '';
|
||||
|
||||
$result = self::getPaymentModules();
|
||||
|
||||
if ($result)
|
||||
foreach ($result AS $module)
|
||||
if (($moduleInstance = Module::getInstanceByName($module['name'])) AND is_callable(array($moduleInstance, 'hookpayment')))
|
||||
if (!$moduleInstance->currencies OR ($moduleInstance->currencies AND sizeof(Currency::checkPaymentCurrencies($moduleInstance->id))))
|
||||
$output .= call_user_func(array($moduleInstance, 'hookpayment'), $hookArgs);
|
||||
return $output;
|
||||
}
|
||||
|
||||
public static function getPaymentModules()
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$billing = new Address($context->cart->id_address_invoice);
|
||||
$list = Context::getContext()->shop->getListOfID();
|
||||
$sql = 'SELECT DISTINCT h.`id_hook`, m.`name`, hm.`position`
|
||||
FROM `'._DB_PREFIX_.'module_country` mc
|
||||
@@ -829,7 +810,13 @@ abstract class ModuleCore
|
||||
AND hm.id_shop IN('.implode(', ', $list).')
|
||||
GROUP BY hm.id_hook, hm.id_module
|
||||
ORDER BY hm.`position`, m.`name` DESC';
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
if ($result)
|
||||
foreach ($result AS $k => $module)
|
||||
if (($moduleInstance = Module::getInstanceByName($module['name'])) AND is_callable(array($moduleInstance, 'hookpayment')))
|
||||
if (!$moduleInstance->currencies OR ($moduleInstance->currencies AND sizeof(Currency::checkPaymentCurrencies($moduleInstance->id))))
|
||||
$output .= call_user_func(array($moduleInstance, 'hookpayment'), $hookArgs);
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1128,7 +1115,13 @@ abstract class ModuleCore
|
||||
|
||||
protected function _clearCache($template, $cacheId = NULL, $compileId = NULL)
|
||||
{
|
||||
Tools::clearCache(Context::getContext()->smarty);
|
||||
$context = Context::getContext();
|
||||
/* Use Smarty 3 API calls */
|
||||
if (!Configuration::get('PS_FORCE_SMARTY_2')) /* PHP version > 5.1.2 */
|
||||
return $context->smarty->clearCache($template ? $this->_getApplicableTemplateDir($template).$template : NULL, $cacheId, $compileId);
|
||||
/* or keep a backward compatibility if PHP version < 5.1.2 */
|
||||
else
|
||||
return $context->smarty->clear_cache($template ? $this->_getApplicableTemplateDir($template).$template : NULL, $cacheId, $compileId);
|
||||
}
|
||||
|
||||
protected function _generateConfigXml()
|
||||
|
||||
+3
-11
@@ -137,19 +137,11 @@ class MySQLCore extends Db
|
||||
}
|
||||
|
||||
/**
|
||||
* tryToConnect return 0 if the connection succeed and the database can be selected.
|
||||
* @since 1.4.4.0, the parameter $newDbLink (default true) has been added.
|
||||
*
|
||||
* @param string $server mysql server name
|
||||
* @param string $user mysql user
|
||||
* @param string $pwd mysql user password
|
||||
* @param string $db mysql database name
|
||||
* @param boolean $newDbLink if set to true, the function will not create a new link if one already exists.
|
||||
* @return integer
|
||||
* @see DbCore::tryToConnect()
|
||||
*/
|
||||
static public function tryToConnect($server, $user, $pwd, $db, $newDbLink = true)
|
||||
static public function tryToConnect($server, $user, $pwd, $db)
|
||||
{
|
||||
if (!$link = @mysql_connect($server, $user, $pwd, $newDbLink))
|
||||
if (!$link = @mysql_connect($server, $user, $pwd))
|
||||
return 1;
|
||||
if (!@mysql_select_db($db, $link))
|
||||
return 2;
|
||||
|
||||
@@ -408,7 +408,7 @@ abstract class ObjectModelCore
|
||||
$fields = array();
|
||||
|
||||
if($this->id_lang == NULL)
|
||||
foreach (Language::getLanguages(false) as $language)
|
||||
foreach (Language::getLanguages() as $language)
|
||||
$this->makeTranslationFields($fields, $fieldsArray, $language['id_lang']);
|
||||
else
|
||||
$this->makeTranslationFields($fields, $fieldsArray, $this->id_lang);
|
||||
|
||||
@@ -293,14 +293,7 @@ class OrderCore extends ObjectModel
|
||||
/* Update order */
|
||||
$shippingDiff = $this->total_shipping - $cart->getOrderShippingCost();
|
||||
$this->total_products -= $productPriceWithoutTax;
|
||||
|
||||
// After upgrading from old version
|
||||
// total_products_wt is null
|
||||
// removing a product made order total negative
|
||||
// and don't recalculating totals (on getTotalProductsWithTaxes)
|
||||
if ($this->total_products_wt != 0)
|
||||
$this->total_products_wt -= $productPrice;
|
||||
|
||||
$this->total_shipping = $cart->getOrderShippingCost();
|
||||
|
||||
/* It's temporary fix for 1.3 version... */
|
||||
|
||||
@@ -105,7 +105,7 @@ abstract class PaymentModuleCore extends Module
|
||||
$order->id_customer = (int)($cart->id_customer);
|
||||
$order->id_address_invoice = (int)($cart->id_address_invoice);
|
||||
$order->id_address_delivery = (int)($cart->id_address_delivery);
|
||||
$vat_address = new Address((int)($order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}));
|
||||
$vat_address = new Address((int)($order->id_address_delivery));
|
||||
$order->id_currency = ($currency_special ? (int)($currency_special) : (int)($cart->id_currency));
|
||||
$order->id_lang = (int)($cart->id_lang);
|
||||
$order->id_cart = (int)($cart->id);
|
||||
|
||||
+1
-29
@@ -263,7 +263,7 @@ class ProductCore extends ObjectModel
|
||||
'out_of_stock' => array('required' => true),
|
||||
'new' => array(),
|
||||
'cache_default_attribute' => array(),
|
||||
'id_default_image' => array('getter' => 'getCoverWs', 'setter' => 'setCoverWs', 'xlink_resource' => array('resourceName' => 'images', 'subResourceName' => 'products')),
|
||||
'id_default_image' => array('getter' => 'getCoverWs', 'setter' => false, 'xlink_resource' => array('resourceName' => 'images', 'subResourceName' => 'products')),
|
||||
'id_default_combination' => array('getter' => 'getWsDefaultCombination', 'setter' => 'setWsDefaultCombination', 'xlink_resource' => array('resourceName' => 'combinations')),
|
||||
'position_in_category' => array('getter' => 'getWsPositionInCategory', 'setter' => false),
|
||||
'manufacturer_name' => array('getter' => 'getWsManufacturerName', 'setter' => false),
|
||||
@@ -285,10 +285,6 @@ class ProductCore extends ObjectModel
|
||||
'id' => array('required' => true),
|
||||
'id_feature_value' => array('required' => true, 'xlink_resource' => 'product_feature_values'),
|
||||
)),
|
||||
'tags' => array('resource' => 'tag',
|
||||
'fields' => array(
|
||||
'id' => array('required' => true),
|
||||
)),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -3340,21 +3336,6 @@ class ProductCore extends ObjectModel
|
||||
return $result['id_image'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Webservice setter : set virtual field id_default_image in category
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function setCoverWs($id_image)
|
||||
{
|
||||
Db::getInstance()->ExecuteS('UPDATE `'._DB_PREFIX_.'image`
|
||||
SET `cover` = 0 WHERE `id_product` = '.(int)($this->id).'
|
||||
');
|
||||
Db::getInstance()->ExecuteS('UPDATE `'._DB_PREFIX_.'image`
|
||||
SET `cover` = 1 WHERE `id_product` = '.(int)($this->id).' AND `id_image` = '.(int)$id_image);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Webservice getter : get image ids of current product for association
|
||||
*
|
||||
@@ -3369,15 +3350,6 @@ class ProductCore extends ObjectModel
|
||||
ORDER BY `position`');
|
||||
}
|
||||
|
||||
public function getWsTags()
|
||||
{
|
||||
return Db::getInstance()->ExecuteS('
|
||||
SELECT `id_tag` as id
|
||||
FROM `'._DB_PREFIX_.'product_tag`
|
||||
WHERE `id_product` = '.(int)($this->id));
|
||||
}
|
||||
|
||||
|
||||
public function getWsManufacturerName()
|
||||
{
|
||||
return Manufacturer::getNameById((int)$this->id_manufacturer);
|
||||
|
||||
@@ -231,12 +231,7 @@ class SpecificPriceCore extends ObjectModel
|
||||
`id_country` IN(0, '.(int)($id_country).') AND
|
||||
`id_group` IN(0, '.(int)($id_group).') AND
|
||||
`from_quantity` = 1 AND
|
||||
(
|
||||
(`from` = \'0000-00-00 00:00:00\' OR \''.$beginning.'\' >= `from`)
|
||||
AND
|
||||
(`to` = \'0000-00-00 00:00:00\' OR \''.$ending.'\' <= `to`)
|
||||
)
|
||||
AND
|
||||
(`from` = \'0000-00-00 00:00:00\' OR (\''.$beginning.'\' >= `from` AND \''.$ending.'\' <= `to`)) AND
|
||||
`reduction` > 0
|
||||
', false);
|
||||
$ids_product = array();
|
||||
|
||||
+5
-23
@@ -1491,7 +1491,7 @@ class ToolsCore
|
||||
return Tools::getHttpHost();
|
||||
}
|
||||
|
||||
public static function generateHtaccess($path, $rewrite_settings, $cache_control, $specific = '', $disableMuliviews = false)
|
||||
public static function generateHtaccess($path, $rewrite_settings, $cache_control, $specific = '')
|
||||
{
|
||||
if (!$writeFd = @fopen($path, 'w'))
|
||||
return false;
|
||||
@@ -1531,8 +1531,7 @@ class ToolsCore
|
||||
$tab['RewriteRule'][$domain]['content']['^'.ltrim($uri['uri'], '/').'([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$'] = _PS_PROD_IMG_.'$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8.jpg [L]';
|
||||
$tab['RewriteRule'][$domain]['content']['^'.ltrim($uri['uri'], '/').'([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$'] = _PS_PROD_IMG_.'$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9.jpg [L]';
|
||||
|
||||
$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'][$domain]['content']['^'.ltrim($uri['uri'], '/').'c/([0-9]+)(\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*\.jpg$'] = 'img/c/$1$2.jpg [L]';
|
||||
|
||||
if ($multilang)
|
||||
{
|
||||
@@ -1592,13 +1591,9 @@ class ToolsCore
|
||||
fwrite($writeFd, $specific);
|
||||
// RewriteEngine
|
||||
fwrite($writeFd, "\n<IfModule mod_rewrite.c>\n");
|
||||
|
||||
if ($disableMuliviews)
|
||||
fwrite($writeFd, "\n# Disable Multiviews\nOptions -Multiviews\n\n");
|
||||
|
||||
fwrite($writeFd, $tab['RewriteEngine']['comment']."\nRewriteEngine on\n\n");
|
||||
fwrite($writeFd, $tab['RewriteRule']['comment']."\n");
|
||||
// Webservice
|
||||
fwrite($writeFd, "\nRewriteEngine on\n\n");
|
||||
// fwrite($writeFd, $tab['RewriteRule']['comment']."\n");
|
||||
// Webservice needs apache_mod_rewrite in order to work
|
||||
fwrite($writeFd, 'RewriteRule ^api/?(.*)$ '.__PS_BASE_URI__."webservice/dispatcher.php?url=$1 [QSA,L]\n");
|
||||
|
||||
fwrite($writeFd, "RewriteCond %{REQUEST_FILENAME} -s [OR]\nRewriteCond %{REQUEST_FILENAME} -l [OR]\nRewriteCond %{REQUEST_FILENAME} -d\nRewriteRule ^.*$ - [NC,L]\nRewriteRule ^.*\$ index.php [NC,L]\n");
|
||||
@@ -1995,19 +1990,6 @@ FileETag INode MTime Size
|
||||
{
|
||||
return str_replace(array("\r\n", "\r", "\n"), '<br />', $str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear cache for Smarty
|
||||
*
|
||||
* @param objet $smarty
|
||||
*/
|
||||
public static function clearCache($smarty)
|
||||
{
|
||||
if (!Configuration::get('PS_FORCE_SMARTY_2'))
|
||||
$smarty->clearAllCache();
|
||||
else
|
||||
$smarty->clear_all_cache();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,138 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 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/osl-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/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class UpgraderCore{
|
||||
const DEFAULT_CHECK_VERSION_DELAY_HOURS = 24;
|
||||
/**
|
||||
* link contains hte url where to download the file
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $needUpgrade = false;
|
||||
private $noRefresh = false;
|
||||
|
||||
public $version_name;
|
||||
public $version_num;
|
||||
public $link;
|
||||
public $autoupgrade;
|
||||
|
||||
public function __get($var)
|
||||
{
|
||||
if($var == 'needUpgrade')
|
||||
return $this->isLastVersion();
|
||||
}
|
||||
/**
|
||||
* we need to checkPSVersion when we use that class
|
||||
* @param boolean noRefresh if true, checkPSVersion will not refresh its information
|
||||
* @return object Upgrader
|
||||
*/
|
||||
public function __construct($noRefresh = false)
|
||||
{
|
||||
$this->noRefresh = (bool)$noRefresh;
|
||||
}
|
||||
|
||||
/**
|
||||
* downloadLast download the last version of PrestaShop and save it in $dest/$filename
|
||||
*
|
||||
* @param string $dest directory where to save the file
|
||||
* @param string $filename new filename
|
||||
* @return boolean
|
||||
*
|
||||
* @TODO ftp if copy is not possible (safe_mode for example)
|
||||
*/
|
||||
public function downloadLast($dest, $filename = 'prestashop.zip')
|
||||
{
|
||||
if (empty($this->link))
|
||||
$this->checkPSVersion();
|
||||
|
||||
if (@copy($this->link, realpath($dest).DIRECTORY_SEPARATOR.$filename))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
public function isLastVersion()
|
||||
{
|
||||
if (empty($this->link))
|
||||
$this->checkPSVersion();
|
||||
|
||||
return $this->needUpgrade;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* checkPSVersion ask to prestashop.com if there is a new version. return an array if yes, false otherwise
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function checkPSVersion($force = false)
|
||||
{
|
||||
if (empty($this->link))
|
||||
{
|
||||
$lastCheck = Configuration::get('PS_LAST_VERSION_CHECK');
|
||||
// if we use the autoupgrade process, we will never refresh it
|
||||
// except if no check has been done before
|
||||
if (!($this->autoUpgrade AND $lastCheck) AND ($force OR ($lastCheck < time() - (3600 * Upgrader::DEFAULT_CHECK_VERSION_DELAY_HOURS))) )
|
||||
{
|
||||
libxml_set_streams_context(stream_context_create(array('http' => array('timeout' => 3))));
|
||||
if ($feed = @simplexml_load_file('http://www.prestashop.com/xml/version.xml'))
|
||||
{
|
||||
$this->version_name = (string)$feed->version->name;
|
||||
$this->version_num = (string)$feed->version->num;
|
||||
$this->link = (string)$feed->download->link;
|
||||
$this->autoupgrade = (int)$feed->autoupgrade;
|
||||
$configLastVersion = array(
|
||||
'name' => $this->version_name,
|
||||
'num' => $this->version_num,
|
||||
'link' => $this->link,
|
||||
'autoupgrade' => $this->autoupgrade
|
||||
);
|
||||
Configuration::updateValue('PS_LAST_VERSION',serialize($configLastVersion));
|
||||
Configuration::updateValue('PS_LAST_VERSION_CHECK',time());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$lastVersionCheck = unserialize(Configuration::get('PS_LAST_VERSION'));
|
||||
$this->version_name = $lastVersionCheck['name'];
|
||||
$this->version_num = $lastVersionCheck['num'];
|
||||
$this->link = $lastVersionCheck['link'];
|
||||
$this->autoupgrade = $lastVersionCheck['autoupgrade'];
|
||||
}
|
||||
}
|
||||
// retro-compatibility :
|
||||
// return array(name,link) if you don't use the last version
|
||||
// false otherwise
|
||||
if (version_compare(_PS_VERSION_, $this->version_num, '<'))
|
||||
{
|
||||
$this->needUpgrade = true;
|
||||
return array('name' => $this->version_name, 'link' => $this->link);
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1356,7 +1356,7 @@ class WebserviceRequestCore
|
||||
$this->setError(400, 'id is duplicate in request', 89);
|
||||
return false;
|
||||
}
|
||||
if (count($xmlEntities) != count($ids))
|
||||
if ($xmlEntities->count() != count($ids))
|
||||
{
|
||||
$this->setError(400, 'id is required when modifying a resource', 90);
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user