Merge branch 'develop' into qlo-remove-mysql2
This commit is contained in:
13
SECURITY.md
Normal file
13
SECURITY.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| 1.5.x | :white_check_mark: |
|
||||
| 1.4.x | :white_check_mark: |
|
||||
| < 1.4.0 | :x: |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
Please report (suspected) security vulnerabilities to support@qloapps.com. You will receive a response from us within 48 hours. If the issue is confirmed, we will release a patch as soon as possible depending on complexity.
|
||||
@@ -72,12 +72,12 @@ if (Tools::isSubmit('ajaxProductPackItems')) {
|
||||
|
||||
if (Tools::isSubmit('getChildrenCategories') && Tools::isSubmit('id_category_parent')) {
|
||||
$children_categories = Category::getChildrenWithNbSelectedSubCat(Tools::getValue('id_category_parent'), Tools::getValue('selectedCat'), Context::getContext()->language->id, null, Tools::getValue('use_shop_context'));
|
||||
die(Tools::jsonEncode($children_categories));
|
||||
die(json_encode($children_categories));
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('getNotifications')) {
|
||||
$notification = new Notification;
|
||||
die(Tools::jsonEncode($notification->getLastElements()));
|
||||
die(json_encode($notification->getLastElements()));
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('updateElementEmployee') && Tools::getValue('updateElementEmployeeType')) {
|
||||
@@ -111,7 +111,7 @@ if (Tools::isSubmit('getParentCategoriesId') && $id_category = Tools::getValue('
|
||||
$output[] = $result;
|
||||
}
|
||||
|
||||
die(Tools::jsonEncode($output));
|
||||
die(json_encode($output));
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('getZones')) {
|
||||
@@ -121,7 +121,7 @@ if (Tools::isSubmit('getZones')) {
|
||||
}
|
||||
$html .= '</select>';
|
||||
$array = array('hasError' => false, 'errors' => '', 'data' => $html);
|
||||
die(Tools::jsonEncode($array));
|
||||
die(json_encode($array));
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('getEmailHTML') && $email = Tools::getValue('email')) {
|
||||
|
||||
@@ -137,7 +137,7 @@ if ($items && ($excludeIds || strpos($_SERVER['HTTP_REFERER'], 'AdminScenes') !=
|
||||
}
|
||||
}
|
||||
$results = array_values($results);
|
||||
echo Tools::jsonEncode($results);
|
||||
echo json_encode($results);
|
||||
} else {
|
||||
Tools::jsonEncode(new stdClass);
|
||||
json_encode(new stdClass);
|
||||
}
|
||||
|
||||
@@ -524,8 +524,8 @@ function runAdminTab($tab, $ajax_mode = false)
|
||||
}
|
||||
|
||||
// we can display the correct url
|
||||
// die(Tools::jsonEncode(array(Translate::getAdminTranslation('Invalid security token'),$url)));
|
||||
die(Tools::jsonEncode(Translate::getAdminTranslation('Invalid security token')));
|
||||
// die(json_encode(array(Translate::getAdminTranslation('Invalid security token'),$url)));
|
||||
die(json_encode(Translate::getAdminTranslation('Invalid security token')));
|
||||
} else {
|
||||
// If this is an XSS attempt, then we should only display a simple, secure page
|
||||
if (ob_get_level() && ob_get_length() > 0) {
|
||||
|
||||
@@ -301,11 +301,11 @@
|
||||
<div class="col-sm-7">
|
||||
<select name="booking_order_status" class="form-control booking_order_status margin-bottom-5">
|
||||
{foreach from=$hotel_order_status item=state}
|
||||
<option value="{$state['id']|intval}" {if isset($data.id_status) && $state.id == $data.id_status} selected="selected" disabled="disabled"{/if}>{$state.status|escape}</option>
|
||||
<option value="{$state['id_status']|intval}" {if isset($data.id_status) && $state.id_status == $data.id_status} selected="selected" disabled="disabled"{/if}>{$state.name|escape}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
|
||||
{if $data['id_status'] == 2}<span class="badge badge-success margin-bottom-5">{l s='checked in on'} {$data['check_in']|date_format:"%d-%m-%Y"}</span>{elseif $data['id_status'] == 3}<span class="badge badge-success margin-bottom-5">{l s='checked out on'} {$data['check_out']|date_format:"%d-%m-%Y"}</span>{/if}
|
||||
{if $data['id_status'] == $hotel_order_status['STATUS_CHECKED_IN']['id_status']}<span class="badge badge-success margin-bottom-5">{l s='checked in on'} {$data['check_in']|date_format:"%d-%m-%Y"}</span>{elseif $data['id_status'] == $hotel_order_status['STATUS_CHECKED_OUT']['id_status']}<span class="badge badge-success margin-bottom-5">{l s='checked out on'} {$data['check_out']|date_format:"%d-%m-%Y"}</span>{/if}
|
||||
|
||||
{* field for the current date *}
|
||||
<input class="room_status_date wk-input-date" type="text" name="status_date" value="{$data['date_from']|date_format:"%d-%m-%Y"}" readonly/>
|
||||
|
||||
@@ -377,7 +377,7 @@ class Crypt_Blowfish
|
||||
for ($i = 0; $i < 18; $i++) {
|
||||
$data = 0;
|
||||
for ($j = 4; $j > 0; $j--) {
|
||||
$data = $data << 8 | ord($key{$k});
|
||||
$data = $data << 8 | ord($key[$k]);
|
||||
$k = ($k + 1) % $len;
|
||||
}
|
||||
$this->_P[$i] ^= $data;
|
||||
|
||||
@@ -2632,6 +2632,9 @@ class CartCore extends ObjectModel
|
||||
*/
|
||||
public static function desintifier($int, $delimiter = ',')
|
||||
{
|
||||
if (!$int)
|
||||
return;
|
||||
|
||||
$delimiter_len = $int[0];
|
||||
$int = strrev(substr($int, 1));
|
||||
$elm = explode(str_repeat('0', $delimiter_len + 1), $int);
|
||||
@@ -4317,7 +4320,7 @@ class CartCore extends ObjectModel
|
||||
$postData = trim(file_get_contents('php://input'));
|
||||
libxml_use_internal_errors(true);
|
||||
$xml = simplexml_load_string(utf8_decode($postData));
|
||||
$cartData = Tools::jsonDecode(Tools::jsonEncode($xml, true));
|
||||
$cartData = json_decode(json_encode($xml, true));
|
||||
|
||||
$this->id_address_delivery = $cartData->cart->id_address;
|
||||
$this->id_address_invoice = $cartData->cart->id_address;
|
||||
@@ -4344,7 +4347,7 @@ class CartCore extends ObjectModel
|
||||
$postData = trim(file_get_contents('php://input'));
|
||||
libxml_use_internal_errors(true);
|
||||
$xml = simplexml_load_string(utf8_decode($postData));
|
||||
$cartData = Tools::jsonDecode(Tools::jsonEncode($xml, true));
|
||||
$cartData = json_decode(json_encode($xml, true));
|
||||
|
||||
$this->id_address_delivery = $cartData->cart->id_address;
|
||||
$this->id_address_invoice = $cartData->cart->id_address;
|
||||
@@ -4384,14 +4387,14 @@ class CartCore extends ObjectModel
|
||||
|
||||
$extraDemands = null;
|
||||
foreach ($bookingRows as $booking) {
|
||||
$booking = Tools::jsonDecode(Tools::jsonEncode($booking, true), true);
|
||||
$booking = json_decode(json_encode($booking, true), true);
|
||||
if (isset($booking['extra_demands']['extra_demand'])) {
|
||||
$extraDemands = $booking['extra_demands']['extra_demand'];
|
||||
if (isset($extraDemands['id_global_demand'])) {
|
||||
$extraDemands = array($extraDemands);
|
||||
}
|
||||
// $extraDemands = Tools::jsonDecode($extraDemands, true);
|
||||
$extraDemands = Tools::jsonEncode($extraDemands);
|
||||
// $extraDemands = json_decode($extraDemands, true);
|
||||
$extraDemands = json_encode($extraDemands);
|
||||
}
|
||||
|
||||
// get room booking info
|
||||
|
||||
@@ -1220,7 +1220,7 @@ class CartRuleCore extends ObjectModel
|
||||
if ($type == 'shop') {
|
||||
$shops = Context::getContext()->employee->getAssociatedShops();
|
||||
if (count($shops)) {
|
||||
$shop_list = ' AND t.id_shop IN ('.implode(array_map('intval', $shops), ',').') ';
|
||||
$shop_list = ' AND t.id_shop IN ('.implode(',', array_map('intval', $shops)).') ';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ class ConfigurationTestCore
|
||||
'/classes/log/index.php',
|
||||
'/classes/cache/index.php',
|
||||
'/config/index.php',
|
||||
'/tools/tar/Archive_Tar.php',
|
||||
'/tools/tar/Tar.php',
|
||||
'/tools/pear/PEAR.php',
|
||||
'/controllers/admin/AdminLoginController.php',
|
||||
'/css/index.php',
|
||||
@@ -94,6 +94,7 @@ class ConfigurationTestCore
|
||||
'upload_max_filesize' => false,
|
||||
'max_execution_time' => false,
|
||||
'fopen' => false,
|
||||
'zip' => false,
|
||||
));
|
||||
}
|
||||
|
||||
@@ -179,7 +180,7 @@ class ConfigurationTestCore
|
||||
|
||||
public static function test_magicquotes()
|
||||
{
|
||||
return !get_magic_quotes_gpc();
|
||||
return function_exists('get_magic_quotes_gpc') ? !get_magic_quotes_gpc() : true;
|
||||
}
|
||||
|
||||
public static function test_upload()
|
||||
@@ -214,6 +215,12 @@ class ConfigurationTestCore
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function test_zip()
|
||||
{
|
||||
return extension_loaded('zip');
|
||||
}
|
||||
|
||||
|
||||
public static function test_fopen()
|
||||
{
|
||||
return ini_get('allow_url_fopen');
|
||||
|
||||
@@ -136,7 +136,7 @@ class ConnectionCore extends ObjectModel
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).'
|
||||
ORDER BY `date_add` DESC';
|
||||
$result = Db::getInstance()->getRow($sql, false);
|
||||
if (!$result['id_guest'] && (int)$cookie->id_guest) {
|
||||
if (!isset($result['id_guest']) && (int)$cookie->id_guest) {
|
||||
// The old connections details are removed from the database in order to spare some memory
|
||||
Connection::cleanConnectionsPages();
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ class CookieCore
|
||||
$this->_standalone = $standalone;
|
||||
$this->_expire = is_null($expire) ? time() + 1728000 : (int)$expire;
|
||||
$this->_path = trim(($this->_standalone ? '' : Context::getContext()->shop->physical_uri).$path, '/\\').'/';
|
||||
if ($this->_path{0} != '/') {
|
||||
if ($this->_path[0] != '/') {
|
||||
$this->_path = '/'.$this->_path;
|
||||
}
|
||||
$this->_path = rawurlencode($this->_path);
|
||||
|
||||
@@ -798,7 +798,7 @@ class LanguageCore extends ObjectModel
|
||||
|
||||
// If the language pack has not been provided, retrieve it from prestashop.com
|
||||
if (!$lang_pack) {
|
||||
$lang_pack = Tools::jsonDecode(Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/get_language_pack.php?version='._PS_VERSION_.'&iso_lang='.$iso_code));
|
||||
$lang_pack = json_decode(Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/get_language_pack.php?version='._PS_VERSION_.'&iso_lang='.$iso_code));
|
||||
}
|
||||
|
||||
// If a language pack has been found or provided, prefill the language object with the value
|
||||
@@ -914,7 +914,7 @@ class LanguageCore extends ObjectModel
|
||||
|
||||
if (!$lang_pack_link = Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/get_language_pack.php?version='.$version.'&iso_lang='.Tools::strtolower((string)$iso))) {
|
||||
$errors[] = Tools::displayError('Archive cannot be downloaded from prestashop.com.');
|
||||
} elseif (!$lang_pack = Tools::jsonDecode($lang_pack_link)) {
|
||||
} elseif (!$lang_pack = json_decode($lang_pack_link)) {
|
||||
$errors[] = Tools::displayError('Error occurred when language was checked according to your Prestashop version.');
|
||||
} elseif (empty($lang_pack->error) && ($content = Tools::file_get_contents('http://translations.prestashop.com/download/lang_packs/gzip/'.$lang_pack->version.'/'.Tools::strtolower($lang_pack->iso_code.'.gzip')))) {
|
||||
if (!@file_put_contents($file, $content)) {
|
||||
@@ -930,7 +930,7 @@ class LanguageCore extends ObjectModel
|
||||
if (!file_exists($file)) {
|
||||
$errors[] = Tools::displayError('No language pack is available for your version.');
|
||||
} elseif ($install) {
|
||||
require_once(_PS_TOOL_DIR_.'tar/Archive_Tar.php');
|
||||
require_once(_PS_TOOL_DIR_.'tar/Tar.php');
|
||||
$gz = new Archive_Tar($file, true);
|
||||
$files_list = AdminTranslationsController::filterTranslationFiles(Language::getLanguagePackListContent((string)$iso, $gz));
|
||||
$files_paths = AdminTranslationsController::filesListToPaths($files_list);
|
||||
@@ -1030,7 +1030,7 @@ class LanguageCore extends ObjectModel
|
||||
|
||||
public static function updateModulesTranslations(array $modules_list)
|
||||
{
|
||||
require_once(_PS_TOOL_DIR_.'tar/Archive_Tar.php');
|
||||
require_once(_PS_TOOL_DIR_.'tar/Tar.php');
|
||||
|
||||
$languages = Language::getLanguages(false);
|
||||
foreach ($languages as $lang) {
|
||||
|
||||
@@ -5776,7 +5776,7 @@ class ProductCore extends ObjectModel
|
||||
libxml_use_internal_errors(true);
|
||||
$xml = simplexml_load_string(utf8_decode($postData));
|
||||
|
||||
$roomtypeData = Tools::jsonDecode(Tools::jsonEncode($xml), true);
|
||||
$roomtypeData = json_decode(json_encode($xml), true);
|
||||
|
||||
// set room map info for the hotel from request
|
||||
return Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'htl_room_type` (`id_product`, `id_hotel`, `adult`, `children`, `date_add`, `date_upd`) VALUES ('.(int)$this->id.', '.(int) $roomtypeData['room_type']['id_hotel'].', '.(int) $roomtypeData['room_type']['adults'].', '.(int) $roomtypeData['room_type']['children'].', \''.date('Y-m-d h:i:s').'\', \''.date('Y-m-d h:i:s').'\')');
|
||||
|
||||
@@ -236,7 +236,7 @@ class ReferrerCore extends ObjectModel
|
||||
if ($implode) {
|
||||
$sql = 'SELECT COUNT(id_order) AS orders, SUM(total_paid_real / conversion_rate) AS sales
|
||||
FROM '._DB_PREFIX_.'orders
|
||||
WHERE id_order IN ('.implode($implode, ',').')
|
||||
WHERE id_order IN ('.implode(',', $implode).')
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER).'
|
||||
AND valid = 1';
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
||||
@@ -349,6 +349,6 @@ class ReferrerCore extends ObjectModel
|
||||
'percent_fee' => Tools::displayPrice($stats_sales['sales'] * $referrer->percent_fee / 100, $currency),
|
||||
);
|
||||
|
||||
die('['.Tools::jsonEncode($json_array).']');
|
||||
die('['.json_encode($json_array).']');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2017 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-2017 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
/**
|
||||
* 2007-2017 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-2017 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
require_once(_PS_TOOL_DIR_.'smarty/Smarty.class.php');
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2017 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-2017 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
/**
|
||||
* 2007-2017 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-2017 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class SmartyCustomCore extends Smarty
|
||||
{
|
||||
63
classes/Smarty/SmartyDev.php
Normal file
63
classes/Smarty/SmartyDev.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2016 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-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class SmartyDev extends Smarty
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->template_class = 'Smarty_Dev_Template';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null, $display = false, $merge_tpl_vars = true, $no_output_filter = false)
|
||||
{
|
||||
return "\n<!-- begin $template -->\n"
|
||||
.parent::fetch($template, $cache_id, $compile_id, $parent, $display, $merge_tpl_vars, $no_output_filter)
|
||||
."\n<!-- end $template -->\n";
|
||||
}
|
||||
}
|
||||
|
||||
class Smarty_Dev_Template extends Smarty_Internal_Template
|
||||
{
|
||||
/** @var SmartyCustom|null */
|
||||
public $smarty = null;
|
||||
|
||||
public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null, $display = false, $merge_tpl_vars = true, $no_output_filter = false)
|
||||
{
|
||||
if (!is_null($template)) {
|
||||
$tpl = $template->template_resource;
|
||||
} else {
|
||||
$tpl = $this->template_resource;
|
||||
}
|
||||
|
||||
return "\n<!-- begin $tpl -->\n"
|
||||
.parent::fetch($template, $cache_id, $compile_id, $parent, $display, $merge_tpl_vars, $no_output_filter)
|
||||
."\n<!-- end $tpl -->\n";
|
||||
}
|
||||
}
|
||||
95
classes/Smarty/SmartyLazyRegister.php
Normal file
95
classes/Smarty/SmartyLazyRegister.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2015 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-2015 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
/**
|
||||
* Used to delay loading of external classes with smarty->register_plugin.
|
||||
*/
|
||||
class SmartyLazyRegister
|
||||
{
|
||||
protected $registry = array();
|
||||
protected static $instance;
|
||||
|
||||
/**
|
||||
* Register a function or method to be dynamically called later.
|
||||
*
|
||||
* @param string|array $params function name or array(object name, method name)
|
||||
*/
|
||||
public function register($params)
|
||||
{
|
||||
if (is_array($params)) {
|
||||
$this->registry[$params[1]] = $params;
|
||||
} else {
|
||||
$this->registry[$params] = $params;
|
||||
}
|
||||
}
|
||||
|
||||
public function isRegistered($params)
|
||||
{
|
||||
if (is_array($params)) {
|
||||
$params = $params[1];
|
||||
}
|
||||
|
||||
return isset($this->registry[$params]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically call static function or method.
|
||||
*
|
||||
* @param string $name function name
|
||||
* @param mixed $arguments function argument
|
||||
*
|
||||
* @return mixed function return
|
||||
*/
|
||||
public function __call($name, $arguments)
|
||||
{
|
||||
$item = $this->registry[$name];
|
||||
|
||||
// case 1: call to static method - case 2 : call to static function
|
||||
if (is_array($item[1])) {
|
||||
return call_user_func_array($item[1].'::'.$item[0], array($arguments[0], &$arguments[1]));
|
||||
} else {
|
||||
$args = array();
|
||||
|
||||
foreach ($arguments as $a => $argument) {
|
||||
if ($a == 0) {
|
||||
$args[] = $arguments[0];
|
||||
} else {
|
||||
$args[] = &$arguments[$a];
|
||||
}
|
||||
}
|
||||
|
||||
return call_user_func_array($item, $args);
|
||||
}
|
||||
}
|
||||
|
||||
public static function getInstance()
|
||||
{
|
||||
if (!self::$instance) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
}
|
||||
68
classes/Smarty/SmartyResourceModule.php
Normal file
68
classes/Smarty/SmartyResourceModule.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 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-2015 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
/**
|
||||
* Override module templates easily
|
||||
*
|
||||
* @since 1.7.0.0
|
||||
*/
|
||||
class SmartyResourceModuleCore extends Smarty_Resource_Custom
|
||||
{
|
||||
private $shop;
|
||||
|
||||
public function __construct(array $paths)
|
||||
{
|
||||
$this->paths = $paths;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch a template
|
||||
*
|
||||
* @param string $name template name
|
||||
* @param string $source template source
|
||||
* @param integer $mtime template modification timestamp (epoch)
|
||||
* @return void
|
||||
*/
|
||||
protected function fetch($name, &$source, &$mtime)
|
||||
{
|
||||
foreach ($this->paths as $path) {
|
||||
if (Tools::file_exists_cache($file = $path.$name)) {
|
||||
if (_PS_MODE_DEV_) {
|
||||
$source = implode('', [
|
||||
'<!-- begin '.$file.' -->',
|
||||
file_get_contents($file),
|
||||
'<!-- end '.$file.' -->'
|
||||
]);
|
||||
} else {
|
||||
$source = file_get_contents($file);
|
||||
}
|
||||
$mtime = filemtime($file);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -104,65 +104,7 @@ class ToolsCore
|
||||
}
|
||||
}
|
||||
|
||||
if (function_exists('mcrypt_create_iv')) {
|
||||
$bytes = mcrypt_create_iv($length, MCRYPT_DEV_URANDOM);
|
||||
|
||||
if ($bytes !== false && strlen($bytes) === $length) {
|
||||
return $bytes;
|
||||
}
|
||||
}
|
||||
|
||||
// Else try to get $length bytes of entropy.
|
||||
// Thanks to Zend
|
||||
|
||||
$result = '';
|
||||
$entropy = '';
|
||||
$msec_per_round = 400;
|
||||
$bits_per_round = 2;
|
||||
$total = $length;
|
||||
$hash_length = 20;
|
||||
|
||||
while (strlen($result) < $length) {
|
||||
$bytes = ($total > $hash_length) ? $hash_length : $total;
|
||||
$total -= $bytes;
|
||||
|
||||
for ($i=1; $i < 3; $i++) {
|
||||
$t1 = microtime(true);
|
||||
$seed = mt_rand();
|
||||
|
||||
for ($j=1; $j < 50; $j++) {
|
||||
$seed = sha1($seed);
|
||||
}
|
||||
|
||||
$t2 = microtime(true);
|
||||
$entropy .= $t1 . $t2;
|
||||
}
|
||||
|
||||
$div = (int) (($t2 - $t1) * 1000000);
|
||||
|
||||
if ($div <= 0) {
|
||||
$div = 400;
|
||||
}
|
||||
|
||||
$rounds = (int) ($msec_per_round * 50 / $div);
|
||||
$iter = $bytes * (int) (ceil(8 / $bits_per_round));
|
||||
|
||||
for ($i = 0; $i < $iter; $i ++) {
|
||||
$t1 = microtime();
|
||||
$seed = sha1(mt_rand());
|
||||
|
||||
for ($j = 0; $j < $rounds; $j++) {
|
||||
$seed = sha1($seed);
|
||||
}
|
||||
|
||||
$t2 = microtime();
|
||||
$entropy .= $t1 . $t2;
|
||||
}
|
||||
|
||||
$result .= sha1($entropy, true);
|
||||
}
|
||||
|
||||
return substr($result, 0, $length);
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function strReplaceFirst($search, $replace, $subject, $cur = 0)
|
||||
@@ -926,6 +868,11 @@ class ToolsCore
|
||||
return html_entity_decode((string)$string, ENT_QUOTES, 'utf-8');
|
||||
}
|
||||
|
||||
public static function removeHtmlComments($html)
|
||||
{
|
||||
return preg_replace('/<!--(.|\s)*?-->/', '', $html);
|
||||
}
|
||||
|
||||
public static function safePostVars()
|
||||
{
|
||||
if (!isset($_POST) || !is_array($_POST)) {
|
||||
@@ -1066,7 +1013,7 @@ class ToolsCore
|
||||
|
||||
echo '
|
||||
<script type="text/javascript">
|
||||
console.'.$type.'('.Tools::jsonEncode($object).');
|
||||
console.'.$type.'('.json_encode($object).');
|
||||
</script>
|
||||
';
|
||||
}
|
||||
@@ -1822,10 +1769,10 @@ class ToolsCore
|
||||
return Tools::strtoupper(Tools::substr($str, 0, 1)).Tools::substr($str, 1);
|
||||
}
|
||||
|
||||
public static function ucwords($str)
|
||||
public static function ucwords($str, $encoding = 'utf-8')
|
||||
{
|
||||
if (function_exists('mb_convert_case')) {
|
||||
return mb_convert_case($str, MB_CASE_TITLE);
|
||||
return mb_convert_case($str, MB_CASE_TITLE, $encoding);
|
||||
}
|
||||
return ucwords(Tools::strtolower($str));
|
||||
}
|
||||
@@ -2222,8 +2169,8 @@ class ToolsCore
|
||||
public static function parserSQL($sql)
|
||||
{
|
||||
if (strlen($sql) > 0) {
|
||||
require_once _PS_TOOL_DIR_.'parser_sql/PHPSQLParser.php';
|
||||
$parser = new PHPSQLParser($sql);
|
||||
require_once _PS_TOOL_DIR_.'parser_sql/php_sql_parser_autoload.php';
|
||||
$parser = new PHPSQLParser\PHPSQLParser($sql);
|
||||
return $parser->parsed;
|
||||
}
|
||||
return false;
|
||||
@@ -2660,19 +2607,15 @@ exit;
|
||||
/**
|
||||
* jsonDecode convert json string to php array / object
|
||||
*
|
||||
* @param string $json
|
||||
* @param string $data
|
||||
* @param bool $assoc (since 1.4.2.4) if true, convert to associativ array
|
||||
* @return array
|
||||
*/
|
||||
public static function jsonDecode($json, $assoc = false)
|
||||
public static function jsonDecode($data, $assoc = false, $depth = 512, $options = 0
|
||||
)
|
||||
{
|
||||
if (function_exists('json_decode')) {
|
||||
return json_decode($json, $assoc);
|
||||
} else {
|
||||
include_once(_PS_TOOL_DIR_.'json/json.php');
|
||||
$pear_json = new Services_JSON(($assoc) ? SERVICES_JSON_LOOSE_TYPE : 0);
|
||||
return $pear_json->decode($json);
|
||||
}
|
||||
Tools::displayAsDeprecated();
|
||||
return json_decode($data, $assoc, $depth, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2681,15 +2624,15 @@ exit;
|
||||
* @param array $data
|
||||
* @return string json
|
||||
*/
|
||||
public static function jsonEncode($data)
|
||||
public static function jsonEncode($data, $options = 0, $depth = 512)
|
||||
{
|
||||
if (function_exists('json_encode')) {
|
||||
return json_encode($data);
|
||||
} else {
|
||||
include_once(_PS_TOOL_DIR_.'json/json.php');
|
||||
$pear_json = new Services_JSON();
|
||||
return $pear_json->encode($data);
|
||||
Tools::displayAsDeprecated();
|
||||
if (PHP_VERSION_ID < 50500) { /* PHP version < 5.5.0 */
|
||||
return json_encode($data, $options);
|
||||
}
|
||||
|
||||
return json_encode($data, $options, $depth);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2854,14 +2797,9 @@ exit;
|
||||
*/
|
||||
public static function ZipTest($from_file)
|
||||
{
|
||||
if (class_exists('ZipArchive', false)) {
|
||||
$zip = new ZipArchive();
|
||||
return ($zip->open($from_file, ZIPARCHIVE::CHECKCONS) === true);
|
||||
} else {
|
||||
require_once(_PS_ROOT_DIR_.'/tools/pclzip/pclzip.lib.php');
|
||||
$zip = new PclZip($from_file);
|
||||
return ($zip->privCheckFormat() === true);
|
||||
}
|
||||
$zip = new ZipArchive();
|
||||
|
||||
return ($zip->open($from_file, ZipArchive::CHECKCONS) === true);
|
||||
}
|
||||
|
||||
public static function getSafeModeStatus()
|
||||
@@ -2881,23 +2819,12 @@ exit;
|
||||
if (!file_exists($to_dir)) {
|
||||
mkdir($to_dir, 0777);
|
||||
}
|
||||
if (class_exists('ZipArchive', false)) {
|
||||
$zip = new ZipArchive();
|
||||
if ($zip->open($from_file) === true && $zip->extractTo($to_dir) && $zip->close()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
require_once(_PS_ROOT_DIR_.'/tools/pclzip/pclzip.lib.php');
|
||||
$zip = new PclZip($from_file);
|
||||
$list = $zip->extract(PCLZIP_OPT_PATH, $to_dir, PCLZIP_OPT_REPLACE_NEWER);
|
||||
foreach ($list as $file) {
|
||||
if ($file['status'] != 'ok' && $file['status'] != 'already_a_directory') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$zip = new ZipArchive();
|
||||
if ($zip->open($from_file) === true && $zip->extractTo($to_dir) && $zip->close()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function chmodr($path, $filemode)
|
||||
@@ -3626,8 +3553,6 @@ exit;
|
||||
|
||||
public static function purifyHTML($html, $uri_unescape = null, $allow_style = false)
|
||||
{
|
||||
require_once(_PS_TOOL_DIR_.'htmlpurifier/HTMLPurifier.standalone.php');
|
||||
|
||||
static $use_html_purifier = null;
|
||||
static $purifier = null;
|
||||
|
||||
|
||||
@@ -1803,14 +1803,14 @@ class AdminControllerCore extends Controller
|
||||
}
|
||||
|
||||
if ($conf = Tools::getValue('conf')) {
|
||||
$this->context->smarty->assign('conf', $this->json ? Tools::jsonEncode($this->_conf[(int)$conf]) : $this->_conf[(int)$conf]);
|
||||
$this->context->smarty->assign('conf', $this->json ? json_encode($this->_conf[(int)$conf]) : $this->_conf[(int)$conf]);
|
||||
}
|
||||
|
||||
foreach (array('errors', 'warnings', 'informations', 'confirmations') as $type) {
|
||||
if (!is_array($this->$type)) {
|
||||
$this->$type = (array)$this->$type;
|
||||
}
|
||||
$this->context->smarty->assign($type, $this->json ? Tools::jsonEncode(array_unique($this->$type)) : array_unique($this->$type));
|
||||
$this->context->smarty->assign($type, $this->json ? json_encode(array_unique($this->$type)) : array_unique($this->$type));
|
||||
}
|
||||
|
||||
if ($this->show_page_header_toolbar && !$this->lite_display) {
|
||||
@@ -1824,7 +1824,7 @@ class AdminControllerCore extends Controller
|
||||
|
||||
$this->context->smarty->assign(
|
||||
array(
|
||||
'page' => $this->json ? Tools::jsonEncode($page) : $page,
|
||||
'page' => $this->json ? json_encode($page) : $page,
|
||||
'header' => $this->context->smarty->fetch($header_tpl),
|
||||
'footer' => $this->context->smarty->fetch($footer_tpl),
|
||||
)
|
||||
|
||||
@@ -435,7 +435,7 @@ class HelperListCore extends Helper
|
||||
'token' => $token != null ? $token : $this->token,
|
||||
'action' => self::$cache_lang['Details'],
|
||||
'params' => $ajax_params,
|
||||
'json_params' => Tools::jsonEncode($ajax_params)
|
||||
'json_params' => json_encode($ajax_params)
|
||||
));
|
||||
return $tpl->fetch();
|
||||
}
|
||||
|
||||
@@ -142,8 +142,8 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
|
||||
*/
|
||||
public function getContent()
|
||||
{
|
||||
$invoiceAddressPatternRules = Tools::jsonDecode(Configuration::get('PS_INVCE_INVOICE_ADDR_RULES'), true);
|
||||
$deliveryAddressPatternRules = Tools::jsonDecode(Configuration::get('PS_INVCE_DELIVERY_ADDR_RULES'), true);
|
||||
$invoiceAddressPatternRules = json_decode(Configuration::get('PS_INVCE_INVOICE_ADDR_RULES'), true);
|
||||
$deliveryAddressPatternRules = json_decode(Configuration::get('PS_INVCE_DELIVERY_ADDR_RULES'), true);
|
||||
|
||||
$invoice_address = new Address((int)$this->order->id_address_invoice);
|
||||
$country = new Country((int)$invoice_address->id_country);
|
||||
@@ -444,8 +444,8 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
|
||||
$num_days = $obj_htl_bk_dtl->getNumberOfDays($data_v['date_from'], $data_v['date_to']);
|
||||
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] = 1;
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['data_form'] = $data_v['date_from'];
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['data_to'] = $data_v['date_to'];
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['data_form'] = Tools::displayDate($data_v['date_from']);
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['data_to'] = Tools::displayDate($data_v['date_to']);
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'] = $num_days;
|
||||
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days;
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
require_once(_PS_TOOL_DIR_.'tcpdf/config/lang/eng.php');
|
||||
require_once(_PS_TOOL_DIR_.'tcpdf/tcpdf.php');
|
||||
|
||||
/**
|
||||
|
||||
@@ -76,7 +76,7 @@ class TreeToolbarSearchCore extends TreeToolbarButtonCore implements
|
||||
$html = '';
|
||||
|
||||
foreach ($data as $item) {
|
||||
$html .= Tools::jsonEncode($item).',';
|
||||
$html .= json_encode($item).',';
|
||||
if (array_key_exists('children', $item) && !empty($item['children'])) {
|
||||
$html .= $this->_renderData($item['children']);
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ class TreeToolbarSearchCategoriesCore extends TreeToolbarButtonCore implements
|
||||
$html = '';
|
||||
|
||||
foreach ($data as $item) {
|
||||
$html .= Tools::jsonEncode($item).',';
|
||||
$html .= json_encode($item).',';
|
||||
if (array_key_exists('children', $item) && !empty($item['children'])) {
|
||||
$html .= $this->_renderData($item['children']);
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ define('_PS_PRICE_DISPLAY_PRECISION_', Configuration::get('PS_PRICE_DISPLAY_PREC
|
||||
define('_PS_PRICE_COMPUTE_PRECISION_', _PS_PRICE_DISPLAY_PRECISION_);
|
||||
|
||||
if (Configuration::get('PS_USE_HTMLPURIFIER')) {
|
||||
require_once(_PS_TOOL_DIR_.'htmlpurifier/HTMLPurifier.standalone.php');
|
||||
require_once(_PS_TOOL_DIR_.'htmlpurifier/HTMLPurifier.auto.php');
|
||||
}
|
||||
|
||||
/* Load all languages */
|
||||
|
||||
@@ -140,7 +140,7 @@ define('_PS_TMP_IMG_DIR_', _PS_IMG_DIR_.'tmp/');
|
||||
define('_PS_TRANS_PATTERN_', '(.*[^\\\\])');
|
||||
define('_PS_MIN_TIME_GENERATE_PASSWD_', '360');
|
||||
if (!defined('_PS_MAGIC_QUOTES_GPC_')) {
|
||||
define('_PS_MAGIC_QUOTES_GPC_', get_magic_quotes_gpc());
|
||||
define('_PS_MAGIC_QUOTES_GPC_', function_exists('get_magic_quotes_gpc')? @get_magic_quotes_gpc() : false);
|
||||
}
|
||||
|
||||
define('_CAN_LOAD_FILES_', 1);
|
||||
|
||||
@@ -29,7 +29,14 @@ define('_PS_SMARTY_DIR_', _PS_TOOL_DIR_.'smarty/');
|
||||
require_once(_PS_SMARTY_DIR_.'Smarty.class.php');
|
||||
|
||||
global $smarty;
|
||||
$smarty = new SmartyCustom();
|
||||
if (Configuration::get('PS_SMARTY_LOCAL')) {
|
||||
$smarty = new SmartyCustom();
|
||||
} elseif (_PS_MODE_DEV_) {
|
||||
$smarty = new SmartyDev();
|
||||
} else {
|
||||
$smarty = new Smarty();
|
||||
}
|
||||
|
||||
$smarty->setCompileDir(_PS_CACHE_DIR_.'smarty/compile');
|
||||
$smarty->setCacheDir(_PS_CACHE_DIR_.'smarty/cache');
|
||||
if (!Tools::getSafeModeStatus()) {
|
||||
@@ -38,7 +45,7 @@ if (!Tools::getSafeModeStatus()) {
|
||||
$smarty->setConfigDir(_PS_SMARTY_DIR_.'configs');
|
||||
$smarty->caching = false;
|
||||
if (Configuration::get('PS_SMARTY_CACHING_TYPE') == 'mysql') {
|
||||
include(_PS_CLASS_DIR_.'/SmartyCacheResourceMysql.php');
|
||||
include _PS_CLASS_DIR_.'Smarty/SmartyCacheResourceMysql.php';
|
||||
$smarty->caching_type = 'mysql';
|
||||
}
|
||||
$smarty->force_compile = (Configuration::get('PS_SMARTY_FORCE_COMPILE') == _PS_SMARTY_FORCE_COMPILE_) ? true : false;
|
||||
@@ -55,7 +62,27 @@ if (defined('_PS_ADMIN_DIR_')) {
|
||||
} else {
|
||||
require_once(dirname(__FILE__).'/smartyfront.config.inc.php');
|
||||
}
|
||||
require_once SMARTY_PLUGINS_DIR.'modifier.truncate.php';
|
||||
|
||||
// This escape modifier is required for invoice PDF generation
|
||||
function smartyEscape($string, $esc_type = 'html', $char_set = null, $double_encode = true)
|
||||
{
|
||||
$escapeModifierFile = implode(
|
||||
DIRECTORY_SEPARATOR,
|
||||
array(
|
||||
SMARTY_PLUGINS_DIR,
|
||||
'modifier.escape.php',
|
||||
)
|
||||
);
|
||||
require_once $escapeModifierFile;
|
||||
|
||||
global $smarty;
|
||||
if (($esc_type === 'html' || $esc_type === 'htmlall') && $smarty->escape_html) {
|
||||
return $string;
|
||||
} else {
|
||||
return smarty_modifier_escape($string, $esc_type, $char_set, $double_encode);
|
||||
}
|
||||
}
|
||||
smartyRegisterFunction($smarty, 'modifier', 'truncate', 'smarty_modifier_truncate');
|
||||
smartyRegisterFunction($smarty, 'modifier', 'secureReferrer', array('Tools', 'secureReferrer'));
|
||||
|
||||
@@ -123,25 +150,6 @@ function smartyTruncate($params, &$smarty)
|
||||
return (isset($params['encode']) ? Tools::htmlentitiesUTF8($text, ENT_NOQUOTES) : $text);
|
||||
}
|
||||
|
||||
function smarty_modifier_truncate($string, $length = 80, $etc = '...', $break_words = false, $middle = false, $charset = 'UTF-8')
|
||||
{
|
||||
if (!$length) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$string = trim($string);
|
||||
|
||||
if (Tools::strlen($string) > $length) {
|
||||
$length -= min($length, Tools::strlen($etc));
|
||||
if (!$break_words && !$middle) {
|
||||
$string = preg_replace('/\s+?(\S+)?$/u', '', Tools::substr($string, 0, $length+1, $charset));
|
||||
}
|
||||
return !$middle ? Tools::substr($string, 0, $length, $charset).$etc : Tools::substr($string, 0, $length/2, $charset).$etc.Tools::substr($string, -$length/2, $length, $charset);
|
||||
} else {
|
||||
return $string;
|
||||
}
|
||||
}
|
||||
|
||||
function smarty_modifier_htmlentitiesUTF8($string)
|
||||
{
|
||||
return Tools::htmlentitiesUTF8($string);
|
||||
@@ -175,6 +183,9 @@ function smartyRegisterFunction($smarty, $type, $function, $params, $lazy = true
|
||||
// lazy is better if the function is not called on every page
|
||||
if ($lazy) {
|
||||
$lazy_register = SmartyLazyRegister::getInstance();
|
||||
if ($lazy_register->isRegistered($params)) {
|
||||
return;
|
||||
}
|
||||
$lazy_register->register($params);
|
||||
|
||||
if (is_array($params)) {
|
||||
@@ -221,61 +232,3 @@ function toolsConvertPrice($params, &$smarty)
|
||||
return Tools::convertPrice($params['price'], Context::getContext()->currency);
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to delay loading of external classes with smarty->register_plugin
|
||||
*/
|
||||
class SmartyLazyRegister
|
||||
{
|
||||
protected $registry = array();
|
||||
protected static $instance;
|
||||
|
||||
/**
|
||||
* Register a function or method to be dynamically called later
|
||||
* @param string|array $params function name or array(object name, method name)
|
||||
*/
|
||||
public function register($params)
|
||||
{
|
||||
if (is_array($params)) {
|
||||
$this->registry[$params[1]] = $params;
|
||||
} else {
|
||||
$this->registry[$params] = $params;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically call static function or method
|
||||
*
|
||||
* @param string $name function name
|
||||
* @param mixed $arguments function argument
|
||||
* @return mixed function return
|
||||
*/
|
||||
public function __call($name, $arguments)
|
||||
{
|
||||
$item = $this->registry[$name];
|
||||
|
||||
// case 1: call to static method - case 2 : call to static function
|
||||
if (is_array($item[1])) {
|
||||
return call_user_func_array($item[1].'::'.$item[0], array($arguments[0], &$arguments[1]));
|
||||
} else {
|
||||
$args = array();
|
||||
|
||||
foreach ($arguments as $a => $argument) {
|
||||
if ($a == 0) {
|
||||
$args[] = $arguments[0];
|
||||
} else {
|
||||
$args[] = &$arguments[$a];
|
||||
}
|
||||
}
|
||||
|
||||
return call_user_func_array($item, $args);
|
||||
}
|
||||
}
|
||||
|
||||
public static function getInstance()
|
||||
{
|
||||
if (!self::$instance) {
|
||||
self::$instance = new SmartyLazyRegister();
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ $smarty->force_compile = (Configuration::get('PS_SMARTY_FORCE_COMPILE') == _PS_S
|
||||
// But force compile_check since the performance impact is small and it is better for debugging
|
||||
$smarty->compile_check = true;
|
||||
|
||||
function smartyTranslate($params, &$smarty)
|
||||
function smartyTranslate($params, $smarty)
|
||||
{
|
||||
$htmlentities = !isset($params['js']);
|
||||
$pdf = isset($params['pdf']);
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
*/
|
||||
|
||||
global $smarty;
|
||||
$smarty->setTemplateDir(_PS_THEME_DIR_.'tpl');
|
||||
$smarty->setTemplateDir(_PS_THEME_DIR_);
|
||||
|
||||
if (Configuration::get('PS_HTML_THEME_COMPRESSION')) {
|
||||
$smarty->registerFilter('output', 'smartyMinifyHTML');
|
||||
@@ -34,7 +34,7 @@ if (Configuration::get('PS_JS_HTML_THEME_COMPRESSION')) {
|
||||
$smarty->registerFilter('output', 'smartyPackJSinHTML');
|
||||
}
|
||||
|
||||
function smartyTranslate($params, &$smarty)
|
||||
function smartyTranslate($params, $smarty)
|
||||
{
|
||||
global $_LANG;
|
||||
|
||||
@@ -48,7 +48,47 @@ function smartyTranslate($params, &$smarty)
|
||||
$params['mod'] = false;
|
||||
}
|
||||
if (!isset($params['sprintf'])) {
|
||||
$params['sprintf'] = null;
|
||||
$params['sprintf'] = array();
|
||||
}
|
||||
|
||||
if (!isset($params['d'])) {
|
||||
$params['d'] = null;
|
||||
}
|
||||
|
||||
if (!is_null($params['d'])) {
|
||||
if (isset($params['tags'])) {
|
||||
$backTrace = debug_backtrace();
|
||||
|
||||
$errorMessage = sprintf(
|
||||
'Unable to translate "%s" in %s. tags() is not supported anymore, please use sprintf().',
|
||||
$params['s'],
|
||||
$backTrace[0]['args'][1]->template_resource
|
||||
);
|
||||
|
||||
if (_PS_MODE_DEV_) {
|
||||
throw new Exception($errorMessage);
|
||||
} else {
|
||||
PrestaShopLogger::addLog($errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_array($params['sprintf'])) {
|
||||
$backTrace = debug_backtrace();
|
||||
|
||||
$errorMessage = sprintf(
|
||||
'Unable to translate "%s" in %s. sprintf() parameter should be an array.',
|
||||
$params['s'],
|
||||
$backTrace[0]['args'][1]->template_resource
|
||||
);
|
||||
|
||||
if (_PS_MODE_DEV_) {
|
||||
throw new Exception($errorMessage);
|
||||
} else {
|
||||
PrestaShopLogger::addLog($errorMessage);
|
||||
|
||||
return $params['s'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$string = str_replace('\'', '\\\'', $params['s']);
|
||||
|
||||
@@ -495,7 +495,7 @@ class AdminAddressesControllerCore extends AdminController
|
||||
$customer = Customer::searchByName($email);
|
||||
if (!empty($customer)) {
|
||||
$customer = $customer['0'];
|
||||
echo Tools::jsonEncode(array('infos' => pSQL($customer['firstname']).'_'.pSQL($customer['lastname']).'_'.pSQL($customer['company'])));
|
||||
echo json_encode(array('infos' => pSQL($customer['firstname']).'_'.pSQL($customer['lastname']).'_'.pSQL($customer['company'])));
|
||||
}
|
||||
}
|
||||
die;
|
||||
|
||||
@@ -76,7 +76,7 @@ class AdminAttributeGeneratorControllerCore extends AdminController
|
||||
protected static function createCombinations($list)
|
||||
{
|
||||
if (count($list) <= 1) {
|
||||
return count($list) ? array_map(create_function('$v', 'return (array($v));'), $list[0]) : $list;
|
||||
return count($list) ? array_map(function ($v) {return (array($v));}, $list[0]) : $list;
|
||||
}
|
||||
$res = array();
|
||||
$first = array_pop($list);
|
||||
|
||||
@@ -297,7 +297,7 @@ class AdminAttributesGroupsControllerCore extends AdminController
|
||||
$associations = array();
|
||||
}
|
||||
|
||||
$this->fields_form['shop_associations'] = Tools::jsonEncode($associations);
|
||||
$this->fields_form['shop_associations'] = json_encode($associations);
|
||||
|
||||
$this->fields_form['input'][] = array(
|
||||
'type' => 'color',
|
||||
|
||||
@@ -652,7 +652,7 @@ class AdminCarrierWizardControllerCore extends AdminController
|
||||
$return['errors'] = $this->errors;
|
||||
}
|
||||
if (count($this->errors) || $die) {
|
||||
die(Tools::jsonEncode($return));
|
||||
die(json_encode($return));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -870,7 +870,7 @@ class AdminCarrierWizardControllerCore extends AdminController
|
||||
$return['id_carrier'] = $carrier->id;
|
||||
}
|
||||
}
|
||||
die(Tools::jsonEncode($return));
|
||||
die(json_encode($return));
|
||||
}
|
||||
|
||||
protected function changeGroups($id_carrier, $delete = true)
|
||||
|
||||
@@ -140,7 +140,7 @@ class AdminCartRulesControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
}
|
||||
echo Tools::jsonEncode(array('html' => $html, 'next_link' => $next_link));
|
||||
echo json_encode(array('html' => $html, 'next_link' => $next_link));
|
||||
}
|
||||
|
||||
public function setMedia()
|
||||
@@ -589,7 +589,7 @@ class AdminCartRulesControllerCore extends AdminController
|
||||
)
|
||||
ORDER BY c.`firstname`, c.`lastname` ASC
|
||||
LIMIT 50');
|
||||
die(Tools::jsonEncode($customers));
|
||||
die(json_encode($customers));
|
||||
}
|
||||
// Both product filter (free product and product discount) search for products
|
||||
if (Tools::isSubmit('giftProductFilter') || Tools::isSubmit('reductionProductFilter')) {
|
||||
@@ -599,7 +599,7 @@ class AdminCartRulesControllerCore extends AdminController
|
||||
$products,
|
||||
$this->context->employee->id_profile
|
||||
);
|
||||
die(Tools::jsonEncode($products));
|
||||
die(json_encode($products));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -642,7 +642,7 @@ class AdminCartRulesControllerCore extends AdminController
|
||||
public function ajaxProcessSearchProducts()
|
||||
{
|
||||
$array = $this->searchProducts(Tools::getValue('product_search'));
|
||||
$this->content = trim(Tools::jsonEncode($array));
|
||||
$this->content = trim(json_encode($array));
|
||||
}
|
||||
|
||||
public function renderForm()
|
||||
@@ -771,6 +771,6 @@ class AdminCartRulesControllerCore extends AdminController
|
||||
if ($vouchers = CartRule::getCartsRuleByCode(Tools::getValue('q'), (int)$this->context->language->id, true)) {
|
||||
$found = true;
|
||||
}
|
||||
echo Tools::jsonEncode(array('found' => $found, 'vouchers' => $vouchers));
|
||||
echo json_encode(array('found' => $found, 'vouchers' => $vouchers));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -403,10 +403,10 @@ class AdminCartsControllerCore extends AdminController
|
||||
$errors[] = Tools::displayError('Invalid combination');
|
||||
}
|
||||
if (count($errors)) {
|
||||
die(Tools::jsonEncode($errors));
|
||||
die(json_encode($errors));
|
||||
}
|
||||
if ($this->context->cart->deleteProduct($id_product, $id_product_attribute, (int)Tools::getValue('id_customization'))) {
|
||||
echo Tools::jsonEncode($this->ajaxReturnVars());
|
||||
echo json_encode($this->ajaxReturnVars());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -520,7 +520,7 @@ class AdminCartsControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
echo Tools::jsonEncode(array_merge($this->ajaxReturnVars(), array('errors' => $errors)));
|
||||
echo json_encode(array_merge($this->ajaxReturnVars(), array('errors' => $errors)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -541,7 +541,7 @@ class AdminCartsControllerCore extends AdminController
|
||||
$this->context->cart->gift_message = $gift_message;
|
||||
}
|
||||
$this->context->cart->save();
|
||||
echo Tools::jsonEncode($this->ajaxReturnVars());
|
||||
echo json_encode($this->ajaxReturnVars());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -563,7 +563,7 @@ class AdminCartsControllerCore extends AdminController
|
||||
} elseif (Validate::isLoadedObject($message)) {
|
||||
$message->delete();
|
||||
}
|
||||
echo Tools::jsonEncode($this->ajaxReturnVars());
|
||||
echo json_encode($this->ajaxReturnVars());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -593,7 +593,7 @@ class AdminCartsControllerCore extends AdminController
|
||||
|
||||
$result = $this->ajaxReturnVars();
|
||||
$result['cart_detail_html'] = $cart_dtl_tpl;//tpl is added to the returned array
|
||||
echo Tools::jsonEncode($result);
|
||||
echo json_encode($result);
|
||||
}
|
||||
}
|
||||
public function ajaxProcessUpdateLang()
|
||||
@@ -604,7 +604,7 @@ class AdminCartsControllerCore extends AdminController
|
||||
$this->context->cart->id_lang = (int)$lang->id;
|
||||
$this->context->cart->save();
|
||||
}
|
||||
echo Tools::jsonEncode($this->ajaxReturnVars());
|
||||
echo json_encode($this->ajaxReturnVars());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -623,7 +623,7 @@ class AdminCartsControllerCore extends AdminController
|
||||
$errors[] = Tools::displayError('The order cannot be renewed.');
|
||||
} else {
|
||||
$this->context->cart = $new_cart['cart'];
|
||||
echo Tools::jsonEncode($this->ajaxReturnVars());
|
||||
echo json_encode($this->ajaxReturnVars());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -632,7 +632,7 @@ class AdminCartsControllerCore extends AdminController
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1') {
|
||||
if ($this->context->cart->removeCartRule((int)Tools::getValue('id_cart_rule'))) {
|
||||
echo Tools::jsonEncode($this->ajaxReturnVars());
|
||||
echo json_encode($this->ajaxReturnVars());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -663,7 +663,7 @@ class AdminCartsControllerCore extends AdminController
|
||||
$this->context->cart->addCartRule((int)$cart_rule->id);
|
||||
}
|
||||
|
||||
echo Tools::jsonEncode($this->ajaxReturnVars());
|
||||
echo json_encode($this->ajaxReturnVars());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -681,14 +681,14 @@ class AdminCartsControllerCore extends AdminController
|
||||
$errors[] = Tools::displayError('Can\'t add the voucher.');
|
||||
}
|
||||
}
|
||||
echo Tools::jsonEncode(array_merge($this->ajaxReturnVars(), array('errors' => $errors)));
|
||||
echo json_encode(array_merge($this->ajaxReturnVars(), array('errors' => $errors)));
|
||||
}
|
||||
}
|
||||
|
||||
public function ajaxProcessUpdateAddress()
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1') {
|
||||
echo Tools::jsonEncode(array('addresses' => $this->context->customer->getAddresses((int)$this->context->cart->id_lang)));
|
||||
echo json_encode(array('addresses' => $this->context->customer->getAddresses((int)$this->context->cart->id_lang)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -709,7 +709,7 @@ class AdminCartsControllerCore extends AdminController
|
||||
/*$this->context->cart->id_address_invoice = (int)$address_invoice->id;*/
|
||||
$this->context->cart->save();
|
||||
|
||||
echo Tools::jsonEncode($this->ajaxReturnVars());
|
||||
echo json_encode($this->ajaxReturnVars());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -825,7 +825,7 @@ class AdminCartsControllerCore extends AdminController
|
||||
$to_return = array_merge($this->ajaxReturnVars(), array('found' => false));
|
||||
}
|
||||
|
||||
echo Tools::jsonEncode($to_return);
|
||||
echo json_encode($to_return);
|
||||
}
|
||||
|
||||
public function ajaxReturnVars()
|
||||
@@ -879,7 +879,7 @@ class AdminCartsControllerCore extends AdminController
|
||||
|
||||
public function displayAjaxGetSummary()
|
||||
{
|
||||
echo Tools::jsonEncode($this->ajaxReturnVars());
|
||||
echo json_encode($this->ajaxReturnVars());
|
||||
}
|
||||
|
||||
public function ajaxProcessUpdateProductPrice()
|
||||
@@ -903,7 +903,7 @@ class AdminCartsControllerCore extends AdminController
|
||||
$specific_price->from = '0000-00-00 00:00:00';
|
||||
$specific_price->to = '0000-00-00 00:00:00';
|
||||
$specific_price->add();
|
||||
echo Tools::jsonEncode($this->ajaxReturnVars());
|
||||
echo json_encode($this->ajaxReturnVars());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -961,14 +961,14 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
public function ajaxProcessStatusCategory()
|
||||
{
|
||||
if (!$id_category = (int)Tools::getValue('id_category')) {
|
||||
die(Tools::jsonEncode(array('success' => false, 'error' => true, 'text' => $this->l('Failed to update the status'))));
|
||||
die(json_encode(array('success' => false, 'error' => true, 'text' => $this->l('Failed to update the status'))));
|
||||
} else {
|
||||
$category = new Category((int)$id_category);
|
||||
if (Validate::isLoadedObject($category)) {
|
||||
$category->active = $category->active == 1 ? 0 : 1;
|
||||
$category->save() ?
|
||||
die(Tools::jsonEncode(array('success' => true, 'text' => $this->l('The status has been updated successfully')))) :
|
||||
die(Tools::jsonEncode(array('success' => false, 'error' => true, 'text' => $this->l('Failed to update the status'))));
|
||||
die(json_encode(array('success' => true, 'text' => $this->l('The status has been updated successfully')))) :
|
||||
die(json_encode(array('success' => false, 'error' => true, 'text' => $this->l('Failed to update the status'))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -896,7 +896,7 @@ class AdminCustomerThreadsControllerCore extends AdminController
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('syncImapMail')) {
|
||||
die(Tools::jsonEncode($this->syncImap()));
|
||||
die(json_encode($this->syncImap()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1104,7 +1104,7 @@ class AdminCustomersControllerCore extends AdminController
|
||||
$to_return = array('found' => false);
|
||||
}
|
||||
|
||||
$this->content = Tools::jsonEncode($to_return);
|
||||
$this->content = json_encode($to_return);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -370,7 +370,7 @@ class AdminDashboardControllerCore extends AdminController
|
||||
'extra' => (int)Tools::getValue('extra')
|
||||
);
|
||||
|
||||
die(Tools::jsonEncode(Hook::exec('dashboardData', $params, $id_module, true, true, (int)Tools::getValue('dashboard_use_push'))));
|
||||
die(json_encode(Hook::exec('dashboardData', $params, $id_module, true, true, (int)Tools::getValue('dashboard_use_push'))));
|
||||
}
|
||||
|
||||
public function ajaxProcessSetSimulationMode()
|
||||
@@ -437,7 +437,7 @@ class AdminDashboardControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
}
|
||||
die(Tools::jsonEncode($return));
|
||||
die(json_encode($return));
|
||||
}
|
||||
|
||||
public function ajaxProcessSaveDashConfig()
|
||||
@@ -475,6 +475,6 @@ class AdminDashboardControllerCore extends AdminController
|
||||
$return['widget_html'] = $module_obj->$hook($params);
|
||||
}
|
||||
|
||||
die(Tools::jsonEncode($return));
|
||||
die(json_encode($return));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -673,6 +673,6 @@ class AdminEmployeesControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
}
|
||||
die(Tools::jsonEncode($this->tabs_list));
|
||||
die(json_encode($this->tabs_list));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -451,7 +451,7 @@ class AdminGroupsControllerCore extends AdminController
|
||||
$result['discount'] = $category_reduction;
|
||||
$result['hasError'] = false;
|
||||
}
|
||||
die(Tools::jsonEncode($result));
|
||||
die(json_encode($result));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -58,9 +58,9 @@ class AdminImagesControllerCore extends AdminController
|
||||
'height' => array('title' => $this->l('Height'), 'suffix' => ' px'),
|
||||
'products' => array('title' => $this->l('Products'), 'align' => 'center', 'type' => 'bool', 'callback' => 'printEntityActiveIcon', 'orderby' => false),
|
||||
'categories' => array('title' => $this->l('Categories'), 'align' => 'center', 'type' => 'bool', 'callback' => 'printEntityActiveIcon', 'orderby' => false),
|
||||
'manufacturers' => array('title' => $this->l('Manufacturers'), 'align' => 'center', 'type' => 'bool', 'callback' => 'printEntityActiveIcon', 'orderby' => false),
|
||||
'suppliers' => array('title' => $this->l('Suppliers'), 'align' => 'center', 'type' => 'bool', 'callback' => 'printEntityActiveIcon', 'orderby' => false),
|
||||
'stores' => array('title' => $this->l('Stores'), 'align' => 'center', 'type' => 'bool', 'callback' => 'printEntityActiveIcon', 'orderby' => false)
|
||||
// 'manufacturers' => array('title' => $this->l('Manufacturers'), 'align' => 'center', 'type' => 'bool', 'callback' => 'printEntityActiveIcon', 'orderby' => false),
|
||||
// 'suppliers' => array('title' => $this->l('Suppliers'), 'align' => 'center', 'type' => 'bool', 'callback' => 'printEntityActiveIcon', 'orderby' => false),
|
||||
// 'stores' => array('title' => $this->l('Stores'), 'align' => 'center', 'type' => 'bool', 'callback' => 'printEntityActiveIcon', 'orderby' => false)
|
||||
);
|
||||
|
||||
// Scenes tab has been removed by default from the installation, but may still exists in updates
|
||||
@@ -267,46 +267,46 @@ class AdminImagesControllerCore extends AdminController
|
||||
),
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Manufacturers'),
|
||||
'name' => 'manufacturers',
|
||||
'required' => false,
|
||||
'is_bool' => true,
|
||||
'hint' => $this->l('This type will be used for Manufacturer images.'),
|
||||
'values' => array(
|
||||
array(
|
||||
'id' => 'manufacturers_on',
|
||||
'value' => 1,
|
||||
'label' => $this->l('Enabled')
|
||||
),
|
||||
array(
|
||||
'id' => 'manufacturers_off',
|
||||
'value' => 0,
|
||||
'label' => $this->l('Disabled')
|
||||
),
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Suppliers'),
|
||||
'name' => 'suppliers',
|
||||
'required' => false,
|
||||
'is_bool' => true,
|
||||
'hint' => $this->l('This type will be used for Supplier images.'),
|
||||
'values' => array(
|
||||
array(
|
||||
'id' => 'suppliers_on',
|
||||
'value' => 1,
|
||||
'label' => $this->l('Enabled')
|
||||
),
|
||||
array(
|
||||
'id' => 'suppliers_off',
|
||||
'value' => 0,
|
||||
'label' => $this->l('Disabled')
|
||||
),
|
||||
)
|
||||
),
|
||||
// array(
|
||||
// 'type' => 'switch',
|
||||
// 'label' => $this->l('Manufacturers'),
|
||||
// 'name' => 'manufacturers',
|
||||
// 'required' => false,
|
||||
// 'is_bool' => true,
|
||||
// 'hint' => $this->l('This type will be used for Manufacturer images.'),
|
||||
// 'values' => array(
|
||||
// array(
|
||||
// 'id' => 'manufacturers_on',
|
||||
// 'value' => 1,
|
||||
// 'label' => $this->l('Enabled')
|
||||
// ),
|
||||
// array(
|
||||
// 'id' => 'manufacturers_off',
|
||||
// 'value' => 0,
|
||||
// 'label' => $this->l('Disabled')
|
||||
// ),
|
||||
// )
|
||||
// ),
|
||||
// array(
|
||||
// 'type' => 'switch',
|
||||
// 'label' => $this->l('Suppliers'),
|
||||
// 'name' => 'suppliers',
|
||||
// 'required' => false,
|
||||
// 'is_bool' => true,
|
||||
// 'hint' => $this->l('This type will be used for Supplier images.'),
|
||||
// 'values' => array(
|
||||
// array(
|
||||
// 'id' => 'suppliers_on',
|
||||
// 'value' => 1,
|
||||
// 'label' => $this->l('Enabled')
|
||||
// ),
|
||||
// array(
|
||||
// 'id' => 'suppliers_off',
|
||||
// 'value' => 0,
|
||||
// 'label' => $this->l('Disabled')
|
||||
// ),
|
||||
// )
|
||||
// ),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Scenes'),
|
||||
@@ -328,26 +328,26 @@ class AdminImagesControllerCore extends AdminController
|
||||
),
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Stores'),
|
||||
'name' => 'stores',
|
||||
'required' => false,
|
||||
'is_bool' => true,
|
||||
'hint' => $this->l('This type will be used for Store images.'),
|
||||
'values' => array(
|
||||
array(
|
||||
'id' => 'stores_on',
|
||||
'value' => 1,
|
||||
'label' => $this->l('Enabled')
|
||||
),
|
||||
array(
|
||||
'id' => 'stores_off',
|
||||
'value' => 0,
|
||||
'label' => $this->l('Disabled')
|
||||
),
|
||||
)
|
||||
),
|
||||
// array(
|
||||
// 'type' => 'switch',
|
||||
// 'label' => $this->l('Stores'),
|
||||
// 'name' => 'stores',
|
||||
// 'required' => false,
|
||||
// 'is_bool' => true,
|
||||
// 'hint' => $this->l('This type will be used for Store images.'),
|
||||
// 'values' => array(
|
||||
// array(
|
||||
// 'id' => 'stores_on',
|
||||
// 'value' => 1,
|
||||
// 'label' => $this->l('Enabled')
|
||||
// ),
|
||||
// array(
|
||||
// 'id' => 'stores_off',
|
||||
// 'value' => 0,
|
||||
// 'label' => $this->l('Disabled')
|
||||
// ),
|
||||
// )
|
||||
// ),
|
||||
),
|
||||
'submit' => array(
|
||||
'title' => $this->l('Save')
|
||||
|
||||
@@ -665,7 +665,7 @@ class AdminImportControllerCore extends AdminController
|
||||
$_FILES['file']['filename'] = $filename_prefix.str_replace('\0', '', $_FILES['file']['name']);
|
||||
}
|
||||
|
||||
die(Tools::jsonEncode($_FILES));
|
||||
die(json_encode($_FILES));
|
||||
}
|
||||
|
||||
public function renderView()
|
||||
|
||||
@@ -170,11 +170,11 @@ class AdminInformationControllerCore extends AdminController
|
||||
$this->file_list = array('missing' => array(), 'updated' => array());
|
||||
$xml = @simplexml_load_file(_PS_API_URL_.'/xml/md5/'._PS_VERSION_.'.xml');
|
||||
if (!$xml || !isset($xml->ps_root_dir[0])) {
|
||||
die(Tools::jsonEncode($this->file_list));
|
||||
die(json_encode($this->file_list));
|
||||
}
|
||||
|
||||
$this->getListOfUpdatedFiles($xml->ps_root_dir[0]);
|
||||
die(Tools::jsonEncode($this->file_list));
|
||||
die(json_encode($this->file_list));
|
||||
}
|
||||
|
||||
public function getListOfUpdatedFiles(SimpleXMLElement $dir, $path = '')
|
||||
|
||||
@@ -543,7 +543,7 @@ class AdminLanguagesControllerCore extends AdminController
|
||||
|
||||
// Get all iso code available
|
||||
if ($lang_packs = Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/get_language_pack.php?version='.Tools::getValue('ps_version').'&iso_lang='.Tools::strtolower(Tools::getValue('iso_lang')))) {
|
||||
$result = Tools::jsonDecode($lang_packs);
|
||||
$result = json_decode($lang_packs);
|
||||
if ($lang_packs !== '' && $result && !isset($result->error)) {
|
||||
$this->status = 'ok';
|
||||
$this->content = $lang_packs;
|
||||
|
||||
@@ -219,14 +219,14 @@ class AdminLoginControllerCore extends AdminController
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('ajax')) {
|
||||
die(Tools::jsonEncode(array('hasErrors' => false, 'redirect' => $url)));
|
||||
die(json_encode(array('hasErrors' => false, 'redirect' => $url)));
|
||||
} else {
|
||||
$this->redirect_after = $url;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Tools::isSubmit('ajax')) {
|
||||
die(Tools::jsonEncode(array('hasErrors' => true, 'errors' => $this->errors)));
|
||||
die(json_encode(array('hasErrors' => true, 'errors' => $this->errors)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,19 +270,19 @@ class AdminLoginControllerCore extends AdminController
|
||||
if (!$result) {
|
||||
$this->errors[] = Tools::displayError('An error occurred while attempting to change your password.');
|
||||
} else {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'hasErrors' => false,
|
||||
'confirm' => $this->l('Your password has been emailed to you.', 'AdminTab', false, false)
|
||||
)));
|
||||
}
|
||||
} else {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'hasErrors' => true,
|
||||
'errors' => array(Tools::displayError('An error occurred while attempting to change your password.'))
|
||||
)));
|
||||
}
|
||||
} elseif (Tools::isSubmit('ajax')) {
|
||||
die(Tools::jsonEncode(array('hasErrors' => true, 'errors' => $this->errors)));
|
||||
die(json_encode(array('hasErrors' => true, 'errors' => $this->errors)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ class AdminModulesControllerCore extends AdminController
|
||||
|
||||
public function displayAjaxRefreshModuleList()
|
||||
{
|
||||
echo Tools::jsonEncode(array('status' => $this->status));
|
||||
echo json_encode(array('status' => $this->status));
|
||||
}
|
||||
|
||||
|
||||
@@ -403,7 +403,7 @@ class AdminModulesControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
} else {
|
||||
require_once(_PS_TOOL_DIR_.'tar/Archive_Tar.php');
|
||||
require_once _PS_TOOL_DIR_.'tar/Tar.php';
|
||||
$archive = new Archive_Tar($file);
|
||||
if ($archive->extract($tmp_folder)) {
|
||||
$zip_folders = scandir($tmp_folder);
|
||||
@@ -1091,7 +1091,7 @@ class AdminModulesControllerCore extends AdminController
|
||||
|
||||
// Get the list of installed module ans prepare it for ajax call.
|
||||
if (($list = Tools::getValue('installed_modules'))) {
|
||||
Context::getContext()->smarty->assign('installed_modules', Tools::jsonEncode(explode('|', $list)));
|
||||
Context::getContext()->smarty->assign('installed_modules', json_encode(explode('|', $list)));
|
||||
}
|
||||
|
||||
// If redirect parameter is present and module already installed, we redirect on configuration module page
|
||||
@@ -1532,7 +1532,7 @@ class AdminModulesControllerCore extends AdminController
|
||||
}
|
||||
|
||||
// AutoComplete array
|
||||
$autocomplete_list .= Tools::jsonEncode(array(
|
||||
$autocomplete_list .= json_encode(array(
|
||||
'displayName' => (string)$module->displayName,
|
||||
'desc' => (string)$module->description,
|
||||
'name' => (string)$module->name,
|
||||
|
||||
@@ -552,7 +552,7 @@ class AdminModulesPositionsControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
$hookableList['hasError'] = false;
|
||||
die(Tools::jsonEncode($hookableList));
|
||||
die(json_encode($hookableList));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -582,7 +582,7 @@ class AdminModulesPositionsControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
}
|
||||
die(Tools::jsonEncode($hookableModulesList));
|
||||
die(json_encode($hookableModulesList));
|
||||
}
|
||||
}
|
||||
public function ajaxProcessSaveHook()
|
||||
|
||||
@@ -133,6 +133,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
'align' => 'text-right',
|
||||
'type' => 'price',
|
||||
'currency' => true,
|
||||
'havingFilter' => true,
|
||||
'callback' => 'setOrderCurrency',
|
||||
'badge_success' => true,
|
||||
),
|
||||
@@ -1548,7 +1549,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$bookingOrderInfo = $objBookingDetail->getBookingDataByOrderId($order->id);
|
||||
|
||||
// hotel booking statuses
|
||||
$htlOrderStatus = HotelOrderStatus::getAllHotelOrderStatus();
|
||||
$htlOrderStatus = HotelBookingDetail::getAllHotelOrderStatus();
|
||||
|
||||
$this->tpl_view_vars = array(
|
||||
// refund info
|
||||
@@ -1715,7 +1716,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$to_return = array('found' => false);
|
||||
}
|
||||
|
||||
$this->content = Tools::jsonEncode($to_return);
|
||||
$this->content = json_encode($to_return);
|
||||
}
|
||||
|
||||
public function ajaxProcessSendMailValidateOrder()
|
||||
@@ -1745,11 +1746,11 @@ class AdminOrdersControllerCore extends AdminController
|
||||
true,
|
||||
$cart->id_shop
|
||||
)) {
|
||||
die(Tools::jsonEncode(array('errors' => false, 'result' => $this->l('The email was sent to your customer.'))));
|
||||
die(json_encode(array('errors' => false, 'result' => $this->l('The email was sent to your customer.'))));
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->content = Tools::jsonEncode(array('errors' => true, 'result' => $this->l('Error in sending the email to your customer.')));
|
||||
$this->content = json_encode(array('errors' => true, 'result' => $this->l('Error in sending the email to your customer.')));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1759,7 +1760,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$id_order = (int) Tools::getValue('id_order');
|
||||
$order = new Order($id_order);
|
||||
if (!Validate::isLoadedObject($order)) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('The order object cannot be loaded.')
|
||||
)));
|
||||
@@ -1768,7 +1769,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$old_cart_rules = Context::getContext()->cart->getCartRules();
|
||||
|
||||
if ($order->hasBeenShipped()) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('You cannot add products to delivered orders. ')
|
||||
)));
|
||||
@@ -1782,37 +1783,37 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$curr_date = date('Y-m-d');
|
||||
/*Validations*/
|
||||
if ($date_from == '') {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Please Enter Check In Date.'),
|
||||
)));
|
||||
} elseif (!Validate::isDateFormat($date_from)) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Please Enter a Valid Check In Date.'),
|
||||
)));
|
||||
} elseif ($date_to == '') {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Please Enter Check Out Date.'),
|
||||
)));
|
||||
} elseif (!Validate::isDateFormat($date_to)) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Please Enter a valid Check out Date.'),
|
||||
)));
|
||||
} elseif ($date_from < $curr_date) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Check In date should not be date before current date.'),
|
||||
)));
|
||||
} elseif ($date_to <= $date_from) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Check out Date Should be after Check In date.'),
|
||||
)));
|
||||
} elseif (!Validate::isUnsignedInt($product_informations['product_quantity'])) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Please Enter a valid Quantity.'),
|
||||
)));
|
||||
@@ -1836,19 +1837,19 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$total_available_rooms = $hotel_room_data['stats']['num_avail'];
|
||||
|
||||
if ($total_available_rooms < $req_rm) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Required number of rooms are not available.'),
|
||||
)));
|
||||
}
|
||||
} else {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Some error occured Please try again.'),
|
||||
)));
|
||||
}
|
||||
} else {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Some error occured Please try again.'),
|
||||
)));
|
||||
@@ -1865,7 +1866,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$idProduct = $product_informations['product_id'];
|
||||
$product = new Product($idProduct, false, $order->id_lang);
|
||||
if (!Validate::isLoadedObject($product)) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('The product object cannot be loaded.')
|
||||
)));
|
||||
@@ -1874,7 +1875,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
if (isset($product_informations['product_attribute_id']) && $product_informations['product_attribute_id']) {
|
||||
$combination = new Combination($product_informations['product_attribute_id']);
|
||||
if (!Validate::isLoadedObject($combination)) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('The combination object cannot be loaded.')
|
||||
)));
|
||||
@@ -1986,9 +1987,9 @@ class AdminOrdersControllerCore extends AdminController
|
||||
if ($update_quantity < 0) {
|
||||
// If product has attribute, minimal quantity is set with minimal quantity of attribute
|
||||
$minimal_quantity = ($product_informations['product_attribute_id']) ? Attribute::getAttributeMinimalQty($product_informations['product_attribute_id']) : $product->minimal_quantity;
|
||||
die(Tools::jsonEncode(array('error' => sprintf(Tools::displayError('You must add %d minimum quantity', false), $minimal_quantity))));
|
||||
die(json_encode(array('error' => sprintf(Tools::displayError('You must add %d minimum quantity', false), $minimal_quantity))));
|
||||
} elseif (!$update_quantity) {
|
||||
die(Tools::jsonEncode(array('error' => Tools::displayError('You already have the maximum quantity available for this product.', false))));
|
||||
die(json_encode(array('error' => Tools::displayError('You already have the maximum quantity available for this product.', false))));
|
||||
}
|
||||
|
||||
// If order is valid, we can create a new invoice or edit an existing invoice
|
||||
@@ -2264,7 +2265,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => true,
|
||||
//'view' => $this->createTemplate('_product_line.tpl')->fetch(),
|
||||
'can_edit' => $this->tabAccess['add'],
|
||||
@@ -2290,7 +2291,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
{
|
||||
// $order_detail = new OrderDetail(Tools::getValue('id_order_detail'));
|
||||
// if (!Validate::isLoadedObject($order_detail))
|
||||
// die(Tools::jsonEncode(array(
|
||||
// die(json_encode(array(
|
||||
// 'result' => false,
|
||||
// 'error' => Tools::displayError('The OrderDetail object cannot be loaded.')
|
||||
// )));
|
||||
@@ -2298,7 +2299,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$id_product = Tools::getValue('id_product');
|
||||
$product = new Product($id_product);
|
||||
if (!Validate::isLoadedObject($product)) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('The product object cannot be loaded.')
|
||||
)));
|
||||
@@ -2306,13 +2307,13 @@ class AdminOrdersControllerCore extends AdminController
|
||||
|
||||
$address = new Address(Tools::getValue('id_address'));
|
||||
if (!Validate::isLoadedObject($address)) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('The address object cannot be loaded.')
|
||||
)));
|
||||
}
|
||||
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => true,
|
||||
'product' => $product,
|
||||
'tax_rate' => $product->getTaxesRate($address),
|
||||
@@ -2354,47 +2355,47 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$qty_diff = $product_quantity - $old_product_quantity;
|
||||
/*By webkul to validate fields before deleting the cart and order data form the tables*/
|
||||
if ($id_hotel == '') {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Hotel Id is mising.'),
|
||||
)));
|
||||
} elseif ($id_room == '') {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Room Id is missing.'),
|
||||
)));
|
||||
} elseif ($new_date_from == '') {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Please Enter Check In Date.'),
|
||||
)));
|
||||
} elseif (!Validate::isDateFormat($new_date_from)) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Please Enter a Valid Check In Date.'),
|
||||
)));
|
||||
} elseif ($new_date_to == '') {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Please Enter Check Out Date.'),
|
||||
)));
|
||||
} elseif (!Validate::isDateFormat($new_date_to)) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Please Enter a valid Check out Date.'),
|
||||
)));
|
||||
} elseif ($new_date_from < $curr_date) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Check In date should not be after current date.'),
|
||||
)));
|
||||
} elseif ($new_date_to <= $new_date_from) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Check out Date Should be after Check In date.'),
|
||||
)));
|
||||
} elseif (!Validate::isUnsignedInt($product_quantity)) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Invalid quantity.'),
|
||||
)));
|
||||
@@ -2402,7 +2403,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
|
||||
$rooms_booked = $obj_booking_detail->getRoomBookinInformationForDateRangeByOrder($id_room, $old_date_from, $old_date_to, $new_date_from, $new_date_to);
|
||||
if ($rooms_booked) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('This Room Unavailable For Selected Duration.'),
|
||||
)));
|
||||
@@ -2580,7 +2581,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
));
|
||||
|
||||
if (!$res) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => $res,
|
||||
'error' => Tools::displayError('An error occurred while editing the product line.')
|
||||
)));
|
||||
@@ -2597,7 +2598,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
|
||||
$this->sendChangedNotification($order);
|
||||
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => $res,
|
||||
'view' => $view,
|
||||
'can_edit' => $this->tabAccess['add'],
|
||||
@@ -2627,32 +2628,32 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$product_quantity = (int) $obj_booking_detail->getNumberOfDays($date_from, $date_to);
|
||||
/*By webkul to validate fields before deleting the cart and order data form the tables*/
|
||||
if ($id_hotel == '') {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Hotel Id is mising.'),
|
||||
)));
|
||||
} elseif ($id_room == '') {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Room Id is missing.'),
|
||||
)));
|
||||
} elseif ($date_from == '') {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Check In Date is missing.'),
|
||||
)));
|
||||
} elseif ($date_to == '') {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Check Out Date is missing.'),
|
||||
)));
|
||||
} elseif ($date_to == '') {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Check Out Date is missing.'),
|
||||
)));
|
||||
} elseif (!Validate::isUnsignedInt($product_quantity)) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Invalid quantity.'),
|
||||
)));
|
||||
@@ -2757,7 +2758,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
}
|
||||
|
||||
if (!$res) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => $res,
|
||||
'error' => Tools::displayError('An error occurred while attempting to delete the product line.')
|
||||
)));
|
||||
@@ -2795,7 +2796,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
|
||||
$this->sendChangedNotification($order);
|
||||
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => $res,
|
||||
'order' => $order,
|
||||
'invoices' => $invoice_array,
|
||||
@@ -2807,28 +2808,28 @@ class AdminOrdersControllerCore extends AdminController
|
||||
protected function doEditProductValidation(OrderDetail $order_detail, Order $order, OrderInvoice $order_invoice = null)
|
||||
{
|
||||
if (!Validate::isLoadedObject($order_detail)) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('The Order Detail object could not be loaded.')
|
||||
)));
|
||||
}
|
||||
|
||||
if (!empty($order_invoice) && !Validate::isLoadedObject($order_invoice)) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('The invoice object cannot be loaded.')
|
||||
)));
|
||||
}
|
||||
|
||||
if (!Validate::isLoadedObject($order)) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('The order object cannot be loaded.')
|
||||
)));
|
||||
}
|
||||
|
||||
if ($order_detail->id_order != $order->id) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('You cannot edit the order detail for this order.')
|
||||
)));
|
||||
@@ -2836,14 +2837,14 @@ class AdminOrdersControllerCore extends AdminController
|
||||
|
||||
// We can't edit a delivered order
|
||||
if ($order->hasBeenDelivered()) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('You cannot edit a delivered order.')
|
||||
)));
|
||||
}
|
||||
|
||||
if (!empty($order_invoice) && $order_invoice->id_order != Tools::getValue('id_order')) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('You cannot use this invoice for the order')
|
||||
)));
|
||||
@@ -2854,21 +2855,21 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$product_price_tax_excl = str_replace(',', '.', Tools::getValue('product_price_tax_excl'));
|
||||
|
||||
if (!Validate::isPrice($product_price_tax_incl) || !Validate::isPrice($product_price_tax_excl)) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Invalid price')
|
||||
)));
|
||||
}
|
||||
//commented by webkul here quantity is gap between booking days which is calulated and validated in ajaxProcessEditProductOnOrder();
|
||||
/*if (!is_array(Tools::getValue('product_quantity')) && !Validate::isUnsignedInt(Tools::getValue('product_quantity')))
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Invalid quantity')
|
||||
)));
|
||||
elseif (is_array(Tools::getValue('product_quantity')))
|
||||
foreach (Tools::getValue('product_quantity') as $qty)
|
||||
if (!Validate::isUnsignedInt($qty))
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Invalid quantity')
|
||||
)));*/
|
||||
@@ -2877,21 +2878,21 @@ class AdminOrdersControllerCore extends AdminController
|
||||
protected function doDeleteProductLineValidation(OrderDetail $order_detail, Order $order)
|
||||
{
|
||||
if (!Validate::isLoadedObject($order_detail)) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('The Order Detail object could not be loaded.')
|
||||
)));
|
||||
}
|
||||
|
||||
if (!Validate::isLoadedObject($order)) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('The order object cannot be loaded.')
|
||||
)));
|
||||
}
|
||||
|
||||
if ($order_detail->id_order != $order->id) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('You cannot delete the order detail.')
|
||||
)));
|
||||
@@ -2899,7 +2900,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
|
||||
// We can't edit a delivered order
|
||||
if ($order->hasBeenDelivered()) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('You cannot edit a delivered order.')
|
||||
)));
|
||||
@@ -2916,13 +2917,13 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$StockAvailable = StockAvailable::getQuantityAvailableByProduct($order_detail->product_id, $order_detail->product_attribute_id, $order_detail->id_shop);
|
||||
$product = new Product($order_detail->product_id, true, null, $order_detail->id_shop);
|
||||
if (!Validate::isLoadedObject($product)) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('The Product object could not be loaded.')
|
||||
)));
|
||||
} else {
|
||||
if (($StockAvailable < $add_quantity) && (!$product->isAvailableWhenOutOfStock((int)$product->out_of_stock))) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('This product is no longer in stock with those attributes ')
|
||||
)));
|
||||
@@ -3074,7 +3075,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$authorized_modules = array();
|
||||
|
||||
if (!Validate::isLoadedObject($customer) || !is_array($modules)) {
|
||||
die(Tools::jsonEncode(array('result' => false)));
|
||||
die(json_encode(array('result' => false)));
|
||||
}
|
||||
|
||||
foreach ($modules as $module) {
|
||||
@@ -3093,7 +3094,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
'payment_modules' => $payment_modules,
|
||||
));
|
||||
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => true,
|
||||
'view' => $this->createTemplate('_select_payment.tpl')->fetch(),
|
||||
)));
|
||||
@@ -3128,7 +3129,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$result['status'] = 'failed';
|
||||
}
|
||||
|
||||
die(Tools::jsonEncode($result));
|
||||
die(json_encode($result));
|
||||
}
|
||||
|
||||
// To show rooms extra demands in the modal box in order details view page
|
||||
@@ -3238,8 +3239,8 @@ class AdminOrdersControllerCore extends AdminController
|
||||
if ($idCartBooking = Tools::getValue('id_cart_booking')) {
|
||||
if (Validate::isLoadedObject($objCartbookingCata = new HotelCartBookingData($idCartBooking))) {
|
||||
$roomDemands = Tools::getValue('room_demands');
|
||||
$roomDemands = Tools::jsonDecode($roomDemands, true);
|
||||
$roomDemands = Tools::jsonEncode($roomDemands);
|
||||
$roomDemands = json_decode($roomDemands, true);
|
||||
$roomDemands = json_encode($roomDemands);
|
||||
$objCartbookingCata->extra_demands = $roomDemands;
|
||||
if ($objCartbookingCata->save()) {
|
||||
die('1');
|
||||
@@ -3255,7 +3256,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
if ($idHtlBooking = Tools::getValue('id_htl_booking')) {
|
||||
if (Validate::isLoadedObject($objBookingDetail = new HotelBookingDetail($idHtlBooking))) {
|
||||
$roomDemands = Tools::getValue('room_demands');
|
||||
if ($roomDemands = Tools::jsonDecode($roomDemands, true)) {
|
||||
if ($roomDemands = json_decode($roomDemands, true)) {
|
||||
$order = new Order($objBookingDetail->id_order);
|
||||
$vatAddress = new Address((int)$order->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
|
||||
$idLang = (int)$order->id_lang;
|
||||
@@ -3369,7 +3370,10 @@ class AdminOrdersControllerCore extends AdminController
|
||||
|
||||
if (!$newStatus) {
|
||||
$this->errors[] = Tools::displayError('Invalid booking status found.');
|
||||
} elseif ($newStatus == 2 || $newStatus == 3) {
|
||||
} elseif (
|
||||
$newStatus == HotelBookingDetail::STATUS_CHECKED_IN
|
||||
|| $newStatus == HotelBookingDetail::STATUS_CHECKED_OUT
|
||||
) {
|
||||
if (!$statusDate || !Validate::isDate($statusDate)) {
|
||||
$this->errors[] = Tools::displayError('Invalid dates found.');
|
||||
} elseif ((strtotime($statusDate) < strtotime($dateFrom))
|
||||
@@ -3381,24 +3385,24 @@ class AdminOrdersControllerCore extends AdminController
|
||||
|
||||
if (!count($this->errors)) {
|
||||
$objBookingDetail = new HotelBookingDetail();
|
||||
if ($roomBookingInfo = $objBookingDetail->getRoomBookingData($idRoom, $idOrder)) {
|
||||
if ($roomBookingInfo = $objBookingDetail->getRoomBookingData($idRoom, $idOrder, $dateFrom, $dateTo)) {
|
||||
// if admin choose Check-Out status
|
||||
if ($newStatus == 3
|
||||
if ($newStatus == HotelBookingDetail::STATUS_CHECKED_OUT
|
||||
&& $roomBookingInfo['check_in'] == '0000-00-00 00:00:00'
|
||||
) {
|
||||
$this->errors[] = Tools::displayError('Room status must be set to Check-In before setting the room status to Check-Out.');
|
||||
} elseif ($newStatus == 3
|
||||
} elseif ($newStatus == HotelBookingDetail::STATUS_CHECKED_OUT
|
||||
&& $roomBookingInfo['check_in'] != '0000-00-00 00:00:00'
|
||||
&& strtotime($roomBookingInfo['check_in']) >= strtotime($statusDate)
|
||||
) {
|
||||
$this->errors[] = Tools::displayError('Check-Out date can not be before Check-In date').
|
||||
'('.date('d-m-Y', strtotime($roomBookingInfo['check_in'])).')';
|
||||
} elseif ($newStatus == 2 && $roomBookingInfo['check_out'] == '0000-00-00 00:00:00'
|
||||
} elseif ($newStatus == HotelBookingDetail::STATUS_CHECKED_IN && $roomBookingInfo['check_out'] == '0000-00-00 00:00:00'
|
||||
&& strtotime($roomBookingInfo['check_in']) >= strtotime($dateTo)
|
||||
) {
|
||||
$this->errors[] = Tools::displayError('Check-In date can not be after Check-Out date').
|
||||
'('.date('d-m-Y', strtotime($roomBookingInfo['date_to'])).')';
|
||||
} elseif ($newStatus == 2 && $roomBookingInfo['check_out'] != '0000-00-00 00:00:00'
|
||||
} elseif ($newStatus == HotelBookingDetail::STATUS_CHECKED_IN && $roomBookingInfo['check_out'] != '0000-00-00 00:00:00'
|
||||
&& strtotime($roomBookingInfo['check_out']) <= strtotime($statusDate)
|
||||
) {
|
||||
$this->errors[] = Tools::displayError('Check-In date can not be after Check-Out date').
|
||||
|
||||
@@ -1014,7 +1014,7 @@ class AdminPerformanceControllerCore extends AdminController
|
||||
$res = @memcache_get_server_status($memcache, $host, $port);
|
||||
}
|
||||
}
|
||||
die(Tools::jsonEncode(array($res)));
|
||||
die(json_encode(array($res)));
|
||||
}
|
||||
}
|
||||
die;
|
||||
|
||||
@@ -600,7 +600,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
public function ajaxProcessAddAttachment()
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '0') {
|
||||
return die(Tools::jsonEncode(array('error' => $this->l('You do not have the right permission'))));
|
||||
return die(json_encode(array('error' => $this->l('You do not have the right permission'))));
|
||||
}
|
||||
if (isset($_FILES['attachment_file'])) {
|
||||
if ((int)$_FILES['attachment_file']['error'] === 1) {
|
||||
@@ -720,7 +720,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
die(Tools::jsonEncode($_FILES));
|
||||
die(json_encode($_FILES));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1296,7 +1296,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
);
|
||||
}
|
||||
|
||||
die(Tools::jsonEncode($json));
|
||||
die(json_encode($json));
|
||||
}
|
||||
|
||||
public function processSpecificPricePriorities()
|
||||
@@ -1632,7 +1632,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
);
|
||||
}
|
||||
|
||||
die(Tools::jsonEncode($json));
|
||||
die(json_encode($json));
|
||||
}
|
||||
|
||||
public function ajaxProcessDefaultProductAttribute()
|
||||
@@ -1656,7 +1656,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
);
|
||||
}
|
||||
|
||||
die(Tools::jsonEncode($json));
|
||||
die(json_encode($json));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1671,7 +1671,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
$combinations[$key]['attributes'][] = array($combination['group_name'], $combination['attribute_name'], $combination['id_attribute']);
|
||||
}
|
||||
|
||||
die(Tools::jsonEncode($combinations));
|
||||
die(json_encode($combinations));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1732,13 +1732,13 @@ class AdminProductsControllerCore extends AdminController
|
||||
public function ajaxProcessUpdateImagePosition()
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '0') {
|
||||
return die(Tools::jsonEncode(array('error' => $this->l('You do not have the right permission'))));
|
||||
return die(json_encode(array('error' => $this->l('You do not have the right permission'))));
|
||||
}
|
||||
$res = false;
|
||||
if ($json = Tools::getValue('json')) {
|
||||
$res = true;
|
||||
$json = stripslashes($json);
|
||||
$images = Tools::jsonDecode($json, true);
|
||||
$images = json_decode($json, true);
|
||||
foreach ($images as $id => $position) {
|
||||
$img = new Image((int)$id);
|
||||
$img->position = (int)$position;
|
||||
@@ -1755,7 +1755,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
public function ajaxProcessUpdateCover()
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '0') {
|
||||
return die(Tools::jsonEncode(array('error' => $this->l('You do not have the right permission'))));
|
||||
return die(json_encode(array('error' => $this->l('You do not have the right permission'))));
|
||||
}
|
||||
Image::deleteCover((int)Tools::getValue('id_product'));
|
||||
$img = new Image((int)Tools::getValue('id_image'));
|
||||
@@ -2742,7 +2742,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
if ($manufacturers) {
|
||||
foreach ($manufacturers as $manufacturer) {
|
||||
$tmp = array("optionValue" => $manufacturer['id_manufacturer'], "optionDisplay" => htmlspecialchars(trim($manufacturer['name'])));
|
||||
$jsonArray[] = Tools::jsonEncode($tmp);
|
||||
$jsonArray[] = json_encode($tmp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2925,7 +2925,9 @@ class AdminProductsControllerCore extends AdminController
|
||||
public function renderForm()
|
||||
{
|
||||
// This nice code (irony) is here to store the product name, because the row after will erase product name in multishop context
|
||||
$this->product_name = $this->object->name[$this->context->language->id];
|
||||
if (Validate::isLoadedObject(($this->object))) {
|
||||
$this->product_name = $this->object->name[$this->context->language->id];
|
||||
}
|
||||
|
||||
if (!method_exists($this, 'initForm'.$this->tab_display)) {
|
||||
return;
|
||||
@@ -2965,7 +2967,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
$this->tpl_form_vars['token'] = $this->token;
|
||||
$this->tpl_form_vars['combinationImagesJs'] = $this->getCombinationImagesJs();
|
||||
$this->tpl_form_vars['PS_ALLOW_ACCENTED_CHARS_URL'] = (int)Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL');
|
||||
$this->tpl_form_vars['post_data'] = Tools::jsonEncode($_POST);
|
||||
$this->tpl_form_vars['post_data'] = json_encode($_POST);
|
||||
$this->tpl_form_vars['save_error'] = !empty($this->errors);
|
||||
$this->tpl_form_vars['mod_evasive'] = Tools::apacheModExists('evasive');
|
||||
$this->tpl_form_vars['mod_security'] = Tools::apacheModExists('security');
|
||||
@@ -3339,7 +3341,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
foreach ($hotelRoomInfo as &$room) {
|
||||
if ($room['id_status'] == 3) {
|
||||
$disabledDates = $objRoomDisableDates->getRoomDisableDates($room['id']);
|
||||
$room['disabled_dates_json'] = Tools::jsonEncode($disabledDates);
|
||||
$room['disabled_dates_json'] = json_encode($disabledDates);
|
||||
}
|
||||
}
|
||||
$data->assign('htl_room_info', $hotelRoomInfo);
|
||||
@@ -3492,7 +3494,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
$disableDtsArr = array();
|
||||
foreach ($room_status as $key => $status) {
|
||||
if ($status == 3) {
|
||||
$disableDtsArr[$key] = Tools::jsonDecode($disable_dates[$key], true);
|
||||
$disableDtsArr[$key] = json_decode($disable_dates[$key], true);
|
||||
$this->validateDisableDateRanges($disableDtsArr[$key]);
|
||||
}
|
||||
}
|
||||
@@ -3714,7 +3716,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
}
|
||||
|
||||
if ($booking_calendar_data) {
|
||||
die(Tools::jsonEncode($booking_calendar_data));
|
||||
die(json_encode($booking_calendar_data));
|
||||
} else {
|
||||
die(0);
|
||||
}
|
||||
@@ -4793,7 +4795,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
die(Tools::jsonEncode(array($image_uploader->getName() => $files)));
|
||||
die(json_encode(array($image_uploader->getName() => $files)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -5421,28 +5423,28 @@ class AdminProductsControllerCore extends AdminController
|
||||
public function ajaxProcessProductQuantity()
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '0') {
|
||||
return die(Tools::jsonEncode(array('error' => $this->l('You do not have the right permission'))));
|
||||
return die(json_encode(array('error' => $this->l('You do not have the right permission'))));
|
||||
}
|
||||
if (!Tools::getValue('actionQty')) {
|
||||
return Tools::jsonEncode(array('error' => $this->l('Undefined action')));
|
||||
return json_encode(array('error' => $this->l('Undefined action')));
|
||||
}
|
||||
|
||||
$product = new Product((int)Tools::getValue('id_product'), true);
|
||||
switch (Tools::getValue('actionQty')) {
|
||||
case 'depends_on_stock':
|
||||
if (Tools::getValue('value') === false) {
|
||||
die(Tools::jsonEncode(array('error' => $this->l('Undefined value'))));
|
||||
die(json_encode(array('error' => $this->l('Undefined value'))));
|
||||
}
|
||||
if ((int)Tools::getValue('value') != 0 && (int)Tools::getValue('value') != 1) {
|
||||
die(Tools::jsonEncode(array('error' => $this->l('Incorrect value'))));
|
||||
die(json_encode(array('error' => $this->l('Incorrect value'))));
|
||||
}
|
||||
if (!$product->advanced_stock_management && (int)Tools::getValue('value') == 1) {
|
||||
die(Tools::jsonEncode(array('error' => $this->l('Not possible if advanced stock management is disabled. '))));
|
||||
die(json_encode(array('error' => $this->l('Not possible if advanced stock management is disabled. '))));
|
||||
}
|
||||
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && (int)Tools::getValue('value') == 1 && (Pack::isPack($product->id) && !Pack::allUsesAdvancedStockManagement($product->id)
|
||||
&& ($product->pack_stock_type == 2 || $product->pack_stock_type == 1 ||
|
||||
($product->pack_stock_type == 3 && (Configuration::get('PS_PACK_STOCK_TYPE') == 1 || Configuration::get('PS_PACK_STOCK_TYPE') == 2))))) {
|
||||
die(Tools::jsonEncode(array('error' => $this->l('You cannot use advanced stock management for this pack because').'<br />'.
|
||||
die(json_encode(array('error' => $this->l('You cannot use advanced stock management for this pack because').'<br />'.
|
||||
$this->l('- advanced stock management is not enabled for these room types').'<br />'.
|
||||
$this->l('- you have chosen to decrement room types quantities.'))));
|
||||
}
|
||||
@@ -5453,15 +5455,15 @@ class AdminProductsControllerCore extends AdminController
|
||||
case 'pack_stock_type':
|
||||
$value = Tools::getValue('value');
|
||||
if ($value === false) {
|
||||
die(Tools::jsonEncode(array('error' => $this->l('Undefined value'))));
|
||||
die(json_encode(array('error' => $this->l('Undefined value'))));
|
||||
}
|
||||
if ((int)$value != 0 && (int)$value != 1
|
||||
&& (int)$value != 2 && (int)$value != 3) {
|
||||
die(Tools::jsonEncode(array('error' => $this->l('Incorrect value'))));
|
||||
die(json_encode(array('error' => $this->l('Incorrect value'))));
|
||||
}
|
||||
if ($product->depends_on_stock && !Pack::allUsesAdvancedStockManagement($product->id) && ((int)$value == 1
|
||||
|| (int)$value == 2 || ((int)$value == 3 && (Configuration::get('PS_PACK_STOCK_TYPE') == 1 || Configuration::get('PS_PACK_STOCK_TYPE') == 2)))) {
|
||||
die(Tools::jsonEncode(array('error' => $this->l('You cannot use this stock management option because:').'<br />'.
|
||||
die(json_encode(array('error' => $this->l('You cannot use this stock management option because:').'<br />'.
|
||||
$this->l('- advanced stock management is not enabled for these room types').'<br />'.
|
||||
$this->l('- advanced stock management is enabled for the pack'))));
|
||||
}
|
||||
@@ -5471,10 +5473,10 @@ class AdminProductsControllerCore extends AdminController
|
||||
|
||||
case 'out_of_stock':
|
||||
if (Tools::getValue('value') === false) {
|
||||
die(Tools::jsonEncode(array('error' => $this->l('Undefined value'))));
|
||||
die(json_encode(array('error' => $this->l('Undefined value'))));
|
||||
}
|
||||
if (!in_array((int)Tools::getValue('value'), array(0, 1, 2))) {
|
||||
die(Tools::jsonEncode(array('error' => $this->l('Incorrect value'))));
|
||||
die(json_encode(array('error' => $this->l('Incorrect value'))));
|
||||
}
|
||||
|
||||
StockAvailable::setProductOutOfStock($product->id, (int)Tools::getValue('value'));
|
||||
@@ -5482,10 +5484,10 @@ class AdminProductsControllerCore extends AdminController
|
||||
|
||||
case 'set_qty':
|
||||
if (Tools::getValue('value') === false || (!is_numeric(trim(Tools::getValue('value'))))) {
|
||||
die(Tools::jsonEncode(array('error' => $this->l('Undefined value'))));
|
||||
die(json_encode(array('error' => $this->l('Undefined value'))));
|
||||
}
|
||||
if (Tools::getValue('id_product_attribute') === false) {
|
||||
die(Tools::jsonEncode(array('error' => $this->l('Undefined id room type attribute'))));
|
||||
die(json_encode(array('error' => $this->l('Undefined id room type attribute'))));
|
||||
}
|
||||
|
||||
StockAvailable::setQuantity($product->id, (int)Tools::getValue('id_product_attribute'), (int)Tools::getValue('value'));
|
||||
@@ -5495,18 +5497,18 @@ class AdminProductsControllerCore extends AdminController
|
||||
$error = ob_get_contents();
|
||||
if (!empty($error)) {
|
||||
ob_end_clean();
|
||||
die(Tools::jsonEncode(array('error' => $error)));
|
||||
die(json_encode(array('error' => $error)));
|
||||
}
|
||||
break;
|
||||
case 'advanced_stock_management' :
|
||||
if (Tools::getValue('value') === false) {
|
||||
die(Tools::jsonEncode(array('error' => $this->l('Undefined value'))));
|
||||
die(json_encode(array('error' => $this->l('Undefined value'))));
|
||||
}
|
||||
if ((int)Tools::getValue('value') != 1 && (int)Tools::getValue('value') != 0) {
|
||||
die(Tools::jsonEncode(array('error' => $this->l('Incorrect value'))));
|
||||
die(json_encode(array('error' => $this->l('Incorrect value'))));
|
||||
}
|
||||
if (!Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && (int)Tools::getValue('value') == 1) {
|
||||
die(Tools::jsonEncode(array('error' => $this->l('Not possible if advanced stock management is disabled. '))));
|
||||
die(json_encode(array('error' => $this->l('Not possible if advanced stock management is disabled. '))));
|
||||
}
|
||||
|
||||
$product->setAdvancedStockManagement((int)Tools::getValue('value'));
|
||||
@@ -5516,7 +5518,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
break;
|
||||
|
||||
}
|
||||
die(Tools::jsonEncode(array('error' => false)));
|
||||
die(json_encode(array('error' => false)));
|
||||
}
|
||||
|
||||
public function getCombinationImagesJS()
|
||||
@@ -5666,7 +5668,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
GROUP BY pl.`id_product`
|
||||
LIMIT '.(int)$limit);
|
||||
}
|
||||
die(Tools::jsonEncode($result));
|
||||
die(json_encode($result));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ class AdminQuickAccessesControllerCore extends AdminController
|
||||
public function getQuickAccessesList()
|
||||
{
|
||||
$links = QuickAccess::getQuickAccesses($this->context->language->id);
|
||||
return Tools::jsonEncode(array_map(array($this, 'getLinkToken'), $links));
|
||||
return json_encode(array_map(array($this, 'getLinkToken'), $links));
|
||||
}
|
||||
|
||||
public function getLinkToken($item)
|
||||
@@ -195,7 +195,7 @@ class AdminQuickAccessesControllerCore extends AdminController
|
||||
$this->errors = array_unique($this->errors);
|
||||
if (!empty($this->errors)) {
|
||||
$this->errors['has_errors'] = true;
|
||||
$this->ajaxDie(Tools::jsonEncode($this->errors));
|
||||
$this->ajaxDie(json_encode($this->errors));
|
||||
return false;
|
||||
}
|
||||
return $this->getQuickAccessesList();
|
||||
|
||||
@@ -197,7 +197,7 @@ class AdminRequestSqlControllerCore extends AdminController
|
||||
unset($attributes[$key]['Default']);
|
||||
unset($attributes[$key]['Extra']);
|
||||
}
|
||||
die(Tools::jsonEncode($attributes));
|
||||
die(json_encode($attributes));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -191,7 +191,7 @@ class AdminSearchControllerCore extends AdminController
|
||||
$iso_lang = Tools::strtolower(Context::getContext()->language->iso_code);
|
||||
$iso_country = Tools::strtolower(Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT')));
|
||||
if (($json_content = Tools::file_get_contents('https://api-addons.prestashop.com/'._PS_VERSION_.'/search/'.urlencode($this->query).'/'.$iso_country.'/'.$iso_lang.'/')) != false) {
|
||||
$results = Tools::jsonDecode($json_content, true);
|
||||
$results = json_decode($json_content, true);
|
||||
if (isset($results['id'])) {
|
||||
$this->_list['addons'] = array($results);
|
||||
} else {
|
||||
|
||||
@@ -36,7 +36,7 @@ class AdminShopControllerCore extends AdminController
|
||||
$this->table = 'shop';
|
||||
$this->className = 'Shop';
|
||||
$this->multishop_context = Shop::CONTEXT_ALL;
|
||||
|
||||
|
||||
$this->id_shop_group = (int)Tools::getValue('id_shop_group');
|
||||
|
||||
/* if $_GET['id_shop'] is transmitted, virtual url can be loaded in config.php, so we wether transmit shop_id in herfs */
|
||||
@@ -250,7 +250,7 @@ class AdminShopControllerCore extends AdminController
|
||||
elseif (Shop::getTotalShops() == 1)
|
||||
$this->errors[] = Tools::displayError('You cannot disable the last shop.');
|
||||
}*/
|
||||
|
||||
|
||||
if (Tools::isSubmit('submitAddshopAndStay') || Tools::isSubmit('submitAddshop')) {
|
||||
$shop_group = new ShopGroup((int)Tools::getValue('id_shop_group'));
|
||||
if ($shop_group->shopNameExists(Tools::getValue('name'), (int)Tools::getValue('id_shop'))) {
|
||||
@@ -475,7 +475,7 @@ class AdminShopControllerCore extends AdminController
|
||||
$root_category = new Category($root_categories[0]['id_category']);
|
||||
$children = $root_category->getAllChildren($this->context->language->id);
|
||||
$selected_cat[] = $root_categories[0]['id_category'];
|
||||
|
||||
|
||||
foreach ($children as $child) {
|
||||
$selected_cat[] = $child->id;
|
||||
}
|
||||
@@ -576,7 +576,7 @@ class AdminShopControllerCore extends AdminController
|
||||
'zone' => $this->l('Zones'),
|
||||
'cart_rule' => $this->l('Cart rules'),
|
||||
);
|
||||
|
||||
|
||||
// Hook for duplication of shop data
|
||||
$modules_list = Hook::getHookModuleExecList('actionShopDataDuplication');
|
||||
if (is_array($modules_list) && count($modules_list) > 0) {
|
||||
@@ -586,7 +586,7 @@ class AdminShopControllerCore extends AdminController
|
||||
}
|
||||
|
||||
asort($import_data);
|
||||
|
||||
|
||||
if (!$this->object->id) {
|
||||
$this->fields_import_form = array(
|
||||
'radio' => array(
|
||||
@@ -615,9 +615,9 @@ class AdminShopControllerCore extends AdminController
|
||||
|
||||
$this->fields_value = array(
|
||||
'id_shop_group' => (Tools::getValue('id_shop_group') ? Tools::getValue('id_shop_group') :
|
||||
(isset($obj->id_shop_group)) ? $obj->id_shop_group : Shop::getContextShopGroupID()),
|
||||
((isset($obj->id_shop_group)) ? $obj->id_shop_group : Shop::getContextShopGroupID())),
|
||||
'id_category' => (Tools::getValue('id_category') ? Tools::getValue('id_category') :
|
||||
(isset($obj->id_category)) ? $obj->id_category : (int)Configuration::get('PS_HOME_CATEGORY')),
|
||||
((isset($obj->id_category)) ? $obj->id_category : (int)Configuration::get('PS_HOME_CATEGORY'))),
|
||||
'id_theme_checked' => (isset($obj->id_theme) ? $obj->id_theme : $id_theme)
|
||||
);
|
||||
|
||||
@@ -653,7 +653,7 @@ class AdminShopControllerCore extends AdminController
|
||||
if (Tools::isSubmit('id_category_default')) {
|
||||
$_POST['id_category'] = (int)Tools::getValue('id_category_default');
|
||||
}
|
||||
|
||||
|
||||
/* Checking fields validity */
|
||||
$this->validateRules();
|
||||
|
||||
@@ -711,13 +711,13 @@ class AdminShopControllerCore extends AdminController
|
||||
if (!array_key_exists('Edit', self::$cache_lang)) {
|
||||
self::$cache_lang['Edit'] = $this->l('Edit', 'Helper');
|
||||
}
|
||||
|
||||
|
||||
$tpl->assign(array(
|
||||
'href' => $this->context->link->getAdminLink('AdminShop').'&shop_id='.(int)$id.'&update'.$this->table,
|
||||
'action' => self::$cache_lang['Edit'],
|
||||
'id' => $id
|
||||
));
|
||||
|
||||
|
||||
return $tpl->fetch();
|
||||
} else {
|
||||
return;
|
||||
@@ -738,7 +738,7 @@ class AdminShopControllerCore extends AdminController
|
||||
$root_category = new Category($root_categories[0]['id_category']);
|
||||
$children = $root_category->getAllChildren($this->context->language->id);
|
||||
$selected_cat[] = $root_categories[0]['id_category'];
|
||||
|
||||
|
||||
foreach ($children as $child) {
|
||||
$selected_cat[] = $child->id;
|
||||
}
|
||||
@@ -860,6 +860,6 @@ class AdminShopControllerCore extends AdminController
|
||||
'children' => $tree,
|
||||
));
|
||||
|
||||
die(Tools::jsonEncode($tree));
|
||||
die(json_encode($tree));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,7 +281,7 @@ class AdminShopUrlControllerCore extends AdminController
|
||||
}
|
||||
|
||||
$this->tpl_form_vars = array(
|
||||
'js_shop_url' => Tools::jsonEncode($list_shop_with_url)
|
||||
'js_shop_url' => json_encode($list_shop_with_url)
|
||||
);
|
||||
|
||||
$this->fields_value = array(
|
||||
|
||||
@@ -542,7 +542,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
}
|
||||
$value .= '%';
|
||||
|
||||
// ConfigurationKPI::updateValue('CONVERSION_RATE_CHART', Tools::jsonEncode($data));
|
||||
// ConfigurationKPI::updateValue('CONVERSION_RATE_CHART', json_encode($data));
|
||||
ConfigurationKPI::updateValue('CONVERSION_RATE', $value);
|
||||
ConfigurationKPI::updateValue('CONVERSION_RATE_EXPIRE', strtotime(date('Y-m-d 00:00:00', strtotime('+1 day'))));
|
||||
break;
|
||||
@@ -793,8 +793,8 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
if (isset($data)) {
|
||||
$array['data'] = $data;
|
||||
}
|
||||
die(Tools::jsonEncode($array));
|
||||
die(json_encode($array));
|
||||
}
|
||||
die(Tools::jsonEncode(array('has_errors' => true)));
|
||||
die(json_encode(array('has_errors' => true)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
|
||||
}
|
||||
$this->content .= $this->renderView();
|
||||
}
|
||||
|
||||
|
||||
$this->content .= $this->displayMenu();
|
||||
$this->content .= $this->displayCalendar();
|
||||
$this->content .= $this->displayStats();
|
||||
@@ -97,7 +97,7 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
|
||||
$identifier = 'module';
|
||||
$id = Tools::getValue('module');
|
||||
}
|
||||
|
||||
|
||||
$action = Context::getContext()->link->getAdminLink('AdminStats');
|
||||
$action .= ($action && $table ? '&'.Tools::safeOutput($action) : '');
|
||||
$action .= ($identifier && $id ? '&'.Tools::safeOutput($identifier).'='.(int)$id : '');
|
||||
@@ -172,7 +172,7 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
|
||||
|
||||
return $tpl->fetch();
|
||||
}
|
||||
|
||||
|
||||
public function checkModulesNames($a, $b)
|
||||
{
|
||||
return (bool)($a['displayName'] > $b['displayName']);
|
||||
@@ -205,7 +205,7 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
|
||||
if (!isset($module_instance)) {
|
||||
$module_instance = Module::getInstanceByName($module_name);
|
||||
}
|
||||
|
||||
|
||||
if ($module_instance && $module_instance->active) {
|
||||
$hook = Hook::exec('displayAdminStatsModules', null, $module_instance->id);
|
||||
}
|
||||
@@ -223,9 +223,9 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
|
||||
public function postProcess()
|
||||
{
|
||||
$this->context = Context::getContext();
|
||||
|
||||
|
||||
$this->processDateRange();
|
||||
|
||||
|
||||
if (Tools::getValue('submitSettings')) {
|
||||
if ($this->tabAccess['edit'] === '1') {
|
||||
self::$currentIndex .= '&module='.Tools::getValue('module');
|
||||
@@ -237,7 +237,7 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function processDateRange()
|
||||
{
|
||||
if (Tools::isSubmit('submitDatePicker')) {
|
||||
@@ -281,21 +281,21 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function ajaxProcessSetDashboardDateRange()
|
||||
{
|
||||
$this->processDateRange();
|
||||
|
||||
|
||||
if ($this->isXmlHttpRequest()) {
|
||||
if (is_array($this->errors) && count($this->errors)) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'has_errors' => true,
|
||||
'errors' => array($this->errors),
|
||||
'date_from' => $this->context->employee->stats_date_from,
|
||||
'date_to' => $this->context->employee->stats_date_to)
|
||||
));
|
||||
} else {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'has_errors' => false,
|
||||
'date_from' => $this->context->employee->stats_date_from,
|
||||
'date_to' => $this->context->employee->stats_date_to)
|
||||
|
||||
@@ -719,7 +719,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
}
|
||||
|
||||
$this->tpl_form_vars['products_list'] = $products;
|
||||
$this->tpl_form_vars['product_ids'] = implode($product_ids, '|');
|
||||
$this->tpl_form_vars['product_ids'] = implode('|', $product_ids);
|
||||
$this->tpl_form_vars['product_ids_to_delete'] = '';
|
||||
$this->tpl_form_vars['supplier_id'] = $supply_order->id_supplier;
|
||||
$this->tpl_form_vars['currency'] = $currency;
|
||||
@@ -1771,7 +1771,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
if ($items) {
|
||||
die(Tools::jsonEncode($items));
|
||||
die(json_encode($items));
|
||||
}
|
||||
|
||||
die(1);
|
||||
|
||||
@@ -546,7 +546,7 @@ class AdminTaxRulesGroupControllerCore extends AdminController
|
||||
foreach ($tax_rules as $key => $result) {
|
||||
$output[$key] = $result;
|
||||
}
|
||||
die(Tools::jsonEncode($output));
|
||||
die(json_encode($output));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -179,8 +179,8 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
$file_name = $this->link_lang_pack.'?version='._PS_VERSION_;
|
||||
$array_stream_context = @stream_context_create(array('http' => array('method' => 'GET', 'timeout' => 8)));
|
||||
if ($lang_packs = Tools::file_get_contents($file_name, false, $array_stream_context)) {
|
||||
// Notice : for php < 5.2 compatibility, Tools::jsonDecode. The second parameter to true will set us
|
||||
if ($lang_packs != '' && $lang_packs = Tools::jsonDecode($lang_packs, true)) {
|
||||
// Notice : for php < 5.2 compatibility, json_decode. The second parameter to true will set us
|
||||
if ($lang_packs != '' && $lang_packs = json_decode($lang_packs, true)) {
|
||||
foreach ($lang_packs as $key => $lang_pack) {
|
||||
if (!Language::isInstalled($lang_pack['iso_code'])) {
|
||||
$packs_to_install[$key] = $lang_pack;
|
||||
@@ -481,7 +481,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
$this->exportTabs();
|
||||
$items = array_flip(Language::getFilesList($this->lang_selected->iso_code, $this->theme_selected, false, false, false, false, true));
|
||||
$file_name = _PS_TRANSLATIONS_DIR_.'/export/'.$this->lang_selected->iso_code.'.gzip';
|
||||
require_once(_PS_TOOL_DIR_.'tar/Archive_Tar.php');
|
||||
require_once(_PS_TOOL_DIR_.'tar/Tar.php');
|
||||
$gz = new Archive_Tar($file_name, true);
|
||||
if ($gz->createModify($items, null, _PS_ROOT_DIR_)) {
|
||||
ob_start();
|
||||
@@ -718,7 +718,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
if (!isset($_FILES['file']['tmp_name']) || !$_FILES['file']['tmp_name']) {
|
||||
$this->errors[] = Tools::displayError('No file has been selected.');
|
||||
} else {
|
||||
require_once(_PS_TOOL_DIR_.'tar/Archive_Tar.php');
|
||||
require_once(_PS_TOOL_DIR_.'tar/Tar.php');
|
||||
$gz = new Archive_Tar($_FILES['file']['tmp_name'], true);
|
||||
$filename = $_FILES['file']['name'];
|
||||
$iso_code = str_replace(array('.tar.gz', '.gzip'), '', $filename);
|
||||
@@ -859,7 +859,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
if ($content) {
|
||||
$file = _PS_TRANSLATIONS_DIR_.$arr_import_lang[0].'.gzip';
|
||||
if ((bool)@file_put_contents($file, $content)) {
|
||||
require_once(_PS_TOOL_DIR_.'/tar/Archive_Tar.php');
|
||||
require_once(_PS_TOOL_DIR_.'/tar/Tar.php');
|
||||
$gz = new Archive_Tar($file, true);
|
||||
if (_PS_MODE_DEV_) {
|
||||
$gz->setErrorHandling(PEAR_ERROR_TRIGGER, E_USER_WARNING);
|
||||
@@ -1019,7 +1019,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
$arr_good_ext = array('.tpl', '.php');
|
||||
|
||||
foreach ($files as $key => $file) {
|
||||
if ($file{0} === '.' || in_array(substr($file, 0, strrpos($file, '.')), $this->all_iso_lang)) {
|
||||
if ($file[0] === '.' || in_array(substr($file, 0, strrpos($file, '.')), $this->all_iso_lang)) {
|
||||
unset($files[$key]);
|
||||
} elseif ($type_clear === 'file' && !in_array(substr($file, strrpos($file, '.')), $arr_good_ext)) {
|
||||
unset($files[$key]);
|
||||
@@ -2872,7 +2872,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
$initial_root_dir = $root_dir;
|
||||
foreach ($modules as $module) {
|
||||
$root_dir = $initial_root_dir;
|
||||
if ($module{0} == '.') {
|
||||
if ($module[0] == '.') {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -204,7 +204,7 @@ class AddressControllerCore extends FrontController
|
||||
'hasError' => (bool)$this->errors,
|
||||
'errors' => $this->errors
|
||||
);
|
||||
$this->ajaxDie(Tools::jsonEncode($return));
|
||||
$this->ajaxDie(json_encode($return));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,7 +231,7 @@ class AddressControllerCore extends FrontController
|
||||
'id_address_delivery' => (int)$this->context->cart->id_address_delivery,
|
||||
'id_address_invoice' => (int)$this->context->cart->id_address_invoice
|
||||
);
|
||||
$this->ajaxDie(Tools::jsonEncode($return));
|
||||
$this->ajaxDie(json_encode($return));
|
||||
}
|
||||
|
||||
// Redirect to old page or current page
|
||||
@@ -364,7 +364,7 @@ class AddressControllerCore extends FrontController
|
||||
'hasError' => !empty($this->errors),
|
||||
'errors' => $this->errors
|
||||
);
|
||||
$this->ajaxDie(Tools::jsonEncode($return));
|
||||
$this->ajaxDie(json_encode($return));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ class AuthControllerCore extends FrontController
|
||||
'page' => $this->context->smarty->fetch($this->template),
|
||||
'token' => Tools::getToken(false)
|
||||
);
|
||||
$this->ajaxDie(Tools::jsonEncode($return));
|
||||
$this->ajaxDie(json_encode($return));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -349,7 +349,7 @@ class AuthControllerCore extends FrontController
|
||||
'errors' => $this->errors,
|
||||
'token' => Tools::getToken(false)
|
||||
);
|
||||
$this->ajaxDie(Tools::jsonEncode($return));
|
||||
$this->ajaxDie(json_encode($return));
|
||||
} else {
|
||||
$this->context->smarty->assign('authentification_error', $this->errors);
|
||||
}
|
||||
@@ -516,7 +516,7 @@ class AuthControllerCore extends FrontController
|
||||
'id_address_invoice' => $this->context->cart->id_address_invoice,
|
||||
'token' => Tools::getToken(false)
|
||||
);
|
||||
$this->ajaxDie(Tools::jsonEncode($return));
|
||||
$this->ajaxDie(json_encode($return));
|
||||
}
|
||||
|
||||
if (($back = Tools::getValue('back')) && $back == Tools::secureReferrer($back)) {
|
||||
@@ -690,7 +690,7 @@ class AuthControllerCore extends FrontController
|
||||
'id_address_invoice' => $this->context->cart->id_address_invoice,
|
||||
'token' => Tools::getToken(false)
|
||||
);
|
||||
$this->ajaxDie(Tools::jsonEncode($return));
|
||||
$this->ajaxDie(json_encode($return));
|
||||
}
|
||||
// if registration type is in two steps, we redirect to register address
|
||||
if (!Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && !$this->ajax && !Tools::isSubmit('submitGuestAccount')) {
|
||||
@@ -730,7 +730,7 @@ class AuthControllerCore extends FrontController
|
||||
'isSaved' => false,
|
||||
'id_customer' => 0
|
||||
);
|
||||
$this->ajaxDie(Tools::jsonEncode($return));
|
||||
$this->ajaxDie(json_encode($return));
|
||||
}
|
||||
$this->context->smarty->assign('account_error', $this->errors);
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ class CartControllerCore extends FrontController
|
||||
}
|
||||
} elseif (!$this->isTokenValid()) {
|
||||
if (Tools::getValue('ajax')) {
|
||||
$this->ajaxDie(Tools::jsonEncode(array(
|
||||
$this->ajaxDie(json_encode(array(
|
||||
'hasError' => true,
|
||||
'errors' => array(Tools::displayError('Impossible to add the product to the cart. Please refresh page.')),
|
||||
)));
|
||||
@@ -137,7 +137,7 @@ class CartControllerCore extends FrontController
|
||||
}
|
||||
|
||||
if ($total_quantity < $minimal_quantity) {
|
||||
$this->ajaxDie(Tools::jsonEncode(array(
|
||||
$this->ajaxDie(json_encode(array(
|
||||
'hasError' => true,
|
||||
'errors' => array(sprintf(Tools::displayError('You must add %d minimum quantity', !Tools::getValue('ajax')), $minimal_quantity)),
|
||||
)));
|
||||
@@ -210,7 +210,7 @@ class CartControllerCore extends FrontController
|
||||
$new_id_address_delivery = (int)Tools::getValue('new_id_address_delivery');
|
||||
|
||||
if (!count(Carrier::getAvailableCarrierList(new Product($this->id_product), null, $new_id_address_delivery))) {
|
||||
$this->ajaxDie(Tools::jsonEncode(array(
|
||||
$this->ajaxDie(json_encode(array(
|
||||
'hasErrors' => true,
|
||||
'error' => Tools::displayError('It is not possible to deliver this product to the selected address.', false),
|
||||
)));
|
||||
@@ -312,7 +312,7 @@ class CartControllerCore extends FrontController
|
||||
if (isset($hotel_room_data['stats']['num_avail'])) {
|
||||
$total_available_rooms = $hotel_room_data['stats']['num_avail'];
|
||||
if ($total_available_rooms < $req_rm) {
|
||||
die(Tools::jsonEncode(array('status' => 'unavailable_quantity', 'avail_rooms' => $total_available_rooms)));
|
||||
die(json_encode(array('status' => 'unavailable_quantity', 'avail_rooms' => $total_available_rooms)));
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('Rooms are unavailable. Please try with different dates');
|
||||
@@ -322,10 +322,10 @@ class CartControllerCore extends FrontController
|
||||
}
|
||||
}
|
||||
} else {
|
||||
die(Tools::jsonEncode(array('status' => 'failed3')));
|
||||
die(json_encode(array('status' => 'failed3')));
|
||||
}
|
||||
} else {
|
||||
die(Tools::jsonEncode(array('status' => 'failed4')));
|
||||
die(json_encode(array('status' => 'failed4')));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -416,8 +416,8 @@ class CartControllerCore extends FrontController
|
||||
foreach ($hotel_room_info_arr as $key_hotel_room_info => $val_hotel_room_info) {
|
||||
if ($chkQty < $req_rm) {
|
||||
$roomDemand = Tools::getValue('roomDemands');
|
||||
$roomDemand = Tools::jsonDecode($roomDemand, true);
|
||||
$roomDemand = Tools::jsonEncode($roomDemand);
|
||||
$roomDemand = json_decode($roomDemand, true);
|
||||
$roomDemand = json_encode($roomDemand);
|
||||
$obj_htl_cart_booking_data = new HotelCartBookingData();
|
||||
$obj_htl_cart_booking_data->id_cart = $this->context->cart->id;
|
||||
$obj_htl_cart_booking_data->id_guest = $this->context->cart->id_guest;
|
||||
@@ -519,10 +519,10 @@ class CartControllerCore extends FrontController
|
||||
public function displayAjax()
|
||||
{
|
||||
if ($this->errors) {
|
||||
$this->ajaxDie(Tools::jsonEncode(array('hasError' => true, 'errors' => $this->errors)));
|
||||
$this->ajaxDie(json_encode(array('hasError' => true, 'errors' => $this->errors)));
|
||||
}
|
||||
if ($this->ajax_refresh) {
|
||||
$this->ajaxDie(Tools::jsonEncode(array('refresh' => true)));
|
||||
$this->ajaxDie(json_encode(array('refresh' => true)));
|
||||
}
|
||||
|
||||
// write cookie if can't on destruct
|
||||
@@ -560,7 +560,7 @@ class CartControllerCore extends FrontController
|
||||
|
||||
$json = '';
|
||||
Hook::exec('actionCartListOverride', array('summary' => $result, 'json' => &$json));
|
||||
$this->ajaxDie(Tools::jsonEncode(array_merge($result, (array)Tools::jsonDecode($json, true))));
|
||||
$this->ajaxDie(json_encode(array_merge($result, (array)json_decode($json, true))));
|
||||
}
|
||||
// @todo create a hook
|
||||
elseif (file_exists(_PS_MODULE_DIR_.'/blockcart/blockcart-ajax.php')) {
|
||||
|
||||
@@ -305,7 +305,7 @@ class ContactControllerCore extends FrontController
|
||||
if (Configuration::get('WK_GOOGLE_ACTIVE_MAP')) {
|
||||
$hotelLocationArray = $objHotelInfo->getMapFormatHotelsInfo(Configuration::get('WK_MAP_HOTEL_ACTIVE_ONLY'));
|
||||
if ($hotelLocationArray) {
|
||||
$this->context->smarty->assign('hotelLocationArray', Tools::jsonEncode($hotelLocationArray));
|
||||
$this->context->smarty->assign('hotelLocationArray', json_encode($hotelLocationArray));
|
||||
}
|
||||
}
|
||||
//End
|
||||
|
||||
@@ -138,7 +138,7 @@ class OrderControllerCore extends ParentOrderController
|
||||
)
|
||||
)
|
||||
);
|
||||
$this->ajaxDie(Tools::jsonEncode($return));
|
||||
$this->ajaxDie(json_encode($return));
|
||||
}
|
||||
|
||||
if ($this->nbProducts) {
|
||||
|
||||
@@ -208,7 +208,7 @@ class OrderDetailControllerCore extends FrontController
|
||||
$hasError = 1;
|
||||
}
|
||||
if ($bookingRefunds = Tools::getValue('bookings_to_refund')) {
|
||||
if (!count($bookingRefunds = Tools::jsonDecode($bookingRefunds, true))) {
|
||||
if (!count($bookingRefunds = json_decode($bookingRefunds, true))) {
|
||||
$hasError = 1;
|
||||
} else {
|
||||
foreach ($bookingRefunds as $idHtlBooking) {
|
||||
@@ -248,9 +248,9 @@ class OrderDetailControllerCore extends FrontController
|
||||
// Emails to customer, admin on refund request state change
|
||||
$objOrderReturn->changeIdOrderReturnState(OrderReturnState::ORDER_RETRUN_FIRST_STATUS, $objOrderReturn->id);
|
||||
|
||||
die(Tools::jsonEncode(array('status' => 1)));
|
||||
die(json_encode(array('status' => 1)));
|
||||
}
|
||||
die(Tools::jsonEncode(array('status' => 0)));
|
||||
die(json_encode(array('status' => 0)));
|
||||
}
|
||||
// END ajax request handle
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
$this->getFormatedSummaryDetail()
|
||||
);
|
||||
Cart::addExtraCarriers($return);
|
||||
$this->ajaxDie(Tools::jsonEncode($return));
|
||||
$this->ajaxDie(json_encode($return));
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating the cart.');
|
||||
}
|
||||
@@ -89,7 +89,7 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
case 'updateTOSStatusAndGetPayments':
|
||||
if (Tools::isSubmit('checked')) {
|
||||
$this->context->cookie->checkedTOS = (int)Tools::getValue('checked');
|
||||
$this->ajaxDie(Tools::jsonEncode(array(
|
||||
$this->ajaxDie(json_encode(array(
|
||||
'HOOK_TOP_PAYMENT' => Hook::exec('displayPaymentTop'),
|
||||
'HOOK_PAYMENT' => $this->_getPaymentMethods()
|
||||
)));
|
||||
@@ -97,7 +97,7 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
break;
|
||||
|
||||
case 'getCarrierList':
|
||||
$this->ajaxDie(Tools::jsonEncode($this->_getCarrierList()));
|
||||
$this->ajaxDie(json_encode($this->_getCarrierList()));
|
||||
break;
|
||||
|
||||
case 'editCustomer':
|
||||
@@ -132,14 +132,14 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
} else {
|
||||
$return['isSaved'] = false;
|
||||
}
|
||||
$this->ajaxDie(Tools::jsonEncode($return));
|
||||
$this->ajaxDie(json_encode($return));
|
||||
break;
|
||||
|
||||
case 'getAddressBlockAndCarriersAndPayments':
|
||||
if ($this->context->customer->isLogged() || $this->context->customer->isGuest()) {
|
||||
// check if customer have addresses
|
||||
if (!Customer::getAddressesTotalById($this->context->customer->id)) {
|
||||
$this->ajaxDie(Tools::jsonEncode(array('no_address' => 1)));
|
||||
$this->ajaxDie(json_encode(array('no_address' => 1)));
|
||||
}
|
||||
if (file_exists(_PS_MODULE_DIR_.'blockuserinfo/blockuserinfo.php')) {
|
||||
include_once(_PS_MODULE_DIR_.'blockuserinfo/blockuserinfo.php');
|
||||
@@ -183,7 +183,7 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
),
|
||||
$this->getFormatedSummaryDetail()
|
||||
);
|
||||
$this->ajaxDie(Tools::jsonEncode($return));
|
||||
$this->ajaxDie(json_encode($return));
|
||||
}
|
||||
die(Tools::displayError());
|
||||
break;
|
||||
@@ -265,11 +265,11 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
'refresh' => (bool)$this->ajax_refresh),
|
||||
$this->getFormatedSummaryDetail()
|
||||
);
|
||||
$this->ajaxDie(Tools::jsonEncode($result));
|
||||
$this->ajaxDie(json_encode($result));
|
||||
}
|
||||
}
|
||||
if (count($this->errors)) {
|
||||
$this->ajaxDie(Tools::jsonEncode(array(
|
||||
$this->ajaxDie(json_encode(array(
|
||||
'hasError' => true,
|
||||
'errors' => $this->errors
|
||||
)));
|
||||
@@ -958,8 +958,8 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
if ($idCartBooking = Tools::getValue('id_cart_booking')) {
|
||||
if (Validate::isLoadedObject($objCartbookingCata = new HotelCartBookingData($idCartBooking))) {
|
||||
$roomDemands = Tools::getValue('room_demands');
|
||||
$roomDemands = Tools::jsonDecode($roomDemands, true);
|
||||
$roomDemands = Tools::jsonEncode($roomDemands);
|
||||
$roomDemands = json_decode($roomDemands, true);
|
||||
$roomDemands = json_encode($roomDemands);
|
||||
$objCartbookingCata->extra_demands = $roomDemands;
|
||||
if ($objCartbookingCata->save()) {
|
||||
die('1');
|
||||
|
||||
@@ -969,7 +969,7 @@ class ProductControllerCore extends FrontController
|
||||
$totalPrice += $totalRoomPrice;
|
||||
$demandsPrice = 0;
|
||||
if ($roomDemand = Tools::getValue('room_demands')) {
|
||||
if ($roomDemand = Tools::jsonDecode($roomDemand, true)) {
|
||||
if ($roomDemand = json_decode($roomDemand, true)) {
|
||||
$objRoomDemandPrice = new HotelRoomTypeDemandPrice();
|
||||
$demandsPrice = $objRoomDemandPrice->getRoomTypeDemandsTotalPrice(
|
||||
$idProduct,
|
||||
@@ -1009,6 +1009,6 @@ class ProductControllerCore extends FrontController
|
||||
$result['msg'] = 'failed3';
|
||||
$result['avail_rooms'] = 0;
|
||||
}
|
||||
die(Tools::jsonEncode($result));
|
||||
die(json_encode($result));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,12 +64,12 @@ class SearchControllerCore extends FrontController
|
||||
}
|
||||
Hook::exec('actionSearch', array('expr' => $query, 'total' => count($searchResults)));
|
||||
}
|
||||
$this->ajaxDie(Tools::jsonEncode($searchResults));
|
||||
$this->ajaxDie(json_encode($searchResults));
|
||||
}
|
||||
|
||||
//Only controller content initialization when the user use the normal search
|
||||
parent::initContent();
|
||||
|
||||
|
||||
$product_per_page = isset($this->context->cookie->nb_item_per_page) ? (int)$this->context->cookie->nb_item_per_page : Configuration::get('PS_PRODUCTS_PER_PAGE');
|
||||
|
||||
if ($this->instant_search && !is_array($query)) {
|
||||
|
||||
@@ -430,7 +430,7 @@ abstract class InstallControllerHttp
|
||||
if (!$success && empty($message)) {
|
||||
$message = print_r(@error_get_last(), true);
|
||||
}
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'success' => (bool)$success,
|
||||
'message' => $message,
|
||||
// 'memory' => round(memory_get_peak_usage()/1024/1024, 2).' Mo',
|
||||
|
||||
@@ -221,7 +221,7 @@ class InstallControllerConsoleProcess extends InstallControllerConsole
|
||||
$this->model_install->xml_loader_ids = $this->datas->xml_loader_ids;
|
||||
$result = $this->model_install->populateDatabase();
|
||||
$this->datas->xml_loader_ids = $this->model_install->xml_loader_ids;
|
||||
Configuration::updateValue('PS_INSTALL_XML_LOADERS_ID', Tools::jsonEncode($this->datas->xml_loader_ids));
|
||||
Configuration::updateValue('PS_INSTALL_XML_LOADERS_ID', json_encode($this->datas->xml_loader_ids));
|
||||
|
||||
return $result;
|
||||
}
|
||||
@@ -269,7 +269,7 @@ class InstallControllerConsoleProcess extends InstallControllerConsole
|
||||
{
|
||||
$this->initializeContext();
|
||||
|
||||
if ((!$this->datas->xml_loader_ids || !is_array($this->datas->xml_loader_ids)) && ($xml_ids = Tools::jsonDecode(Configuration::get('PS_INSTALL_XML_LOADERS_ID'), true))) {
|
||||
if ((!$this->datas->xml_loader_ids || !is_array($this->datas->xml_loader_ids)) && ($xml_ids = json_decode(Configuration::get('PS_INSTALL_XML_LOADERS_ID'), true))) {
|
||||
$this->datas->xml_loader_ids = $xml_ids;
|
||||
}
|
||||
|
||||
|
||||
@@ -99,6 +99,7 @@ class InstallControllerHttpSystem extends InstallControllerHttp
|
||||
'max_execution_time' => $this->l('In the PHP configuration set max_execution_time to minimum 500'),
|
||||
'upload_max_filesize' => $this->l('In the PHP configuration set upload_max_filesize to minimum 16M'),
|
||||
'fopen' => $this->l('Cannot open external URLs (requires allow_url_fopen as On).'),
|
||||
'zip' => $this->l('ZIP extension is not enabled'),
|
||||
)
|
||||
),
|
||||
array(
|
||||
|
||||
@@ -113,7 +113,7 @@
|
||||
$this->loader->setDefaultPath();
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
var dependencies = <?php echo Tools::jsonEncode($dependencies) ?>;
|
||||
var dependencies = <?php echo json_encode($dependencies) ?>;
|
||||
</script>
|
||||
<form action="" method="post">
|
||||
Selectionnez la liste des entités à resynchroniser. Afin d'éviter au maximum les erreurs, sélectionnez uniquement les entitiés que vous avez modifier.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
var install_is_done = '<?php echo addslashes($this->l('Done!')) ?>';
|
||||
var process_steps = <?php echo Tools::jsonEncode($this->process_steps) ?>;
|
||||
var process_steps = <?php echo json_encode($this->process_steps) ?>;
|
||||
var admin = '<?php echo(file_exists('../admin-dev') ? '../admin-dev' : '../admin') ?>';
|
||||
-->
|
||||
</script>
|
||||
|
||||
@@ -86,7 +86,7 @@ class AddConfToFile
|
||||
|
||||
public function checkString($string)
|
||||
{
|
||||
if (get_magic_quotes_gpc()) {
|
||||
if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
|
||||
$string = stripslashes($string);
|
||||
}
|
||||
if (!is_numeric($string)) {
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
*/
|
||||
|
||||
if (!defined('_PS_MAGIC_QUOTES_GPC_')) {
|
||||
define('_PS_MAGIC_QUOTES_GPC_', get_magic_quotes_gpc());
|
||||
define('_PS_MAGIC_QUOTES_GPC_', function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc());
|
||||
}
|
||||
if (!defined('_PS_MYSQL_REAL_ESCAPE_STRING_')) {
|
||||
define('_PS_MYSQL_REAL_ESCAPE_STRING_', function_exists('mysql_real_escape_string'));
|
||||
|
||||
@@ -31,7 +31,7 @@ function ps1607_language_code_update()
|
||||
if (is_array($langs) && $langs) {
|
||||
foreach ($langs as $lang) {
|
||||
if (Tools::strlen($lang['language_code']) == 2) {
|
||||
$result = Tools::jsonDecode(Tools::file_get_contents('https://www.prestashop.com/download/lang_packs/get_language_pack.php?version='._PS_VERSION_.'&iso_lang='.Tools::strtolower($lang['iso_code'])));
|
||||
$result = json_decode(Tools::file_get_contents('https://www.prestashop.com/download/lang_packs/get_language_pack.php?version='._PS_VERSION_.'&iso_lang='.Tools::strtolower($lang['iso_code'])));
|
||||
if ($result && !isset($result->error) && Tools::strlen($result->language_code) > 2) {
|
||||
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'lang` SET `language_code` = \''.pSQL($result->language_code).'\' WHERE `id_lang` = '.(int)$lang['id_lang']).' LIMIT 1';
|
||||
}
|
||||
|
||||
@@ -224,7 +224,8 @@ class blockcart extends Module
|
||||
}
|
||||
|
||||
$this->assignContentVars($params);
|
||||
$res = Tools::jsonDecode($this->display(__FILE__, 'blockcart-json.tpl'), true);
|
||||
|
||||
$res = json_decode(Tools::removeHtmlComments($this->display(__FILE__, 'blockcart-json.tpl')), true);
|
||||
|
||||
if (isset($params['cookie']->avail_rooms)) {
|
||||
$res['avail_rooms'] = $params['cookie']->avail_rooms;
|
||||
@@ -237,7 +238,7 @@ class blockcart extends Module
|
||||
$res['crossSelling'] = $this->display(__FILE__, 'crossselling.tpl');
|
||||
}
|
||||
|
||||
$res = Tools::jsonEncode($res);
|
||||
$res = json_encode($res);
|
||||
|
||||
return $res;
|
||||
}
|
||||
@@ -249,7 +250,7 @@ class blockcart extends Module
|
||||
}
|
||||
|
||||
$this->assignContentVars(array('cookie' => $this->context->cookie, 'cart' => $this->context->cart));
|
||||
$params['json'] = $this->display(__FILE__, 'blockcart-json.tpl');
|
||||
$params['json'] = Tools::removeHtmlComments($this->display(__FILE__, 'blockcart-json.tpl'));
|
||||
}
|
||||
|
||||
public function hookHeader()
|
||||
|
||||
@@ -57,21 +57,21 @@
|
||||
break;
|
||||
}
|
||||
}
|
||||
die(Tools::jsonEncode(array('status'=>'success', 'avail_rooms'=>$total_available_rooms)));
|
||||
die(json_encode(array('status'=>'success', 'avail_rooms'=>$total_available_rooms)));
|
||||
} else {
|
||||
die(Tools::jsonEncode(array('status'=>'failed1')));
|
||||
die(json_encode(array('status'=>'failed1')));
|
||||
}
|
||||
} else {
|
||||
die(Tools::jsonEncode(array('status'=>'unavailable_quantity', 'avail_rooms'=>$total_available_rooms)));
|
||||
die(json_encode(array('status'=>'unavailable_quantity', 'avail_rooms'=>$total_available_rooms)));
|
||||
}
|
||||
} else {
|
||||
die(Tools::jsonEncode(array('status'=>'failed2')));
|
||||
die(json_encode(array('status'=>'failed2')));
|
||||
}
|
||||
} else {
|
||||
die(Tools::jsonEncode(array('status'=>'failed3')));
|
||||
die(json_encode(array('status'=>'failed3')));
|
||||
}
|
||||
} else {
|
||||
die(Tools::jsonEncode(array('status'=>'failed4')));
|
||||
die(json_encode(array('status'=>'failed4')));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,9 +94,9 @@
|
||||
$result = $obj_htl_cart_booking_data->deleteCartBookingData($id_cart, $id_product);
|
||||
|
||||
if ($result) {
|
||||
die(Tools::jsonEncode(array('status'=>'success', 'avail_rooms'=>$total_available_rooms)));
|
||||
die(json_encode(array('status'=>'success', 'avail_rooms'=>$total_available_rooms)));
|
||||
} else {
|
||||
die(Tools::jsonEncode(array('status'=>'failed')));
|
||||
die(json_encode(array('status'=>'failed')));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,10 +109,10 @@
|
||||
$cart_obj = new Cart($id_cart);
|
||||
$update_cart_product = $cart_obj->updateQty($num_rooms_to_decr_from_cart, $id_product, null, false, $operator = 'down', 0, null, true);
|
||||
if ($update_cart_product) {
|
||||
die(Tools::jsonEncode(array('status'=>'success', 'msg'=>'successfully cart product updated.')));
|
||||
die(json_encode(array('status'=>'success', 'msg'=>'successfully cart product updated.')));
|
||||
} else {
|
||||
die(Tools::jsonEncode(array('status'=>'failed', 'msg'=>'error while updating cart product.')));
|
||||
die(json_encode(array('status'=>'failed', 'msg'=>'error while updating cart product.')));
|
||||
}
|
||||
}
|
||||
die(Tools::jsonEncode(array('status'=>'failed', 'msg'=>'error while deleting room from cart booking table.')));
|
||||
die(json_encode(array('status'=>'failed', 'msg'=>'error while deleting room from cart booking table.')));
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ class BlockcartCheckRoomAvailabilityAjaxProcessModuleFrontController extends Mod
|
||||
}
|
||||
}
|
||||
die(
|
||||
Tools::jsonEncode(
|
||||
json_encode(
|
||||
array(
|
||||
'status'=>'success',
|
||||
'msg'=>'successfully cart product updated.',
|
||||
@@ -60,7 +60,7 @@ class BlockcartCheckRoomAvailabilityAjaxProcessModuleFrontController extends Mod
|
||||
);
|
||||
}
|
||||
die(
|
||||
Tools::jsonEncode(
|
||||
json_encode(
|
||||
array('status'=>'failed', 'msg'=>'error while deleting room from cart booking table.')
|
||||
)
|
||||
);
|
||||
|
||||
@@ -48,7 +48,7 @@ class AdminBlockCategoriesController extends ModuleAdminController
|
||||
}
|
||||
|
||||
public function ajaxProcessuploadThumbnailImages()
|
||||
{
|
||||
{
|
||||
$category = new Category((int)Tools::getValue('id_category'));
|
||||
|
||||
if (isset($_FILES['thumbnail']))
|
||||
@@ -74,7 +74,7 @@ class AdminBlockCategoriesController extends ModuleAdminController
|
||||
{
|
||||
$total_errors['name'] = sprintf(Tools::displayError('An error occurred while uploading the image :'));
|
||||
$total_errors['error'] = sprintf(Tools::displayError('You cannot upload more files'));
|
||||
die(Tools::jsonEncode(array('thumbnail' => array($total_errors))));
|
||||
die(json_encode(array('thumbnail' => array($total_errors))));
|
||||
}
|
||||
|
||||
foreach ($files as $key => &$file)
|
||||
@@ -99,7 +99,7 @@ class AdminBlockCategoriesController extends ModuleAdminController
|
||||
unset($file['save_path']);
|
||||
|
||||
if (isset($file['tmp_name']))
|
||||
unset($file['tmp_name']);
|
||||
unset($file['tmp_name']);
|
||||
|
||||
//Add image preview and delete url
|
||||
$file['image'] = ImageManager::thumbnail(_PS_CAT_IMG_DIR_.(int)$category->id.'-'.$id.'_thumb.jpg',
|
||||
@@ -113,7 +113,7 @@ class AdminBlockCategoriesController extends ModuleAdminController
|
||||
else
|
||||
Tools::clearSmartyCache();
|
||||
|
||||
die(Tools::jsonEncode(array('thumbnail' => $files)));
|
||||
die(json_encode(array('thumbnail' => $files)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,5 +7,5 @@ if (substr(Tools::encrypt('blocklayered/index'),0,10) != Tools::getValue('token'
|
||||
die('Bad token');
|
||||
|
||||
$blockLayered = new BlockLayered();
|
||||
$cursor = Tools::jsonDecode(Tools::getValue('cursor', '{}'), true);
|
||||
$cursor = json_decode(Tools::getValue('cursor', '{}'), true);
|
||||
echo $blockLayered->indexUrl($cursor, (int)Tools::getValue('truncate'));
|
||||
@@ -1621,7 +1621,7 @@ class BlockLayered extends Module
|
||||
'template_name' => $template['name'],
|
||||
'attribute_groups' => $attribute_groups,
|
||||
'features' => $features,
|
||||
'filters' => Tools::jsonEncode($filters),
|
||||
'filters' => json_encode($filters),
|
||||
'total_filters' => 6+count($attribute_groups)+count($features)
|
||||
));
|
||||
|
||||
@@ -1862,7 +1862,7 @@ class BlockLayered extends Module
|
||||
break;
|
||||
|
||||
case 'manufacturer':
|
||||
$query_filters_where .= ' AND p.id_manufacturer IN ('.implode($selected_filters['manufacturer'], ',').')';
|
||||
$query_filters_where .= ' AND p.id_manufacturer IN ('.implode(',', $selected_filters['manufacturer']).')';
|
||||
break;
|
||||
|
||||
case 'condition':
|
||||
@@ -2005,7 +2005,7 @@ class BlockLayered extends Module
|
||||
$this->products = array();
|
||||
else
|
||||
{
|
||||
$product_per_page = isset($this->context->cookie->nb_item_per_page) ? (int)$this->context->cookie->nb_item_per_page : Configuration::get('PS_PRODUCTS_PER_PAGE');
|
||||
$product_per_page = isset($this->context->cookie->nb_item_per_page) ? (int)$this->context->cookie->nb_item_per_page : Configuration::get('PS_PRODUCTS_PER_PAGE');
|
||||
$n = (int)Tools::getValue('n', Configuration::get('PS_PRODUCTS_PER_PAGE'));
|
||||
$nb_day_new_product = (Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20);
|
||||
|
||||
@@ -3049,8 +3049,8 @@ class BlockLayered extends Module
|
||||
$query_filters = '';
|
||||
else
|
||||
{
|
||||
array_walk($filter_value, create_function('&$id_manufacturer', '$id_manufacturer = (int)$id_manufacturer;'));
|
||||
$query_filters = ' AND p.id_manufacturer IN ('.implode($filter_value, ',').')';
|
||||
array_walk($filter_value, function (&$id_manufacturer) {$id_manufacturer = (int)$id_manufacturer;});
|
||||
$query_filters = ' AND p.id_manufacturer IN ('.implode(',', $filter_value).')';
|
||||
}
|
||||
if ($ignore_join)
|
||||
return array('where' => $query_filters);
|
||||
@@ -3177,7 +3177,7 @@ class BlockLayered extends Module
|
||||
$vars = array_merge($vars, array('pagination_bottom' => $smarty->assign('paginationId', 'bottom')
|
||||
->fetch(_PS_THEME_DIR_.'pagination.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($vars);
|
||||
return json_encode($vars);
|
||||
}
|
||||
|
||||
public function getProducts($selected_filters, &$products, &$nb_products, &$p, &$n, &$pages_nb, &$start, &$stop, &$range)
|
||||
|
||||
@@ -51,7 +51,7 @@ class BlockWishListMyWishListModuleFrontController extends ModuleFrontController
|
||||
elseif (!empty($action) && method_exists($this, 'ajaxProcess'.Tools::toCamelCase($action)))
|
||||
$this->{'ajaxProcess'.Tools::toCamelCase($action)}();
|
||||
else
|
||||
die(Tools::jsonEncode(array('error' => 'method doesn\'t exist')));
|
||||
die(json_encode(array('error' => 'method doesn\'t exist')));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -150,7 +150,7 @@ class BlockWishListMyWishListModuleFrontController extends ModuleFrontController
|
||||
public function ajaxProcessDeleteList()
|
||||
{
|
||||
if (!$this->context->customer->isLogged())
|
||||
die(Tools::jsonEncode(array('success' => false,
|
||||
die(json_encode(array('success' => false,
|
||||
'error' => $this->module->l('You aren\'t logged in', 'mywishlist'))));
|
||||
|
||||
$default = Tools::getIsset('default');
|
||||
@@ -165,7 +165,7 @@ class BlockWishListMyWishListModuleFrontController extends ModuleFrontController
|
||||
$wishlist->delete();
|
||||
}
|
||||
else
|
||||
die(Tools::jsonEncode(array('success' => false,
|
||||
die(json_encode(array('success' => false,
|
||||
'error' => $this->module->l('Cannot delete this wishlist', 'mywishlist'))));
|
||||
|
||||
if ($default_change)
|
||||
@@ -173,19 +173,19 @@ class BlockWishListMyWishListModuleFrontController extends ModuleFrontController
|
||||
$array = WishList::getDefault($id_customer);
|
||||
|
||||
if (count($array))
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'success' => true,
|
||||
'id_default' => $array[0]['id_wishlist']
|
||||
)));
|
||||
}
|
||||
|
||||
die(Tools::jsonEncode(array('success' => true)));
|
||||
die(json_encode(array('success' => true)));
|
||||
}
|
||||
|
||||
public function ajaxProcessSetDefault()
|
||||
{
|
||||
if (!$this->context->customer->isLogged())
|
||||
die(Tools::jsonEncode(array('success' => false,
|
||||
die(json_encode(array('success' => false,
|
||||
'error' => $this->module->l('You aren\'t logged in', 'mywishlist'))));
|
||||
|
||||
$default = Tools::getIsset('default');
|
||||
@@ -196,16 +196,16 @@ class BlockWishListMyWishListModuleFrontController extends ModuleFrontController
|
||||
{
|
||||
$wishlist = new WishList((int)$id_wishlist);
|
||||
if (Validate::isLoadedObject($wishlist) && $wishlist->id_customer == $this->context->customer->id && $wishlist->setDefault())
|
||||
die(Tools::jsonEncode(array('success' => true)));
|
||||
die(json_encode(array('success' => true)));
|
||||
}
|
||||
|
||||
die(Tools::jsonEncode(array('error' => true)));
|
||||
die(json_encode(array('error' => true)));
|
||||
}
|
||||
|
||||
public function ajaxProcessProductChangeWishlist()
|
||||
{
|
||||
if (!$this->context->customer->isLogged())
|
||||
die(Tools::jsonEncode(array('success' => false,
|
||||
die(json_encode(array('success' => false,
|
||||
'error' => $this->module->l('You aren\'t logged in', 'mywishlist'))));
|
||||
|
||||
$id_product = (int)Tools::getValue('id_product');
|
||||
@@ -222,7 +222,7 @@ class BlockWishListMyWishListModuleFrontController extends ModuleFrontController
|
||||
!is_int($priority) || ($priority < 0 && $priority > 2) || !$id_old_wishlist || !$id_new_wishlist ||
|
||||
(Validate::isLoadedObject($new_wishlist) && $new_wishlist->id_customer != $this->context->customer->id) ||
|
||||
(Validate::isLoadedObject($old_wishlist) && $old_wishlist->id_customer != $this->context->customer->id))
|
||||
die(Tools::jsonEncode(array('success' => false, 'error' => $this->module->l('Error while moving product to another list', 'mywishlist'))));
|
||||
die(json_encode(array('success' => false, 'error' => $this->module->l('Error while moving product to another list', 'mywishlist'))));
|
||||
|
||||
$res = true;
|
||||
$check = (int)Db::getInstance()->getValue('SELECT quantity FROM '._DB_PREFIX_.'wishlist_product
|
||||
@@ -240,7 +240,7 @@ class BlockWishListMyWishListModuleFrontController extends ModuleFrontController
|
||||
}
|
||||
|
||||
if (!$res)
|
||||
die(Tools::jsonEncode(array('success' => false, 'error' => $this->module->l('Error while moving product to another list', 'mywishlist'))));
|
||||
die(Tools::jsonEncode(array('success' => true, 'msg' => $this->module->l('The product has been correctly moved', 'mywishlist'))));
|
||||
die(json_encode(array('success' => false, 'error' => $this->module->l('Error while moving product to another list', 'mywishlist'))));
|
||||
die(json_encode(array('success' => true, 'msg' => $this->module->l('The product has been correctly moved', 'mywishlist'))));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,6 +176,6 @@ class GraphNvD3 extends ModuleGraphEngine
|
||||
$array['data'][] = array('values' => $nvd3_values, 'key' => $this->_titles['main'][$layer]);
|
||||
}
|
||||
}
|
||||
die(preg_replace('/"([0-9]+)"/', '$1', Tools::jsonEncode($array)));
|
||||
die(preg_replace('/"([0-9]+)"/', '$1', json_encode($array)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,19 +43,19 @@ class GridHtml extends ModuleGridEngine
|
||||
$this->version = '1.3.1';
|
||||
$this->author = 'PrestaShop';
|
||||
$this->need_instance = 0;
|
||||
|
||||
|
||||
Module::__construct();
|
||||
|
||||
|
||||
$this->displayName = $this->l('Simple HTML table display');
|
||||
$this->description = $this->l('Allows the statistics system to display data in a grid.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function install()
|
||||
{
|
||||
return (parent::install() AND $this->registerHook('GridEngine'));
|
||||
}
|
||||
|
||||
|
||||
public static function hookGridEngine($params, $grider)
|
||||
{
|
||||
self::$_columns = $params['columns'];
|
||||
@@ -112,7 +112,7 @@ class GridHtml extends ModuleGridEngine
|
||||
$("#grid_1 tbody").append("<tr><td class=\"center\" colspan=\"" + '.count($params['columns']).' + "\">'.$params['emptyMsg'].'</td></tr>");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function gridNextPage(url)
|
||||
{
|
||||
var from = url.match(/&start=[0-9]+/i);
|
||||
@@ -123,7 +123,7 @@ class GridHtml extends ModuleGridEngine
|
||||
url = url.replace(/&start=[0-9]+/i, "") + from;
|
||||
getGridData(url);
|
||||
}
|
||||
|
||||
|
||||
function gridPrevPage(url)
|
||||
{
|
||||
var from = url.match(/&start=[0-9]+/i);
|
||||
@@ -145,46 +145,46 @@ class GridHtml extends ModuleGridEngine
|
||||
</script>';
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
public function setColumnsInfos(&$infos)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public function setValues($values)
|
||||
{
|
||||
$this->_values = $values;
|
||||
}
|
||||
|
||||
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->_title = $title;
|
||||
}
|
||||
|
||||
|
||||
public function setSize($width, $height)
|
||||
{
|
||||
$this->_width = $width;
|
||||
$this->_height = $height;
|
||||
}
|
||||
|
||||
|
||||
public function setTotalCount($totalCount)
|
||||
{
|
||||
$this->_totalCount = $totalCount;
|
||||
}
|
||||
|
||||
|
||||
public function setLimit($start, $limit)
|
||||
{
|
||||
$this->_start = (int)$start;
|
||||
$this->_limit = (int)$limit;
|
||||
}
|
||||
|
||||
|
||||
public function render()
|
||||
{
|
||||
echo Tools::jsonEncode(array(
|
||||
echo json_encode(array(
|
||||
'total' => $this->_totalCount,
|
||||
'from' => min($this->_start + 1, $this->_totalCount),
|
||||
'to' => min($this->_start + $this->_limit, $this->_totalCount),
|
||||
'values' => $this->_values
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -64,6 +64,10 @@ class HotelBookingDetail extends ObjectModel
|
||||
public $date_add;
|
||||
public $date_upd;
|
||||
|
||||
const STATUS_ALLOTED = 1;
|
||||
const STATUS_CHECKED_IN = 2;
|
||||
const STATUS_CHECKED_OUT = 3;
|
||||
|
||||
public static $definition = array(
|
||||
'table' => 'htl_booking_detail',
|
||||
'primary' => 'id',
|
||||
@@ -273,7 +277,7 @@ class HotelBookingDetail extends ObjectModel
|
||||
$sql = 'SELECT bd.`id_product`, bd.`id_room`, bd.`id_hotel`, bd.`id_customer`, bd.`booking_type`, bd.`id_status` AS booking_status, bd.`comment`, rf.`room_num`, bd.`date_from`, bd.`date_to`
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` AS bd
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_room_information` AS rf ON (rf.`id` = bd.`id_room`)
|
||||
WHERE bd.`id_hotel`='.(int)$hotel_id.' AND bd.`id_product` ='.(int)$room_type['id_product'].' AND bd.`is_refunded` = 0 AND bd.`is_back_order` = 0 AND IF(bd.`id_status` = 3, bd.`date_from` <= \''.pSQL($date_from).'\' AND bd.`check_out` >= \''.pSQL($date_to).'\', bd.`date_from` <= \''.pSQL($date_from).'\' AND bd.date_to >= \''.pSQL($date_to).'\')';
|
||||
WHERE bd.`id_hotel`='.(int)$hotel_id.' AND bd.`id_product` ='.(int)$room_type['id_product'].' AND bd.`is_refunded` = 0 AND bd.`is_back_order` = 0 AND IF(bd.`id_status` = '. self::STATUS_CHECKED_OUT .', bd.`date_from` <= \''.pSQL($date_from).'\' AND bd.`check_out` >= \''.pSQL($date_to).'\', bd.`date_from` <= \''.pSQL($date_from).'\' AND bd.date_to >= \''.pSQL($date_to).'\')';
|
||||
|
||||
$booked_rooms = Db::getInstance()->executeS($sql);
|
||||
|
||||
@@ -301,12 +305,12 @@ class HotelBookingDetail extends ObjectModel
|
||||
if ($search_unavai) {
|
||||
$sql1 = 'SELECT `id_product`, `id_hotel`, `room_num`, `comment` AS `room_comment`
|
||||
FROM `'._DB_PREFIX_.'htl_room_information`
|
||||
WHERE `id_hotel`='.(int)$hotel_id.' AND `id_product` ='.(int)$room_type['id_product'].' AND `id_status` = 2';
|
||||
WHERE `id_hotel`='.(int)$hotel_id.' AND `id_product` ='.(int)$room_type['id_product'].' AND `id_status` = '. self::STATUS_CHECKED_IN;
|
||||
|
||||
$sql2 = 'SELECT hri.`id_product`, hri.`id_hotel`, hri.`room_num`, hri.`comment` AS `room_comment`
|
||||
FROM `'._DB_PREFIX_.'htl_room_information` AS hri
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_room_disable_dates` AS hrdd ON (hrdd.`id_room_type` = hri.`id_product` AND hrdd. id_room = hri.`id`)
|
||||
WHERE hri.`id_hotel`='.$hotel_id.' AND hri.`id_product` ='.$room_type['id_product'].' AND hri.`id_status` = 3 AND hrdd.`date_from` <= \''.pSql($date_from).'\' AND hrdd.`date_to` >= \''.pSql($date_to).'\'';
|
||||
WHERE hri.`id_hotel`='.$hotel_id.' AND hri.`id_product` ='.$room_type['id_product'].' AND hri.`id_status` = '. self::STATUS_CHECKED_OUT .' AND hrdd.`date_from` <= \''.pSql($date_from).'\' AND hrdd.`date_to` >= \''.pSql($date_to).'\'';
|
||||
|
||||
$sql = $sql1.' UNION '.$sql2;
|
||||
|
||||
@@ -317,7 +321,7 @@ class HotelBookingDetail extends ObjectModel
|
||||
if ($search_available) {
|
||||
$exclude_ids = 'SELECT `id_room`
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail`
|
||||
WHERE `is_back_order` = 0 AND `is_refunded` = 0 AND IF(`id_status` = 3, (
|
||||
WHERE `is_back_order` = 0 AND `is_refunded` = 0 AND IF(`id_status` = '. self::STATUS_CHECKED_OUT.', (
|
||||
(DATE_FORMAT(`check_out`, "%Y-%m-%d") > \''.pSQL($date_from).'\' AND DATE_FORMAT(`check_out`, "%Y-%m-%d") <= \''.PSQL($date_to).'\') AND (
|
||||
(`date_from` <= \''.pSQL($date_from).'\' AND `check_out` > \''.pSQL($date_from).'\' AND `check_out` <= \''.PSQL($date_to).'\') OR
|
||||
(`date_from` >= \''.pSQL($date_from).'\' AND `check_out` > \''.pSQL($date_from).'\' AND `check_out` <= \''.pSQL($date_to).'\') OR
|
||||
@@ -343,13 +347,13 @@ class HotelBookingDetail extends ObjectModel
|
||||
SELECT hri.`id` AS id_room
|
||||
FROM `'._DB_PREFIX_.'htl_room_information` AS hri
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_room_disable_dates` AS hrdd ON (hrdd.`id_room_type` = hri.`id_product` AND hrdd.`id_room` = hri.`id`)
|
||||
WHERE hri.`id_hotel`='.(int)$hotel_id.' AND hri.`id_product` ='.(int)$room_type['id_product'].' AND hri.`id_status` = 3 AND (hrdd.`date_from` <= \''.pSql($date_to).'\' AND hrdd.`date_to` >= \''.pSql($date_from).'\')';
|
||||
WHERE hri.`id_hotel`='.(int)$hotel_id.' AND hri.`id_product` ='.(int)$room_type['id_product'].' AND hri.`id_status` = '. self::STATUS_CHECKED_OUT .' AND (hrdd.`date_from` <= \''.pSql($date_to).'\' AND hrdd.`date_to` >= \''.pSql($date_from).'\')';
|
||||
|
||||
$selectAvailRoomSearch = 'SELECT ri.`id` AS `id_room`, ri.`id_product`, ri.`id_hotel`, ri.`room_num`, ri.`comment` AS `room_comment`';
|
||||
|
||||
$joinAvailRoomSearch = '';
|
||||
|
||||
$whereAvailRoomSearch = 'WHERE ri.`id_hotel`='.(int)$hotel_id.' AND ri.`id_product`='.(int)$room_type['id_product'].' AND ri.`id_status` != 2 AND ri.`id` NOT IN ('.$exclude_ids.')';
|
||||
$whereAvailRoomSearch = 'WHERE ri.`id_hotel`='.(int)$hotel_id.' AND ri.`id_product`='.(int)$room_type['id_product'].' AND ri.`id_status` != '. self::STATUS_CHECKED_IN .' AND ri.`id` NOT IN ('.$exclude_ids.')';
|
||||
|
||||
$groupByAvailRoomSearch = '';
|
||||
$orderByAvailRoomSearch = '';
|
||||
@@ -385,10 +389,10 @@ class HotelBookingDetail extends ObjectModel
|
||||
}
|
||||
|
||||
if ($search_partial) {
|
||||
$sql1 = 'SELECT bd.`id_product`, bd.`id_room`, bd.`id_hotel`, bd.`id_customer`, bd.`booking_type`, bd.`id_status` AS booking_status, bd.`comment` AS `room_comment`, rf.`room_num`, bd.`date_from`, IF(bd.`id_status` = 3, bd.`check_out`, bd.`date_to`) AS `date_to`
|
||||
$sql1 = 'SELECT bd.`id_product`, bd.`id_room`, bd.`id_hotel`, bd.`id_customer`, bd.`booking_type`, bd.`id_status` AS booking_status, bd.`comment` AS `room_comment`, rf.`room_num`, bd.`date_from`, IF(bd.`id_status` = '. self::STATUS_CHECKED_OUT .', bd.`check_out`, bd.`date_to`) AS `date_to`
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` AS bd
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_room_information` AS rf ON (rf.`id` = bd.`id_room`)
|
||||
WHERE bd.`id_hotel`='.(int)$hotel_id.' AND bd.`id_product`='.(int)$room_type['id_product'].' AND rf.`id_status` != 2 AND bd.`is_back_order` = 0 AND bd.`is_refunded` = 0 AND IF(bd.`id_status` = 3, (
|
||||
WHERE bd.`id_hotel`='.(int)$hotel_id.' AND bd.`id_product`='.(int)$room_type['id_product'].' AND rf.`id_status` != '. self::STATUS_CHECKED_IN .' AND bd.`is_back_order` = 0 AND bd.`is_refunded` = 0 AND IF(bd.`id_status` = '. self::STATUS_CHECKED_OUT .', (
|
||||
(DATE_FORMAT(`check_out`, "%Y-%m-%d") > \''.pSQL($date_from).'\' AND DATE_FORMAT(`check_out`, "%Y-%m-%d") < \''.PSQL($date_to).'\') AND (
|
||||
(bd.`date_from` <= \''.pSQL($date_from).'\' AND bd.`check_out` > \''.pSQL($date_from).'\' AND bd.`check_out` < \''.pSQL($date_to).'\') OR
|
||||
(bd.`date_from` > \''.pSQL($date_from).'\' AND bd.`date_from` < \''.pSQL($date_to).'\' AND bd.`check_out` >= \''.pSQL($date_to).'\') OR
|
||||
@@ -404,7 +408,7 @@ class HotelBookingDetail extends ObjectModel
|
||||
FROM `'._DB_PREFIX_.'htl_room_information` AS hri
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_room_disable_dates` AS hrdd ON (hrdd.`id_room_type` = hri.`id_product` AND hrdd.`id_room` = hri.`id`)
|
||||
WHERE hri.`id_hotel`='.(int)$hotel_id.' AND hri.`id_product`='.(int)$room_type['id_product'].' AND
|
||||
hri.`id_status` = 3 AND (
|
||||
hri.`id_status` = '. self::STATUS_CHECKED_OUT .' AND (
|
||||
(hrdd.`date_from` <= \''.pSQL($date_from).'\' AND hrdd.`date_to` > \''.pSQL($date_from).'\' AND hrdd.`date_to` < \''.pSQL($date_to).'\') OR
|
||||
(hrdd.`date_from` > \''.pSQL($date_from).'\' AND hrdd.`date_from` < \''.pSQL($date_to).'\' AND hrdd.`date_to` >= \''.pSQL($date_to).'\') OR
|
||||
(hrdd.`date_from` > \''.pSQL($date_from).'\' AND hrdd.`date_from` < \''.pSQL($date_to).'\' AND hrdd.`date_to` < \''.pSQL($date_to).'\')
|
||||
@@ -764,12 +768,12 @@ class HotelBookingDetail extends ObjectModel
|
||||
$table = 'htl_booking_detail';
|
||||
|
||||
// create date to update in the table
|
||||
if ($new_status == 2) {
|
||||
if ($new_status == self::STATUS_CHECKED_IN) {
|
||||
$data = array(
|
||||
'id_status' => $new_status,
|
||||
'check_in' => ($status_date > $date_to ? $date_to : $status_date)
|
||||
);
|
||||
} elseif ($new_status == 3) {
|
||||
} elseif ($new_status == self::STATUS_CHECKED_OUT) {
|
||||
$data = array(
|
||||
'id_status' => $new_status,
|
||||
'check_out' => ($status_date > $date_to ? $date_to : $status_date)
|
||||
@@ -947,14 +951,14 @@ class HotelBookingDetail extends ObjectModel
|
||||
if (isset($current_admin_cart_id) && $current_admin_cart_id) {
|
||||
$sql = 'SELECT `id` AS `id_room`, `id_product`, `id_hotel`, `room_num`, `comment` AS `room_comment`
|
||||
FROM `'._DB_PREFIX_.'htl_room_information`
|
||||
WHERE `id_hotel`='.(int)$hotel_id.' AND `id_product`='.(int)$room_type.' AND id_status = 1
|
||||
WHERE `id_hotel`='.(int)$hotel_id.' AND `id_product`='.(int)$room_type.' AND id_status = '. self::STATUS_ALLOTED .'
|
||||
AND `id` NOT IN (SELECT `id_room` FROM `'._DB_PREFIX_.'htl_booking_detail` WHERE `date_from` < \''.
|
||||
pSQL($date_to).'\' AND `date_to` > \''.pSQL($date_from).'\' AND `is_refunded`=0 AND `is_back_order`=0)
|
||||
AND `id` NOT IN (SELECT `id_room` FROM `'._DB_PREFIX_.'htl_cart_booking_data` WHERE `id_cart`='.
|
||||
(int)$current_admin_cart_id.')';
|
||||
} else {
|
||||
$sql = 'SELECT `id` AS `id_room`, `id_product`, `id_hotel`, `room_num`, `comment` AS `room_comment`
|
||||
FROM `'._DB_PREFIX_.'htl_room_information` WHERE `id_hotel`='.(int)$hotel_id.' AND `id_product`='.(int)$room_type.' AND id_status = 1 AND `id` NOT IN (SELECT `id_room` FROM `'._DB_PREFIX_.'htl_booking_detail` WHERE `date_from` < \''.pSQL($date_to).'\' AND `date_to` > \''.pSQL($date_from).'\' AND `is_refunded`=0 AND `is_back_order`=0)';
|
||||
FROM `'._DB_PREFIX_.'htl_room_information` WHERE `id_hotel`='.(int)$hotel_id.' AND `id_product`='.(int)$room_type.' AND id_status = '. self::STATUS_ALLOTED .' AND `id` NOT IN (SELECT `id_room` FROM `'._DB_PREFIX_.'htl_booking_detail` WHERE `date_from` < \''.pSQL($date_to).'\' AND `date_to` > \''.pSQL($date_from).'\' AND `is_refunded`=0 AND `is_back_order`=0)';
|
||||
}
|
||||
$avail_rooms = Db::getInstance()->executeS($sql);
|
||||
if ($avail_rooms) {
|
||||
@@ -976,7 +980,7 @@ class HotelBookingDetail extends ObjectModel
|
||||
public function getAvailableRoomsForSwapping($date_from, $date_to, $room_type, $hotel_id, $id_room)
|
||||
{
|
||||
$sql = 'SELECT `id` AS `id_room`, `id_product`, `id_hotel`, `room_num`, `comment` AS `room_comment` FROM `'._DB_PREFIX_.'htl_room_information` WHERE `id_hotel`='.(int)$hotel_id.' AND `id_product`='.(int)$room_type.
|
||||
' AND `id_status` = 1 AND `id` IN (SELECT `id_room` FROM `'._DB_PREFIX_.'htl_booking_detail` WHERE `date_from` = \''.pSQL($date_from).'\' AND `date_to` = \''.pSQL($date_to).'\' AND `id_room`!='.(int)$id_room.' AND `is_refunded`=0 AND `is_back_order`=0)';
|
||||
' AND `id_status` = '. self::STATUS_ALLOTED .' AND `id` IN (SELECT `id_room` FROM `'._DB_PREFIX_.'htl_booking_detail` WHERE `date_from` = \''.pSQL($date_from).'\' AND `date_to` = \''.pSQL($date_to).'\' AND `id_room`!='.(int)$id_room.' AND `is_refunded`=0 AND `is_back_order`=0)';
|
||||
|
||||
return Db::getInstance()->executeS($sql);
|
||||
}
|
||||
@@ -1660,7 +1664,7 @@ class HotelBookingDetail extends ObjectModel
|
||||
$objHtlBooking->id_hotel = $objCartBooking->id_hotel;
|
||||
$objHtlBooking->id_customer = $cart->id_customer;
|
||||
$objHtlBooking->booking_type = $objCartBooking->booking_type;
|
||||
$objHtlBooking->id_status = 1;
|
||||
$objHtlBooking->id_status = self::STATUS_ALLOTED;
|
||||
$objHtlBooking->comment = $objCartBooking->comment;
|
||||
|
||||
// For Back Order(Because of cart lock)
|
||||
@@ -1753,15 +1757,37 @@ class HotelBookingDetail extends ObjectModel
|
||||
);
|
||||
}
|
||||
|
||||
public function getRoomBookingData($idRoom, $idOrder)
|
||||
public function getRoomBookingData($idRoom, $idOrder, $date_from, $date_to)
|
||||
{
|
||||
$sql = 'SELECT `id_product`, `id_order_detail`, `id_hotel`, `id_customer`, `booking_type`, `id_status`, `check_in`, `check_out`
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail`
|
||||
WHERE `id_order`='.(int)$idOrder.' AND `id_room`='.(int)$idRoom;
|
||||
WHERE `id_order`='.(int)$idOrder.' AND `id_room`='.(int)$idRoom.'
|
||||
AND `date_from`=\''.pSQL($date_from).'\' AND `date_to`= \''.pSQL($date_to).'\'';
|
||||
|
||||
return Db::getInstance()->getRow($sql);
|
||||
}
|
||||
|
||||
public static function getAllHotelOrderStatus()
|
||||
{
|
||||
$moduleInstance = Module::getInstanceByName('hotelreservationsystem');
|
||||
|
||||
$pages = array(
|
||||
'STATUS_ALLOTED' => array(
|
||||
'id_status' => self::STATUS_ALLOTED,
|
||||
'name' => $moduleInstance->l('Alloted', 'hotelreservationsystem')
|
||||
),
|
||||
'STATUS_CHECKED_IN' => array(
|
||||
'id_status' => self::STATUS_CHECKED_IN,
|
||||
'name' => $moduleInstance->l('Checked In', 'hotelreservationsystem')
|
||||
),
|
||||
'STATUS_CHECKED_OUT' => array(
|
||||
'id_status' => self::STATUS_CHECKED_OUT,
|
||||
'name' => $moduleInstance->l('Checked Out', 'hotelreservationsystem')
|
||||
),
|
||||
);
|
||||
return $pages;
|
||||
}
|
||||
|
||||
// Webservice funcions
|
||||
public function getWsBookingExtraDemands()
|
||||
{
|
||||
|
||||
@@ -840,7 +840,7 @@ class HotelBranchInformation extends ObjectModel
|
||||
libxml_use_internal_errors(true);
|
||||
$xml = simplexml_load_string(utf8_decode($postData));
|
||||
|
||||
$hotelData = Tools::jsonDecode(Tools::jsonEncode($xml));
|
||||
$hotelData = json_decode(json_encode($xml));
|
||||
if (isset($hotelData->hotel->max_order_date)) {
|
||||
if ($maxOrderDate = $hotelData->hotel->max_order_date) {
|
||||
$this->setWsMaxOrderDate($maxOrderDate);
|
||||
@@ -863,7 +863,7 @@ class HotelBranchInformation extends ObjectModel
|
||||
libxml_use_internal_errors(true);
|
||||
$xml = simplexml_load_string(utf8_decode($postData));
|
||||
|
||||
$hotelData = Tools::jsonDecode(Tools::jsonEncode($xml));
|
||||
$hotelData = json_decode(json_encode($xml));
|
||||
if (isset($hotelData->hotel->max_order_date)) {
|
||||
if ($maxOrderDate = $hotelData->hotel->max_order_date) {
|
||||
$this->setWsMaxOrderDate($maxOrderDate);
|
||||
|
||||
@@ -764,7 +764,7 @@ class HotelCartBookingData extends ObjectModel
|
||||
AND fp.`active`=1 AND fp.`date_from` <= \''.pSQL($date).'\' AND fp.`date_to` >= \''.pSQL($date).'\''
|
||||
)) {
|
||||
foreach ($featurePrice as $fRow) {
|
||||
$specialDays = Tools::jsonDecode($fRow['special_days']);
|
||||
$specialDays = json_decode($fRow['special_days']);
|
||||
if (in_array(strtolower(date('D', strtotime($date))), $specialDays)) {
|
||||
return $fRow;
|
||||
}
|
||||
@@ -1105,7 +1105,7 @@ class HotelCartBookingData extends ObjectModel
|
||||
|
||||
if ($getTotalPrice) {
|
||||
if ($roomTypeDemands['extra_demands']
|
||||
&& ($extraDemand = Tools::jsonDecode($roomTypeDemands['extra_demands'], true))
|
||||
&& ($extraDemand = json_decode($roomTypeDemands['extra_demands'], true))
|
||||
) {
|
||||
$totalDemandsPrice += $objRoomDemandPrice->getRoomTypeDemandsTotalPrice(
|
||||
$roomTypeDemands['id_product'],
|
||||
@@ -1116,7 +1116,7 @@ class HotelCartBookingData extends ObjectModel
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$roomTypeDemands['extra_demands'] = Tools::jsonDecode(
|
||||
$roomTypeDemands['extra_demands'] = json_decode(
|
||||
$roomTypeDemands['extra_demands'],
|
||||
true
|
||||
);
|
||||
@@ -1146,7 +1146,7 @@ class HotelCartBookingData extends ObjectModel
|
||||
foreach ($roomTypeDemands as $key => &$demand) {
|
||||
if ($getTotalPrice) {
|
||||
if ($demand['extra_demands']
|
||||
&& ($extraDemand = Tools::jsonDecode($demand['extra_demands'], true))
|
||||
&& ($extraDemand = json_decode($demand['extra_demands'], true))
|
||||
) {
|
||||
$totalDemandsPrice += $objRoomDemandPrice->getRoomTypeDemandsTotalPrice(
|
||||
$demand['id_product'],
|
||||
@@ -1157,7 +1157,7 @@ class HotelCartBookingData extends ObjectModel
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$demand['extra_demands'] = Tools::jsonDecode(
|
||||
$demand['extra_demands'] = json_decode(
|
||||
$demand['extra_demands'],
|
||||
true
|
||||
);
|
||||
@@ -1193,7 +1193,7 @@ class HotelCartBookingData extends ObjectModel
|
||||
// Webservice :: get extra demands for the cart booking
|
||||
public function getWsExtraDemands()
|
||||
{
|
||||
$extraDemands = Tools::jsonDecode($this->extra_demands, true);
|
||||
$extraDemands = json_decode($this->extra_demands, true);
|
||||
if (count($extraDemands)) {
|
||||
foreach ($extraDemands as &$demnad) {
|
||||
$demnad['id'] = $demnad['id_global_demand'];
|
||||
|
||||
@@ -293,18 +293,6 @@ class HotelHelper
|
||||
return true;
|
||||
}
|
||||
|
||||
public function insertHotelOrderStatus()
|
||||
{
|
||||
$order_status_arr = array('Alloted','Checked In','Checked Out');
|
||||
foreach ($order_status_arr as $key => $value) {
|
||||
$obj_order_status = new HotelOrderStatus();
|
||||
$obj_order_status->status = $value;
|
||||
$obj_order_status->save();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function insertHotelRoomAllotmentType()
|
||||
{
|
||||
$altment_type_arr = array('Random Allotment','Manual Allotment');
|
||||
|
||||
@@ -54,10 +54,8 @@ class HotelOrderRestrictDate extends ObjectModel
|
||||
$obj_ord_rest = new self();
|
||||
$order_restrict_data = $obj_ord_rest->getDataByHotelId($id_hotel);
|
||||
|
||||
$max_order_date_restr = $order_restrict_data['max_order_date'];
|
||||
|
||||
if (isset($max_order_date_restr) && $max_order_date_restr) {
|
||||
$max_order_date = $max_order_date_restr;
|
||||
if (isset($order_restrict_data['max_order_date']) && $order_restrict_data['max_order_date']) {
|
||||
$max_order_date = $order_restrict_data['max_order_date'];
|
||||
} elseif (isset($global_max_order_date) && $global_max_order_date) {
|
||||
$max_order_date = $global_max_order_date;
|
||||
} else {
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* 2010-2020 Webkul.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* All right is reserved,
|
||||
* Please go through this link for complete license : https://store.webkul.com/license.html
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to newer
|
||||
* versions in the future. If you wish to customize this module for your
|
||||
* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information.
|
||||
*
|
||||
* @author Webkul IN <support@webkul.com>
|
||||
* @copyright 2010-2020 Webkul IN
|
||||
* @license https://store.webkul.com/license.html
|
||||
*/
|
||||
|
||||
class HotelOrderStatus extends ObjectModel
|
||||
{
|
||||
public $id;
|
||||
public $status;
|
||||
|
||||
public static $definition = array(
|
||||
'table' => 'htl_order_status',
|
||||
'primary' => 'id',
|
||||
'fields' => array(
|
||||
'status' => array('type' => self::TYPE_STRING),
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* [getAllHotelOrderStatus :: To get array all possible order statuses]
|
||||
* @return [array|boolean] [If data found then Returns array of the order statuses else returns false]
|
||||
*/
|
||||
public static function getAllHotelOrderStatus()
|
||||
{
|
||||
$result = Db::getInstance()->executeS("SELECT * FROM `"._DB_PREFIX_."htl_order_status`");
|
||||
if ($result) {
|
||||
return $result;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -143,7 +143,7 @@ class HotelRoomTypeDemandPrice extends ObjectModel
|
||||
}
|
||||
if ($cartChanged) {
|
||||
if (Validate::isLoadedObject($objCartBooking = new HotelCartBookingData($demandInfo['id']))) {
|
||||
$objCartBooking->extra_demands = Tools::jsonEncode($demandInfo['extra_demands']);
|
||||
$objCartBooking->extra_demands = json_encode($demandInfo['extra_demands']);
|
||||
$objCartBooking->save();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ class HotelRoomTypeGlobalDemand extends ObjectModel
|
||||
}
|
||||
if ($cartChanged) {
|
||||
if (Validate::isLoadedObject($objCartBooking = new HotelCartBookingData($demandInfo['id']))) {
|
||||
$objCartBooking->extra_demands = Tools::jsonEncode($demandInfo['extra_demands']);
|
||||
$objCartBooking->extra_demands = json_encode($demandInfo['extra_demands']);
|
||||
$objCartBooking->save();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ class HotelRoomTypeGlobalDemandAdvanceOption extends ObjectModel
|
||||
}
|
||||
if ($cartChanged) {
|
||||
if (Validate::isLoadedObject($objCartBooking = new HotelCartBookingData($demandInfo['id']))) {
|
||||
$objCartBooking->extra_demands = Tools::jsonEncode($demandInfo['extra_demands']);
|
||||
$objCartBooking->extra_demands = json_encode($demandInfo['extra_demands']);
|
||||
$objCartBooking->save();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ class QloRoomType extends QloWebservice
|
||||
// }
|
||||
|
||||
// // convert object to array
|
||||
// $address = Tools::jsonDecode(Tools::jsonEncode($address), true);
|
||||
// $address = json_decode(json_encode($address), true);
|
||||
|
||||
// $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('address', array());
|
||||
// $address['country'] = Country::getNameById($this->id_lang, $address['id_country']);
|
||||
|
||||
@@ -80,7 +80,7 @@ class WebserviceSpecificManagementQlo implements WebserviceSpecificManagementInt
|
||||
$outputXML = $this->objOutput->getObjectRender()->overrideContent($this->output);
|
||||
if (isset($this->wsObject->urlFragments['outputformat']) && $this->wsObject->urlFragments['outputformat'] == 'json') {
|
||||
$outputXML = simplexml_load_string($outputXML, null, LIBXML_NOCDATA);
|
||||
$json = Tools::jsonEncode($outputXML);
|
||||
$json = json_encode($outputXML);
|
||||
$content = preg_replace("/\\\\u([a-f0-9]{4})/e", "iconv('UCS-4LE','UTF-8',pack('V', hexdec('U$1')))", $json);
|
||||
header('Content-Type: application/json');
|
||||
die($content);
|
||||
@@ -153,7 +153,7 @@ class WebserviceSpecificManagementQlo implements WebserviceSpecificManagementInt
|
||||
}
|
||||
} else {
|
||||
// If input type is json
|
||||
$array = Tools::jsonDecode($inputXML, true);
|
||||
$array = json_decode($inputXML, true);
|
||||
if (isset($array['json']) && $array['json'] && isset($array[$head])) {
|
||||
return ($head ? $array[$head] : $array);
|
||||
} else {
|
||||
@@ -172,7 +172,7 @@ class WebserviceSpecificManagementQlo implements WebserviceSpecificManagementInt
|
||||
|
||||
$xmlEntities = $xml->children();
|
||||
// Convert multi-dimention xml into an array
|
||||
$array = Tools::jsonDecode(Tools::jsonEncode($xmlEntities), true);
|
||||
$array = json_decode(json_encode($xmlEntities), true);
|
||||
|
||||
return ($head ? $array[$head] : $array);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user