diff --git a/admin-dev/ajax.php b/admin-dev/ajax.php index 72639aacc..6bd5cf27e 100644 --- a/admin-dev/ajax.php +++ b/admin-dev/ajax.php @@ -663,7 +663,7 @@ if (Tools::isSubmit('getAdminHomeElement')) } // PREACTIVATION PAYPAL WARNING - $content = @file_get_contents('https://www.prestashop.com/partner/preactivation/preactivation-warnings.php?version=1.0&partner=paypal&iso_country='.Tools::strtolower(Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'))).'&iso_lang='.Tools::strtolower(Context::getContext()->language->iso_code).'&id_lang='.(int)Context::getContext().'&email='.urlencode(Configuration::get('PS_SHOP_EMAIL')).'&security='.md5(Configuration::get('PS_SHOP_EMAIL')._COOKIE_IV_), false, $stream_context); + $content = @file_get_contents('https://www.prestashop.com/partner/preactivation/preactivation-warnings.php?version=1.0&partner=paypal&iso_country='.Tools::strtolower(Context::getContext()->country->iso_code).'&iso_lang='.Tools::strtolower(Context::getContext()->language->iso_code).'&id_lang='.(int)Context::getContext().'&email='.urlencode(Configuration::get('PS_SHOP_EMAIL')).'&security='.md5(Configuration::get('PS_SHOP_EMAIL')._COOKIE_IV_), false, $stream_context); $content = explode('|', $content); if ($content[0] == 'OK') Configuration::updateValue('PS_PREACTIVATION_PAYPAL_WARNING', $content[1]); diff --git a/admin-dev/ajax_send_mail_test.php b/admin-dev/ajax_send_mail_test.php index 225ec082f..908043541 100644 --- a/admin-dev/ajax_send_mail_test.php +++ b/admin-dev/ajax_send_mail_test.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ - +define('PS_ADMIN_DIR', getcwd()); include_once(dirname(__FILE__).'/../config/config.inc.php'); /* Getting cookie or logout */ diff --git a/admin-dev/login.php b/admin-dev/login.php index d77e9559e..f4df1a8c9 100644 --- a/admin-dev/login.php +++ b/admin-dev/login.php @@ -51,8 +51,7 @@ if ((empty($_SERVER['HTTPS']) OR strtolower($_SERVER['HTTPS']) == 'off') .'

https://'.Tools::getServerName().$_SERVER['REQUEST_URI'].''; } -$cookie = Context::getContext()->cookie; -$iso = strtolower(Language::getIsoById(Context::getContext()->language->id)); +$iso = strtolower(Context::getContext()->language->iso_code); include(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php'); include(_PS_TRANSLATIONS_DIR_.$iso.'/errors.php'); @@ -83,6 +82,7 @@ if (Tools::isSubmit('Submit')) { $employee->remote_addr = ip2long(Tools::getRemoteAddr()); /* Creating cookie */ + $cookie = Context::getContext()->cookie; $cookie->id_employee = $employee->id; $cookie->email = $employee->email; $cookie->profile = $employee->id_profile; diff --git a/admin-dev/tabs/AdminModules.php b/admin-dev/tabs/AdminModules.php index 57dcb2d85..11331c79b 100644 --- a/admin-dev/tabs/AdminModules.php +++ b/admin-dev/tabs/AdminModules.php @@ -489,7 +489,6 @@ class AdminModules extends AdminTab public function displayList() { - $this->context = Context::getContext(); $modulesAuthors = array(); $autocompleteList = 'var moduleList = ['; @@ -499,7 +498,7 @@ class AdminModules extends AdminTab $showCountryModules = Configuration::get('PS_SHOW_COUNTRY_MODULES_'.(int)$this->context->employee->id); $nameCountryDefault = Country::getNameById($this->context->language->id, Configuration::get('PS_COUNTRY_DEFAULT')); - $isoCountryDefault = Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT')); + $isoCountryDefault = $this->context->country->iso_code; $serialModules = ''; $modules = Module::getModulesOnDisk(true); diff --git a/classes/Customer.php b/classes/Customer.php index c7b442147..4347f9992 100644 --- a/classes/Customer.php +++ b/classes/Customer.php @@ -606,7 +606,8 @@ class CustomerCore extends ObjectModel /** * Check customer informations and return customer validity * - * @parma boolean $withGuest + * @since 1.5.0 + * @param boolean $withGuest * @return boolean customer validity */ public function isLogged($withGuest = false) @@ -622,6 +623,8 @@ class CustomerCore extends ObjectModel /** * Logout + * + * @since 1.5.0 */ public function logout() { @@ -633,6 +636,8 @@ class CustomerCore extends ObjectModel /** * Soft logout, delete everything links to the customer * but leave there affiliate's informations + * + * @since 1.5.0 */ public function mylogout() { diff --git a/classes/PDF.php b/classes/PDF.php index 769479b5e..40cc63bcf 100644 --- a/classes/PDF.php +++ b/classes/PDF.php @@ -189,7 +189,7 @@ class PDFCore extends PDF_PageGroupCore private function _builMerchantFooterDetail($conf) { // If the country is USA - if (Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT')) == 'US') + if (Context::getContext()->country->iso_code == 'US') { $completeAddressShop = $this->_getCompleteUSAddressFormat($conf); @@ -449,7 +449,7 @@ class PDFCore extends PDF_PageGroupCore if (!in_array($pattern, $patternRules['avoid'])) { if ($pattern == 'State:name' && - Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT')) == 'US') + Context::getContext()->country->iso_code == 'US') { $state = &$addressType[$type]['addressFormatedValues'][$pattern]; $state = strtoupper(substr($state, 0, 2)); diff --git a/modules/ebay/ebay.php b/modules/ebay/ebay.php index 5e90a8460..19689ac82 100755 --- a/modules/ebay/ebay.php +++ b/modules/ebay/ebay.php @@ -67,7 +67,7 @@ class Ebay extends Module $this->id_lang = Language::getIdByIso('fr'); // Check the country and ask the bypass if not 'fr' - if (strtolower(Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'))) != 'fr' && !isset($this->context->cookie->ebay_country_default_fr)) + if (strtolower($this->context->country->iso_code) != 'fr' && !isset($this->context->cookie->ebay_country_default_fr)) { $this->warning = $this->l('eBay module currently works only for eBay.fr'); return false; @@ -485,7 +485,7 @@ class Ebay extends Module // Checking Country if (Tools::getValue('ebay_country_default_fr') == 'ok') $this->context->cookie->ebay_country_default_fr = true; - if (strtolower(Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'))) != 'fr' && !isset($this->context->cookie->ebay_country_default_fr)) + if (strtolower($this->context->country->iso_code) != 'fr' && !isset($this->context->cookie->ebay_country_default_fr)) return $this->_html.$this->displayError($this->l('eBay module currently works only for eBay.fr').'. '.$this->l('Continue anyway ?').''); diff --git a/modules/feeder/rss.php b/modules/feeder/rss.php index f3f2a589d..9f13cda30 100644 --- a/modules/feeder/rss.php +++ b/modules/feeder/rss.php @@ -46,7 +46,7 @@ echo ''."\n"; PrestaShop - id_lang)); ?> + language->iso_code; ?> <![CDATA[<?php echo Configuration::get('PS_SHOP_NAME') ?>]]> diff --git a/modules/moneybookers/moneybookers.php b/modules/moneybookers/moneybookers.php index 436e1f499..8845313af 100644 --- a/modules/moneybookers/moneybookers.php +++ b/modules/moneybookers/moneybookers.php @@ -382,9 +382,9 @@ class MoneyBookers extends PaymentModule $selected = ($currentLogoBlockPosition == $position) ? 'selected="selected"' : ''; $output .= ''; } - $link = new Link(); + $link = $this->context->link; $admin_dir = substr(_PS_ADMIN_DIR_, strrpos(_PS_ADMIN_DIR_,'/') + 1); - $iso_code = strtolower(Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'))); + $iso_code = strtolower($this->context->country->iso_code); $landingPage = ($iso_code == 'en' || $iso_code == 'us') ? 'http://www.moneybookers.com/ads/partners/index.html?p=Prestashop' : 'http://www.moneybookers.com/ads/partners/'.$iso_code.'/index.html?p=Prestashop'; diff --git a/modules/paypal/about.php b/modules/paypal/about.php index 98e765295..efd0dfeec 100644 --- a/modules/paypal/about.php +++ b/modules/paypal/about.php @@ -30,7 +30,7 @@ require_once(dirname(__FILE__).'/../../init.php'); include(dirname(__FILE__).'/../../header.php'); -$smarty->assign('iso_code', Tools::strtolower(Language::getIsoById($cookie->id_lang ? (int)$cookie->id_lang : Configuration::get('PS_LANG_DEFAULT')))); +$smarty->assign('iso_code', Tools::strtolower(Context::getContext()->language->iso_code)); echo Module::display(dirname(__FILE__).'/paypal', 'about.tpl'); diff --git a/modules/sendtoafriend/sendtoafriend.php b/modules/sendtoafriend/sendtoafriend.php index b0b74e167..18b31f58c 100644 --- a/modules/sendtoafriend/sendtoafriend.php +++ b/modules/sendtoafriend/sendtoafriend.php @@ -123,7 +123,7 @@ class sendToAFriend extends Module } if (!isset($cover)) - $cover = array('id_image' => Language::getIsoById((int)$cookie->id_lang).'-default', 'legend' => 'No picture'); + $cover = array('id_image' => $this->context->language->iso_code.'-default', 'legend' => 'No picture'); $this->context->smarty->assign(array( 'cover' => $cover, diff --git a/modules/trustedshops/lib/TSBuyerProtection.php b/modules/trustedshops/lib/TSBuyerProtection.php index db61a9f66..ef77fb0a9 100644 --- a/modules/trustedshops/lib/TSBuyerProtection.php +++ b/modules/trustedshops/lib/TSBuyerProtection.php @@ -1199,7 +1199,7 @@ class TSBuyerProtection extends AbsTrustedShops } public function hookRightColumn($params) { - $lang = Language::getIsoById($params['cookie']->id_lang); + $lang = $this->context->language->iso_code; $lang = strtoupper($lang); if (array_key_exists($lang, $this->available_languages) AND isset(TSBuyerProtection::$CERTIFICATE[$lang]['tsID'])) { @@ -1219,7 +1219,7 @@ class TSBuyerProtection extends AbsTrustedShops */ public function hookPaymentTop($params) { - $lang = Language::getIsoById($params['cookie']->id_lang); + $lang = $this->context->language->iso_code; $lang = strtoupper($lang); if (!isset(TSBuyerProtection::$CERTIFICATE[$lang]) || diff --git a/modules/trustedshops/lib/TrustedShopsRating.php b/modules/trustedshops/lib/TrustedShopsRating.php index 8346ee24b..95831b132 100644 --- a/modules/trustedshops/lib/TrustedShopsRating.php +++ b/modules/trustedshops/lib/TrustedShopsRating.php @@ -464,7 +464,7 @@ class TrustedShopsRating extends AbsTrustedShops if (!$this->_isTsIdActive((int)($params['cookie']->id_lang))) return false; - self::$smarty->assign(array('rating_url' => $this->getRatingUrl((int)($params['objOrder']->id)), 'language' => Language::getIsoById((int)($params['cookie']->id_lang)))); + self::$smarty->assign(array('rating_url' => $this->getRatingUrl((int)($params['objOrder']->id)), 'language' => $this->context->language->iso_code)); return $this->display(self::$module_name, 'order-confirmation.tpl'); } diff --git a/modules/twenga/twenga.php b/modules/twenga/twenga.php index 49fdcfb6e..95c616c88 100644 --- a/modules/twenga/twenga.php +++ b/modules/twenga/twenga.php @@ -138,7 +138,7 @@ class Twenga extends PaymentModule self::$base_path = $this->site_url.'/modules/twenga/'; $this->feed_url = self::$base_path.'export.php?twenga_token='.sha1(Configuration::get('TWENGA_TOKEN')._COOKIE_KEY_); - self::$shop_country = Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT')); + self::$shop_country = $this->context->country->iso_code; require_once realpath(self::$base_dir.'/lib/PrestashopStats.php'); require_once realpath(self::$base_dir.'/lib/TwengaObj.php');