diff --git a/classes/Carrier.php b/classes/Carrier.php
index fb9247249..b460293b1 100644
--- a/classes/Carrier.php
+++ b/classes/Carrier.php
@@ -183,7 +183,7 @@ class CarrierCore extends ObjectModel
return false;
return Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'cart_rule_carrier WHERE id_carrier = '.(int)$this->id);
}
-
+
/**
* Change carrier id in delivery prices when updating a carrier
*
diff --git a/classes/Cart.php b/classes/Cart.php
index 8680ac6a0..07146ebea 100644
--- a/classes/Cart.php
+++ b/classes/Cart.php
@@ -164,6 +164,8 @@ class CartCore extends ObjectModel
public function add($autodate = true, $nullValues = false)
{
+ if (!$this->id_lang)
+ $this->id_lang = Configuration::get('PS_LANG_DEFAULT');
$return = parent::add($autodate);
Hook::exec('cart');
return $return;
@@ -253,7 +255,7 @@ class CartCore extends ObjectModel
Tools::displayAsDeprecated();
return $this->getCartRules();
}
-
+
public function getCartRules()
{
// TODO : add cache
@@ -266,7 +268,7 @@ class CartCore extends ObjectModel
$total_products_te = $this->getOrderTotal(false, Cart::ONLY_PRODUCTS);
$shipping_ti = $this->getOrderShippingCost();
$shipping_te = $this->getOrderShippingCost(NULL, false);
-
+
$result = Db::getInstance()->executeS('
SELECT *
FROM `'._DB_PREFIX_.'cart_cart_rule` cd
@@ -279,7 +281,7 @@ class CartCore extends ObjectModel
$cartRule = new CartRule($row['id_cart_rule'], (int)$this->id_lang);
$row['value_real'] = $cartRule->getContextualValue(true);
$row['value_tax_exc'] = $cartRule->getContextualValue(false);
-
+
// Retro compatibility < 1.5.0.2
$row['id_discount'] = $row['id_cart_rule'];
$row['description'] = $row['name'];
@@ -1016,7 +1018,7 @@ class CartCore extends ObjectModel
}
$wrapping_fees = Tools::convertPrice(Tools::ps_round($wrapping_fees, 2), Currency::getCurrencyInstance((int)($this->id_currency)));
}
-
+
$order_total_discount = 0;
if ($type != Cart::ONLY_PRODUCTS && CartRule::isFeatureActive())
{
@@ -1275,7 +1277,7 @@ class CartCore extends ObjectModel
}
return self::$_totalWeight[$this->id];
}
-
+
/**
* @deprecated 1.5.0.1
*/
diff --git a/classes/Connection.php b/classes/Connection.php
index 333099d0c..4c5fcb2d1 100644
--- a/classes/Connection.php
+++ b/classes/Connection.php
@@ -1,6 +1,6 @@
'isUnsignedId', 'id_page' => 'isUnsignedId',
'ip_address' => 'isInt', 'http_referer' => 'isAbsoluteUrl');
- /* MySQL does not allow 'connection' for a table name */
+ /* MySQL does not allow 'connection' for a table name */
protected $table = 'connections';
protected $identifier = 'id_connections';
-
+
public function getFields()
{
+ if (!$this->id_shop)
+ $this->id_shop = Context::getContext()->shop->getId(true);
+ if (!$this->id_group_shop)
+ $this->id_group_shop = Context::getContext()->shop->getGroupID();
+
$this->validateFields();
$fields['id_guest'] = (int)($this->id_guest);
$fields['id_page'] = (int)($this->id_page);
@@ -69,33 +74,33 @@ class ConnectionCore extends ObjectModel
$fields['id_group_shop'] = (int)$this->id_group_shop;
return $fields;
}
-
+
public static function setPageConnection($cookie, $full = true)
{
// The connection is created if it does not exist yet and we get the current page id
- if (!isset($cookie->id_connections) OR !strstr(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '', Tools::getHttpHost(false, false)))
+ if (!isset($cookie->id_connections) OR !strstr(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '', Tools::getHttpHost(false, false)))
$id_page = Connection::setNewConnection($cookie);
if (!isset($id_page) OR !$id_page)
$id_page = Page::getCurrentId();
if (!Configuration::get('PS_STATSDATA_CUSTOMER_PAGESVIEWS'))
return array('id_page' => $id_page);
-
+
// The ending time will be updated by an ajax request when the guest will close the page
$time_start = date('Y-m-d H:i:s');
Db::getInstance()->AutoExecute(_DB_PREFIX_.'connections_page', array('id_connections' => (int)($cookie->id_connections), 'id_page' => (int)($id_page), 'time_start' => $time_start), 'INSERT');
-
+
// This array is serialized and used by the ajax request to identify the page
return array(
'id_connections' => (int)($cookie->id_connections),
'id_page' => (int)($id_page),
'time_start' => $time_start);
}
-
+
public static function setNewConnection($cookie, Shop $shop = null)
{
if (!$shop)
$shop = Context::getContext()->shop;
-
+
if (isset($_SERVER['HTTP_USER_AGENT'])
AND preg_match('/BotLink|ahoy|AlkalineBOT|anthill|appie|arale|araneo|AraybOt|ariadne|arks|ATN_Worldwide|Atomz|bbot|Bjaaland|Ukonline|borg\-bot\/0\.9|boxseabot|bspider|calif|christcrawler|CMC\/0\.01|combine|confuzzledbot|CoolBot|cosmos|Internet Cruiser Robot|cusco|cyberspyder|cydralspider|desertrealm, desert realm|digger|DIIbot|grabber|downloadexpress|DragonBot|dwcp|ecollector|ebiness|elfinbot|esculapio|esther|fastcrawler|FDSE|FELIX IDE|ESI|fido|H�m�h�kki|KIT\-Fireball|fouineur|Freecrawl|gammaSpider|gazz|gcreep|golem|googlebot|griffon|Gromit|gulliver|gulper|hambot|havIndex|hotwired|htdig|iajabot|INGRID\/0\.1|Informant|InfoSpiders|inspectorwww|irobot|Iron33|JBot|jcrawler|Teoma|Jeeves|jobo|image\.kapsi\.net|KDD\-Explorer|ko_yappo_robot|label\-grabber|larbin|legs|Linkidator|linkwalker|Lockon|logo_gif_crawler|marvin|mattie|mediafox|MerzScope|NEC\-MeshExplorer|MindCrawler|udmsearch|moget|Motor|msnbot|muncher|muninn|MuscatFerret|MwdSearch|sharp\-info\-agent|WebMechanic|NetScoop|newscan\-online|ObjectsSearch|Occam|Orbsearch\/1\.0|packrat|pageboy|ParaSite|patric|pegasus|perlcrawler|phpdig|piltdownman|Pimptrain|pjspider|PlumtreeWebAccessor|PortalBSpider|psbot|Getterrobo\-Plus|Raven|RHCS|RixBot|roadrunner|Robbie|robi|RoboCrawl|robofox|Scooter|Search\-AU|searchprocess|Senrigan|Shagseeker|sift|SimBot|Site Valet|skymob|SLCrawler\/2\.0|slurp|ESI|snooper|solbot|speedy|spider_monkey|SpiderBot\/1\.0|spiderline|nil|suke|http:\/\/www\.sygol\.com|tach_bw|TechBOT|templeton|titin|topiclink|UdmSearch|urlck|Valkyrie libwww\-perl|verticrawl|Victoria|void\-bot|Voyager|VWbot_K|crawlpaper|wapspider|WebBandit\/1\.0|webcatcher|T\-H\-U\-N\-D\-E\-R\-S\-T\-O\-N\-E|WebMoose|webquest|webreaper|webs|webspider|WebWalker|wget|winona|whowhere|wlm|WOLP|WWWC|none|XGET|Nederland\.zoek/i', $_SERVER['HTTP_USER_AGENT']))
{
@@ -111,7 +116,7 @@ class ConnectionCore extends ObjectModel
return Page::getCurrentId();
}
}
-
+
// A new connection is created if the guest made no actions during 30 minutes
$sql = 'SELECT `id_guest`
FROM `'._DB_PREFIX_.'connections`
@@ -124,7 +129,7 @@ class ConnectionCore extends ObjectModel
{
// The old connections details are removed from the database in order to spare some memory
Connection::cleanConnectionsPages();
-
+
$referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
$arrayUrl = parse_url($referer);
if (!isset($arrayUrl['host']) OR preg_replace('/^www./', '', $arrayUrl['host']) == preg_replace('/^www./', '', Tools::getHttpHost(false, false)))
@@ -142,14 +147,14 @@ class ConnectionCore extends ObjectModel
return $connection->id_page;
}
}
-
+
public static function setPageTime($id_connections, $id_page, $time_start, $time)
{
if (!Validate::isUnsignedId($id_connections)
OR !Validate::isUnsignedId($id_page)
OR !Validate::isDate($time_start))
return;
-
+
// Limited to 5 minutes because more than 5 minutes is considered as an error
if ($time > 300000)
$time = 300000;
@@ -160,7 +165,7 @@ class ConnectionCore extends ObjectModel
AND `id_page` = '.(int)($id_page).'
AND `time_start` = \''.pSQL($time_start).'\'');
}
-
+
public static function cleanConnectionsPages()
{
$period = Configuration::get('PS_STATS_OLD_CONNECT_AUTO_CLEAN');
@@ -173,7 +178,7 @@ class ConnectionCore extends ObjectModel
$interval = '1 YEAR';
else
return;
-
+
if ($interval != null)
{
// Records of connections details older than the beginning of the specified interval are deleted
diff --git a/classes/Country.php b/classes/Country.php
index bee4178ef..e01be0a7b 100644
--- a/classes/Country.php
+++ b/classes/Country.php
@@ -66,7 +66,7 @@ class CountryCore extends ObjectModel
protected $tables = array ('country', 'country_lang');
- protected $fieldsRequired = array('id_zone', 'id_currency', 'iso_code', 'contains_states', 'need_identification_number', 'display_tax_label');
+ protected $fieldsRequired = array('id_zone', 'iso_code', 'contains_states', 'need_identification_number', 'display_tax_label');
protected $fieldsSize = array('iso_code' => 3);
protected $fieldsValidate = array(
'id_zone' => 'isUnsignedId',
@@ -122,7 +122,7 @@ class CountryCore extends ObjectModel
$this->validateFieldsLang();
return $this->getTranslationsFields(array('name'));
}
-
+
public function delete()
{
if (!parent::delete())
diff --git a/classes/Feature.php b/classes/Feature.php
index f5709a7a1..04983d8a9 100644
--- a/classes/Feature.php
+++ b/classes/Feature.php
@@ -1,6 +1,6 @@
128);
protected $fieldsValidateLang = array('name' => 'isGenericName', 'position' => 'isInt');
-
+
protected $table = 'feature';
protected $identifier = 'id_feature';
-
+
protected $webserviceParameters = array(
'objectsNodeName' => 'product_features',
'objectNodeName' => 'product_feature',
@@ -48,7 +48,7 @@ class FeatureCore extends ObjectModel
{
return array('id_feature' => NULL, 'position' => (int)$this->position);
}
-
+
/**
* Check then return multilingual fields for database interaction
*
@@ -59,7 +59,7 @@ class FeatureCore extends ObjectModel
$this->validateFieldsLang();
return $this->getTranslationsFields(array('name'));
}
-
+
/**
* Get a feature data for a given id_feature and id_lang
*
@@ -76,7 +76,7 @@ class FeatureCore extends ObjectModel
LEFT JOIN `'._DB_PREFIX_.'feature_lang` fl ON ( f.`id_feature` = fl.`id_feature` AND fl.`id_lang` = '.(int)($id_lang).')
WHERE f.`id_feature` = '.(int)($id_feature));
}
-
+
/**
* Get all features for a given language
*
@@ -92,7 +92,7 @@ class FeatureCore extends ObjectModel
LEFT JOIN `'._DB_PREFIX_.'feature_lang` fl ON (f.`id_feature` = fl.`id_feature` AND fl.`id_lang` = '.(int)($id_lang).')
ORDER BY f.`position` ASC');
}
-
+
/**
* Delete several objects from database
*
@@ -112,6 +112,9 @@ class FeatureCore extends ObjectModel
public function add($autodate = true, $nullValues = false)
{
+ if ($this->position <= 0)
+ $this->position = Feature::getHigherPosition() + 1;
+
$return = parent::add($autodate, true);
Hook::exec('afterSaveFeature', array('id_feature' => $this->id));
return $return;
@@ -124,21 +127,21 @@ class FeatureCore extends ObjectModel
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'feature_value` WHERE `id_feature` = '.(int)($this->id));
/* Also delete related products */
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'feature_product` WHERE `id_feature` = '.(int)($this->id));
-
+
$return = parent::delete();
if($return)
Hook::exec('afterDeleteFeature', array('id_feature' => $this->id));
-
+
/* Reinitializing position */
$this->cleanPositions();
-
+
return $return;
}
-
+
public function update($nullValues = false)
{
$this->clearCache();
-
+
$result = 1;
$fields = $this->getTranslationsFieldsChild();
foreach ($fields as $field)
@@ -146,19 +149,19 @@ class FeatureCore extends ObjectModel
foreach (array_keys($field) as $key)
if (!Validate::isTableOrIdentifier($key))
die(Tools::displayError());
-
+
$sql = 'SELECT `id_lang` FROM `'.pSQL(_DB_PREFIX_.$this->table).'_lang`
WHERE `'.pSQL($this->identifier).'` = '.(int)$this->id.'
AND `id_lang` = '.(int)$field['id_lang'];
$mode = Db::getInstance()->getRow($sql);
- $result &= (!$mode) ? Db::getInstance()->AutoExecute(_DB_PREFIX_.$this->table.'_lang', $field, 'INSERT') :
+ $result &= (!$mode) ? Db::getInstance()->AutoExecute(_DB_PREFIX_.$this->table.'_lang', $field, 'INSERT') :
Db::getInstance()->AutoExecute(_DB_PREFIX_.$this->table.'_lang', $field, 'UPDATE', '`'.
pSQL($this->identifier).'` = '.(int)$this->id.' AND `id_lang` = '.(int)$field['id_lang']);
}
Hook::exec('afterSaveFeature', array('id_feature' => $this->id));
return $result;
}
-
+
/**
* Count number of features for a given language
*
@@ -175,14 +178,14 @@ class FeatureCore extends ObjectModel
ORDER BY `name` ASC');
return ($result['nb']);
}
-
+
/**
* Create a feature from import
*
* @param integer $id_feature Feature id
- * @param integer $id_product Product id
- * @param array $value Feature Value
- */
+ * @param integer $id_product Product id
+ * @param array $value Feature Value
+ */
public static function addFeatureImport($name, $position = false)
{
$rq = Db::getInstance()->getRow('SELECT `id_feature` FROM '._DB_PREFIX_.'feature_lang WHERE `name` = \''.pSQL($name).'\' GROUP BY `id_feature`');
@@ -200,21 +203,21 @@ class FeatureCore extends ObjectModel
$feature->add();
return $feature->id;
}
-
+
public static function getFeaturesForComparison($list_ids_product, $id_lang)
{
if (!Feature::isFeatureActive())
return false;
-
+
$ids = '';
foreach($list_ids_product as $id)
$ids .= (int)($id).',';
-
+
$ids = rtrim($ids, ',');
-
+
if (empty($ids))
return false;
-
+
return Db::getInstance()->executeS('
SELECT * , COUNT(*) as nb
FROM `'._DB_PREFIX_.'feature` f
@@ -225,7 +228,7 @@ class FeatureCore extends ObjectModel
GROUP BY f.`id_feature`
ORDER BY nb DESC');
}
-
+
/**
* This metohd is allow to know if a feature is used or active
* @since 1.5.0.1
@@ -235,7 +238,7 @@ class FeatureCore extends ObjectModel
{
return Configuration::get('PS_FEATURE_FEATURE_ACTIVE');
}
-
+
/**
* Move a feature
* @param boolean $way Up (1) or Down (0)
@@ -273,7 +276,7 @@ class FeatureCore extends ObjectModel
SET `position` = '.(int)$position.'
WHERE `id_feature`='.(int)$movedFeature['id_feature']));
}
-
+
/**
* Reorder feature position
* Call it after deleting a feature.
@@ -301,9 +304,9 @@ class FeatureCore extends ObjectModel
/**
* getHigherPosition
- *
+ *
* Get the higher feature position
- *
+ *
* @return integer $position
*/
public static function getHigherPosition()
@@ -311,7 +314,7 @@ class FeatureCore extends ObjectModel
$sql = 'SELECT MAX(`position`)
FROM `'._DB_PREFIX_.'feature`';
$position = DB::getInstance()->getValue($sql);
- return ($position !== false) ? $position : -1;
+ return (is_numeric($position)) ? $position : -1;
}
}
diff --git a/classes/Module.php b/classes/Module.php
index ab0fd3221..9ba1b8ebb 100644
--- a/classes/Module.php
+++ b/classes/Module.php
@@ -989,7 +989,7 @@ abstract class ModuleCore
$sql = 'SELECT id_module, id_shop
FROM '._DB_PREFIX_.'hook_module
WHERE id_hook = '.(int)$id_hook.'
- '.((!is_null($shopList)) ? ' AND id_shop IN('.implode(', ', $shopList).')' : '').'
+ '.((!is_null($shopList) && $shopList) ? ' AND id_shop IN('.implode(', ', $shopList).')' : '').'
ORDER BY position';
$results = Db::getInstance()->executeS($sql);
$position = array();
diff --git a/classes/ObjectModel.php b/classes/ObjectModel.php
index cc4824469..d6f3a3611 100644
--- a/classes/ObjectModel.php
+++ b/classes/ObjectModel.php
@@ -478,7 +478,7 @@ abstract class ObjectModelCore
foreach ($fieldsRequired as $field)
if (Tools::isEmpty($this->{$field}) AND (!is_numeric($this->{$field})))
{
- if ($die)
+ if ($die)
throw new PrestashopException('property empty : '.get_class($this).'->'.$field);
return $errorReturn ? get_class($this).' -> '.$field.' is empty' : false;
}
@@ -495,7 +495,7 @@ abstract class ObjectModelCore
throw new PrestashopException('Validation function not found. '.$method);
elseif (!empty($this->{$field}) AND !call_user_func(array('Validate', $method), $this->{$field}))
{
- if ($die)
+ if ($die)
throw new PrestashopException('Field not valid : '.get_class($this).'->'.$field.' = '.$this->{$field});
return $errorReturn ? get_class($this).' -> '.$field.' = '.$this->{$field} : false;
}
@@ -514,7 +514,7 @@ abstract class ObjectModelCore
continue ;
if (!$this->{$fieldArray} OR !sizeof($this->{$fieldArray}) OR ($this->{$fieldArray}[$defaultLanguage] !== '0' AND empty($this->{$fieldArray}[$defaultLanguage])))
{
- if ($die)
+ if ($die)
throw new PrestashopException('empty for default language : '.get_class($this).'->'.$fieldArray);
return $errorReturn ? get_class($this).'->'.$fieldArray.' '.Tools::displayError('is empty for default language.') : false;
}
@@ -526,7 +526,7 @@ abstract class ObjectModelCore
foreach ($this->{$fieldArray} as $k => $value)
if (Tools::strlen($value) > $size)
{
- if ($die)
+ if ($die)
throw new PrestashopException('fieldsize error '.get_class($this).'->'.$fieldArray.' length of '.$size.' for language');
return $errorReturn ? get_class($this).'->'.$fieldArray.' '.Tools::displayError('Length').' '.$size.' '.Tools::displayError('for language') : false;
}
@@ -541,7 +541,7 @@ abstract class ObjectModelCore
throw new PrestashopException('Validation function not found for lang: '.$method);
elseif (!empty($value) AND !call_user_func(array('Validate', $method), $value))
{
- if ($die)
+ if ($die)
throw new PrestashopException('Field not valid : '.get_class($this).'->'.$field.' = '.$this->{$field}. 'for language '.$k);
return $errorReturn ? Tools::displayError('The following field is invalid according to the validate method ').''.$method.':
('. get_class($this).'->'.$fieldArray.' = '.$value.' '.Tools::displayError('for language').' '.$k : false;
}
diff --git a/classes/Order.php b/classes/Order.php
index cb24a8c0f..6b8b5e272 100644
--- a/classes/Order.php
+++ b/classes/Order.php
@@ -196,6 +196,9 @@ class OrderCore extends ObjectModel
public function getFields()
{
+ if (!$this->id_lang)
+ $this->id_lang = Configuration::get('PS_LANG_DEFAULT');
+
$this->validateFields();
$fields['id_group_shop'] = (int)$this->id_group_shop;
@@ -614,7 +617,7 @@ class OrderCore extends ObjectModel
}
return $virtual;
}
-
+
/**
* @deprecated 1.5.0.1
*/
@@ -623,7 +626,7 @@ class OrderCore extends ObjectModel
Tools::displayAsDeprecated();
return Order::getCartRules();
}
-
+
public function getCartRules()
{
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
@@ -898,7 +901,7 @@ class OrderCore extends ObjectModel
Tools::displayAsDeprecated();
return Order::addCartRule($id_cart_rule, $name, $value);
}
-
+
public function addCartRule($id_cart_rule, $name, $value)
{
return Db::getInstance()->AutoExecute(_DB_PREFIX_.'order_cart_rule', array('id_order' => (int)$this->id, 'id_cart_rule' => (int)$id_cart_rule, 'name' => pSQL($name), 'value' => (float)$value), 'INSERT');
diff --git a/classes/Tab.php b/classes/Tab.php
index 964f06ef7..2521b1135 100644
--- a/classes/Tab.php
+++ b/classes/Tab.php
@@ -41,7 +41,7 @@ class TabCore extends ObjectModel
/** @var integer position */
public $position;
- protected $fieldsRequired = array('class_name', 'position');
+ protected $fieldsRequired = array('class_name');
protected $fieldsSize = array('class_name' => 64, 'module' => 64);
protected $fieldsValidate = array(
'id_parent' => 'isInt',
@@ -105,7 +105,7 @@ class TabCore extends ObjectModel
{
if (!$context)
$context = Context::getContext();
- if (!$context->employee->id_profile)
+ if (!$context->employee || !$context->employee->id_profile)
return false;
/* Profile selection */
$profiles = Db::getInstance()->executeS('
diff --git a/classes/Validate.php b/classes/Validate.php
index ca0489d62..ef7b5528f 100644
--- a/classes/Validate.php
+++ b/classes/Validate.php
@@ -1,6 +1,6 @@
= 0;
@@ -243,17 +243,17 @@ class ValidateCore
{
return preg_match('/^[a-zA-Z]{2,3}$/', $isoCode);
}
-
+
public static function isLanguageCode($s)
{
return preg_match('/^[a-zA-Z]{2}(-[a-zA-Z]{2})?$/', $s);
}
-
+
public static function isStateIsoCode($isoCode)
{
- return preg_match('/^[a-zA-Z0-9]{2,3}((-)[a-zA-Z0-9]{1,3})?$/', $isoCode);
+ return preg_match('/^[a-zA-Z0-9]{1,3}((-)[a-zA-Z0-9]{1,3})?$/', $isoCode);
}
-
+
public static function isNumericIsoCode($isoCode)
{
return preg_match('/^[0-9]{2,3}$/', $isoCode);
@@ -430,7 +430,7 @@ class ValidateCore
{
return (bool)preg_match('/^([0-9]{4})-((0?[0-9])|(1[0-2]))-((0?[0-9])|([1-2][0-9])|(3[01]))( [0-9]{2}:[0-9]{2}:[0-9]{2})?$/', $date);
}
-
+
/**
* Check for date validity
*
@@ -494,7 +494,7 @@ class ValidateCore
{
return !$ean13 OR preg_match('/^[0-9]{0,13}$/', $ean13);
}
-
+
/**
* Check for barcode validity (UPC)
*
@@ -516,7 +516,7 @@ class ValidateCore
{
return empty($postcode) OR preg_match('/^[a-zA-Z 0-9-]+$/', $postcode);
}
-
+
/**
* Check for zip code format validity
*
@@ -526,7 +526,7 @@ class ValidateCore
public static function isZipCodeFormat($zip_code)
{
if (!empty($zip_code))
- return preg_match('/^[NLCnlc -]+$/', $zip_code);
+ return preg_match('/^[NLCnlc 0-9-]+$/', $zip_code);
return true;
}
@@ -691,12 +691,12 @@ class ValidateCore
{
return (in_array($engine, array('InnoDB', 'MyISAM')));
}
-
+
public static function isUnixName($data)
{
return preg_match('/^[a-z0-9\._-]+$/ui', $data);
}
-
+
public static function isTablePrefix($data)
{
// Even if "-" is theorically allowed, it will be considered a syntax error if you do not add backquotes (`) around the table name
@@ -729,7 +729,7 @@ class ValidateCore
{
return preg_match('/^[a-zA-Z]{1,3}$/', $unit);
}
-
+
public static function isDistanceUnit($unit)
{
return preg_match('/^[a-zA-Z]{1,2}$/', $unit);
@@ -777,7 +777,7 @@ class ValidateCore
{
return ($data == PS_TAX_EXC OR $data == PS_TAX_INC);
}
-
+
/**
* @param string $dni to validate
* @return bool
@@ -786,7 +786,7 @@ class ValidateCore
{
return empty($dni) OR (bool)preg_match('/^[0-9A-Za-z-.]{1,16}$/U', $dni);
}
-
+
/**
* Check if $data is a PrestaShop cookie object
*
@@ -819,7 +819,7 @@ class ValidateCore
{
return ($data === 'amount' || $data === 'percentage');
}
-
+
/**
* Check for bool_id
*
@@ -841,7 +841,7 @@ class ValidateCore
{
return ($data === 'states' OR $data === 'taxes' OR $data === 'currencies' OR $data === 'languages' OR $data === 'units');
}
-
+
/**
* Check for PHP serialized data
*
@@ -852,7 +852,7 @@ class ValidateCore
{
return ($data == NULL) OR (bool)(is_string($data) AND preg_match('/^a:[0-9]+:{.*;}$/s', $data));
}
-
+
/**
* Check for Latitude/Longitude
*
@@ -863,7 +863,7 @@ class ValidateCore
{
return ($data == NULL) OR (bool)(preg_match('/^\-?[0-9]{1,8}\.[0-9]{1,8}$/s', $data));
}
-
+
/**
* Check for Language Iso Code
*
@@ -874,7 +874,7 @@ class ValidateCore
{
return (bool)(preg_match('/^[a-zA-Z]{2,3}$/s', $iso_code));
}
-
+
/**
* Check for Language File Name
*
@@ -885,11 +885,11 @@ class ValidateCore
{
return (bool)(preg_match('/^[a-zA-Z]{2,3}\.gzip$/s', $file_name));
}
-
+
/**
*
* @param array $ids
- * @return boolean return true if the array contain only unsigned int value
+ * @return boolean return true if the array contain only unsigned int value
*/
public static function isArrayWithIds($ids)
{
@@ -899,11 +899,11 @@ class ValidateCore
return false;
return true;
}
-
+
/**
*
* @param array $zones
- * @return boolean return true if array contain all value required for an image map zone
+ * @return boolean return true if array contain all value required for an image map zone
*/
public static function isSceneZones($zones)
{
@@ -922,9 +922,9 @@ class ValidateCore
}
return true;
}
-
+
/**
- *
+ *
* @param array $stock_management
* @return boolean return true if is a valide stock management
*/
diff --git a/classes/exception/PrestashopException.php b/classes/exception/PrestashopException.php
index c6bd69180..bc7bcb30f 100644
--- a/classes/exception/PrestashopException.php
+++ b/classes/exception/PrestashopException.php
@@ -64,17 +64,20 @@ class PrestashopExceptionCore extends Exception
echo '