From 55c1a0afeb75d5bdf987cd87cb1e7d6422b920e3 Mon Sep 17 00:00:00 2001 From: tDidierjean Date: Fri, 29 Jul 2011 15:06:20 +0000 Subject: [PATCH] // Context part 28 --- modules/producttooltip/producttooltip.php | 8 +++--- modules/referralprogram/referralprogram.php | 29 +++++++-------------- modules/reverso/reverso.php | 3 +-- 3 files changed, 13 insertions(+), 27 deletions(-) diff --git a/modules/producttooltip/producttooltip.php b/modules/producttooltip/producttooltip.php index 42cf6d95b..c2f7c50ab 100644 --- a/modules/producttooltip/producttooltip.php +++ b/modules/producttooltip/producttooltip.php @@ -133,8 +133,6 @@ class ProductToolTip extends Module public function hookProductFooter($params) { - global $smarty, $cookie; - $id_product = (int)($params['product']->id); /* First we try to display the number of people who are currently watching this product page */ @@ -149,7 +147,7 @@ class ProductToolTip extends Module WHERE p.id_page_type = 1 AND p.id_object = '.(int)($id_product).' AND cp.time_start > \''.pSQL($date).'\''); if (isset($nbPeople['nb']) AND $nbPeople['nb'] > 0) - $smarty->assign('nb_people', (int)($nbPeople['nb'])); + $this->context->smarty->assign('nb_people', (int)($nbPeople['nb'])); } /* Then, we try to display last sale */ @@ -166,7 +164,7 @@ class ProductToolTip extends Module ORDER BY o.date_add DESC'); if (isset($order['date_add']) && Validate::isDateFormat($order['date_add']) && $order['date_add'] != '0000-00-00 00:00:00') - $smarty->assign('date_last_order', $order['date_add']); + $this->context->smarty->assign('date_last_order', $order['date_add']); else { /* No sale? display last cart add instead */ @@ -178,7 +176,7 @@ class ProductToolTip extends Module WHERE cp.id_product = '.(int)($id_product)); if (isset($cart['date_add']) && Validate::isDateFormat($cart['date_add']) && $cart['date_add'] != '0000-00-00 00:00:00') - $smarty->assign('date_last_cart', $cart['date_add']); + $this->context->smarty->assign('date_last_cart', $cart['date_add']); } } } diff --git a/modules/referralprogram/referralprogram.php b/modules/referralprogram/referralprogram.php index 2a318fd2d..d6dc30f79 100644 --- a/modules/referralprogram/referralprogram.php +++ b/modules/referralprogram/referralprogram.php @@ -296,12 +296,10 @@ class ReferralProgram extends Module private function _displayFormRules() { - global $cookie; - // Languages preliminaries - $defaultLanguage = (int)(Configuration::get('PS_LANG_DEFAULT')); + $defaultLanguage = $this->context->language->id; $languages = Language::getLanguages(); - $iso = Language::getIsoById($defaultLanguage); + $iso = $this->context->language->iso_code; $divLangName = 'cpara¤dd'; // xml loading @@ -311,8 +309,6 @@ class ReferralProgram extends Module $this->_html .= $this->displayError($this->l('Your text is empty.')); // TinyMCE - global $cookie; - $iso = Language::getIsoById((int)($cookie->id_lang)); $isoTinyMCE = (file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$iso.'.js') ? $iso : 'en'); $ad = dirname($_SERVER["PHP_SELF"]); echo ' @@ -364,8 +360,7 @@ class ReferralProgram extends Module if ($params['cart']->checkDiscountValidity($discount, $params['cart']->getDiscounts(), $params['cart']->getOrderTotal(true, Cart::ONLY_PRODUCTS), $params['cart']->getProducts(), false, $this->context) === false) { - global $smarty; - $smarty->assign(array('discount_display' => Discount::display($discount->value, $discount->id_discount_type, new Currency($params['cookie']->id_currency)), 'discount' => $discount)); + $this->context->smarty->assign(array('discount_display' => Discount::display($discount->value, $discount->id_discount_type, new Currency($params['cookie']->id_currency)), 'discount' => $discount)); return $this->display(__FILE__, 'shopping-cart.tpl'); } return false; @@ -393,8 +388,6 @@ class ReferralProgram extends Module { include_once(dirname(__FILE__).'/ReferralProgramModule.php'); - global $smarty; - if (Configuration::get('PS_CIPHER_ALGORITHM')) $cipherTool = new Rijndael(_RIJNDAEL_KEY_, _RIJNDAEL_IV_); else @@ -425,8 +418,6 @@ class ReferralProgram extends Module */ public function hookCreateAccount($params) { - global $cookie; - $newCustomer = $params['newCustomer']; if (!Validate::isLoadedObject($newCustomer)) return false; @@ -468,8 +459,8 @@ class ReferralProgram extends Module if (Validate::isLoadedObject($discount)) { $data = array('{firstname}' => $newCustomer->firstname, '{lastname}' => $newCustomer->lastname, '{voucher_num}' => $discount->name, - '{voucher_amount}' => Tools::displayPrice((float)Configuration::get('REFERRAL_DISCOUNT_VALUE_'.(int)($cookie->id_currency)), (int)Configuration::get('PS_CURRENCY_DEFAULT'))); - Mail::Send((int)$cookie->id_lang, 'referralprogram-voucher', Mail::l('Congratulations!'), $data, $newCustomer->email, $newCustomer->firstname.' '.$newCustomer->lastname, strval(Configuration::get('PS_SHOP_EMAIL')), strval(Configuration::get('PS_SHOP_NAME')), NULL, NULL, dirname(__FILE__).'/mails/'); + '{voucher_amount}' => Tools::displayPrice((float)Configuration::get('REFERRAL_DISCOUNT_VALUE_'.(int)$this->context->currency->id), (int)Configuration::get('PS_CURRENCY_DEFAULT'))); + Mail::Send($this->context->language->id, 'referralprogram-voucher', Mail::l('Congratulations!'), $data, $newCustomer->email, $newCustomer->firstname.' '.$newCustomer->lastname, strval(Configuration::get('PS_SHOP_EMAIL')), strval(Configuration::get('PS_SHOP_NAME')), NULL, NULL, dirname(__FILE__).'/mails/'); } } return true; @@ -490,7 +481,6 @@ class ReferralProgram extends Module if (!Validate::isLoadedObject($customer)) die (Tools::displayError('Incorrect object Customer.')); - global $cookie; $friends = ReferralProgramModule::getSponsorFriend((int)$customer->id); if ($id_referralprogram = ReferralProgramModule::isSponsorised((int)$customer->id, true)) { @@ -500,7 +490,7 @@ class ReferralProgram extends Module $html = '

'.$this->l('Referral program').'

-

'.(isset($sponsor) ? $this->l('Customer\'s sponsor:').' '.$sponsor->firstname.' '.$sponsor->lastname.'' : $this->l('No one has sponsored this customer.')).'

'; +

'.(isset($sponsor) ? $this->l('Customer\'s sponsor:').' '.$sponsor->firstname.' '.$sponsor->lastname.'' : $this->l('No one has sponsored this customer.')).'

'; if ($friends AND sizeof($friends)) { @@ -520,11 +510,11 @@ class ReferralProgram extends Module { $orders = Order::getCustomerOrders($friend['id_customer']); $html.= ' - + '.((int)($friend['id_customer']) ? $friend['id_customer'] : '--').' '.$friend['firstname'].' '.$friend['lastname'].' '.$friend['email'].' - '.Tools::displayDate($friend['date_add'], (int)($cookie->id_lang), true).' + '.Tools::displayDate($friend['date_add'], $this->context->language->id, true).' '.sizeof(ReferralProgramModule::getSponsorFriend($friend['id_customer'])).' '.($orders ? sizeof($orders) : 0).' '.((int)$friend['id_customer'] ? '' : '').' @@ -561,8 +551,7 @@ class ReferralProgram extends Module $discount = new Discount((int)$referralprogram->id_discount_sponsor); if (!Validate::isLoadedObject($discount)) return false; - global $smarty; - $smarty->assign(array('discount' => $discount->display($discount->value, (int)$discount->id_discount_type, new Currency((int)$params['objOrder']->id_currency)), 'sponsor_firstname' => $sponsor->firstname, 'sponsor_lastname' => $sponsor->lastname)); + $this->context->smarty->assign(array('discount' => $discount->display($discount->value, (int)$discount->id_discount_type, new Currency((int)$params['objOrder']->id_currency)), 'sponsor_firstname' => $sponsor->firstname, 'sponsor_lastname' => $sponsor->lastname)); return $this->display(__FILE__, 'order-confirmation.tpl'); } return false; diff --git a/modules/reverso/reverso.php b/modules/reverso/reverso.php index 4f1965350..04a2ddbc9 100644 --- a/modules/reverso/reverso.php +++ b/modules/reverso/reverso.php @@ -84,9 +84,8 @@ class Reverso extends Module public function hookCreateAccountTop($params) { - global $smarty; $tag = ''; - $smarty->assign(array('reverso_tag' => $tag)); + $this->context->smarty->assign(array('reverso_tag' => $tag)); return $this->display(__FILE__, 'reverso.tpl'); }