diff --git a/admin-dev/themes/default/template/controllers/shop/tree.tpl b/admin-dev/themes/default/template/controllers/shop/tree.tpl
index 25fba6604..8019d0174 100644
--- a/admin-dev/themes/default/template/controllers/shop/tree.tpl
+++ b/admin-dev/themes/default/template/controllers/shop/tree.tpl
@@ -186,7 +186,7 @@ $("#multishop-tree").jstree({
'plugins': ["themes","json_data","cookies","contextmenu"],
'json_data': {
'ajax': {
- 'url': "{$link->getAdminLink('AdminShop')}",
+ 'url': "{$link->getAdminLink('AdminShop')|addslashes}",
'data': function(n)
{
return {
diff --git a/classes/Address.php b/classes/Address.php
index abf8ac2a3..cb1fef134 100644
--- a/classes/Address.php
+++ b/classes/Address.php
@@ -222,7 +222,7 @@ class AddressCore extends ObjectModel
public function validateController($htmlentities = true)
{
$errors = parent::validateController($htmlentities);
- if (!Configuration::get('VATNUMBER_CHECKING'))
+ if (!Configuration::get('VATNUMBER_MANAGEMENT') || !Configuration::get('VATNUMBER_CHECKING'))
return $errors;
include_once(_PS_MODULE_DIR_.'vatnumber/vatnumber.php');
if (class_exists('VatNumber', false))
@@ -237,6 +237,8 @@ class AddressCore extends ObjectModel
*/
public static function getZoneById($id_address)
{
+ if(!isset($id_address) || empty($id_address))
+ return false;
if (isset(self::$_idZones[$id_address]))
return self::$_idZones[$id_address];
@@ -259,6 +261,9 @@ class AddressCore extends ObjectModel
*/
public static function isCountryActiveById($id_address)
{
+ if(!isset($id_address) || empty($id_address))
+ return false;
+
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
SELECT c.`active`
FROM `'._DB_PREFIX_.'address` a
diff --git a/classes/AdminTab.php b/classes/AdminTab.php
index 97467207d..6375b5f12 100644
--- a/classes/AdminTab.php
+++ b/classes/AdminTab.php
@@ -1676,9 +1676,9 @@ abstract class AdminTabCore
elseif (isset($params['float']))
echo rtrim(rtrim($tr[$key], '0'), '.');
elseif (isset($params['type']) && $params['type'] == 'date')
- echo Tools::displayDate($tr[$key], $this->context->language->id);
+ echo Tools::displayDate($tr[$key]);
elseif (isset($params['type']) && $params['type'] == 'datetime')
- echo Tools::displayDate($tr[$key], $this->context->language->id, true);
+ echo Tools::displayDate($tr[$key],null , true);
elseif (isset($tr[$key]))
{
if ($key == 'price')
diff --git a/classes/Attribute.php b/classes/Attribute.php
index c27e409b3..93391bc6c 100644
--- a/classes/Attribute.php
+++ b/classes/Attribute.php
@@ -71,7 +71,7 @@ class AttributeCore extends ObjectModel
public function delete()
{
- if (!$this->hasMultishopEntries())
+ if (!$this->hasMultishopEntries() || Shop::getContext() == Shop::CONTEXT_ALL)
{
$result = Db::getInstance()->executeS('SELECT id_product_attribute FROM '._DB_PREFIX_.'product_attribute_combination WHERE id_attribute = '.(int)$this->id);
foreach ($result as $row)
@@ -343,4 +343,4 @@ class AttributeCore extends ObjectModel
return (is_numeric($position)) ? $position : -1;
}
-}
+}
\ No newline at end of file
diff --git a/classes/AttributeGroup.php b/classes/AttributeGroup.php
index 8a8548379..15f72122a 100644
--- a/classes/AttributeGroup.php
+++ b/classes/AttributeGroup.php
@@ -70,6 +70,11 @@ class AttributeGroupCore extends ObjectModel
public function add($autodate = true, $nullValues = false)
{
+ if ($this->group_type == 'color')
+ $this->is_color_group = 1;
+ else
+ $this->is_color_group = 0;
+
if ($this->position <= 0)
$this->position = AttributeGroup::getHigherPosition() + 1;
@@ -80,11 +85,16 @@ class AttributeGroupCore extends ObjectModel
public function update($nullValues = false)
{
+ if ($this->group_type == 'color')
+ $this->is_color_group = 1;
+ else
+ $this->is_color_group = 0;
+
$return = parent::update($nullValues);
Hook::exec('actionAttributeGroupSave', array('id_attribute_group' => $this->id));
return $return;
}
-
+
public static function cleanDeadCombinations()
{
$attribute_combinations = Db::getInstance()->executeS('
@@ -109,7 +119,7 @@ class AttributeGroupCore extends ObjectModel
public function delete()
{
- if (!$this->hasMultishopEntries())
+ if (!$this->hasMultishopEntries() || Shop::getContext() == Shop::CONTEXT_ALL)
{
/* Select children in order to find linked combinations */
$attribute_ids = Db::getInstance()->executeS('
diff --git a/classes/Blowfish.php b/classes/Blowfish.php
index 1fffd8b73..2fd8e53d5 100644
--- a/classes/Blowfish.php
+++ b/classes/Blowfish.php
@@ -42,7 +42,7 @@ class BlowfishCore extends Crypt_Blowfish
$piece = substr($paddedtext, $x, 8);
$cipher_piece = parent::encrypt($piece);
$encoded = base64_encode($cipher_piece);
- $ciphertext = $ciphertext.$encoded;
+ $ciphertext = $ciphertext.$encoded;
}
return $ciphertext.sprintf('%06d', $length);
}
diff --git a/classes/Carrier.php b/classes/Carrier.php
index f7a49f1b1..df7208dba 100644
--- a/classes/Carrier.php
+++ b/classes/Carrier.php
@@ -467,7 +467,9 @@ class CarrierCore extends ObjectModel
ORDER BY s.`name` ASC');
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
- SELECT cl.*,c.*, cl.`name` AS country, zz.`name` AS zone FROM `'._DB_PREFIX_.'country` c
+ SELECT cl.*,c.*, cl.`name` AS country, zz.`name` AS zone
+ FROM `'._DB_PREFIX_.'country` c'.
+ Shop::addSqlAssociation('country', 'c').'
LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (c.`id_country` = cl.`id_country` AND cl.`id_lang` = '.(int)$id_lang.')
INNER JOIN (`'._DB_PREFIX_.'carrier_zone` cz INNER JOIN `'._DB_PREFIX_.'carrier` cr ON ( cr.id_carrier = cz.id_carrier AND cr.deleted = 0 '.
($active_carriers ? 'AND cr.active = 1) ' : ') ').'
diff --git a/classes/Cart.php b/classes/Cart.php
index 52126f604..385745061 100644
--- a/classes/Cart.php
+++ b/classes/Cart.php
@@ -631,8 +631,8 @@ class CartCore extends ObjectModel
{
$row2 = Db::getInstance()->getRow('
SELECT image_shop.`id_image` id_image, il.`legend`
- FROM `'._DB_PREFIX_.'image` i'.
- Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').'
+ FROM `'._DB_PREFIX_.'image` i
+ JOIN `'._DB_PREFIX_.'image_shop` image_shop ON (i.id_image = image_shop.id_image AND image_shop.cover=1 AND image_shop.id_shop='.(int)$row['id_shop'].')
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (image_shop.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$this->id_lang.')
WHERE i.`id_product` = '.(int)$row['id_product'].' AND image_shop.`cover` = 1'
);
@@ -2958,12 +2958,8 @@ class CartCore extends ObjectModel
return false;
foreach ($this->getProducts() as $product)
-
- if (!$product['active']
- || (
- !$product['allow_oosp'] && $product['stock_quantity'] < $product['cart_quantity']
- )
- || !$product['available_for_order'])
+ if (!$product['active'] || !$product['available_for_order']
+ || (!$product['allow_oosp'] && $product['stock_quantity'] < $product['cart_quantity']))
return false;
return true;
diff --git a/classes/CartRule.php b/classes/CartRule.php
index 1b0177810..ab5cef179 100644
--- a/classes/CartRule.php
+++ b/classes/CartRule.php
@@ -333,11 +333,8 @@ class CartRuleCore extends ObjectModel
return array();
$productRuleGroups = array();
- $results = Db::getInstance()->executeS('
- SELECT *
- FROM '._DB_PREFIX_.'cart_rule_product_rule_group prg
- WHERE prg.id_cart_rule = '.(int)$this->id, false);
- foreach ($results as $row)
+ $result = Db::getInstance()->executeS('SELECT * FROM '._DB_PREFIX_.'cart_rule_product_rule_group WHERE id_cart_rule = '.(int)$this->id);
+ foreach ($result as $row)
{
if (!isset($productRuleGroups[$row['id_product_rule_group']]))
$productRuleGroups[$row['id_product_rule_group']] = array('id_product_rule_group' => $row['id_product_rule_group'], 'quantity' => $row['quantity']);
@@ -533,14 +530,21 @@ class CartRuleCore extends ObjectModel
return (!$display_error) ? false : Tools::displayError('You have not reached the minimum amount required to use this voucher');
}
- // Check if the voucher is already in the cart of if a non compatible voucher is in the cart
- // Important note: this MUST be the last check, because if the tested cart rule has priority over a non combinable one in the cart, we will switch them
+ /* This loop checks:
+ - if the voucher is already in the cart
+ - if a non compatible voucher is in the cart
+ - if there are products in the cart (gifts excluded)
+ Important note: this MUST be the last check, because if the tested cart rule has priority over a non combinable one in the cart, we will switch them
+ */
+ $nb_products = Cart::getNbProducts($context->cart->id);
$otherCartRules = $context->cart->getCartRules();
if (count($otherCartRules))
foreach ($otherCartRules as $otherCartRule)
{
if ($otherCartRule['id_cart_rule'] == $this->id && !$alreadyInCart)
return (!$display_error) ? false : Tools::displayError('This voucher is already in your cart');
+ if ($otherCartRule['gift_product'])
+ --$nb_products;
if ($this->cart_rule_restriction && $otherCartRule['cart_rule_restriction'] && $otherCartRule['id_cart_rule'] != $this->id)
{
$combinable = Db::getInstance()->getValue('
@@ -561,6 +565,9 @@ class CartRuleCore extends ObjectModel
}
}
+ if (!$nb_products)
+ return (!$display_error) ? false : Tools::displayError('Cart is empty');
+
if (!$display_error)
return true;
}
@@ -630,7 +637,8 @@ class CartRuleCore extends ObjectModel
FROM `'._DB_PREFIX_.'cart_product` cp
LEFT JOIN `'._DB_PREFIX_.'category_product` catp ON cp.id_product = catp.id_product
WHERE cp.`id_cart` = '.(int)$context->cart->id.'
- AND cp.`id_product` IN ('.implode(array_map('intval', $eligibleProductsList), ',').')');
+ AND cp.`id_product` IN ('.implode(array_map('intval', $eligibleProductsList), ',').')
+ AND cp.`id_product` <> '.(int)$this->gift_product);
$countMatchingProducts = 0;
$matchingProductsList = array();
foreach ($cartCategories as $cartCategory)
diff --git a/classes/Category.php b/classes/Category.php
index ac211811c..a77f122d9 100644
--- a/classes/Category.php
+++ b/classes/Category.php
@@ -510,7 +510,7 @@ class CategoryCore extends ObjectModel
die(Tools::displayError());
$groups = FrontController::getCurrentCustomerGroups();
- $sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');
+ $sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '='.(int)Group::getCurrent()->id);
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT c.*, cl.id_lang, cl.name, cl.description, cl.link_rewrite, cl.meta_title, cl.meta_keywords, cl.meta_description
@@ -684,8 +684,7 @@ class CategoryCore extends ObjectModel
else
return new Category($shop->getCategory(), $id_lang);
$is_more_than_one_root_category = count(Category::getCategoriesWithoutParent()) > 1;
- if ((!Shop::isFeatureActive() && $is_more_than_one_root_category) ||
- Shop::isFeatureActive() && $is_more_than_one_root_category && Shop::getContext() != Shop::CONTEXT_SHOP)
+ if (Shop::isFeatureActive() && $is_more_than_one_root_category && Shop::getContext() != Shop::CONTEXT_SHOP)
$category = Category::getTopCategory($id_lang);
else
$category = new Category($shop->getCategory(), $id_lang);
diff --git a/classes/ConnectionsSource.php b/classes/ConnectionsSource.php
index 0e86de001..c818c9796 100644
--- a/classes/ConnectionsSource.php
+++ b/classes/ConnectionsSource.php
@@ -61,32 +61,37 @@ class ConnectionsSourceCore extends ObjectModel
$cookie = Context::getContext()->cookie;
if (!isset($cookie->id_connections) || !Validate::isUnsignedId($cookie->id_connections))
return false;
+
+ // If the referrer is not correct, we drop the connection
+ if (isset($_SERVER['HTTP_REFERER']) && !Validate::isAbsoluteUrl($_SERVER['HTTP_REFERER']))
+ return false;
+ // If there is no referrer and we do not want to save direct traffic (as opposed to referral traffic), we drop the connection
if (!isset($_SERVER['HTTP_REFERER']) && !Configuration::get('TRACKING_DIRECT_TRAFFIC'))
return false;
$source = new ConnectionsSource();
- if (isset($_SERVER['HTTP_REFERER']) && Validate::isAbsoluteUrl($_SERVER['HTTP_REFERER']))
+
+ // There are a few more operations if there is a referrer
+ if (isset($_SERVER['HTTP_REFERER']))
{
+ // If the referrer is internal (i.e. from your own website), then we drop the connection
$parsed = parse_url($_SERVER['HTTP_REFERER']);
$parsed_host = parse_url(Tools::getProtocol().Tools::getHttpHost(false, false).__PS_BASE_URI__);
- if ((!isset($parsed['path']) ||!isset($parsed_host['path'])) || (preg_replace('/^www./', '', $parsed['host']) == preg_replace('/^www./', '', Tools::getHttpHost(false, false)))
- && !strncmp($parsed['path'], $parsed_host['path'], strlen(__PS_BASE_URI__)))
+ if ((!isset($parsed['path']) ||!isset($parsed_host['path'])) || (preg_replace('/^www./', '', $parsed['host']) == preg_replace('/^www./', '', Tools::getHttpHost(false, false))) && !strncmp($parsed['path'], $parsed_host['path'], strlen(__PS_BASE_URI__)))
return false;
- if (Validate::isAbsoluteUrl(strval($_SERVER['HTTP_REFERER'])))
- {
- $source->http_referer = substr(strval($_SERVER['HTTP_REFERER']), 0, ConnectionsSource::$uri_max_size);
- $source->keywords = trim(SearchEngine::getKeywords(strval($_SERVER['HTTP_REFERER'])));
- if (!Validate::isMessage($source->keywords))
- return false;
- }
+
+ $source->http_referer = substr($_SERVER['HTTP_REFERER'], 0, ConnectionsSource::$uri_max_size);
+ $source->keywords = substr(trim(SearchEngine::getKeywords($_SERVER['HTTP_REFERER'])), 0, ConnectionsSource::$uri_max_size);
}
$source->id_connections = (int)$cookie->id_connections;
$source->request_uri = Tools::getHttpHost(false, false);
- if (isset($_SERVER['REDIRECT_URL']))
- $source->request_uri .= strval($_SERVER['REDIRECT_URL']);
- elseif (isset($_SERVER['REQUEST_URI']))
- $source->request_uri .= strval($_SERVER['REQUEST_URI']);
+
+ if (isset($_SERVER['REQUEST_URI']))
+ $source->request_uri .= $_SERVER['REQUEST_URI'];
+ elseif (isset($_SERVER['REDIRECT_URL']))
+ $source->request_uri .= $_SERVER['REDIRECT_URL'];
+
if (!Validate::isUrl($source->request_uri))
$source->request_uri = '';
$source->request_uri = substr($source->request_uri, 0, ConnectionsSource::$uri_max_size);
@@ -104,4 +109,4 @@ class ConnectionsSourceCore extends ObjectModel
WHERE id_order = '.(int)($id_order).'
ORDER BY cos.date_add DESC');
}
-}
+}
\ No newline at end of file
diff --git a/classes/Cookie.php b/classes/Cookie.php
index 655ada642..7fbec5303 100644
--- a/classes/Cookie.php
+++ b/classes/Cookie.php
@@ -44,15 +44,13 @@ class CookieCore
/** @var array cipher tool instance */
protected $_cipherTool;
- /** @var array cipher tool initialization key */
- protected $_key;
-
- /** @var array cipher tool initilization vector */
- protected $_iv;
-
protected $_modified = false;
protected $_allow_writing;
+
+ protected $_salt;
+
+ protected $_standalone;
/**
* Get data if the cookie exists and else initialize an new one
@@ -60,24 +58,26 @@ class CookieCore
* @param $name Cookie name before encrypting
* @param $path
*/
- public function __construct($name, $path = '', $expire = null, $shared_urls = null)
+ public function __construct($name, $path = '', $expire = null, $shared_urls = null, $standalone = false)
{
$this->_content = array();
+ $this->_standalone = $standalone;
$this->_expire = is_null($expire) ? time() + 1728000 : (int)$expire;
- $this->_name = md5(_PS_VERSION_.$name);
- $this->_path = trim(Context::getContext()->shop->physical_uri.$path, '/\\').'/';
+ $this->_name = md5(($this->_standalone ? '' : _PS_VERSION_).$name);
+ $this->_path = trim(($this->_standalone ? '' : Context::getContext()->shop->physical_uri).$path, '/\\').'/';
if ($this->_path{0} != '/') $this->_path = '/'.$this->_path;
$this->_path = rawurlencode($this->_path);
$this->_path = str_replace('%2F', '/', $this->_path);
$this->_path = str_replace('%7E', '~', $this->_path);
- $this->_key = _COOKIE_KEY_;
- $this->_iv = _COOKIE_IV_;
$this->_domain = $this->getDomain($shared_urls);
$this->_allow_writing = true;
- if (Configuration::get('PS_CIPHER_ALGORITHM'))
- $this->_cipherTool = new Rijndael(_RIJNDAEL_KEY_, _RIJNDAEL_IV_);
+ $this->_salt = $this->_standalone ? str_pad('', 8, md5('ps'.__FILE__)) : _COOKIE_IV_;
+ if ($this->_standalone)
+ $this->_cipherTool = new Blowfish(str_pad('', 56, md5('ps'.__FILE__)), str_pad('', 56, md5('iv'.__FILE__)));
+ elseif (!Configuration::get('PS_CIPHER_ALGORITHM'))
+ $this->_cipherTool = new Blowfish(_COOKIE_KEY_, _COOKIE_IV_);
else
- $this->_cipherTool = new Blowfish($this->_key, $this->_iv);
+ $this->_cipherTool = new Rijndael(_RIJNDAEL_KEY_, _RIJNDAEL_IV_);
$this->update();
}
@@ -270,7 +270,7 @@ class CookieCore
//printf("\$content = %s ", $content);
/* Get cookie checksum */
- $checksum = crc32($this->_iv.substr($content, 0, strrpos($content, '¤') + 2));
+ $checksum = crc32($this->_salt.substr($content, 0, strrpos($content, '¤') + 2));
//printf("\$checksum = %s ", $checksum);
/* Unserialize cookie content */
@@ -297,7 +297,7 @@ class CookieCore
$this->_content['date_add'] = date('Y-m-d H:i:s');
//checks if the language exists, if not choose the default language
- if (!Language::getLanguage((int)$this->id_lang))
+ if (!$this->_standalone && !Language::getLanguage((int)$this->id_lang))
$this->id_lang = Configuration::get('PS_LANG_DEFAULT');
}
@@ -344,7 +344,7 @@ class CookieCore
$cookie .= $key.'|'.$value.'¤';
/* Add checksum to cookie */
- $cookie .= 'checksum|'.crc32($this->_iv.$cookie);
+ $cookie .= 'checksum|'.crc32($this->_salt.$cookie);
$this->_modified = false;
/* Cookies are encrypted for evident security reasons */
return $this->_setcookie($cookie);
diff --git a/classes/CustomerMessage.php b/classes/CustomerMessage.php
index a8ec2395d..ae8709d5b 100644
--- a/classes/CustomerMessage.php
+++ b/classes/CustomerMessage.php
@@ -104,6 +104,11 @@ class CustomerMessageCore extends ObjectModel
WHERE '.$where
);
}
-
-}
-
+
+ public function delete()
+ {
+ if (!empty($this->file_name))
+ @unlink(_PS_UPLOAD_DIR_.$this->file_name);
+ return parent::delete();
+ }
+}
\ No newline at end of file
diff --git a/classes/CustomerThread.php b/classes/CustomerThread.php
index a2822aab5..3425b38d1 100644
--- a/classes/CustomerThread.php
+++ b/classes/CustomerThread.php
@@ -97,11 +97,27 @@ class CustomerThreadCore extends ObjectModel
{
if (!Validate::isUnsignedId($this->id))
return false;
- Db::getInstance()->execute('
- DELETE FROM `'._DB_PREFIX_.'customer_message`
+
+ $return = true;
+ $result = Db::getInstance()->executeS('
+ SELECT `id_customer_message`
+ FROM `'._DB_PREFIX_.'customer_message`
WHERE `id_customer_thread` = '.(int)$this->id
);
- return (parent::delete());
+
+ if( count($result))
+ {
+ foreach ($result AS $res)
+ {
+ $message = new CustomerMessage((int)$res['id_customer_message']);
+ if (!Validate::isLoadedObject($message))
+ $return = false;
+ else
+ $return &= $message->delete();
+ }
+ }
+ $return &= parent::delete();
+ return $return;
}
public static function getCustomerMessages($id_customer, $read = null)
@@ -204,5 +220,4 @@ class CustomerThreadCore extends ObjectModel
' ORDER BY ct.date_upd ASC
');
}
-}
-
+}
\ No newline at end of file
diff --git a/classes/Dispatcher.php b/classes/Dispatcher.php
index 2eebe37aa..b8da414aa 100644
--- a/classes/Dispatcher.php
+++ b/classes/Dispatcher.php
@@ -647,7 +647,9 @@ class DispatcherCore
* @return string
*/
public function getController()
- {
+ {
+ if (defined('_PS_ADMIN_DIR_'))
+ $_GET['controllerUri'] = Tools::getvalue('controller');
if ($this->controller)
{
$_GET['controller'] = $this->controller;
@@ -669,7 +671,7 @@ class DispatcherCore
$controller = false;
// Use routes ? (for url rewriting)
- if ($this->use_routes && !$controller)
+ if ($this->use_routes && !$controller && !defined('_PS_ADMIN_DIR_'))
{
if (!$this->request_uri)
return strtolower($this->controller_not_found);
@@ -709,7 +711,8 @@ class DispatcherCore
break;
}
}
- if ($controller == 'index' || $this->request_uri == '/index.php')
+
+ if ($controller == 'index' || $this->request_uri == '/index.php')
$controller = $this->default_controller;
$this->controller = $controller;
}
diff --git a/classes/Feature.php b/classes/Feature.php
index fbf6af072..38e566ed0 100644
--- a/classes/Feature.php
+++ b/classes/Feature.php
@@ -81,7 +81,7 @@ class FeatureCore extends ObjectModel
public static function getFeatures($id_lang, $with_shop = true)
{
return Db::getInstance()->executeS('
- SELECT *
+ SELECT DISTINCT f.id_feature, f.*, fl.*
FROM `'._DB_PREFIX_.'feature` f
'.($with_shop ? Shop::addSqlAssociation('feature', 'f') : '').'
LEFT JOIN `'._DB_PREFIX_.'feature_lang` fl ON (f.`id_feature` = fl.`id_feature` AND fl.`id_lang` = '.(int)$id_lang.')
diff --git a/classes/Language.php b/classes/Language.php
index 3ce4b1908..047cca8a0 100644
--- a/classes/Language.php
+++ b/classes/Language.php
@@ -466,7 +466,7 @@ class LanguageCore extends ObjectModel
public function delete()
{
- if (!$this->hasMultishopEntries())
+ if (!$this->hasMultishopEntries() || Shop::getContext() == Shop::CONTEXT_ALL)
{
if (empty($this->iso_code))
$this->iso_code = Language::getIsoById($this->id);
@@ -514,7 +514,7 @@ class LanguageCore extends ObjectModel
if (!parent::delete())
return false;
- if (!$this->hasMultishopEntries())
+ if (!$this->hasMultishopEntries() || Shop::getContext() == Shop::CONTEXT_ALL)
{
// delete images
$files_copy = array(
@@ -580,7 +580,7 @@ class LanguageCore extends ObjectModel
public static function getLanguage($id_lang)
{
- if (!array_key_exists((int)($id_lang), self::$_LANGUAGES))
+ if (!array_key_exists((int)$id_lang, self::$_LANGUAGES))
return false;
return self::$_LANGUAGES[(int)($id_lang)];
}
@@ -788,11 +788,11 @@ class LanguageCore extends ObjectModel
$lang_pack_ok = false;
$errors = array();
$file = _PS_TRANSLATIONS_DIR_.$iso.'.gzip';
- if (!$lang_pack_link = Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/get_language_pack.php?version='.$version.'&iso_lang='.$iso))
+ 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($iso)))
$errors[] = Tools::displayError('Archive cannot be downloaded from prestashop.com.');
elseif (!$lang_pack = Tools::jsonDecode($lang_pack_link))
$errors[] = Tools::displayError('Error occurred when language was checked according to your Prestashop version.');
- elseif ($content = Tools::file_get_contents('http://translations.prestashop.com/download/lang_packs/gzip/'.$lang_pack->version.'/'.$lang_pack->iso_code.'.gzip'))
+ elseif ($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))
$errors[] = Tools::displayError('Server does not have permissions for writing.');
if (file_exists($file))
@@ -831,4 +831,4 @@ class LanguageCore extends ObjectModel
{
return (Language::countActiveLanguages() > 1);
}
-}
+}
\ No newline at end of file
diff --git a/classes/LocalizationPack.php b/classes/LocalizationPack.php
index 133ad8534..bfa03e301 100644
--- a/classes/LocalizationPack.php
+++ b/classes/LocalizationPack.php
@@ -294,7 +294,7 @@ class LocalizationPackCore
// if we are not in an installation context or if the pack is not available in the local directory
if (Language::getIdByIso($attributes['iso_code']) && !$install_mode)
continue;
- $errors = Language::downloadAndInstallLanguagePack($attributes['iso_code'], $attributes['version']);
+ $errors = Language::downloadAndInstallLanguagePack($attributes['iso_code'], $attributes['version'], $attributes);
if ($errors !== true && is_array($errors))
$this->_errors = array_merge($this->_errors, $errors);
}
diff --git a/classes/Mail.php b/classes/Mail.php
index 12d315516..2b2fcacb6 100644
--- a/classes/Mail.php
+++ b/classes/Mail.php
@@ -63,7 +63,6 @@ class MailCore
'PS_SHOP_NAME',
'PS_MAIL_SMTP_ENCRYPTION',
'PS_MAIL_SMTP_PORT',
- 'PS_MAIL_METHOD',
'PS_MAIL_TYPE'
), null, null, $id_shop);
diff --git a/classes/Manufacturer.php b/classes/Manufacturer.php
index 118433fe2..285f802e1 100644
--- a/classes/Manufacturer.php
+++ b/classes/Manufacturer.php
@@ -215,7 +215,7 @@ class ManufacturerCore extends ObjectModel
for ($i = 0; $i < $total_manufacturers; $i++)
if ($rewrite_settings)
- $manufacturers[$i]['link_rewrite'] = Tools::link_rewrite($manufacturers[$i]['name'], false);
+ $manufacturers[$i]['link_rewrite'] = Tools::link_rewrite($manufacturers[$i]['name']);
else
$manufacturers[$i]['link_rewrite'] = 0;
@@ -258,7 +258,7 @@ class ManufacturerCore extends ObjectModel
public function getLink()
{
- return Tools::link_rewrite($this->name, false);
+ return Tools::link_rewrite($this->name);
}
public static function getProducts($id_manufacturer, $id_lang, $p, $n, $order_by = null, $order_way = null,
@@ -339,7 +339,7 @@ class ManufacturerCore extends ObjectModel
'.Shop::addSqlAssociation('product', 'p').'
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa
ON (p.`id_product` = pa.`id_product`)
- '.Shop::addSqlAssociation('product_attribute', 'pa', false).'
+ '.Shop::addSqlAssociation('product_attribute', 'pa', false, 'product_attribute_shop.`default_on` = 1').'
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').')
LEFT JOIN `'._DB_PREFIX_.'image` i
diff --git a/classes/Meta.php b/classes/Meta.php
index 8d82adfb3..e4c3b3147 100644
--- a/classes/Meta.php
+++ b/classes/Meta.php
@@ -168,7 +168,7 @@ class MetaCore extends ObjectModel
$result = $result && $this->delete();
}
- return Tools::generateHtaccess();
+ return $result && Tools::generateHtaccess();
}
public static function getEquivalentUrlRewrite($new_id_lang, $id_lang, $url_rewrite)
diff --git a/classes/ObjectModel.php b/classes/ObjectModel.php
index 5b41111ef..48fe026e4 100644
--- a/classes/ObjectModel.php
+++ b/classes/ObjectModel.php
@@ -633,7 +633,7 @@ abstract class ObjectModelCore
$shop_exists = ObjectModel::$db->getValue('SELECT '.$this->def['primary'].' FROM '._DB_PREFIX_.$this->def['table'].'_shop WHERE '.$where);
if ($shop_exists)
$result &= ObjectModel::$db->update($this->def['table'].'_shop', $fields, $where, 0, $null_values);
- else if (Shop::getContext() == Shop::CONTEXT_SHOP)
+ elseif (Shop::getContext() == Shop::CONTEXT_SHOP)
$result &= ObjectModel::$db->insert($this->def['table'].'_shop', $all_fields, $null_values);
}
}
@@ -1277,6 +1277,11 @@ abstract class ObjectModelCore
{
return Shop::isTableAssociated($this->def['table']) || !empty($this->def['multilang_shop']);
}
+
+ public function isMultiShopField($field)
+ {
+ return (isset($this->def['fields'][$field]) && isset($this->def['fields'][$field]['shop']) && $this->def['fields'][$field]['shop']);
+ }
public function isLangMultishop()
{
diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php
index e19f2947b..561881c55 100644
--- a/classes/PaymentModule.php
+++ b/classes/PaymentModule.php
@@ -595,7 +595,7 @@ abstract class PaymentModuleCore extends Module
'{invoice_phone}' => ($invoice->phone) ? $invoice->phone : $invoice->phone_mobile,
'{invoice_other}' => $invoice->other,
'{order_name}' => $order->getUniqReference(),
- '{date}' => Tools::displayDate(date('Y-m-d H:i:s'), (int)$order->id_lang, 1),
+ '{date}' => Tools::displayDate(date('Y-m-d H:i:s'),null , 1),
'{carrier}' => $virtual_product ? Tools::displayError('No carrier') : $carrier->name,
'{payment}' => Tools::substr($order->payment, 0, 32),
'{products}' => $this->formatProductAndVoucherForEmail($products_list),
diff --git a/classes/Product.php b/classes/Product.php
index d253d87f7..1354df139 100644
--- a/classes/Product.php
+++ b/classes/Product.php
@@ -394,6 +394,7 @@ class ProductCore extends ObjectModel
'resource' => 'product_feature',
'fields' => array(
'id' => array('required' => true),
+ 'custom' => array('required' => false),
'id_feature_value' => array(
'required' => true,
'xlink_resource' => 'product_feature_values'
@@ -1448,6 +1449,7 @@ class ProductCore extends ObjectModel
$id_shop_list_array = Product::getShopsByProduct($this->id);
foreach ($id_shop_list_array as $array_shop)
$id_shop_list[] = $array_shop['id_shop'];
+ $id_shop_list = array_unique($id_shop_list);
}
if (count($id_shop_list))
@@ -3213,8 +3215,9 @@ class ProductCore extends ObjectModel
return array();
if (!array_key_exists($id_product, self::$_cacheFeatures))
self::$_cacheFeatures[$id_product] = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
- SELECT id_feature, id_product, id_feature_value
- FROM `'._DB_PREFIX_.'feature_product`
+ SELECT fp.id_feature, fp.id_product, fp.id_feature_value, custom
+ FROM `'._DB_PREFIX_.'feature_product` fp
+ LEFT JOIN `'._DB_PREFIX_.'feature_value` fv ON (fp.id_feature_value = fv.id_feature_value)
WHERE `id_product` = '.(int)$id_product
);
return self::$_cacheFeatures[$id_product];
@@ -3262,6 +3265,7 @@ class ProductCore extends ObjectModel
LEFT JOIN '._DB_PREFIX_.'feature_lang fl ON (fl.id_feature = pf.id_feature AND fl.id_lang = '.(int)$id_lang.')
LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.id_feature_value = pf.id_feature_value AND fvl.id_lang = '.(int)$id_lang.')
LEFT JOIN '._DB_PREFIX_.'feature f ON (f.id_feature = pf.id_feature)
+ '.Shop::addSqlAssociation('feature', 'f').'
WHERE `id_product` IN ('.implode($product_implode, ',').')
ORDER BY f.position ASC');
@@ -3346,33 +3350,57 @@ class ProductCore extends ObjectModel
WHERE pa.`id_product` = '.(int)$id_product_old
);
+ $combinations = array();
foreach ($result as $row)
{
$id_product_attribute_old = (int)$row['id_product_attribute'];
- $result2 = Db::getInstance()->executeS('
- SELECT *
- FROM `'._DB_PREFIX_.'product_attribute_combination`
- WHERE `id_product_attribute` = '.$id_product_attribute_old
- );
+ if (!isset($combinations[$id_product_attribute_old]))
+ {
+ $id_combination = null;
+ $id_shop = null;
+ $result2 = Db::getInstance()->executeS('
+ SELECT *
+ FROM `'._DB_PREFIX_.'product_attribute_combination`
+ WHERE `id_product_attribute` = '.$id_product_attribute_old
+ );
+ }
+ else
+ {
+ $id_combination = (int)$combinations[$id_product_attribute_old];
+ $id_shop = (int)$row['id_shop'];
+ $context_old = Shop::getContext();
+ $context_shop_id_old = Shop::getContextShopID();
+ Shop::setContext(Shop::CONTEXT_SHOP, $id_shop);
+
+ }
$row['id_product'] = $id_product_new;
unset($row['id_product_attribute']);
- $combination = new Combination();
+
+ $combination = new Combination($id_combination, null, $id_shop);
foreach ($row as $k => $v)
$combination->$k = $v;
- $return &= $combination->add();
+ $return &= $combination->save();
$id_product_attribute_new = (int)$combination->id;
+
if ($result_images = Product::_getAttributeImageAssociations($id_product_attribute_old))
{
$combination_images['old'][$id_product_attribute_old] = $result_images;
$combination_images['new'][$id_product_attribute_new] = $result_images;
}
- foreach ($result2 as $row2)
+
+ if (!isset($combinations[$id_product_attribute_old]))
{
- $row2['id_product_attribute'] = $id_product_attribute_new;
- $return &= Db::getInstance()->insert('product_attribute_combination', $row2);
+ $combinations[$id_product_attribute_old] = (int)$id_product_attribute_new;
+ foreach ($result2 as $row2)
+ {
+ $row2['id_product_attribute'] = $id_product_attribute_new;
+ $return &= Db::getInstance()->insert('product_attribute_combination', $row2);
+ }
}
+ else
+ Shop::setContext($context_old, $context_shop_id_old);
}
return !$return ? false : $combination_images;
}
@@ -3848,6 +3876,7 @@ class ProductCore extends ObjectModel
LEFT JOIN '._DB_PREFIX_.'feature_lang fl ON (fl.id_feature = pf.id_feature AND fl.id_lang = '.(int)$id_lang.')
LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.id_feature_value = pf.id_feature_value AND fvl.id_lang = '.(int)$id_lang.')
LEFT JOIN '._DB_PREFIX_.'feature f ON (f.id_feature = pf.id_feature AND fl.id_lang = '.(int)$id_lang.')
+ '.Shop::addSqlAssociation('feature', 'f').'
WHERE pf.id_product = '.(int)$id_product.'
ORDER BY f.position ASC'
);
@@ -4400,12 +4429,51 @@ class ProductCore extends ObjectModel
*/
public function setWsProductFeatures($product_features)
{
- $this->deleteProductFeatures();
- foreach ($product_features as $product_feature)
- $this->addFeaturesToDB($product_feature['id'], $product_feature['id_feature_value']);
- return true;
- }
+
+ $db_features = Db::getInstance()->executeS('
+ SELECT p.*, f.`custom`
+ FROM `'._DB_PREFIX_.'feature_product` p
+ LEFT JOIN `'._DB_PREFIX_.'feature_value` f ON (f.`id_feature_value` = p.`id_feature_value`)
+ WHERE `id_product` = '.(int)$this->id
+ );
+
+ $pfa = array();
+ foreach ($product_features as $product_feature)
+ $pfa[$product_feature['id']] = 1;
+
+ foreach ($db_features as $db_feature)
+ {
+ // test if feature should stay in db (if it is part of updated product)
+ if (!isset($pfa[$db_feature['id_feature']]))
+ {
+ // delete only custom features
+ if ($db_feature['custom'])
+ {
+ Db::getInstance()->execute('
+ DELETE FROM `'._DB_PREFIX_.'feature_value_lang`
+ WHERE `id_feature_value` = '.(int)$db_feature['id_feature_value']
+ );
+ Db::getInstance()->execute('
+ DELETE FROM `'._DB_PREFIX_.'feature_value`
+ WHERE `id_feature_value` = '.(int)$db_feature['id_feature_value']
+ );
+
+ }
+ }
+ }
+
+ Db::getInstance()->execute('
+ DELETE FROM `'._DB_PREFIX_.'feature_product`
+ WHERE `id_product` = '.(int)$this->id
+ );
+
+ foreach ($product_features as $product_feature)
+ $this->addFeaturesToDB($product_feature['id'], $product_feature['id_feature_value'], $product_feature['custom']);
+
+ return true;
+ }
+ /*
/**
* Webservice getter : get virtual field default combination
*
@@ -5275,5 +5343,4 @@ class ProductCore extends ObjectModel
{
return Db::getInstance()->executeS('SELECT id_product_item as id, quantity FROM '._DB_PREFIX_.'pack where id_product_pack = '.(int)$this->id);
}
-}
-
+}
\ No newline at end of file
diff --git a/classes/SearchEngine.php b/classes/SearchEngine.php
index 30bc7fa21..851d8b9ef 100644
--- a/classes/SearchEngine.php
+++ b/classes/SearchEngine.php
@@ -60,6 +60,8 @@ class SearchEngineCore extends ObjectModel
if (empty($array[0]))
return false;
$str = urldecode(str_replace('+', ' ', ltrim(substr(rtrim($array[0], '&'), strlen($varname) + 1), '=')));
+ if (!Validate::isMessage($str))
+ return false;
return $str;
}
}
diff --git a/classes/Supplier.php b/classes/Supplier.php
index 80bca2139..c878257f0 100644
--- a/classes/Supplier.php
+++ b/classes/Supplier.php
@@ -95,7 +95,7 @@ class SupplierCore extends ObjectModel
public function getLink()
{
- return Tools::link_rewrite($this->name, false);
+ return Tools::link_rewrite($this->name);
}
/**
@@ -156,7 +156,7 @@ class SupplierCore extends ObjectModel
$rewrite_settings = (int)Configuration::get('PS_REWRITING_SETTINGS');
for ($i = 0; $i < $nb_suppliers; $i++)
if ($rewrite_settings)
- $suppliers[$i]['link_rewrite'] = Tools::link_rewrite($suppliers[$i]['name'], false);
+ $suppliers[$i]['link_rewrite'] = Tools::link_rewrite($suppliers[$i]['name']);
else
$suppliers[$i]['link_rewrite'] = 0;
return $suppliers;
diff --git a/classes/Tab.php b/classes/Tab.php
index 19d839031..542d68c7f 100644
--- a/classes/Tab.php
+++ b/classes/Tab.php
@@ -140,7 +140,11 @@ class TabCore extends ObjectModel
public function delete()
{
if (Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'access WHERE `id_tab` = '.(int)$this->id) && parent::delete())
+ {
+ if (is_array(self::$_getIdFromClassName) && isset(self::$_getIdFromClassName[strtolower($this->class_name)]))
+ unset(self::$_getIdFromClassName[strtolower($this->class_name)]);
return $this->cleanPositions($this->id_parent);
+ }
return false;
}
diff --git a/classes/Tools.php b/classes/Tools.php
index 925a5fc39..8e6c617b4 100644
--- a/classes/Tools.php
+++ b/classes/Tools.php
@@ -267,6 +267,9 @@ class ToolsCore
// $_SERVER['SSL'] exists only in some specific configuration
if (isset($_SERVER['SSL']))
return ($_SERVER['SSL'] == 1 || strtolower($_SERVER['SSL']) == 'on');
+ // $_SERVER['REDIRECT_HTTPS'] exists only in some specific configuration
+ if (isset($_SERVER['REDIRECT_HTTPS']))
+ return ($_SERVER['REDIRECT_HTTPS'] == 1 || strtolower($_SERVER['REDIRECT_HTTPS']) == 'on');
return false;
}
@@ -598,20 +601,25 @@ class ToolsCore
*/
public static function dateFormat($params, &$smarty)
{
- return Tools::displayDate($params['date'], Context::getContext()->language->id, (isset($params['full']) ? $params['full'] : false));
+ return Tools::displayDate($params['date'], null, (isset($params['full']) ? $params['full'] : false));
}
/**
* Display date regarding to language preferences
*
* @param string $date Date to display format UNIX
- * @param integer $id_lang Language id
+ * @param integer $id_lang Language id DEPRECATED
* @param boolean $full With time or not (optional)
* @param string $separator DEPRECATED
* @return string Date
*/
- public static function displayDate($date, $id_lang, $full = false, $separator = '-')
+ public static function displayDate($date, $id_lang = null, $full = false, $separator = null)
{
+ if ($id_lang !== null)
+ Tools::displayParameterAsDeprecated('id_lang');
+ if ($separator !== null)
+ Tools::displayParameterAsDeprecated('separator');
+
if (!$date || !($time = strtotime($date)))
return $date;
@@ -958,11 +966,13 @@ class ToolsCore
* Return the friendly url from the provided string
*
* @param string $str
- * @param bool $utf8_decode => needs to be marked as deprecated
+ * @param bool $utf8_decode (deprecated)
* @return string
*/
- public static function link_rewrite($str, $utf8_decode = false)
+ public static function link_rewrite($str, $utf8_decode = null)
{
+ if ($utf8_decode !== null)
+ Tools::displayParameterAsDeprecated('utf8_decode');
return Tools::str2url($str);
}
@@ -1019,11 +1029,12 @@ class ToolsCore
'/[\x{010F}]/u',
'/[\x{00E8}\x{00E9}\x{00EA}\x{00EB}\x{011B}\x{0119}]/u',
'/[\x{00EC}\x{00ED}\x{00EE}\x{00EF}]/u',
+ '/[\x{011F}]/u',
'/[\x{0142}\x{013E}\x{013A}]/u',
'/[\x{00F1}\x{0148}]/u',
'/[\x{00F2}\x{00F3}\x{00F4}\x{00F5}\x{00F6}\x{00F8}]/u',
'/[\x{0159}\x{0155}]/u',
- '/[\x{015B}\x{0161}]/u',
+ '/[\x{015B}\x{0161}\x{015F}]/u',
'/[\x{00DF}]/u',
'/[\x{0165}]/u',
'/[\x{00F9}\x{00FA}\x{00FB}\x{00FC}\x{016F}]/u',
@@ -1037,11 +1048,12 @@ class ToolsCore
'/[\x{00C7}\x{010C}\x{0106}]/u',
'/[\x{010E}]/u',
'/[\x{00C8}\x{00C9}\x{00CA}\x{00CB}\x{011A}\x{0118}]/u',
+ '/[\x{011E}]/u',
'/[\x{0141}\x{013D}\x{0139}]/u',
'/[\x{00D1}\x{0147}]/u',
'/[\x{00D3}]/u',
'/[\x{0158}\x{0154}]/u',
- '/[\x{015A}\x{0160}]/u',
+ '/[\x{015A}\x{0160}\x{015E}]/u',
'/[\x{0164}]/u',
'/[\x{00D9}\x{00DA}\x{00DB}\x{00DC}\x{016E}]/u',
'/[\x{017B}\x{0179}\x{017D}]/u',
@@ -1049,8 +1061,8 @@ class ToolsCore
'/[\x{0152}]/u');
$replacements = array(
- 'a', 'c', 'd', 'e', 'i', 'l', 'n', 'o', 'r', 's', 'ss', 't', 'u', 'y', 'z', 'ae', 'oe',
- 'A', 'C', 'D', 'E', 'L', 'N', 'O', 'R', 'S', 'T', 'U', 'Z', 'AE', 'OE'
+ 'a', 'c', 'd', 'e', 'i', 'g', 'l', 'n', 'o', 'r', 's', 'ss', 't', 'u', 'y', 'z', 'ae', 'oe',
+ 'A', 'C', 'D', 'E', 'G', 'L', 'N', 'O', 'R', 'S', 'T', 'U', 'Z', 'AE', 'OE'
);
return preg_replace($patterns, $replacements, $str);
@@ -1511,7 +1523,7 @@ class ToolsCore
if (self::$_cache_nb_media_servers && ($id_media_server = (abs(crc32($filename)) % self::$_cache_nb_media_servers + 1)))
return constant('_MEDIA_SERVER_'.$id_media_server.'_');
- return Tools::getHttpHost();
+ return Tools::getShopDomain();
}
public static function generateHtaccess($path = null, $rewrite_settings = null, $cache_control = null, $specific = '', $disable_multiviews = null, $medias = false, $disable_modsec = null)
@@ -1843,7 +1855,7 @@ exit;
{
$backtrace = debug_backtrace();
$callee = next($backtrace);
- $error = 'Parameter '.$parameter.' in function '.$callee['function'].'() is deprecated in '.$callee['file'].' on line '.$callee['Line'].' ';
+ $error = 'Parameter '.$parameter.' in function '.(isset($callee['function']) ? $callee['function'] : '').'() is deprecated in '.$callee['file'].' on line '.(isset($callee['Line']) ? $callee['Line'] : '').' ';
$message = 'The parameter '.$parameter.' in function '.$callee['function'].' (Line '.$callee['Line'].') is deprecated and will be removed in the next major version.';
$class = isset($callee['class']) ? $callee['class'] : null;
@@ -2196,6 +2208,28 @@ exit;
return (PHP_INT_MAX == '9223372036854775807');
}
+ /**
+ *
+ * @return bool true if php-cli is used
+ */
+ public static function isPHPCLI()
+ {
+ return (defined('STDIN') || (Tools::strtolower(php_sapi_name()) == 'cli' && (!isset($_SERVER['REMOTE_ADDR']) || empty($_SERVER['REMOTE_ADDR']))));
+ }
+
+ public static function argvToGET($argc, $argv)
+ {
+ if ($argc <= 1)
+ return;
+
+ // get the first argument and parse it like a query string
+ parse_str($argv[1], $args);
+ if (!is_array($args) || !count($args))
+ return;
+ $_GET = array_merge($args, $_GET);
+ $_SERVER['QUERY_STRING'] = $argv[1];
+ }
+
/**
* Get max file upload size considering server settings and optional max value
*
diff --git a/classes/Validate.php b/classes/Validate.php
index 6af8d92c2..cee80bd01 100644
--- a/classes/Validate.php
+++ b/classes/Validate.php
@@ -229,7 +229,7 @@ class ValidateCore
*/
public static function isPrice($price)
{
- return preg_match('/^[0-9]{1,10}(\.[0-9]{1,9})?$/', $price);
+ return preg_match('/^[0-9]{1,10}(\.[0-9]{1,9})?$/', sprintf('%f', $price));
}
/**
@@ -240,7 +240,7 @@ class ValidateCore
*/
public static function isNegativePrice($price)
{
- return preg_match('/^[-]?[0-9]{1,10}(\.[0-9]{1,9})?$/', $price);
+ return preg_match('/^[-]?[0-9]{1,10}(\.[0-9]{1,9})?$/', sprintf('%f', $price));
}
/**
@@ -724,7 +724,7 @@ class ValidateCore
*/
public static function isTrackingNumber($tracking_number)
{
- return preg_match('/^[~:#,%&_=\(\)\.\? \+\-@\/a-zA-Z0-9]+$/', $tracking_number);
+ return preg_match('/^[~:#,%&_=\(\)\[\]\.\? \+\-@\/a-zA-Z0-9]+$/', $tracking_number);
}
/**
@@ -747,7 +747,7 @@ class ValidateCore
public static function isAbsoluteUrl($url)
{
if (!empty($url))
- return preg_match('/^https?:\/\/[,:#%&_=\(\)\.\? \+\-@\/a-zA-Z0-9]+$/', $url);
+ return preg_match('/^https?:\/\/[~:#,%&_=\(\)\[\]\.\? \+\-@\/a-zA-Z0-9]+$/', $url);
return true;
}
diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php
index bd413b9d0..df0e25e39 100644
--- a/classes/controller/AdminController.php
+++ b/classes/controller/AdminController.php
@@ -513,37 +513,42 @@ class AdminControllerCore extends Controller
*/
public function postProcess()
{
- if ($this->ajax)
- {
- // from ajax-tab.php
- $action = Tools::getValue('action');
- // no need to use displayConf() here
- if (!empty($action) && method_exists($this, 'ajaxProcess'.Tools::toCamelCase($action)))
- return $this->{'ajaxProcess'.Tools::toCamelCase($action)}();
- elseif (method_exists($this, 'ajaxProcess'))
- return $this->ajaxProcess();
- }
- else
- {
- // Process list filtering
- if ($this->filter)
- $this->processFilter();
-
- // If the method named after the action exists, call "before" hooks, then call action method, then call "after" hooks
- if (!empty($this->action) && method_exists($this, 'process'.ucfirst(Tools::toCamelCase($this->action))))
+ try {
+ if ($this->ajax)
{
- // Hook before action
- Hook::exec('actionAdmin'.ucfirst($this->action).'Before', array('controller' => $this));
- Hook::exec('action'.get_class($this).ucfirst($this->action).'Before', array('controller' => $this));
- // Call process
- $return = $this->{'process'.Tools::toCamelCase($this->action)}();
- // Hook After Action
- Hook::exec('actionAdmin'.ucfirst($this->action).'After', array('controller' => $this, 'return' => $return));
- Hook::exec('action'.get_class($this).ucfirst($this->action).'After', array('controller' => $this, 'return' => $return));
-
- return $return;
+ // from ajax-tab.php
+ $action = Tools::getValue('action');
+ // no need to use displayConf() here
+ if (!empty($action) && method_exists($this, 'ajaxProcess'.Tools::toCamelCase($action)))
+ return $this->{'ajaxProcess'.Tools::toCamelCase($action)}();
+ elseif (method_exists($this, 'ajaxProcess'))
+ return $this->ajaxProcess();
}
- }
+ else
+ {
+ // Process list filtering
+ if ($this->filter)
+ $this->processFilter();
+
+ // If the method named after the action exists, call "before" hooks, then call action method, then call "after" hooks
+ if (!empty($this->action) && method_exists($this, 'process'.ucfirst(Tools::toCamelCase($this->action))))
+ {
+ // Hook before action
+ Hook::exec('actionAdmin'.ucfirst($this->action).'Before', array('controller' => $this));
+ Hook::exec('action'.get_class($this).ucfirst($this->action).'Before', array('controller' => $this));
+ // Call process
+ $return = $this->{'process'.Tools::toCamelCase($this->action)}();
+ // Hook After Action
+ Hook::exec('actionAdmin'.ucfirst($this->action).'After', array('controller' => $this, 'return' => $return));
+ Hook::exec('action'.get_class($this).ucfirst($this->action).'After', array('controller' => $this, 'return' => $return));
+
+ return $return;
+ }
+ }
+ } catch (PrestaShopException $e) {
+ $this->errors[] = $e->getMessage();
+ };
+ return false;
}
/**
@@ -583,16 +588,27 @@ class AdminControllerCore extends Controller
$headers = array();
foreach ($this->fields_list as $datas)
$headers[] = Tools::htmlentitiesDecodeUTF8($datas['title']);
-
$content = array();
foreach ($this->_list as $i => $row)
{
$content[$i] = array();
- foreach ($this->fields_list as $key => $value)
- if (isset($row[$key]))
- $content[$i][] = Tools::htmlentitiesDecodeUTF8($row[$key]);
-
+ $path_to_image = false;
+ foreach ($this->fields_list as $key => $params)
+ {
+ $field_value = isset($row[$key]) ? Tools::htmlentitiesDecodeUTF8($row[$key]) : '';
+ if ($key == 'image')
+ {
+ if ($params['image'] != 'p' || Configuration::get('PS_LEGACY_IMAGES'))
+ $path_to_image = Tools::getShopDomain(true)._PS_IMG_.$params['image'].'/'.$row['id_'.$this->table].(isset($row['id_image']) ? '-'.(int)$row['id_image'] : '').'.'.$this->imageType;
+ else
+ $path_to_image = Tools::getShopDomain(true)._PS_IMG_.$params['image'].'/'.Image::getImgFolderStatic($row['id_image']).(int)$row['id_image'].'.'.$this->imageType;
+ if ($path_to_image)
+ $field_value = $path_to_image;
+ }
+ $content[$i][] = $field_value;
+ }
}
+
$this->context->smarty->assign(array(
'export_precontent' => "\xEF\xBB\xBF",
'export_headers' => $headers,
@@ -1100,7 +1116,7 @@ class AdminControllerCore extends Controller
}
else
{
- $this->errors[] = Tools::displayError('The object cannot be loaded (ithe dentifier is missing or invalid)');
+ $this->errors[] = Tools::displayError('The object cannot be loaded (the dentifier is missing or invalid)');
return false;
}
@@ -1161,6 +1177,7 @@ class AdminControllerCore extends Controller
header('Location: '.$this->redirect_after);
exit;
}
+
public function display()
{
$this->context->smarty->assign(array(
diff --git a/classes/controller/FrontController.php b/classes/controller/FrontController.php
index 14dc91682..798446e34 100755
--- a/classes/controller/FrontController.php
+++ b/classes/controller/FrontController.php
@@ -108,7 +108,7 @@ class FrontControllerCore extends Controller
// If current URL use SSL, set it true (used a lot for module redirect)
if (Tools::usingSecureMode())
- $useSSL = $this->ssl = true;
+ $useSSL = true;
// For compatibility with globals, DEPRECATED as of version 1.5
$css_files = $this->css_files;
diff --git a/classes/db/DbPDO.php b/classes/db/DbPDO.php
index cc1709801..ed2870a16 100644
--- a/classes/db/DbPDO.php
+++ b/classes/db/DbPDO.php
@@ -209,13 +209,27 @@ class DbPDOCore extends Db
if (strtolower($engine) == 'innodb')
{
+ $value = 0;
+
$sql = 'SHOW VARIABLES WHERE Variable_name = \'have_innodb\'';
$result = $link->query($sql);
if (!$result)
- return 4;
+ $value = 4;
$row = $result->fetch();
if (!$row || strtolower($row['Value']) != 'yes')
- return 4;
+ $value = 4;
+
+ /* MySQL >= 5.6 */
+ $sql = 'SHOW ENGINES';
+ $result = $link->query($sql);
+ while ($row = $result->fetch())
+ if ($row['Engine'] == 'InnoDB')
+ {
+ if (in_array($row['Support'], array('DEFAULT', 'YES')))
+ $value = 0;
+ break;
+ }
+ return $value;
}
unset($link);
return 0;
diff --git a/classes/db/MySQL.php b/classes/db/MySQL.php
index b8db3dbd6..ba05fd29c 100644
--- a/classes/db/MySQL.php
+++ b/classes/db/MySQL.php
@@ -168,13 +168,27 @@ class MySQLCore extends Db
if (strtolower($engine) == 'innodb')
{
+ $value = 0;
+
$sql = 'SHOW VARIABLES WHERE Variable_name = \'have_innodb\'';
$result = mysql_query($sql);
if (!$result)
- return 4;
+ $value = 4;
$row = mysql_fetch_assoc($result);
if (!$row || strtolower($row['Value']) != 'yes')
- return 4;
+ $value = 4;
+
+ /* MySQL >= 5.6 */
+ $sql = 'SHOW ENGINES';
+ $result = mysql_query($sql);
+ while ($row = mysql_fetch_assoc($result))
+ if ($row['Engine'] == 'InnoDB')
+ {
+ if (in_array($row['Support'], array('DEFAULT', 'YES')))
+ $value = 0;
+ break;
+ }
+ return $value;
}
@mysql_close($link);
return 0;
diff --git a/classes/helper/HelperList.php b/classes/helper/HelperList.php
index 34db27bdf..eeff1eea4 100644
--- a/classes/helper/HelperList.php
+++ b/classes/helper/HelperList.php
@@ -282,9 +282,9 @@ class HelperListCore extends Helper
$this->_list[$index][$key] = Tools::displayPrice($tr[$key], $currency, false);
}
elseif (isset($params['type']) && $params['type'] == 'date')
- $this->_list[$index][$key] = Tools::displayDate($tr[$key], $this->context->language->id);
+ $this->_list[$index][$key] = Tools::displayDate($tr[$key]);
elseif (isset($params['type']) && $params['type'] == 'datetime')
- $this->_list[$index][$key] = Tools::displayDate($tr[$key], $this->context->language->id, true);
+ $this->_list[$index][$key] = Tools::displayDate($tr[$key],null , true);
elseif (isset($tr[$key]))
{
$echo = $tr[$key];
diff --git a/classes/module/Module.php b/classes/module/Module.php
index 2877c1bad..234897db7 100644
--- a/classes/module/Module.php
+++ b/classes/module/Module.php
@@ -215,7 +215,7 @@ abstract class ModuleCore
}
// Check if module is installed
- $result = Db::getInstance()->getRow('SELECT `id_module` FROM `'._DB_PREFIX_.'module` WHERE `name` = \''.pSQL($this->name).'\'');
+ $result = Module::isInstalled($this->name);
if ($result)
{
$this->_errors[] = $this->l('This module has already been installed.');
@@ -311,6 +311,12 @@ abstract class ModuleCore
*/
public static function initUpgradeModule($module)
{
+ if (((int)$module->installed == 1) & (empty($module->database_version) === true))
+ {
+ Module::upgradeModuleVersion($module->name, $module->version);
+ $module->database_version = $module->version;
+ }
+
// Init cache upgrade details
self::$modules_cache[$module->name]['upgrade'] = array(
'success' => false, // bool to know if upgrade succeed or not
@@ -1543,7 +1549,7 @@ abstract class ModuleCore
{
if (!Cache::isStored('Module::isInstalled'.$module_name))
{
- $id_module = Db::getInstance()->getValue('SELECT `id_module` FROM `'._DB_PREFIX_.'module` WHERE `name` = \''.pSQL($module_name).'\'');
+ $id_module = Module::getModuleIdByName($module_name);
Cache::store('Module::isInstalled'.$module_name, (bool)$id_module);
}
return Cache::retrieve('Module::isInstalled'.$module_name);
@@ -1554,7 +1560,7 @@ abstract class ModuleCore
if (!Cache::isStored('Module::isEnabled'.$module_name))
{
$active = false;
- $id_module = Db::getInstance()->getValue('SELECT `id_module` FROM `'._DB_PREFIX_.'module` WHERE `name` = \''.pSQL($module_name).'\'');
+ $id_module = Module::getModuleIdByName($module_name);
if (Db::getInstance()->getValue('SELECT `id_module` FROM `'._DB_PREFIX_.'module_shop` WHERE `id_module` = '.(int)$id_module.' AND `id_shop` = '.(int)Context::getContext()->shop->id))
$active = true;
Cache::store('Module::isEnabled'.$module_name, (bool)$active);
diff --git a/classes/order/Order.php b/classes/order/Order.php
index 4e17e68c4..80c9a8dbf 100644
--- a/classes/order/Order.php
+++ b/classes/order/Order.php
@@ -240,6 +240,8 @@ class OrderCore extends ObjectModel
'product_quantity' => array('required' => true),
'product_name' => array('setter' => false),
'product_price' => array('setter' => false),
+ 'unit_price_tax_incl' => array('setter' => false),
+ 'unit_price_tax_excl' => array('setter' => false),
)),
),
@@ -1287,7 +1289,7 @@ class OrderCore extends ObjectModel
public function getWsOrderRows()
{
- $query = 'SELECT id_order_detail as `id`, `product_id`, `product_price`, `id_order`, `product_attribute_id`, `product_quantity`, `product_name`
+ $query = 'SELECT id_order_detail as `id`, `product_id`, `product_price`, `id_order`, `product_attribute_id`, `product_quantity`, `product_name`, `unit_price_tax_incl`, `unit_price_tax_excl`
FROM `'._DB_PREFIX_.'order_detail`
WHERE id_order = '.(int)$this->id;
$result = Db::getInstance()->executeS($query);
@@ -1627,7 +1629,7 @@ class OrderCore extends ObjectModel
return Db::getInstance()->getValue('
SELECT SUM(total_paid_tax_incl)
FROM `'._DB_PREFIX_.'orders`
- WHERE `reference` = '.(int)$this->reference.'
+ WHERE `reference` = \''.pSQL($this->reference).'\'
AND `id_cart` = '.(int)$this->id_cart
);
}
diff --git a/classes/order/OrderHistory.php b/classes/order/OrderHistory.php
index 853d15450..b12bcd91a 100644
--- a/classes/order/OrderHistory.php
+++ b/classes/order/OrderHistory.php
@@ -93,7 +93,7 @@ class OrderHistoryCore extends ObjectModel
// executes hook
- if ($new_os->id == Configuration::get('PS_OS_PAYMENT'))
+ if (in_array($new_os->id, array(Configuration::get('PS_OS_PAYMENT'), Configuration::get('PS_OS_WS_PAYMENT'))))
Hook::exec('actionPaymentConfirmation', array('id_order' => (int)$order->id));
// executes hook
@@ -123,7 +123,7 @@ class OrderHistoryCore extends ObjectModel
.'&secure_key='.$order->secure_key;
$assign[$key]['link'] = $dl_link;
if (isset($virtual_product['date_expiration']) && $virtual_product['date_expiration'] != '0000-00-00 00:00:00')
- $assign[$key]['deadline'] = Tools::displayDate($virtual_product['date_expiration '], $order->id_lang);
+ $assign[$key]['deadline'] = Tools::displayDate($virtual_product['date_expiration ']);
if ($product_download->nb_downloadable != 0)
$assign[$key]['downloadable'] = (int)$product_download->nb_downloadable;
}
diff --git a/classes/pdf/HTMLTemplateDeliverySlip.php b/classes/pdf/HTMLTemplateDeliverySlip.php
index a18a4e3b5..6ca63012f 100755
--- a/classes/pdf/HTMLTemplateDeliverySlip.php
+++ b/classes/pdf/HTMLTemplateDeliverySlip.php
@@ -38,7 +38,7 @@ class HTMLTemplateDeliverySlipCore extends HTMLTemplate
$this->smarty = $smarty;
// header informations
- $this->date = Tools::displayDate($this->order->invoice_date, (int)$this->order->id_lang);
+ $this->date = Tools::displayDate($this->order->invoice_date);
$this->title = HTMLTemplateDeliverySlip::l('Delivery').' #'.Configuration::get('PS_DELIVERY_PREFIX', Context::getContext()->language->id).sprintf('%06d', $this->order_invoice->delivery_number);
// footer informations
diff --git a/classes/pdf/HTMLTemplateInvoice.php b/classes/pdf/HTMLTemplateInvoice.php
index 52600802f..86c475833 100755
--- a/classes/pdf/HTMLTemplateInvoice.php
+++ b/classes/pdf/HTMLTemplateInvoice.php
@@ -39,7 +39,7 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
$this->smarty = $smarty;
// header informations
- $this->date = Tools::displayDate($order_invoice->date_add, (int)$this->order->id_lang);
+ $this->date = Tools::displayDate($order_invoice->date_add);
$id_lang = Context::getContext()->language->id;
$this->title = HTMLTemplateInvoice::l('Invoice ').' #'.Configuration::get('PS_INVOICE_PREFIX', $id_lang, null, (int)$this->order->id_shop).sprintf('%06d', $order_invoice->number);
diff --git a/classes/pdf/HTMLTemplateOrderReturn.php b/classes/pdf/HTMLTemplateOrderReturn.php
index 0e366ce91..4bee5be8c 100755
--- a/classes/pdf/HTMLTemplateOrderReturn.php
+++ b/classes/pdf/HTMLTemplateOrderReturn.php
@@ -39,7 +39,7 @@ class HTMLTemplateOrderReturnCore extends HTMLTemplate
$this->order = new Order($order_return->id_order);
// header informations
- $this->date = Tools::displayDate($this->order->invoice_date, (int)$this->order->id_lang);
+ $this->date = Tools::displayDate($this->order->invoice_date);
$this->title = HTMLTemplateOrderReturn::l('Order Return ').sprintf('%06d', $this->order_return->id);
// footer informations
diff --git a/classes/pdf/HTMLTemplateOrderSlip.php b/classes/pdf/HTMLTemplateOrderSlip.php
index 06b8b2e23..95d9b9f1f 100644
--- a/classes/pdf/HTMLTemplateOrderSlip.php
+++ b/classes/pdf/HTMLTemplateOrderSlip.php
@@ -211,6 +211,8 @@ class HTMLTemplateOrderSlipCore extends HTMLTemplateInvoice
if ($ecotax)
foreach ($tmp_tax_infos as $rate => &$row)
{
+ if (!isset($ecotax[$rate]))
+ continue;
$row['total_price_tax_excl'] -= $ecotax[$rate]['ecotax_tax_excl'];
$row['total_amount'] -= ($ecotax[$rate]['ecotax_tax_incl'] - $ecotax[$rate]['ecotax_tax_excl']);
}
diff --git a/classes/pdf/PDFGenerator.php b/classes/pdf/PDFGenerator.php
index 1c117ad86..3049eaf62 100755
--- a/classes/pdf/PDFGenerator.php
+++ b/classes/pdf/PDFGenerator.php
@@ -46,6 +46,7 @@ class PDFGeneratorCore extends TCPDF
'uk' => 'freeserif',
'mk' => 'freeserif',
'el' => 'freeserif',
+ 'en' => 'dejavusans',
'vn' => 'dejavusans',
'pl' => 'dejavusans',
'ar' => 'dejavusans',
diff --git a/classes/shop/Shop.php b/classes/shop/Shop.php
index 1538bb2e2..da7a42e6c 100644
--- a/classes/shop/Shop.php
+++ b/classes/shop/Shop.php
@@ -349,12 +349,27 @@ class ShopCore extends ObjectModel
}
}
- if (!$id_shop && defined('_PS_ADMIN_DIR_'))
+ if ((!$id_shop && defined('_PS_ADMIN_DIR_')) || Tools::isPHPCLI())
{
// If in admin, we can access to the shop without right URL
- $shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
+ if ((!$id_shop && Tools::isPHPCLI()) || defined('_PS_ADMIN_DIR_'))
+ $id_shop = (int)Configuration::get('PS_SHOP_DEFAULT');
+
+ $shop = new Shop((int)$id_shop);
+ if (!Validate::isLoadedObject($shop))
+ $shop = new Shop((int)Configuration::get('PS_SHOP_DEFAULT'));
+
$shop->physical_uri = preg_replace('#/+#', '/', str_replace('\\', '/', dirname(dirname($_SERVER['SCRIPT_NAME']))).'/');
$shop->virtual_uri = '';
+
+ // Define some $_SERVER variables like HTTP_HOST if PHP is launched with php-cli
+ if (Tools::isPHPCLI())
+ {
+ if(!isset($_SERVER['HTTP_HOST']) || empty($_SERVER['HTTP_HOST']))
+ $_SERVER['HTTP_HOST'] = $shop->domain;
+ if(!isset($_SERVER['SERVER_NAME']) || empty($_SERVER['SERVER_NAME']))
+ $_SERVER['SERVER_NAME'] = $shop->domain;
+ }
}
else
{
diff --git a/classes/stock/StockManager.php b/classes/stock/StockManager.php
index 1ad67d77b..a313da21f 100644
--- a/classes/stock/StockManager.php
+++ b/classes/stock/StockManager.php
@@ -479,13 +479,13 @@ class StockManagerCore implements StockManagerInterface
$query->where('o.valid = 1 OR (os.id_order_state != '.(int)Configuration::get('PS_OS_ERROR').'
AND os.id_order_state != '.(int)Configuration::get('PS_OS_CANCELED').')');
$query->groupBy('od.id_order_detail');
- //if (count($ids_warehouse))
- //$query->where('od.id_warehouse IN('.implode(', ', $ids_warehouse).')');
+ if (count($ids_warehouse))
+ $query->where('od.id_warehouse IN('.implode(', ', $ids_warehouse).')');
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
$client_orders_qty = 0;
if (count($res))
foreach ($res as $row)
- $client_orders_qty += $row['product_quantity'] + $row['product_quantity_refunded'];
+ $client_orders_qty += ($row['product_quantity'] - $row['product_quantity_refunded']);
// Gets supply_orders_qty
$query = new DbQuery();
@@ -658,4 +658,4 @@ class StockManagerCore implements StockManagerInterface
return $stocks;
}
-}
+}
\ No newline at end of file
diff --git a/classes/webservice/WebserviceRequest.php b/classes/webservice/WebserviceRequest.php
index a4f5ee6b5..61a0aa0a7 100644
--- a/classes/webservice/WebserviceRequest.php
+++ b/classes/webservice/WebserviceRequest.php
@@ -1184,7 +1184,14 @@ class WebserviceRequestCore
$sql_sort .= 'main_i18n.`'.pSQL($this->resourceConfiguration['fields'][$fieldName]['sqlId']).'` '.$direction.', ';// ORDER BY main_i18n.`field` ASC|DESC
}
else
- $sql_sort .= (isset($this->resourceConfiguration['retrieveData']['tableAlias']) ? $this->resourceConfiguration['retrieveData']['tableAlias'].'.' : '').'`'.pSQL($this->resourceConfiguration['fields'][$fieldName]['sqlId']).'` '.$direction.', ';// ORDER BY `field` ASC|DESC
+ {
+ $object = new $this->resourceConfiguration['retrieveData']['className']();
+ if ($object->isMultiShopField($this->resourceConfiguration['fields'][$fieldName]['sqlId']))
+ $table_alias = 'multi_shop_'.$this->resourceConfiguration['retrieveData']['table'];
+ else
+ $table_alias = '';
+ $sql_sort .= (isset($this->resourceConfiguration['retrieveData']['tableAlias']) ? '`'.bqSQL($this->resourceConfiguration['retrieveData']['tableAlias']).'`.' : '`'.bqSQL($table_alias).'`.').'`'.pSQL($this->resourceConfiguration['fields'][$fieldName]['sqlId']).'` '.$direction.', ';// ORDER BY `field` ASC|DESC
+ }
}
$sql_sort = rtrim($sql_sort, ', ')."\n";
}
@@ -1218,6 +1225,11 @@ class WebserviceRequestCore
{
$objects = array();
$filters = $this->manageFilters();
+
+ /* If we only need to display the synopsis, analyzing the first row is sufficient */
+ if (isset($this->urlFragments['schema']) && $this->urlFragments['schema'] == 'synopsis')
+ $filters = array('sql_join' => '', 'sql_filter' => '', 'sql_sort' => '', 'sql_limit' => ' LIMIT 1');
+
$this->resourceConfiguration['retrieveData']['params'][] = $filters['sql_join'];
$this->resourceConfiguration['retrieveData']['params'][] = $filters['sql_filter'];
$this->resourceConfiguration['retrieveData']['params'][] = $filters['sql_sort'];
diff --git a/config/config.inc.php b/config/config.inc.php
index ce76ea8c6..637089c22 100644
--- a/config/config.inc.php
+++ b/config/config.inc.php
@@ -62,6 +62,9 @@ if (_PS_DEBUG_PROFILING_)
include_once(_PS_TOOL_DIR_.'profiling/Tools.php');
}
+if (Tools::isPHPCLI())
+ Tools::argvToGET($argc, $argv);
+
/* Redefine REQUEST_URI if empty (on some webservers...) */
if (!isset($_SERVER['REQUEST_URI']) || empty($_SERVER['REQUEST_URI']))
{
diff --git a/config/defines.inc.php b/config/defines.inc.php
index 8ce70b580..ab72ff105 100755
--- a/config/defines.inc.php
+++ b/config/defines.inc.php
@@ -28,7 +28,8 @@
define('_PS_MODE_DEV_', true);
if (_PS_MODE_DEV_)
{
- @ini_set('display_errors', 'on');
+ @ini_set('display_errors', 'on');
+ @error_reporting(E_ALL | E_STRICT);
define('_PS_DEBUG_SQL_', true);
/* Compatibility warning */
define('_PS_DISPLAY_COMPATIBILITY_WARNING_', true);
diff --git a/config/smartyadmin.config.inc.php b/config/smartyadmin.config.inc.php
index 60d9a149f..f2916819e 100644
--- a/config/smartyadmin.config.inc.php
+++ b/config/smartyadmin.config.inc.php
@@ -57,7 +57,14 @@ function smartyTranslate($params, &$smarty)
// If the tpl is used by a Controller
else
{
- // Split by \ and / to get the folder tree for the file
+ if (isset(Context::getContext()->controller))
+ {
+ $class_name = get_class(Context::getContext()->controller);
+ $class = substr($class_name, 0, strpos(Tools::strtolower($class_name), 'controller'));
+ }
+ else
+ {
+ // Split by \ and / to get the folder tree for the file
$folder_tree = preg_split('#[/\\\]#', $filename);
$key = array_search('controllers', $folder_tree);
@@ -69,8 +76,8 @@ function smartyTranslate($params, &$smarty)
$class = 'Admin'.Tools::toCamelCase($folder_tree[0], true);
else
$class = null;
+ }
}
return Translate::getAdminTranslation($params['s'], $class, $addslashes, $htmlentities, $sprintf);
-}
-
+}
\ No newline at end of file
diff --git a/controllers/admin/AdminAccessController.php b/controllers/admin/AdminAccessController.php
index a3f79ab4b..543a3b5d2 100644
--- a/controllers/admin/AdminAccessController.php
+++ b/controllers/admin/AdminAccessController.php
@@ -153,35 +153,32 @@ class AdminAccessControllerCore extends AdminController
$join = 'LEFT JOIN `'._DB_PREFIX_.'tab` t ON (t.`id_tab` = a.`id_tab`)';
}
- if ($id_tab == -1 && $perm == 'all' && $enabled == 0)
- $sql = '
- UPDATE `'._DB_PREFIX_.'access` a
- SET `view` = '.(int)$enabled.', `add` = '.(int)$enabled.', `edit` = '.(int)$enabled.', `delete` = '.(int)$enabled.'
- WHERE `id_profile` = '.(int)$id_profile.' AND `id_tab` != '.(int)$this->id_tab_access;
- else if ($id_tab == -1 && $perm == 'all')
- $sql = '
+ if ($id_tab == -1)
+ {
+ if ($perm == 'all')
+ $sql = '
UPDATE `'._DB_PREFIX_.'access` a
SET `view` = '.(int)$enabled.', `add` = '.(int)$enabled.', `edit` = '.(int)$enabled.', `delete` = '.(int)$enabled.'
WHERE `id_profile` = '.(int)$id_profile;
- else if ($id_tab == -1)
- $sql = '
+ else
+ $sql = '
UPDATE `'._DB_PREFIX_.'access` a
SET `'.bqSQL($perm).'` = '.(int)$enabled.'
WHERE `id_profile` = '.(int)$id_profile;
- else if ($perm == 'all')
- $sql = '
- UPDATE `'._DB_PREFIX_.'access` a
- '.$join.'
- SET `view` = '.(int)$enabled.', `add` = '.(int)$enabled.', `edit` = '.(int)$enabled.', `delete` = '.(int)$enabled.'
- WHERE '.$where.' = '.(int)$id_tab.'
- AND `id_profile` = '.(int)$id_profile;
+ }
else
- $sql = '
- UPDATE `'._DB_PREFIX_.'access` a
- '.$join.'
+ {
+ if ($perm == 'all')
+ $sql = '
+ UPDATE `'._DB_PREFIX_.'access` a '.$join.'
+ SET `view` = '.(int)$enabled.', `add` = '.(int)$enabled.', `edit` = '.(int)$enabled.', `delete` = '.(int)$enabled.'
+ WHERE '.$where.' = '.(int)$id_tab.' AND `id_profile` = '.(int)$id_profile;
+ else
+ $sql = '
+ UPDATE `'._DB_PREFIX_.'access` a '.$join.'
SET `'.bqSQL($perm).'` = '.(int)$enabled.'
- WHERE '.$where.' = '.(int)$id_tab.'
- AND `id_profile` = '.(int)$id_profile;
+ WHERE '.$where.' = '.(int)$id_tab.' AND `id_profile` = '.(int)$id_profile;
+ }
$res = Db::getInstance()->execute($sql) ? 'ok' : 'error';
diff --git a/controllers/admin/AdminAddressesController.php b/controllers/admin/AdminAddressesController.php
index 959687eef..9ab026776 100644
--- a/controllers/admin/AdminAddressesController.php
+++ b/controllers/admin/AdminAddressesController.php
@@ -444,4 +444,41 @@ class AdminAddressesControllerCore extends AdminController
}
die;
}
+
+ /**
+ * Object Delete
+ */
+ public function processDelete()
+ {
+ if (Validate::isLoadedObject($object = $this->loadObject()))
+ if (!$object->isUsed())
+ $this->deleted = false;
+
+ return parent::processDelete();
+ }
+
+ /**
+ * Delete multiple items
+ *
+ * @return boolean true if succcess
+ */
+ protected function processBulkDelete()
+ {
+ if (is_array($this->boxes) && !empty($this->boxes))
+ {
+ $deleted = false;
+ foreach ($this->boxes as $id)
+ {
+ $to_delete = new Address((int)$id);
+ if ($to_delete->isUsed())
+ {
+ $deleted = true;
+ break;
+ }
+ }
+ $this->deleted = $deleted;
+ }
+
+ return parent::processBulkDelete();
+ }
}
diff --git a/controllers/admin/AdminAttributesGroupsController.php b/controllers/admin/AdminAttributesGroupsController.php
index 26c53cc83..937d632e0 100644
--- a/controllers/admin/AdminAttributesGroupsController.php
+++ b/controllers/admin/AdminAttributesGroupsController.php
@@ -686,7 +686,11 @@ class AdminAttributesGroupsControllerCore extends AdminController
{
foreach ($this->_list as &$list)
if (file_exists(_PS_IMG_DIR_.$this->fieldImageSettings['dir'].'/'.(int)$list['id_attribute'].'.jpg'))
+ {
+ if (!isset($list['color']) || !is_array($list['color']))
+ $list['color'] = array();
$list['color']['texture'] = '../img/'.$this->fieldImageSettings['dir'].'/'.(int)$list['id_attribute'].'.jpg';
+ }
}
else
{
diff --git a/controllers/admin/AdminCategoriesController.php b/controllers/admin/AdminCategoriesController.php
index 0a512abd5..4d48eb608 100644
--- a/controllers/admin/AdminCategoriesController.php
+++ b/controllers/admin/AdminCategoriesController.php
@@ -208,8 +208,7 @@ class AdminCategoriesControllerCore extends AdminController
public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
{
- $alias = 'sa';
- parent::getList($id_lang, $alias.'.position', $order_way, $start, $limit, Context::getContext()->shop->id);
+ parent::getList($id_lang, $order_by, $order_way, $start, $limit, Context::getContext()->shop->id);
// Check each row to see if there are combinations and get the correct action in consequence
$nb_items = count($this->_list);
@@ -415,6 +414,7 @@ class AdminCategoriesControllerCore extends AdminController
'type' => 'textarea',
'label' => $this->l('Description:'),
'name' => 'description',
+ 'autoload_rte' => true,
'lang' => true,
'rows' => 10,
'cols' => 100,
diff --git a/controllers/admin/AdminCountriesController.php b/controllers/admin/AdminCountriesController.php
index 5a80556cd..2eb4e31a2 100644
--- a/controllers/admin/AdminCountriesController.php
+++ b/controllers/admin/AdminCountriesController.php
@@ -251,6 +251,26 @@ class AdminCountriesControllerCore extends AdminController
'encoding_default_layout' => urlencode($default_layout),
'display_valid_fields' => $this->displayValidFields()
),
+ array(
+ 'type' => 'radio',
+ 'label' => $this->l('Address Standardization:'),
+ 'name' => 'standardization',
+ 'required' => false,
+ 'class' => 't',
+ 'is_bool' => true,
+ 'values' => array(
+ array(
+ 'id' => 'standardization_on',
+ 'value' => 1,
+ 'label' => $this->l('Enabled')
+ ),
+ array(
+ 'id' => 'standardization_off',
+ 'value' => 0,
+ 'label' => $this->l('Disabled')
+ )
+ ),
+ ),
array(
'type' => 'radio',
'label' => $this->l('Active:'),
@@ -271,7 +291,7 @@ class AdminCountriesControllerCore extends AdminController
)
),
'desc' => $this->l('Display this country to your customers (the selected country will always be displayed in the Back Office)')
- ),
+ ),
array(
'type' => 'radio',
'label' => $this->l('Contains following states:'),
@@ -330,6 +350,7 @@ class AdminCountriesControllerCore extends AdminController
)
)
)
+
);
if (Shop::isFeatureActive())
@@ -345,7 +366,10 @@ class AdminCountriesControllerCore extends AdminController
'title' => $this->l('Save '),
'class' => 'button'
);
-
+
+ if ($this->object->iso_code == 'US')
+ $this->object->standardization = Configuration::get('PS_TAASC');
+
return parent::renderForm();
}
@@ -362,6 +386,9 @@ class AdminCountriesControllerCore extends AdminController
if (!is_null($id_country) && $id_country != Tools::getValue('id_'.$this->table))
$this->errors[] = Tools::displayError('This ISO code already exists.You cannot create two countries with the same ISO code.');
}
+
+ if (Tools::isSubmit('standardization'))
+ Configuration::updateValue('PS_TAASC', (bool)Tools::getValue('standardization', false));
if (!count($this->errors))
$res = parent::postProcess();
diff --git a/controllers/admin/AdminCustomerPreferencesController.php b/controllers/admin/AdminCustomerPreferencesController.php
index 07e7393dd..497f69314 100644
--- a/controllers/admin/AdminCustomerPreferencesController.php
+++ b/controllers/admin/AdminCustomerPreferencesController.php
@@ -72,6 +72,14 @@ class AdminCustomerPreferencesControllerCore extends AdminController
'cast' => 'intval',
'type' => 'bool'
),
+ 'PS_CUSTOMER_CREATION_EMAIL' => array(
+ 'title' => $this->l('Send an email after registration'),
+ 'desc' => $this->l('Send an email with summary account (email, password) after registration.'),
+ 'validation' => 'isUnsignedInt',
+ 'validation' => 'isBool',
+ 'cast' => 'intval',
+ 'type' => 'bool'
+ ),
'PS_PASSWD_TIME_FRONT' => array(
'title' => $this->l('Regenerate password'),
'desc' => $this->l('Minimum time required to regenerate a password.'),
diff --git a/controllers/admin/AdminCustomerThreadsController.php b/controllers/admin/AdminCustomerThreadsController.php
index d97b0fded..cc6ed3882 100644
--- a/controllers/admin/AdminCustomerThreadsController.php
+++ b/controllers/admin/AdminCustomerThreadsController.php
@@ -557,7 +557,7 @@ class AdminCustomerThreadsControllerCore extends AdminController
$products = $customer->getBoughtProducts();
if ($products && count($products))
foreach ($products as $key => $product)
- $products[$key]['date_add'] = Tools::displayDate($product['date_add'], $this->context->language->id, true);
+ $products[$key]['date_add'] = Tools::displayDate($product['date_add'],null , true);
}
foreach ($messages as $key => $message)
@@ -595,7 +595,7 @@ class AdminCustomerThreadsControllerCore extends AdminController
if (!empty($message['id_product']) && empty($message['employee_name']))
$id_order_product = Order::getIdOrderProduct((int)$message['id_customer'], (int)$message['id_product']);
}
- $message['date_add'] = Tools::displayDate($message['date_add'], $this->context->language->id, true);
+ $message['date_add'] = Tools::displayDate($message['date_add'],null , true);
$message['user_agent'] = strip_tags($message['user_agent']);
$message['message'] = preg_replace(
'/(https?:\/\/[a-z0-9#%&_=\(\)\.\? \+\-@\/]{6,1000})([\s\n<])/Uui',
diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php
index e395e725d..621e9b765 100644
--- a/controllers/admin/AdminCustomersController.php
+++ b/controllers/admin/AdminCustomersController.php
@@ -555,7 +555,7 @@ class AdminCustomersControllerCore extends AdminController
$total_orders = count($orders);
for ($i = 0; $i < $total_orders; $i++)
{
- $orders[$i]['date_add'] = Tools::displayDate($orders[$i]['date_add'], $this->context->language->id);
+ $orders[$i]['date_add'] = Tools::displayDate($orders[$i]['date_add']);
$orders[$i]['total_paid_real_not_formated'] = $orders[$i]['total_paid_real'];
$orders[$i]['total_paid_real'] = Tools::displayPrice($orders[$i]['total_paid_real'], new Currency((int)$orders[$i]['id_currency']));
}
@@ -565,7 +565,7 @@ class AdminCustomersControllerCore extends AdminController
for ($i = 0; $i < $total_messages; $i++)
{
$messages[$i]['message'] = substr(strip_tags(html_entity_decode($messages[$i]['message'], ENT_NOQUOTES, 'UTF-8')), 0, 75);
- $messages[$i]['date_add'] = Tools::displayDate($messages[$i]['date_add'], $this->context->language->id, true);
+ $messages[$i]['date_add'] = Tools::displayDate($messages[$i]['date_add'], null, true);
}
$groups = $customer->getGroups();
@@ -598,7 +598,7 @@ class AdminCustomersControllerCore extends AdminController
$products = $customer->getBoughtProducts();
$total_products = count($products);
for ($i = 0; $i < $total_products; $i++)
- $products[$i]['date_add'] = Tools::displayDate($products[$i]['date_add'], $this->default_form_language, true);
+ $products[$i]['date_add'] = Tools::displayDate($products[$i]['date_add'], null, true);
$carts = Cart::getCustomerCarts($customer->id);
$total_carts = count($carts);
@@ -610,7 +610,7 @@ class AdminCustomersControllerCore extends AdminController
$currency = new Currency((int)$carts[$i]['id_currency']);
$carrier = new Carrier((int)$carts[$i]['id_carrier']);
$carts[$i]['id_cart'] = sprintf('%06d', $carts[$i]['id_cart']);
- $carts[$i]['date_add'] = Tools::displayDate($carts[$i]['date_add'], $this->default_form_language, true);
+ $carts[$i]['date_add'] = Tools::displayDate($carts[$i]['date_add'], null, true);
$carts[$i]['total_price'] = Tools::displayPrice($summary['total_price'], $currency);
$carts[$i]['name'] = $carrier->name;
}
@@ -646,7 +646,7 @@ class AdminCustomersControllerCore extends AdminController
$total_connections = count($connections);
for ($i = 0; $i < $total_connections; $i++)
{
- $connections[$i]['date_add'] = Tools::displayDate($connections[$i]['date_add'], $this->default_form_language, true);
+ $connections[$i]['date_add'] = Tools::displayDate($connections[$i]['date_add'],null , true);
$connections[$i]['http_referer'] = $connections[$i]['http_referer'] ?
preg_replace('/^www./', '', parse_url($connections[$i]['http_referer'], PHP_URL_HOST)) :
$this->l('Direct link');
@@ -655,7 +655,7 @@ class AdminCustomersControllerCore extends AdminController
$referrers = Referrer::getReferrers($customer->id);
$total_referrers = count($referrers);
for ($i = 0; $i < $total_referrers; $i++)
- $referrers[$i]['date_add'] = Tools::displayDate($referrers[$i]['date_add'], $this->default_form_language, true);
+ $referrers[$i]['date_add'] = Tools::displayDate($referrers[$i]['date_add'],null , true);
$shop = new Shop($customer->id_shop);
$this->tpl_view_vars = array(
@@ -663,14 +663,14 @@ class AdminCustomersControllerCore extends AdminController
'gender_image' => $gender_image,
// General information of the customer
- 'registration_date' => Tools::displayDate($customer->date_add, $this->default_form_language, true),
+ 'registration_date' => Tools::displayDate($customer->date_add,null , true),
'customer_stats' => $customer_stats,
- 'last_visit' => Tools::displayDate($customer_stats['last_visit'], $this->default_form_language, true),
+ 'last_visit' => Tools::displayDate($customer_stats['last_visit'],null , true),
'count_better_customers' => $count_better_customers,
'shop_is_feature_active' => Shop::isFeatureActive(),
'name_shop' => $shop->name,
- 'customer_birthday' => Tools::displayDate($customer->birthday, $this->default_form_language),
- 'last_update' => Tools::displayDate($customer->date_upd, $this->default_form_language, true),
+ 'customer_birthday' => Tools::displayDate($customer->birthday),
+ 'last_update' => Tools::displayDate($customer->date_upd,null , true),
'customer_exists' => Customer::customerExists($customer->email),
'id_lang' => $customer->id_lang,
'customerLanguage' => (new Language($customer->id_lang)),
diff --git a/controllers/admin/AdminEmailsController.php b/controllers/admin/AdminEmailsController.php
index a0c26e124..1e1394b9f 100644
--- a/controllers/admin/AdminEmailsController.php
+++ b/controllers/admin/AdminEmailsController.php
@@ -165,6 +165,15 @@ class AdminEmailsControllerCore extends AdminController
);
}
+ public function updateOptionPsMailPasswd($value)
+ {
+ if (Tools::getValue('PS_MAIL_PASSWD') == '' && Configuration::get('PS_MAIL_PASSWD'))
+ return true;
+ else
+ Configuration::updateValue('PS_MAIL_PASSWD', Tools::getValue('PS_MAIL_PASSWD'));
+ }
+
+
/**
* AdminController::initContent() override
* @see AdminController::initContent()
diff --git a/controllers/admin/AdminEmployeesController.php b/controllers/admin/AdminEmployeesController.php
index ebdef6a4a..3c09f4cf1 100644
--- a/controllers/admin/AdminEmployeesController.php
+++ b/controllers/admin/AdminEmployeesController.php
@@ -297,7 +297,7 @@ class AdminEmployeesControllerCore extends AdminController
}
$this->fields_form['input'][] = array(
'type' => 'select',
- 'label' => $this->l('Profile:'),
+ 'label' => $this->l('Profile Permission:'),
'name' => 'id_profile',
'required' => true,
'options' => array(
diff --git a/controllers/admin/AdminGroupsController.php b/controllers/admin/AdminGroupsController.php
index a17063f88..3c8f26a79 100644
--- a/controllers/admin/AdminGroupsController.php
+++ b/controllers/admin/AdminGroupsController.php
@@ -312,36 +312,32 @@ class AdminGroupsControllerCore extends AdminController
return parent::renderForm();
}
- protected function formatCategoryDiscountList($id)
+ protected function formatCategoryDiscountList($id_group)
{
- $category = GroupReduction::getGroupReductions((int)$id, $this->context->language->id);
+ $group_reductions = GroupReduction::getGroupReductions((int)$id_group, $this->context->language->id);
$category_reductions = array();
$category_reduction = Tools::getValue('category_reduction');
- foreach ($category as $category)
+ foreach ($group_reductions as $category)
{
if (is_array($category_reduction) && array_key_exists($category['id_category'], $category_reduction))
$category['reduction'] = $category_reduction[$category['id_category']];
- $tmp = array();
- $tmp['path'] = getPath(self::$currentIndex.'?tab=AdminCategories', (int)$category['id_category']);
- $tmp['reduction'] = (float)$category['reduction'] * 100;
- $tmp['id_category'] = (int)$category['id_category'];
- $category_reductions[(int)$category['id_category']] = $tmp;
+ $category_reductions[(int)$category['id_category']] = array(
+ 'path' => getPath(self::$currentIndex.'?tab=AdminCategories', (int)$category['id_category']),
+ 'reduction' => (float)$category['reduction'] * 100,
+ 'id_category' => (int)$category['id_category']
+ );
}
if (is_array($category_reduction))
foreach ($category_reduction as $key => $val)
- {
if (!array_key_exists($key, $category_reductions))
- {
- $tmp = array();
- $tmp['path'] = getPath(self::$currentIndex.'?tab=AdminCategories', $key);
- $tmp['reduction'] = (float)$val * 100;
- $tmp['id_category'] = (int)$key;
- $category_reductions[(int)$category['id_category']] = $tmp;
- }
- }
+ $category_reductions[(int)$key] = array(
+ 'path' => getPath(self::$currentIndex.'?tab=AdminCategories', $key),
+ 'reduction' => (float)$val * 100,
+ 'id_category' => (int)$key
+ );
return $category_reductions;
}
diff --git a/controllers/admin/AdminHomeController.php b/controllers/admin/AdminHomeController.php
index 2e9059150..5ab44673b 100644
--- a/controllers/admin/AdminHomeController.php
+++ b/controllers/admin/AdminHomeController.php
@@ -71,7 +71,7 @@ class AdminHomeControllerCore extends AdminController
$indexRebuiltAfterUpdate = 2;
$smartyOptimized = 0;
- if (Configuration::get('PS_SMARTY_FORCE_COMPILE') == _PS_SMARTY_NO_COMPILE_)
+ if (in_array(Configuration::get('PS_SMARTY_FORCE_COMPILE'), array(_PS_SMARTY_CHECK_COMPILE_, _PS_SMARTY_NO_COMPILE_)))
++$smartyOptimized;
if (Configuration::get('PS_SMARTY_CACHE'))
++$smartyOptimized;
diff --git a/controllers/admin/AdminImagesController.php b/controllers/admin/AdminImagesController.php
index 38ecea2e4..22694773d 100644
--- a/controllers/admin/AdminImagesController.php
+++ b/controllers/admin/AdminImagesController.php
@@ -53,7 +53,7 @@ class AdminImagesControllerCore extends AdminController
);
// No need to display the old image system if the install has been made later than 2013-03-26
- $this->display_move = (defined('_PS_CREATION_DATE_') && strtotime(_PS_CREATION_DATE_) > strtotime('2013-03-26')) ? false : true;
+ $this->display_move = (!Configuration::get('PS_LEGACY_IMAGES') && defined('_PS_CREATION_DATE_') && strtotime(_PS_CREATION_DATE_) > strtotime('2013-03-26')) ? false : true;
$this->fields_options = array(
'images' => array(
@@ -62,7 +62,7 @@ class AdminImagesControllerCore extends AdminController
'top' => '',
'bottom' => '',
'description' => $this->l('JPEG images have a small file size and standard quality. PNG images have a larger file size, a higher quality and support transparency. Note that in all cases the image files will have the .jpg extension.').'
-
'.$this->l('WARNING: This feature may not be compatible with your theme, or with some of your modules. In particular, PNG mode is not compatible with the Watermark module. If you encounter any issues, turn it off by selecting "Use JPEG".'),
+
'.$this->l('WARNING: This feature may not be compatible with your theme, or with some of your modules. In particular, PNG mode is not compatible with the Watermark module. If you encounter any issues, turn it off by selecting "Use JPEG".'),
'fields' => array(
'PS_IMAGE_QUALITY' => array(
'title' => $this->l('Image quality'),
diff --git a/controllers/admin/AdminLanguagesController.php b/controllers/admin/AdminLanguagesController.php
index 1db3d4eeb..916942623 100644
--- a/controllers/admin/AdminLanguagesController.php
+++ b/controllers/admin/AdminLanguagesController.php
@@ -489,7 +489,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::getValue('iso_lang')))
+ 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);
if ($lang_packs !== '' && $result && !isset($result->error))
diff --git a/controllers/admin/AdminManufacturersController.php b/controllers/admin/AdminManufacturersController.php
index 80d6fc516..550179b1d 100644
--- a/controllers/admin/AdminManufacturersController.php
+++ b/controllers/admin/AdminManufacturersController.php
@@ -440,6 +440,7 @@ class AdminManufacturersControllerCore extends AdminController
'type' => 'text',
'label' => $this->l('Zip Code/Postal Code'),
'name' => 'postcode',
+ 'required' => true,
'size' => 33,
'required' => false,
);
diff --git a/controllers/admin/AdminMetaController.php b/controllers/admin/AdminMetaController.php
index 6a08f8bc7..5b87d9d6d 100644
--- a/controllers/admin/AdminMetaController.php
+++ b/controllers/admin/AdminMetaController.php
@@ -529,6 +529,7 @@ class AdminMetaControllerCore extends AdminController
{
$this->url->domain = $value;
$this->url->update();
+ Configuration::updateGlobalValue('PS_SHOP_DOMAIN', $value);
}
else
$this->errors[] = Tools::displayError('This domain is not valid.');
@@ -546,6 +547,7 @@ class AdminMetaControllerCore extends AdminController
{
$this->url->domain_ssl = $value;
$this->url->update();
+ Configuration::updateGlobalValue('PS_SHOP_DOMAIN_SSL', $value);
}
else
$this->errors[] = Tools::displayError('The SSL domain is not valid.');
diff --git a/controllers/admin/AdminNotFoundController.php b/controllers/admin/AdminNotFoundController.php
index 00344cd61..d26e92827 100644
--- a/controllers/admin/AdminNotFoundController.php
+++ b/controllers/admin/AdminNotFoundController.php
@@ -39,8 +39,7 @@ class AdminNotFoundControllerCore extends AdminController
public function initContent()
{
$this->errors[] = Tools::displayError('Controller not found');
- $tpl_vars['controller'] = Tools::getvalue('controller');
-
+ $tpl_vars['controller'] = Tools::getvalue('controllerUri', Tools::getvalue('controller'));
$this->context->smarty->assign($tpl_vars);
parent::initContent();
}
diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php
index 6da191cd1..d9704a34d 100755
--- a/controllers/admin/AdminOrdersController.php
+++ b/controllers/admin/AdminOrdersController.php
@@ -266,10 +266,9 @@ class AdminOrdersControllerCore extends AdminController
$order = new Order(Tools::getValue('id_order'));
if (!Validate::isLoadedObject($order))
throw new PrestaShopException('Can\'t load Order object');
+ ShopUrl::cacheMainDomainForShop((int)$order->id_shop);
}
- ShopUrl::cacheMainDomainForShop((int)$order->id_shop);
-
/* Update shipping number */
if (Tools::isSubmit('submitShippingNumber') && isset($order))
{
@@ -1971,8 +1970,8 @@ class AdminOrdersControllerCore extends AdminController
{
$res = true;
- $order_detail = new OrderDetail(Tools::getValue('id_order_detail'));
- $order = new Order(Tools::getValue('id_order'));
+ $order_detail = new OrderDetail((int)Tools::getValue('id_order_detail'));
+ $order = new Order((int)Tools::getValue('id_order'));
$this->doDeleteProductLineValidation($order_detail, $order);
@@ -1995,6 +1994,9 @@ class AdminOrdersControllerCore extends AdminController
$order->total_products_wt -= $order_detail->total_price_tax_incl;
$res &= $order->update();
+
+ // Reinject quantity in stock
+ $this->reinjectQuantity($order_detail, $order_detail->product_quantity);
// Delete OrderDetail
$res &= $order_detail->delete();
diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php
index f87a2bfc7..ccef97b8f 100644
--- a/controllers/admin/AdminProductsController.php
+++ b/controllers/admin/AdminProductsController.php
@@ -373,7 +373,7 @@ class AdminProductsControllerCore extends AdminController
$default_product = new Product((int)$this->object->id, false, null, (int)$this->object->id_shop_default);
$def = ObjectModel::getDefinition($this->object);
foreach ($def['fields'] as $field_name => $row)
- $this->object->$field_name = $default_product->$field_name;
+ $this->object->$field_name = ObjectModel::formatValue($default_product->$field_name, $def['fields'][$field_name]['type']);
}
$this->object->loadStockData();
}
@@ -914,7 +914,9 @@ class AdminProductsControllerCore extends AdminController
$tos = Tools::getValue('spm_to');
foreach ($id_specific_prices as $key => $id_specific_price)
- if ($this->_validateSpecificPrice($id_shops[$key], $id_currencies[$key], $id_countries[$key], $id_groups[$key], $id_customers[$key], $prices[$key], $from_quantities[$key], $reductions[$key], $reduction_types[$key], $froms[$key], $tos[$key], $id_combinations[$key]))
+ if ($reduction_types[$key] == 'percentage' && ((float)$reductions[$key] <= 0 || (float)$reductions[$key] > 100))
+ $this->errors[] = Tools::displayError('Submitted reduction value (0-100) is out-of-range');
+ elseif ($this->_validateSpecificPrice($id_shops[$key], $id_currencies[$key], $id_countries[$key], $id_groups[$key], $id_customers[$key], $prices[$key], $from_quantities[$key], $reductions[$key], $reduction_types[$key], $froms[$key], $tos[$key], $id_combinations[$key]))
{
$specific_price = new SpecificPrice((int)($id_specific_price));
$specific_price->id_shop = (int)$id_shops[$key];
@@ -930,7 +932,7 @@ class AdminProductsControllerCore extends AdminController
$specific_price->from = !$froms[$key] ? '0000-00-00 00:00:00' : $froms[$key];
$specific_price->to = !$tos[$key] ? '0000-00-00 00:00:00' : $tos[$key];
if (!$specific_price->update())
- $this->errors = Tools::displayError('An error occurred while updating the specific price.');
+ $this->errors[] = Tools::displayError('An error occurred while updating the specific price.');
}
if (!count($this->errors))
$this->redirect_after = self::$currentIndex.'&id_product='.(int)(Tools::getValue('id_product')).(Tools::getIsset('id_category') ? '&id_category='.(int)Tools::getValue('id_category') : '').'&update'.$this->table.'&action=Prices&token='.$this->token;
@@ -960,7 +962,10 @@ class AdminProductsControllerCore extends AdminController
$to = Tools::getValue('sp_to');
if (!$to)
$to = '0000-00-00 00:00:00';
- if ($this->_validateSpecificPrice($id_shop, $id_currency, $id_country, $id_group, $id_customer, $price, $from_quantity, $reduction, $reduction_type, $from, $to, $id_product_attribute))
+
+ if ($reduction_type == 'percentage' && ((float)$reduction <= 0 || (float)$reduction > 100))
+ $this->errors[] = Tools::displayError('Submitted reduction value (0-100) is out-of-range');
+ elseif ($this->_validateSpecificPrice($id_shop, $id_currency, $id_country, $id_group, $id_customer, $price, $from_quantity, $reduction, $reduction_type, $from, $to, $id_product_attribute))
{
$specificPrice = new SpecificPrice();
$specificPrice->id_product = (int)$id_product;
@@ -977,7 +982,7 @@ class AdminProductsControllerCore extends AdminController
$specificPrice->from = $from;
$specificPrice->to = $to;
if (!$specificPrice->add())
- $this->errors = Tools::displayError('An error occurred while updating the specific price.');
+ $this->errors[] = Tools::displayError('An error occurred while updating the specific price.');
}
}
@@ -1797,6 +1802,29 @@ class AdminProductsControllerCore extends AdminController
if (Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_SHOP)
$object->setFieldsToUpdate((array)Tools::getValue('multishop_check'));
+ // Duplicate combinations if not associated to shop
+ if ($this->context->shop->getContext() == Shop::CONTEXT_SHOP && !$object->isAssociatedToShop())
+ {
+ $is_associated_to_shop = false;
+ $combinations = Product::getProductAttributesIds($object->id);
+ if ($combinations)
+ {
+ foreach ($combinations as $id_combination)
+ {
+ $combination = new Combination((int)$id_combination['id_product_attribute']);
+ $default_combination = new Combination((int)$id_combination['id_product_attribute'], null, (int)$this->object->id_shop_default);
+
+ $def = ObjectModel::getDefinition($default_combination);
+ foreach ($def['fields'] as $field_name => $row)
+ $combination->$field_name = ObjectModel::formatValue($default_combination->$field_name, $def['fields'][$field_name]['type']);
+
+ $combination->save();
+ }
+ }
+ }
+ else
+ $is_associated_to_shop = true;
+
if ($object->update())
{
if (in_array($this->context->shop->getContext(), array(Shop::CONTEXT_SHOP, Shop::CONTEXT_ALL)))
@@ -1887,7 +1915,15 @@ class AdminProductsControllerCore extends AdminController
$this->display = 'edit';
}
else
+ {
+ if (!$is_associated_to_shop && $combinations)
+ foreach ($combinations as $id_combination)
+ {
+ $combination = new Combination((int)$id_combination['id_product_attribute']);
+ $combination->delete();
+ }
$this->errors[] = Tools::displayError('An error occurred while updating an object.').' '.$this->table.' ('.Db::getInstance()->getMsgError().')';
+ }
}
else
$this->errors[] = Tools::displayError('An error occurred while updating an object.').' '.$this->table.' ('.Tools::displayError('The object cannot be loaded. ').')';
diff --git a/controllers/admin/AdminReturnController.php b/controllers/admin/AdminReturnController.php
index fe51775f9..39866ea4b 100644
--- a/controllers/admin/AdminReturnController.php
+++ b/controllers/admin/AdminReturnController.php
@@ -136,7 +136,7 @@ class AdminReturnControllerCore extends AdminController
$this->tpl_form_vars = array(
'customer' => new Customer($this->object->id_customer),
'url_customer' => 'index.php?tab=AdminCustomers&id_customer='.(int)$this->object->id_customer.'&viewcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$this->context->employee->id),
- 'text_order' => sprintf($this->l('Order #%1$d from %2$s'), $order->id, Tools::displayDate($order->date_upd, $order->id_lang)),
+ 'text_order' => sprintf($this->l('Order #%1$d from %2$s'), $order->id, Tools::displayDate($order->date_upd)),
'url_order' => 'index.php?tab=AdminOrders&id_order='.(int)$order->id.'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)Tab::getIdFromClassName('AdminOrders').(int)$this->context->employee->id),
'picture_folder' => _THEME_PROD_PIC_DIR_,
'type_file' => Product::CUSTOMIZE_FILE,
diff --git a/controllers/admin/AdminSupplyOrdersController.php b/controllers/admin/AdminSupplyOrdersController.php
index 7980fb48f..25d98a664 100644
--- a/controllers/admin/AdminSupplyOrdersController.php
+++ b/controllers/admin/AdminSupplyOrdersController.php
@@ -1877,9 +1877,9 @@ class AdminSupplyOrdersControllerCore extends AdminController
'supply_order_warehouse' => (Validate::isLoadedObject($warehouse) ? $warehouse->name : ''),
'supply_order_reference' => $supply_order->reference,
'supply_order_supplier_name' => $supply_order->supplier_name,
- 'supply_order_creation_date' => Tools::displayDate($supply_order->date_add, $lang_id, false),
- 'supply_order_last_update' => Tools::displayDate($supply_order->date_upd, $lang_id, false),
- 'supply_order_expected' => Tools::displayDate($supply_order->date_delivery_expected, $lang_id, false),
+ 'supply_order_creation_date' => Tools::displayDate($supply_order->date_add,null , false),
+ 'supply_order_last_update' => Tools::displayDate($supply_order->date_upd,null , false),
+ 'supply_order_expected' => Tools::displayDate($supply_order->date_delivery_expected,null , false),
'supply_order_discount_rate' => Tools::ps_round($supply_order->discount_rate, 2),
'supply_order_total_te' => Tools::displayPrice($supply_order->total_te, $currency),
'supply_order_discount_value_te' => Tools::displayPrice($supply_order->discount_value_te, $currency),
diff --git a/controllers/admin/AdminTrackingController.php b/controllers/admin/AdminTrackingController.php
index 2ccb0c6ab..4510d998c 100644
--- a/controllers/admin/AdminTrackingController.php
+++ b/controllers/admin/AdminTrackingController.php
@@ -52,6 +52,9 @@ class AdminTrackingControllerCore extends AdminController
public function initContent()
{
+ if ($id_category = Tools::getValue('id_category') && Tools::getIsset('viewcategory'))
+ Tools::redirectAdmin($this->context->link->getAdminLink('AdminProducts').'&id_category='.(int)$id_category.'&viewcategory');
+
$this->_helper_list = new HelperList();
if (!Configuration::get('PS_STOCK_MANAGEMENT'))
@@ -151,8 +154,6 @@ class AdminTrackingControllerCore extends AdminController
$this->tpl_list_vars = array('sub_title' => $this->l('List of products with attributes but without available quantities for sale:'));
-
-
return $this->renderList();
}
diff --git a/controllers/admin/AdminTranslationsController.php b/controllers/admin/AdminTranslationsController.php
index 7c4d18ce9..eaa19d4a1 100644
--- a/controllers/admin/AdminTranslationsController.php
+++ b/controllers/admin/AdminTranslationsController.php
@@ -720,7 +720,7 @@ class AdminTranslationsControllerCore extends AdminController
if (Validate::isLangIsoCode($arr_import_lang[0]))
{
if ($content = Tools::file_get_contents(
- 'http://www.prestashop.com/download/lang_packs/gzip/'.$arr_import_lang[1].'/'.$arr_import_lang[0].'.gzip', false,
+ 'http://www.prestashop.com/download/lang_packs/gzip/'.$arr_import_lang[1].'/'.Tools::strtolower($arr_import_lang[0]).'.gzip', false,
@stream_context_create(array('http' => array('method' => 'GET', 'timeout' => 5)))))
{
$file = _PS_TRANSLATIONS_DIR_.$arr_import_lang[0].'.gzip';
@@ -815,7 +815,7 @@ class AdminTranslationsControllerCore extends AdminController
$type_file = substr($file, -4) == '.tpl' ? 'tpl' : 'php';
// Parse this content
- $matches = $this->userParseFile($content, $this->type_selected, $type_file);
+ $matches = $this->userParseFile($content, $this->type_selected, $type_file, $module_name);
// Write each translation on its module file
$template_name = substr(basename($file), 0, -4);
@@ -858,7 +858,7 @@ class AdminTranslationsControllerCore extends AdminController
public function clearModuleFiles($files, $type_clear = 'file', $path = '')
{
// List of directory which not must be parsed
- $arr_exclude = array('img', 'js', 'mails');
+ $arr_exclude = array('img', 'js', 'mails','override');
// List of good extention files
$arr_good_ext = array('.tpl', '.php');
@@ -914,7 +914,7 @@ class AdminTranslationsControllerCore extends AdminController
$type_file = substr($file, -4) == '.tpl' ? 'tpl' : 'php';
// Parse this content
- $matches = $this->userParseFile($content, $this->type_selected, $type_file);
+ $matches = $this->userParseFile($content, $this->type_selected, $type_file, $module_name);
// Write each translation on its module file
$template_name = substr(basename($file), 0, -4);
@@ -1057,9 +1057,10 @@ class AdminTranslationsControllerCore extends AdminController
* @param $content
* @param $type_translation : front, back, errors, modules...
* @param string|bool $type_file : (tpl|php)
+ * @param string $module_name : name of the module
* @return return $matches
*/
- protected function userParseFile($content, $type_translation, $type_file = false)
+ protected function userParseFile($content, $type_translation, $type_file = false, $module_name = '')
{
switch ($type_translation)
{
@@ -1088,7 +1089,8 @@ class AdminTranslationsControllerCore extends AdminController
if ($type_file == 'php')
$regex = '/->l\(\''._PS_TRANS_PATTERN_.'\'(, ?\'(.+)\')?(, ?(.+))?\)/U';
else
- $regex = '/\{l\s*s=[\'\"]'._PS_TRANS_PATTERN_.'[\'\"](\s*sprintf=.*)?(\s*mod=\'.+\')?(\s*js=1)?\s*\}/U';
+ // In tpl file look for something that should contain mod='module_name' according to the documentation
+ $regex = '/\{l\s*s=[\'\"]'._PS_TRANS_PATTERN_.'[\'\"].*\s+mod=\''.$module_name.'\'.*\}/U';
break;
case 'pdf':
diff --git a/controllers/admin/AdminWarehousesController.php b/controllers/admin/AdminWarehousesController.php
index 8628f1f52..dc4d2d1ec 100644
--- a/controllers/admin/AdminWarehousesController.php
+++ b/controllers/admin/AdminWarehousesController.php
@@ -424,7 +424,7 @@ class AdminWarehousesControllerCore extends AdminController
$address = new Address($object->id_address);
if (Validate::isLoadedObject($address))
{
- $address->id_warehouse = $object->id_address;
+ $address->id_warehouse = (int)$object->id;
$address->save();
}
diff --git a/controllers/front/AddressController.php b/controllers/front/AddressController.php
index 0d5a399c3..699a37287 100644
--- a/controllers/front/AddressController.php
+++ b/controllers/front/AddressController.php
@@ -138,7 +138,7 @@ class AddressControllerCore extends FrontController
$this->errors[] = Tools::displayError('This country requires you to chose a State.');
// US customer: normalize the address
- if ($address->id_country == Country::getByIso('US'))
+ if ($address->id_country == Country::getByIso('US') && Configuration::get('PS_TAASC'))
{
include_once(_PS_TAASC_PATH_.'AddressStandardizationSolution.php');
$normalize = new AddressStandardizationSolution;
diff --git a/controllers/front/AttachmentController.php b/controllers/front/AttachmentController.php
index 47fd32c08..3c5daedda 100644
--- a/controllers/front/AttachmentController.php
+++ b/controllers/front/AttachmentController.php
@@ -32,6 +32,9 @@ class AttachmentControllerCore extends FrontController
if (!$a->id)
Tools::redirect('index.php');
+ if (ob_get_level())
+ ob_end_clean();
+
header('Content-Transfer-Encoding: binary');
header('Content-Type: '.$a->mime);
header('Content-Length: '.filesize(_PS_DOWNLOAD_DIR_.$a->file));
diff --git a/controllers/front/AuthController.php b/controllers/front/AuthController.php
index f5b8563b4..745cca405 100644
--- a/controllers/front/AuthController.php
+++ b/controllers/front/AuthController.php
@@ -139,6 +139,9 @@ class AuthControllerCore extends FrontController
'HOOK_CREATE_ACCOUNT_TOP' => Hook::exec('displayCustomerAccountFormTop')
));
+ // Just set $this->template value here in case it's used by Ajax
+ $this->setTemplate(_PS_THEME_DIR_.'authentication.tpl');
+
if ($this->ajax)
{
// Call a hook to display more information on form
@@ -150,12 +153,11 @@ class AuthControllerCore extends FrontController
$return = array(
'hasError' => !empty($this->errors),
'errors' => $this->errors,
- 'page' => $this->context->smarty->fetch(_PS_THEME_DIR_.'authentication.tpl'),
+ 'page' => $this->context->smarty->fetch($this->template),
'token' => Tools::getToken(false)
);
die(Tools::jsonEncode($return));
}
- $this->setTemplate(_PS_THEME_DIR_.'authentication.tpl');
}
/**
@@ -472,7 +474,7 @@ class AuthControllerCore extends FrontController
Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? url_encode($this->authRedirection) : 'my-account'));
}
else
- $this->errors[] = Tools::displayError('An error occurred while creating your account..');
+ $this->errors[] = Tools::displayError('An error occurred while creating your account.');
}
}
@@ -487,7 +489,7 @@ class AuthControllerCore extends FrontController
$this->errors = array_unique(array_merge($this->errors, $address->validateController()));
// US customer: normalize the address
- if ($address->id_country == Country::getByIso('US'))
+ if ($address->id_country == Country::getByIso('US') && Configuration::get('PS_TAASC'))
{
include_once(_PS_TAASC_PATH_.'AddressStandardizationSolution.php');
$normalize = new AddressStandardizationSolution;
@@ -545,7 +547,7 @@ class AuthControllerCore extends FrontController
else
$customer->is_guest = 0;
if (!$customer->add())
- $this->errors[] = Tools::displayError('An error occurred while creating your account..');
+ $this->errors[] = Tools::displayError('An error occurred while creating your account.');
else
{
$address->id_customer = (int)$customer->id;
@@ -688,6 +690,9 @@ class AuthControllerCore extends FrontController
*/
protected function sendConfirmationMail(Customer $customer)
{
+ if (!Configuration::get('PS_CUSTOMER_CREATION_EMAIL'))
+ return true;
+
return Mail::Send(
$this->context->language->id,
'account',
diff --git a/controllers/front/CartController.php b/controllers/front/CartController.php
index a29dcbf39..828238c7c 100644
--- a/controllers/front/CartController.php
+++ b/controllers/front/CartController.php
@@ -335,7 +335,8 @@ class CartControllerCore extends FrontController
if ($result['customizedDatas'])
Product::addCustomizationPrice($result['summary']['products'], $result['customizedDatas']);
- die(Tools::jsonEncode($result));
+ Hook::exec('actionCartListOverride', array('summary' => $result, 'json' => &$json));
+ die(Tools::jsonEncode(array_merge($result, (array)Tools::jsonDecode($json, true))));
}
// @todo create a hook
elseif (file_exists(_PS_MODULE_DIR_.'/blockcart/blockcart-ajax.php'))
diff --git a/controllers/front/ContactController.php b/controllers/front/ContactController.php
index 598258a8d..8098ad0ee 100644
--- a/controllers/front/ContactController.php
+++ b/controllers/front/ContactController.php
@@ -281,7 +281,7 @@ class ContactControllerCore extends FrontController
$tmp = $order->getProducts();
foreach ($tmp as $key => $val)
$products[$row['id_order']][$val['product_id']] = array('value' => $val['product_id'], 'label' => $val['product_name']);
- $orders[] = array('value' => $order->id, 'label' => $order->getUniqReference().' - '.Tools::displayDate($date[0], $this->context->language->id), 'selected' => (int)Tools::getValue('id_order') == $order->id);
+ $orders[] = array('value' => $order->id, 'label' => $order->getUniqReference().' - '.Tools::displayDate($date[0],null) , 'selected' => (int)Tools::getValue('id_order') == $order->id);
}
$this->context->smarty->assign('orderList', $orders);
diff --git a/controllers/front/GetFileController.php b/controllers/front/GetFileController.php
index 44dcd8fbe..f39990b4d 100644
--- a/controllers/front/GetFileController.php
+++ b/controllers/front/GetFileController.php
@@ -270,12 +270,14 @@ class GetFileControllerCore extends FrontController
$mimeType = 'application/octet-stream';
}
+ if (ob_get_level())
+ ob_end_clean();
+
/* Set headers for download */
header('Content-Transfer-Encoding: binary');
header('Content-Type: '.$mimeType);
header('Content-Length: '.filesize($file));
header('Content-Disposition: attachment; filename="'.$filename.'"');
- ob_end_flush();
$fp = fopen($file, 'rb');
while (!feof($fp))
echo fgets($fp, 16384);
diff --git a/controllers/front/NewProductsController.php b/controllers/front/NewProductsController.php
index 7cf283eba..a438c4826 100644
--- a/controllers/front/NewProductsController.php
+++ b/controllers/front/NewProductsController.php
@@ -47,6 +47,13 @@ class NewProductsControllerCore extends FrontController
$this->productSort();
+ // Override default configuration values: cause the new products page must display latest products first.
+ if (!Tools::getIsset('orderway') || !Tools::getIsset('orderby'))
+ {
+ $this->orderBy = 'date_add';
+ $this->orderWay = 'DESC';
+ }
+
$nbProducts = (int)Product::getNewProducts(
$this->context->language->id,
(isset($this->p) ? (int)($this->p) - 1 : null),
diff --git a/controllers/front/ParentOrderController.php b/controllers/front/ParentOrderController.php
index b5f5fdc1d..65e287e5d 100644
--- a/controllers/front/ParentOrderController.php
+++ b/controllers/front/ParentOrderController.php
@@ -399,10 +399,11 @@ class ParentOrderControllerCore extends FrontController
// Getting a list of formated address fields with associated values
$formatedAddressFieldsValuesList = array();
- foreach ($customerAddresses as $address)
+ foreach ($customerAddresses as $i => $address)
{
+ if (!Address::isCountryActiveById((int)($address['id_address'])))
+ unset($customerAddresses[$i]);
$tmpAddress = new Address($address['id_address']);
-
$formatedAddressFieldsValuesList[$address['id_address']]['ordered_fields'] = AddressFormat::getOrderedAddressFields($address['id_country']);
$formatedAddressFieldsValuesList[$address['id_address']]['formated_fields_values'] = AddressFormat::getFormattedAddressFieldsValues(
$tmpAddress,
@@ -459,6 +460,8 @@ class ParentOrderControllerCore extends FrontController
{
$address = new Address($this->context->cart->id_address_delivery);
$id_zone = Address::getZoneById($address->id);
+ if (!Address::isCountryActiveById((int)($this->context->cart->id_address_delivery)) || !Address::isCountryActiveById((int)($this->context->cart->id_address_invoice)))
+ Tools::redirect('index.php?controller=order&step=1');
$carriers = $this->context->cart->simulateCarriersOutput();
$checked = $this->context->cart->simulateCarrierSelectedOutput();
$delivery_option_list = $this->context->cart->getDeliveryOptionList();
diff --git a/controllers/front/StatisticsController.php b/controllers/front/StatisticsController.php
index b583d284c..e3b9c5c83 100644
--- a/controllers/front/StatisticsController.php
+++ b/controllers/front/StatisticsController.php
@@ -54,17 +54,17 @@ class StatisticsControllerCore extends FrontController
if (sha1($id_guest._COOKIE_KEY_) != $this->param_token)
die;
- $guest = new Guest($id_guest);
+ $guest = new Guest((int)substr($_POST['id_guest'],0,10));
$guest->javascript = true;
- $guest->screen_resolution_x = (int)Tools::getValue('screen_resolution_x');
- $guest->screen_resolution_y = (int)Tools::getValue('screen_resolution_y');
- $guest->screen_color = (int)Tools::getValue('screen_color');
- $guest->sun_java = (int)Tools::getValue('sun_java');
- $guest->adobe_flash = (int)Tools::getValue('adobe_flash');
- $guest->adobe_director = (int)Tools::getValue('adobe_director');
- $guest->apple_quicktime = (int)Tools::getValue('apple_quicktime');
- $guest->real_player = (int)Tools::getValue('real_player');
- $guest->windows_media = (int)Tools::getValue('windows_media');
+ $guest->screen_resolution_x = (int)substr($_POST['screen_resolution_x'],0,5);
+ $guest->screen_resolution_y = (int)substr($_POST['screen_resolution_y'],0,5);
+ $guest->screen_color = (int)substr($_POST['screen_color'],0,3);
+ $guest->sun_java = (int)substr($_POST['sun_java'],0,1);
+ $guest->adobe_flash = (int)substr($_POST['adobe_flash'],0,1);
+ $guest->adobe_director = (int)substr($_POST['adobe_director'],0,1);
+ $guest->apple_quicktime = (int)substr($_POST['apple_quicktime'],0,1);
+ $guest->real_player = (int)substr($_POST['real_player'],0,1);
+ $guest->windows_media = (int)substr($_POST['windows_media'],0,1);
$guest->update();
}
diff --git a/css/admin.css b/css/admin.css
index ec73d1414..f5201ec60 100644
--- a/css/admin.css
+++ b/css/admin.css
@@ -509,7 +509,7 @@ select optgroup option {
background: #DFF2BF url(../img/admin/icon-valid.png) no-repeat scroll 6px 6px;
border: 1px solid #4F8A10;
color:#4F8A10;
- padding:20px;
+ padding:20px 40px;
position:fixed;
bottom:0;
width:100%;
diff --git a/install-dev/classes/controllerHttp.php b/install-dev/classes/controllerHttp.php
index 8063ab9af..33c6f9d97 100644
--- a/install-dev/classes/controllerHttp.php
+++ b/install-dev/classes/controllerHttp.php
@@ -29,7 +29,7 @@ abstract class InstallControllerHttp
/**
* @var array List of installer steps
*/
- protected static $steps = array('welcome', 'license', 'system', 'database', 'configure', 'process');
+ protected static $steps = array('welcome', 'license', 'system', 'configure', 'database', 'process');
protected static $instances = array();
diff --git a/install-dev/classes/datas.php b/install-dev/classes/datas.php
index 964d737cf..feba9c196 100644
--- a/install-dev/classes/datas.php
+++ b/install-dev/classes/datas.php
@@ -133,6 +133,11 @@ class Datas
'default' => 1,
'help' => 'get news from PrestaShop',
),
+ 'send_email' => array(
+ 'name' => 'send_email',
+ 'default' => 1,
+ 'help' => 'send an email to the administrator after installation',
+ ),
);
protected $datas = array();
@@ -200,4 +205,4 @@ class Datas
return count($errors) ? $errors : true;
}
-}
+}
\ No newline at end of file
diff --git a/install-dev/classes/session.php b/install-dev/classes/session.php
index 27a0506c6..1bc8fa4d2 100644
--- a/install-dev/classes/session.php
+++ b/install-dev/classes/session.php
@@ -30,6 +30,8 @@
class InstallSession
{
protected static $_instance;
+ protected static $_cookie_mode = false;
+ protected static $_cookie = false;
public static function getInstance()
{
@@ -41,39 +43,71 @@ class InstallSession
public function __construct()
{
session_name('install_'.md5(__PS_BASE_URI__));
- session_start();
+ if (!session_start() || (!isset($_SESSION['session_mode']) && (count($_POST) || count($_GET))))
+ {
+ InstallSession::$_cookie_mode = true;
+ InstallSession::$_cookie = new Cookie('ps_install', null, time() + 7200, null, true);
+ }
+ $_SESSION['session_mode'] = 'session';
}
public function clean()
{
- foreach ($_SESSION as $k => $v)
- unset($_SESSION[$k]);
+ if (InstallSession::$_cookie_mode)
+ InstallSession::$_cookie->logout();
+ else
+ foreach ($_SESSION as $k => $v)
+ unset($_SESSION[$k]);
}
public function &__get($varname)
{
- if (isset($_SESSION[$varname]))
- $ref = &$_SESSION[$varname];
+ if (InstallSession::$_cookie_mode)
+ {
+ $ref = InstallSession::$_cookie->{$varname};
+ if (0 === strncmp($ref, 'serialized_array:', strlen('serialized_array:')))
+ $ref = unserialize(substr($ref, strlen('serialized_array:')));
+ }
else
{
- $null = null;
- $ref = &$null;
+ if (isset($_SESSION[$varname]))
+ $ref = &$_SESSION[$varname];
+ else
+ {
+ $null = null;
+ $ref = &$null;
+ }
}
return $ref;
}
public function __set($varname, $value)
{
- $_SESSION[$varname] = $value;
+ if (InstallSession::$_cookie_mode)
+ {
+ if ($varname == 'xml_loader_ids')
+ return;
+ if (is_array($value))
+ $value = 'serialized_array:'.serialize($value);
+ InstallSession::$_cookie->{$varname} = $value;
+ }
+ else
+ $_SESSION[$varname] = $value;
}
public function __isset($varname)
{
- return isset($_SESSION[$varname]);
+ if (InstallSession::$_cookie_mode)
+ return isset(InstallSession::$_cookie->{$varname});
+ else
+ return isset($_SESSION[$varname]);
}
public function __unset($varname)
{
- unset($_SESSION[$varname]);
+ if (InstallSession::$_cookie_mode)
+ unset(InstallSession::$_cookie->{$varname});
+ else
+ unset($_SESSION[$varname]);
}
}
diff --git a/install-dev/classes/xmlLoader.php b/install-dev/classes/xmlLoader.php
index 2b6daad41..b2c86ddc3 100644
--- a/install-dev/classes/xmlLoader.php
+++ b/install-dev/classes/xmlLoader.php
@@ -224,10 +224,13 @@ class InstallXmlLoader
return;
}
+ if (substr($entity, 0, 1) == '.' || substr($entity, 0, 1) == '_')
+ return;
+
$xml = $this->loadEntity($entity);
// Read list of fields
- if (!$xml->fields)
+ if (!is_object($xml) || !$xml->fields)
throw new PrestashopInstallerException('List of fields not found for entity '.$entity);
if ($this->isMultilang($entity))
diff --git a/install-dev/controllers/console/process.php b/install-dev/controllers/console/process.php
index 4b3923dda..4fc78079b 100644
--- a/install-dev/controllers/console/process.php
+++ b/install-dev/controllers/console/process.php
@@ -110,8 +110,9 @@ class InstallControllerConsoleProcess extends InstallControllerConsole
$this->printErrors();
if (!$this->processInstallTheme())
$this->printErrors();
- if (!$this->processSendEmail())
- $this->printErrors();
+ if ($this->datas->send_email)
+ if (!$this->processSendEmail())
+ $this->printErrors();
if ($this->datas->newsletter)
{
@@ -287,5 +288,4 @@ class InstallControllerConsoleProcess extends InstallControllerConsole
{
return $this->model_install->installModulesAddons();
}
-}
-
+}
\ No newline at end of file
diff --git a/install-dev/controllers/http/process.php b/install-dev/controllers/http/process.php
index f9d98996f..38d497ce2 100644
--- a/install-dev/controllers/http/process.php
+++ b/install-dev/controllers/http/process.php
@@ -78,7 +78,7 @@ class InstallControllerHttpProcess extends InstallControllerHttp
public function process()
{
if (file_exists(_PS_ROOT_DIR_.'/'.self::SETTINGS_FILE))
- @require_once _PS_ROOT_DIR_.'/'.self::SETTINGS_FILE;
+ require_once _PS_ROOT_DIR_.'/'.self::SETTINGS_FILE;
if (!$this->session->process_validated)
$this->session->process_validated = array();
@@ -241,7 +241,7 @@ class InstallControllerHttpProcess extends InstallControllerHttp
public function processInstallAddonsModules()
{
$this->initializeContext();
- if ($module = Tools::getValue('module') && $id_module = Tools::getValue('id_module'))
+ if (($module = Tools::getValue('module')) && $id_module = Tools::getValue('id_module'))
$result = $this->model_install->installModulesAddons(array('name' => $module, 'id_module' => $id_module));
else
$result = $this->model_install->installModulesAddons();
diff --git a/install-dev/data/xml/configuration.xml b/install-dev/data/xml/configuration.xml
index 515f0762a..2494938f3 100644
--- a/install-dev/data/xml/configuration.xml
+++ b/install-dev/data/xml/configuration.xml
@@ -769,5 +769,8 @@ Country
1
+
+ 1
+
diff --git a/install-dev/langs/br/install.php b/install-dev/langs/br/install.php
index 104f2a514..e379bec88 100644
--- a/install-dev/langs/br/install.php
+++ b/install-dev/langs/br/install.php
@@ -2,7 +2,7 @@
return array(
'informations' => array(
'phone' => '+1 888.947.6543',
- 'support' => 'http://support.prestashop.com/en/',
+ 'support' => 'https://www.prestashop.com/pt/support',
),
'translations' => array(
'menu_welcome' => 'Escolha seu idioma',
diff --git a/install-dev/langs/de/install.php b/install-dev/langs/de/install.php
index fedcb2247..b09b8ac8b 100644
--- a/install-dev/langs/de/install.php
+++ b/install-dev/langs/de/install.php
@@ -2,6 +2,7 @@
return array(
'informations' => array(
'phone' => '+33 (0)1.40.18.30.04',
+ 'support' => 'https://www.prestashop.com/de/support',
),
'translations' => array(
'menu_welcome' => 'Sprachauswahl',
diff --git a/install-dev/langs/en/install.php b/install-dev/langs/en/install.php
index ee296298a..cd29befe8 100644
--- a/install-dev/langs/en/install.php
+++ b/install-dev/langs/en/install.php
@@ -6,7 +6,7 @@ return array(
'documentation_upgrade' => 'http://docs.prestashop.com/display/PS15/Updating+PrestaShop',
'forum' => 'http://www.prestashop.com/forums/',
'blog' => 'http://www.prestashop.com/blog/',
- 'support' => 'http://support.prestashop.com/en/',
+ 'support' => 'https://www.prestashop.com/en/support',
),
'translations' => array(
'menu_welcome' => 'Choose your language',
diff --git a/install-dev/langs/es/install.php b/install-dev/langs/es/install.php
index e9fb6d41c..78401e6cb 100644
--- a/install-dev/langs/es/install.php
+++ b/install-dev/langs/es/install.php
@@ -2,6 +2,7 @@
return array(
'informations' => array(
'phone' => '+1 (888) 947-6543',
+ 'support' => 'https://www.prestashop.com/es/support',
),
'translations' => array(
'menu_welcome' => 'Elegir el idioma',
diff --git a/install-dev/langs/fr/data/country.xml b/install-dev/langs/fr/data/country.xml
index 3a525918c..6fcb1fbae 100644
--- a/install-dev/langs/fr/data/country.xml
+++ b/install-dev/langs/fr/data/country.xml
@@ -76,7 +76,7 @@
Singapour
- Ireland
+ IrlandeNouvelle-Zélande
diff --git a/install-dev/langs/it/install.php b/install-dev/langs/it/install.php
index 77e6eb468..47bccfb0e 100644
--- a/install-dev/langs/it/install.php
+++ b/install-dev/langs/it/install.php
@@ -2,6 +2,7 @@
return array(
'informations' => array(
'phone' => '+33 (0)1.40.18.30.04',
+ 'support' => 'https://www.prestashop.com/it/support',
),
'translations' => array(
'menu_welcome' => 'Scelta della lingua',
diff --git a/install-dev/langs/pl/install.php b/install-dev/langs/pl/install.php
index d32708c8d..3197cf69b 100644
--- a/install-dev/langs/pl/install.php
+++ b/install-dev/langs/pl/install.php
@@ -1,5 +1,9 @@
array(
+ 'phone' => '+33 (0)1.40.18.30.04',
+ 'support' => 'https://www.prestashop.com/pl/wsparcie-techniczne',
+ ),
'translations' => array(
'An SQL error occured for entity %1$s: %2$s' => 'Wystąpił błąd SQL w rekordzie %1$s: %2$s',
'Cannot create image "%1$s" for entity "%2$s"' => 'Nie można utworzyć obrazu "%1$s" dla rekordu "%2$s"',
diff --git a/install-dev/langs/pl/language.xml b/install-dev/langs/pl/language.xml
index 39b5fd3da..c4fc47528 100644
--- a/install-dev/langs/pl/language.xml
+++ b/install-dev/langs/pl/language.xml
@@ -1,6 +1,6 @@
-
+ plm/j/Ym/j/Y H:i:s
diff --git a/install-dev/langs/ru/install.php b/install-dev/langs/ru/install.php
index eefaef775..063103cd6 100644
--- a/install-dev/langs/ru/install.php
+++ b/install-dev/langs/ru/install.php
@@ -1,5 +1,9 @@
array(
+ 'phone' => '+33 (0)1.40.18.30.04',
+ 'support' => 'https://www.prestashop.com/en/support',
+ ),
'translations' => array(
'An SQL error occured for entity %1$s: %2$s' => 'В SQL произошла ошибка для значения %1$s: %2$s',
'Cannot create image "%1$s" for entity "%2$s"' => 'Невозможно создать изображение "%1$s" для значения "%2$s"',
@@ -17,7 +21,7 @@ return array(
'The password is incorrect (alphanumeric string with at least 8 characters)' => 'Ваш пароль неверный (он должен состоять из букв и цифр и содержать минимум 8 символов)',
'Password and its confirmation are different' => 'В полях "пароль" и "подтверждение пароля" были введены разные значения',
'This e-mail address is invalid' => 'Неверный адрес электронной почты',
- 'Image folder %s is not writable' => 'Папка изображений %s не поддвется перезаписи',
+ 'Image folder %s is not writable' => 'Папка изображений %s не поддается перезаписи',
'An error occurred during logo copy.' => 'Во время копирования логотипа произошла ошибка.',
'An error occurred during logo upload.' => 'Во время загрузки логотипа произошла ошибка.',
'Lingerie and Adult' => 'Нижнее белье и товары для взрослых',
@@ -50,10 +54,10 @@ return array(
'Create database tables' => 'Таблицы для базы данных созданы',
'Create default shop and languages' => 'Магазин по умолчанию и язык по умолчанию созданы',
'Populate database tables' => 'Таблица для базы данных создана',
- 'Configure shop information' => 'Информация о магазине сконфигурирована',
- 'Install modules' => 'Модули установлены',
- 'Install demonstration data' => 'Установить демонстрационную версию',
- 'Install theme' => 'Установить тему',
+ 'Configure shop information' => 'Конфигурация магазина',
+ 'Install modules' => 'Установка модулей',
+ 'Install demonstration data' => 'Установка демонстрационной версии',
+ 'Install theme' => 'Установка темы',
'Send information e-mail' => 'Отправить информационное письмо',
'PHP parameters:' => 'Параметры PHP:',
'Is PHP 5.1.2 or later installed ?' => 'Используете PHP 5.1.2 или более старую версию?',
@@ -73,12 +77,12 @@ return array(
'You must enter a database name' => 'Введите название базы данных',
'You must enter a database login' => 'Введите пароль для базы данных',
'Tables prefix is invalid' => 'Неверный префикс базы данных',
- 'Wrong engine chosen for MySQL' => 'Для MySQL выбран неверный движок ',
+ 'Wrong engine chosen for MySQL' => 'Для MySQL выбрана неверная подсистема',
'Cannot convert database data to utf-8' => 'Невозможно конвертировать базу данных в utf-8',
'At least one table with same prefix was already found, please change your prefix or drop your database' => 'Найдена как минимум одна база данных с таким префиксом. Измените префикс или перенесите базу данных ',
- 'Database Server is not found. Please verify the login, password and server fields' => 'Сервер базы данных не найден. Проверьте, пожалуйста, что Вы правильно ввели логин, пароль и верно ли заполнили запрашиваемые поля',
+ 'Database Server is not found. Please verify the login, password and server fields' => 'Сервер базы данных не найден. Проверьте, пожалуйста, что Вы правильно ввели логин, пароль и верно ли заполнены запрашиваемые поля',
'Connection to MySQL server succeeded, but database "%s" not found' => 'Успешное подключение к серверу MySQL, но база данных "%s" не найдена',
- 'Engine innoDB is not supported by your MySQL server, please use MyISAM' => 'Движок innoDB не поддерживается Вашим сервером MySQL, используйте MyISAM',
+ 'Engine innoDB is not supported by your MySQL server, please use MyISAM' => 'Подсистема innoDB не поддерживается Вашим сервером MySQL, используйте MyISAM',
'%s file is not writable (check permissions)' => 'Файл %s не подлежит перезаписи (проверьте критерии допуска)',
'%s folder is not writable (check permissions)' => 'Папка %s не подлежит перезаписи (проверьте критерии допуска)',
'Cannot write settings file' => 'Невозможно перезаписать установочный файл',
@@ -115,7 +119,7 @@ return array(
'E-mail address:' => 'Адрес электронной почты:',
'Shop password:' => 'Пароль магазина:',
'Must be alphanumeric string with at least 8 characters' => 'Он должен состоять из букв и цифр и содержать минимум 8 знаков',
- 'Re-type to confirm:' => 'Подтверждите пароль:',
+ 'Re-type to confirm:' => 'Подтвердите пароль:',
'Receive this information by e-mail' => 'Получить данную информацию по электронной почте ',
'Warning: You will receive this information only if your e-mail configuration is correct.' => 'Внимание: Вы получите данное сообщение только в случае верной конфигурации Вашего электронного почтового ящика.',
'Configure your database by filling out the following fields:' => 'Заполните поля ниже для конфигурации Вашей базы данных:',
@@ -125,7 +129,7 @@ return array(
'Database name:' => 'Название базы данных:',
'Database login:' => 'Логин базы данных:',
'Database password:' => 'Пароль базы данных:',
- 'Database Engine:' => 'Движок для базы данных:',
+ 'Database Engine:' => 'Подсистема для базы данных:',
'Tables prefix:' => 'Префикс таблицы:',
'Drop existing tables (mode dev):' => 'Удалите существующие таблицы (режим dev):',
'Verify now!' => 'Проверьте прямо сейчас!',
@@ -146,22 +150,22 @@ return array(
'Official forum' => 'Официальный форум',
'Support' => 'Поддержка',
'Documentation' => 'Документация',
- 'Contact us!' => 'Свяжитесьс нами!',
+ 'Contact us!' => 'Свяжитесь с нами!',
'PrestaShop Wizard Installer' => 'PrestaShop Wizard Installer',
'Forum' => 'Форум',
'Blog' => 'Блог',
'menu_' => 'меню_',
'Done!' => 'Готово!',
'An error occured during installation...' => 'Во время установки была обнаружена ошибка...',
- 'You can use the links on the left column to go back to the previous steps, or restart the installation process by clicking here.' => 'Вы можете использовать ссылки левой колонки для перехода к предыдущим этапам или же оставаться в процессе установки , кликнув .',
+ 'You can use the links on the left column to go back to the previous steps, or restart the installation process by clicking here.' => 'Вы можете использовать ссылки левой колонки для перехода к предыдущим этапам или же снова начать установку , кликнув .',
'Your installation is finished!' => 'Процесс установки упешно завершен',
'You have just finished installing your shop. Thank you for using PrestaShop!' => 'Установка Вашего магазина успешно завершена. Спасибо, что Вы выбрали PrestaShop!',
- 'Please remember your login information:' => 'Запомните, пожалуйста, Ваши идентификационную информацию',
+ 'Please remember your login information:' => 'Запомните, пожалуйста, Ваши идентификационные данные',
'E-mail:' => 'E-mail:',
'Display' => 'Отображать',
'WARNING: For security purposes, you must delete the "install" folder.' => 'ВНИМАНИЕ: В мерах предосторожности рекомендуем удалить папку "install" ',
'Back Office' => 'Бэк-офис',
- 'Manage your store using your Back Office. Manage your orders and customers, add modules, change themes, etc.' => 'Управляйте магазином из Вашего бэк-офиса. Управляйте заказами и клиентами, добавляйте модули. меняйте темы и т.д.',
+ 'Manage your store using your Back Office. Manage your orders and customers, add modules, change themes, etc.' => 'Управляйте магазином из Вашего бэк-офиса. Управляйте заказами и клиентами, добавляйте модули, меняйте темы и т.д.',
'Manage your store' => 'Управляйте Вашим магазином',
'Front Office' => 'Фронт-офис',
'Discover your store as your future customers will see it!' => 'Просмотрите магазин таким, каким его увидят Ваши клиенты!',
@@ -183,7 +187,7 @@ return array(
'menu_license' => 'Лицензионное соглашение',
'PrestaShop core is released under the OSL 3.0 while PrestaShop modules and themes are released under the AFL 3.0.' => 'Ядро PrestaShop разработано на OSL 3.0, а модули и шаблоны PrestaShop разработаны на AFL 3.0.',
'I agree to the above terms and conditions.' => 'Я принимаю правила и условия.',
- 'I agree to participate in improving the solution by sending anonymous information about my configuration.' => 'Внесите свой вклад в улучшение программного обеспечения, отравив анонимное сообщене о Вашей конфгурации.',
+ 'I agree to participate in improving the solution by sending anonymous information about my configuration.' => 'Внесите свой вклад в улучшение программного обеспечения, отправив анонимное сообщение о Вашей конфигурации.',
'PHP 5.1.2 or later is not enabled' => 'PHP 5.1.2 или более поздняя версия не активирована',
'Cannot upload files' => 'Невозможно загрузить файлы',
'Cannot create new files and folders' => 'Невозможно создать новые файлы и папки',
@@ -193,7 +197,7 @@ return array(
'PHP register global option is on' => 'Опция "Общий регистр" для PHP активирована',
'GZIP compression is not activated' => 'Архиватор GZIP не активирован',
'Mcrypt extension is not enabled' => 'Расширение Mcrypt не активировано',
- 'Mbstring extension is not enabled' => 'РасширениеMbstring не активировано',
+ 'Mbstring extension is not enabled' => 'Расширение Mbstring не активировано',
'PHP magic quotes option is enabled' => 'Опция "Волшебные кавычки" для PHP активирована',
'Dom extension is not loaded' => 'Расширение Dom не установлено',
'PDO MySQL extension is not loaded' => 'Расширение PDO MySQL не установлено',
@@ -209,22 +213,23 @@ return array(
'Installation Assistant' => 'Помощник установки',
'License Agreements' => 'Лицензионное соглшение',
'Print my login information' => 'Распечатать информацию о моем аккаунте',
- 'To use PrestaShop, you must create a database to collect all of your store’s data-related activities.' => 'Для использования PrestaShop, Вам следует создать базу данных , чтобы сгруппровать информацию Вашего магазина.',
- 'Please complete the fields below in order for PrestaShop to connect to your database. ' => 'Заполните поля ниже, чтобы PrestaShop смог уствновить соединение с Вашей с базой данных ',
- 'The default port is 3306. To use a different port, add the port number at the end of your server’s address i.e ":4242".' => 'Порт по умолчанию: 3306. Если Вы используете другой порт, то введите номер порта в конце адреса Вашего сервера. пример: ":4242".',
+ 'To use PrestaShop, you must create a database to collect all of your store’s data-related activities.' => 'Для использования PrestaShop, Вам следует создать базу данных , чтобы сгруппировать информацию Вашего магазина.',
+ 'Please complete the fields below in order for PrestaShop to connect to your database. ' => 'Заполните поля ниже, чтобы PrestaShop смог установить соединение с Вашей с базой данных.',
+ 'The default port is 3306. To use a different port, add the port number at the end of your server’s address i.e ":4242".' => 'Порт по умолчанию: 3306. Если Вы используете другой порт, то введите номер порта в адрес Вашего сервера. пример: ":4242".',
'Continue the installation in:' => 'Продолжить установку:',
- 'The language selection above only applies to the Installation Assistant. Once your store is installed, you can choose the language of your store from over %d translations, all for free!' => 'Выбранный Вами язык применим только для Помощника установки. После установки магазина Вы можете выбрать любой язык бесплатно из %d переводов!',
+ 'The language selection above only applies to the Installation Assistant. Once your store is installed, you can choose the language of your store from over %d translations, all for free!' => 'Выбранный Вами язык применим только для Помощника установки. После установки магазина Вы можете выбрать любой из %d бесплатных переводов!',
'PrestaShop compatibility with your system environment has been verified!' => 'Полная совместимость PrestaShop проверена!',
'Oops! Please correct the item(s) below, and then click "Refresh information" to test the compatibility of your new system.' => 'Упс! Исправьте поле (я) выше и нажмите "Обновить информацию", чтобы проверить совместимость с Вашей новой системой.',
- 'PrestaShop can provide you with guidance on a regular basis by sending you tips on how to optimize the management of your store which will help you grow your business. If you do not wish to receive these tips, please uncheck this box.' => 'PrestaShop предоставит Вам поддержку, отправляя Вам уведомления о том как оптимизировать менеджмента Вашего магазина. Если Вы не хотите получать данные уведомления, то снимите этот флажок в данного поля. ',
+ 'PrestaShop can provide you with guidance on a regular basis by sending you tips on how to optimize the management of your store which will help you grow your business. If you do not wish to receive these tips, please uncheck this box.' => 'PrestaShop предоставит Вам поддержку, отправляя уведомления о том, как оптимизировать менеджмент Вашего магазина. Если Вы не хотите получать данные уведомления, то снимите флажок с данного поля. ',
'To enjoy the many features that are offered by PrestaShop, please read the license terms below. PrestaShop core is licensed under OSL 3.0, while the modules and themes are licensed under AFL 3.0.' => 'Чтобы использовать многочисленные свойства PrestaShop, прочитайте нижеприведенное лицензионное соглашение. Ядро PrestaShop лицензировано на OSL 3.0,модули и шаблоны - на AFL 3.0.',
'We are currently checking PrestaShop compatibility with your system environment' => 'Мы проверяем совместимость PrestaShop с Вашей системой',
- 'The installation of PrestaShop is quick and easy. In just a few moments, you will become part of a community consisting of more than 130,000 merchants. You are on the way to creating your own unique online store that you can manage easily every day.' => 'У PrestaShop простая и быстрая установка. Всего через несколько минут Вы станете членом сообщество, которое уже насчитывает около 130 000 членов. Вы уже сделали первый шаг для создании Вашего уникального магазина с простым управлением!',
+ 'The installation of PrestaShop is quick and easy. In just a few moments, you will become part of a community consisting of more than 130,000 merchants. You are on the way to creating your own unique online store that you can manage easily every day.' => 'У PrestaShop простая и быстрая установка. Всего через несколько минут Вы станете членом сообщества, которое уже насчитывает около 130 000 членов. Вы уже сделали первый шаг для создании Вашего уникального магазина с простым управлением!',
'menu_system' => 'Совместимость системы',
'menu_database' => 'Конфигурация системы',
'menu_process' => 'Установка магазина',
'menu_configure' => 'Информация о магазине',
'menu_welcome' => 'Выберите язык',
'Your PHP sessions path is not writable - check with your hosting provider:' => 'Дисковая память недоступна в письменном виде - обратитесь к Вашему хостинг-провайдеру',
+ 'Install modules Addons' => 'Установка модулей Addons',
),
);
\ No newline at end of file
diff --git a/install-dev/theme/js/process.js b/install-dev/theme/js/process.js
index ffdf34ff2..20246ebcf 100644
--- a/install-dev/theme/js/process.js
+++ b/install-dev/theme/js/process.js
@@ -20,8 +20,8 @@ function start_install()
$('.stepList li:last-child').removeClass('ok').removeClass('ko');
process_pixel = parseInt($('#progress_bar .total').css('width')) / process_steps.length;
$('#tabs li a').each(function() {
- this.rel=$(this).attr('href');
- this.href='#';
+ this.rel = $(this).attr('href');
+ this.href = '#';
});
process_install();
}
@@ -31,11 +31,11 @@ function process_install(step)
if (!step)
step = process_steps[0];
- $('.installing').hide().html(step.lang+' ...').fadeIn('slow');
+ $('.installing').hide().html(step.lang + ' ...').fadeIn('slow');
$.ajax({
url: 'index.php',
- data: step.key+'=true',
+ data: step.key + '=true',
dataType: 'json',
cache: false,
success: function(json)
@@ -51,10 +51,7 @@ function process_install(step)
$('#progress_bar .total span').html('100%');
// Installation finished
- setTimeout(function()
- {
- install_success();
- }, 700)
+ setTimeout(function(){install_success();}, 700);
}
else
{
diff --git a/install-dev/theme/views/configure.phtml b/install-dev/theme/views/configure.phtml
index ab9b6377c..faf816f27 100644
--- a/install-dev/theme/views/configure.phtml
+++ b/install-dev/theme/views/configure.phtml
@@ -40,11 +40,11 @@ var default_iso = 'session->shop_country ?>';