diff --git a/admin-dev/tabs/AdminReturn.php b/admin-dev/tabs/AdminReturn.php index 6d6c3bbd7..7d9069650 100644 --- a/admin-dev/tabs/AdminReturn.php +++ b/admin-dev/tabs/AdminReturn.php @@ -29,13 +29,12 @@ class AdminReturn extends AdminTab { public function __construct() { - global $cookie; - + $context = Context::getContext(); $this->table = 'order_return'; $this->className = 'OrderReturn'; $this->colorOnBackground = true; $this->_select = 'orsl.`name`'; - $this->_join = 'LEFT JOIN '._DB_PREFIX_.'order_return_state_lang orsl ON (orsl.`id_order_return_state` = a.`state` AND orsl.`id_lang` = '.(int)($cookie->id_lang).')'; + $this->_join = 'LEFT JOIN '._DB_PREFIX_.'order_return_state_lang orsl ON (orsl.`id_order_return_state` = a.`state` AND orsl.`id_lang` = '.(int)$context->language->id.')'; $this->fieldsDisplay = array( 'id_order_return' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), @@ -54,8 +53,7 @@ class AdminReturn extends AdminTab public function postProcess() { - global $currentIndex, $cookie; - + $context = Context::getContext(); if (Tools::isSubmit('deleteorder_return_detail')) { if ($this->tabAccess['delete'] === '1') @@ -103,7 +101,7 @@ class AdminReturn extends AdminTab '{firstname}' => $customer->firstname, '{id_order_return}' => $id_order_return, '{state_order_return}' => $orderReturnState->name[(int)(Configuration::get('PS_LANG_DEFAULT'))]); - Mail::Send((int)($cookie->id_lang), 'order_return_state', Mail::l('Your order return state has changed'), $vars, $customer->email, $customer->firstname.' '.$customer->lastname); + Mail::Send(clan, 'order_return_state', Mail::l('Your order return state has changed'), $vars, $customer->email, $customer->firstname.' '.$customer->lastname); Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token); } } @@ -118,8 +116,7 @@ class AdminReturn extends AdminTab public function display() { - global $currentIndex, $cookie; - + $context = Context::getContext(); // Include current tab if (isset($_GET['update'.$this->table])) { @@ -133,7 +130,7 @@ class AdminReturn extends AdminTab } else { - $this->getList((int)($cookie->id_lang), !Tools::getValue($this->table.'Orderby') ? 'date_add' : NULL, !Tools::getValue($this->table.'Orderway') ? 'DESC' : NULL); + $this->getList($context->language->id, !Tools::getValue($this->table.'Orderby') ? 'date_add' : NULL, !Tools::getValue($this->table.'Orderway') ? 'DESC' : NULL); $this->displayList(); $this->displayOptionsList(); $this->includeSubTab('display'); @@ -143,7 +140,6 @@ class AdminReturn extends AdminTab public function displayListContent($token = NULL) { - global $currentIndex, $cookie; $irow = 0; if ($this->_list) foreach ($this->_list AS $tr) @@ -159,7 +155,7 @@ class AdminReturn extends AdminTab public function displayForm($isMainTab = true) { - global $currentIndex, $cookie; + $context = Context::getContext(); parent::displayForm(); if (!($obj = $this->loadObject(true))) @@ -175,12 +171,12 @@ class AdminReturn extends AdminTab $customer = new Customer((int)($obj->id_customer)); echo '
'.$customer->firstname.' '.$customer->lastname.' -

'.$this->l('View details on customer page').'

+

'.$this->l('View details on customer page').'

'; $order = new Order((int)($obj->id_order)); echo '
'.$this->l('Order #').sprintf('%06d', $order->id).' '.$this->l('from').' '.Tools::displayDate($order->date_upd, $order->id_lang).' -

'.$this->l('View details on order page').'

+

'.$this->l('View details on order page').'

'.$obj->question.'
@@ -188,7 +184,7 @@ class AdminReturn extends AdminTab
@@ -197,7 +193,7 @@ class AdminReturn extends AdminTab if ($obj->state >= 3) echo '
'.$this->l('Generate a new slip from the customer order').' -

'.$this->l('More information on order page').'

+

'.$this->l('More information on order page').'

'; echo '
'; diff --git a/admin-dev/tabs/AdminReturnStates.php b/admin-dev/tabs/AdminReturnStates.php index 8e69cf2f2..1795e521a 100644 --- a/admin-dev/tabs/AdminReturnStates.php +++ b/admin-dev/tabs/AdminReturnStates.php @@ -47,7 +47,6 @@ class AdminReturnStates extends AdminTab public function displayForm($isMainTab = true) { - global $currentIndex; parent::displayForm(); if (!($obj = $this->loadObject(true))) diff --git a/admin-dev/tabs/AdminScenes.php b/admin-dev/tabs/AdminScenes.php index 9b9f94f7b..c22a85447 100644 --- a/admin-dev/tabs/AdminScenes.php +++ b/admin-dev/tabs/AdminScenes.php @@ -125,7 +125,7 @@ class AdminScenes extends AdminTab public function displayForm($isMainTab = true) { - global $currentIndex, $cookie; + $context = Context::getContext(); parent::displayForm(); if (!($obj = $this->loadObject(true))) @@ -139,7 +139,7 @@ class AdminScenes extends AdminTab echo 'startingData = new Array();'."\n"; foreach ($obj->getProducts() as $key => $product) { - $productObj = new Product((int)($product['id_product']), true, (int)($cookie->id_lang)); + $productObj = new Product($product['id_product'], true, $context->language->id); echo 'startingData['.$key.'] = new Array(\''.$productObj->name.'\', '.$product['id_product'].', '.$product['x_axis'].', '.$product['y_axis'].', '.$product['zone_width'].', '.$product['zone_height'].');'; } @@ -235,7 +235,7 @@ class AdminScenes extends AdminTab '.$this->l('ID').' '.$this->l('Image map name:').' '; - $categories = Category::getCategories((int)($cookie->id_lang), false); + $categories = Category::getCategories($context->language->id, false); $done = array(); $index = array(); if (Tools::isSubmit('categories')) diff --git a/admin-dev/tabs/AdminSearch.php b/admin-dev/tabs/AdminSearch.php index b1018be9c..7964b2358 100644 --- a/admin-dev/tabs/AdminSearch.php +++ b/admin-dev/tabs/AdminSearch.php @@ -35,14 +35,13 @@ class AdminSearch extends AdminTab */ public function searchCatalog($query) { - global $cookie; - - $this->_list['products'] = Product::searchByName((int)$cookie->id_lang, $query); + $context = Context::getContext(); + $this->_list['products'] = Product::searchByName($context->language->id, $query); if (!empty($this->_list['products'])) for ($i = 0; $i < count($this->_list['products']); $i++) $this->_list['products'][$i]['nameh'] = str_ireplace($query, ''.Tools::htmlentitiesUTF8($query).'', $this->_list['products'][$i]['name']); - $this->_list['categories'] = Category::searchByName((int)$cookie->id_lang, $query); + $this->_list['categories'] = Category::searchByName($context->language->id, $query); } /** @@ -57,8 +56,7 @@ class AdminSearch extends AdminTab function postProcess() { - global $cookie; - + $context = Context::getContext(); $query = trim(Tools::getValue('bo_query')); $searchType = (int)Tools::getValue('bo_search_type'); @@ -73,7 +71,7 @@ class AdminSearch extends AdminTab { global $_LANGADM; $tabs = array(); - $result = Db::getInstance()->ExecuteS('SELECT class_name, name FROM '._DB_PREFIX_.'tab t INNER JOIN '._DB_PREFIX_.'tab_lang tl ON t.id_tab = tl.id_tab AND tl.id_lang = '.(int)$cookie->id_lang); + $result = Db::getInstance()->ExecuteS('SELECT class_name, name FROM '._DB_PREFIX_.'tab t INNER JOIN '._DB_PREFIX_.'tab_lang tl ON t.id_tab = tl.id_tab AND tl.id_lang = '.(int)$context->language->id); foreach ($result as $row) $tabs[$row['class_name']] = $row['name']; foreach (AdminTab::$tabParenting as $key => $value) @@ -132,7 +130,7 @@ class AdminSearch extends AdminTab /* Handle product ID */ if ($searchType == 1 AND (int)$query AND Validate::isUnsignedInt((int)$query)) if ($product = new Product((int)$query) AND Validate::isLoadedObject($product)) - Tools::redirectAdmin('index.php?tab=AdminCatalog&id_product='.(int)($product->id).'&addproduct'.'&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee))); + Tools::redirectAdmin('index.php?tab=AdminCatalog&id_product='.(int)($product->id).'&addproduct'.'&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id)); /* Normal catalog search */ $this->searchCatalog($query); @@ -156,7 +154,7 @@ class AdminSearch extends AdminTab /* Handle customer ID */ if ($searchType AND (int)$query AND Validate::isUnsignedInt((int)$query)) if ($customer = new Customer((int)$query) AND Validate::isLoadedObject($customer)) - Tools::redirectAdmin('index.php?tab=AdminCustomers&id_customer='.(int)($customer->id).'&viewcustomer'.'&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)($cookie->id_employee))); + Tools::redirectAdmin('index.php?tab=AdminCustomers&id_customer='.(int)($customer->id).'&viewcustomer'.'&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$context->employee->id)); /* Normal customer search */ $this->searchCustomer($query); @@ -166,7 +164,7 @@ class AdminSearch extends AdminTab if ($searchType == 3) { if ((int)$query AND Validate::isUnsignedInt((int)$query) AND $order = new Order((int)$query) AND Validate::isLoadedObject($order)) - Tools::redirectAdmin('index.php?tab=AdminOrders&id_order='.(int)($order->id).'&vieworder'.'&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee))); + Tools::redirectAdmin('index.php?tab=AdminOrders&id_order='.(int)($order->id).'&vieworder'.'&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$context->employee->id)); $this->_errors[] = Tools::displayError('No order found with this ID:').' '.Tools::htmlentitiesUTF8($query); } @@ -182,7 +180,7 @@ class AdminSearch extends AdminTab if ($searchType == 5) { if ((int)$query AND Validate::isUnsignedInt((int)$query) AND $cart = new Cart((int)$query) AND Validate::isLoadedObject($cart)) - Tools::redirectAdmin('index.php?tab=AdminCarts&id_cart='.(int)($cart->id).'&viewcart'.'&token='.Tools::getAdminToken('AdminCarts'.(int)(Tab::getIdFromClassName('AdminCarts')).(int)($cookie->id_employee))); + Tools::redirectAdmin('index.php?tab=AdminCarts&id_cart='.(int)($cart->id).'&viewcart'.'&token='.Tools::getAdminToken('AdminCarts'.(int)(Tab::getIdFromClassName('AdminCarts')).(int)$context->employee->id)); $this->_errors[] = Tools::displayError('No cart found with this ID:').' '.Tools::htmlentitiesUTF8($query); } } @@ -190,8 +188,8 @@ class AdminSearch extends AdminTab public function display() { - global $cookie; - $currentIndex = 'index.php'; + $context = Context::getContext(); + self::$currentIndex = 'index.php'; $currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); $query = trim(Tools::getValue('bo_query')); $nbCategories = $nbProducts = $nbCustomers = 0; @@ -224,17 +222,17 @@ class AdminSearch extends AdminTab '.$product['id_product'].' '.($product['manufacturer_name'] != NULL ? stripslashes($product['manufacturer_name']) : '--').' '.$product['reference'].' - '.stripslashes($product['nameh']).' + '.stripslashes($product['nameh']).' '.Tools::displayPrice($product['price'], $currency).' '.stripslashes($product['tax_name']).' '.$product['quantity'].' '.$product['weight'].' '.Configuration::get('PS_WEIGHT_UNIT').' - + - + '.$this->l('Modify this product').'  - '.$this->l('Delete this product').' @@ -263,16 +261,16 @@ class AdminSearch extends AdminTab '.$imgGender.' '.stripslashes($customer['lastname']).' '.stripslashes($customer['firstname']).' '.stripslashes($customer['email']).' '.$this->l('Write to this customer').' - '.Tools::displayDate($customer['birthday'], (int)($cookie->id_lang)).' - '.Tools::displayDate($customer['date_add'], (int)($cookie->id_lang)).' + '.Tools::displayDate($customer['birthday'], $context->language->id).' + '.Tools::displayDate($customer['date_add'], $context->language->id).' '.Order::getCustomerNbOrders($customer['id_customer']).' - + '.$this->l('View orders').' - + '.$this->l('Modify this customer').' - + '.$this->l('Delete this customer').' '; diff --git a/admin-dev/tabs/AdminSearchConf.php b/admin-dev/tabs/AdminSearchConf.php index 46070f786..286e7acc1 100644 --- a/admin-dev/tabs/AdminSearchConf.php +++ b/admin-dev/tabs/AdminSearchConf.php @@ -31,8 +31,6 @@ class AdminSearchConf extends AdminPreferences { public function __construct() { - global $cookie; - $this->className = 'Configuration'; $this->table = 'configuration'; diff --git a/admin-dev/tabs/AdminSearchEngines.php b/admin-dev/tabs/AdminSearchEngines.php index e43db7005..8252f175b 100644 --- a/admin-dev/tabs/AdminSearchEngines.php +++ b/admin-dev/tabs/AdminSearchEngines.php @@ -45,7 +45,6 @@ class AdminSearchEngines extends AdminTab public function displayForm($isMainTab = true) { - global $currentIndex; parent::displayForm(); if (!($obj = $this->loadObject(true))) diff --git a/admin-dev/tabs/AdminShipping.php b/admin-dev/tabs/AdminShipping.php index 691db0860..85452f514 100644 --- a/admin-dev/tabs/AdminShipping.php +++ b/admin-dev/tabs/AdminShipping.php @@ -46,8 +46,6 @@ class AdminShipping extends AdminTab public function postProcess() { - global $currentIndex; - /* Handling settings */ if (isset($_POST['submitHandling'.$this->table])) { @@ -138,8 +136,6 @@ class AdminShipping extends AdminTab public function displayFormHandling() { - global $currentIndex; - $confKeys = $this->_fieldsHandling; foreach ($confKeys AS $key => $confKey) $getConf[] = $key; @@ -195,8 +191,6 @@ class AdminShipping extends AdminTab public function displayFormFees() { - global $currentIndex; - $carrierArray = array(); $id_carrier = Tools::getValue('id_carrier'); $carriers = Carrier::getCarriers((int)(Configuration::get('PS_LANG_DEFAULT')), true , false,false, NULL, PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE); diff --git a/admin-dev/tabs/AdminShop.php b/admin-dev/tabs/AdminShop.php index e3f9e6039..a6753cb9f 100755 --- a/admin-dev/tabs/AdminShop.php +++ b/admin-dev/tabs/AdminShop.php @@ -30,7 +30,7 @@ class AdminShop extends AdminTab { public function __construct() { - global $cookie; + $context = Context::getContext(); $this->table = 'shop'; $this->className = 'Shop'; @@ -40,7 +40,7 @@ class AdminShop extends AdminTab $this->_select = 'gs.name group_shop_name, cl.name category_name'; $this->_join = 'LEFT JOIN `'._DB_PREFIX_.'group_shop` gs ON (a.id_group_shop = gs.id_group_shop) - LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (a.id_category = cl.id_category AND cl.id_lang='.(int)$cookie->id_lang.')'; + LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (a.id_category = cl.id_category AND cl.id_lang='.(int)$context->language->id.')'; $this->_group = 'GROUP BY id_shop'; $this->fieldsDisplay = array( @@ -80,7 +80,7 @@ class AdminShop extends AdminTab public function displayForm($isMainTab = true) { - global $currentIndex, $cookie; + $context = Context::getContext(); parent::displayForm($isMainTab); if (!($obj = $this->loadObject(true))) @@ -111,7 +111,7 @@ class AdminShop extends AdminTab echo '
'; - $countries = Country::getCountries((int)($cookie->id_lang), false, true); + $countries = Country::getCountries($context->language->id, false, true); foreach ($countries AS $country) echo ''; echo ' diff --git a/admin-dev/tabs/AdminStatsConf.php b/admin-dev/tabs/AdminStatsConf.php index bd3228bb8..7b637ee71 100644 --- a/admin-dev/tabs/AdminStatsConf.php +++ b/admin-dev/tabs/AdminStatsConf.php @@ -52,8 +52,6 @@ class AdminStatsConf extends AdminPreferences public function display() { - global $currentIndex, $cookie; - $graphEngine = Configuration::get('PS_STATS_RENDER'); $gridEngine = Configuration::get('PS_STATS_GRID_RENDER'); $autoclean = Configuration::get('PS_STATS_OLD_CONNECT_AUTO_CLEAN'); diff --git a/admin-dev/tabs/AdminStatsTab.php b/admin-dev/tabs/AdminStatsTab.php index 2b9fc68f9..976ede7a2 100644 --- a/admin-dev/tabs/AdminStatsTab.php +++ b/admin-dev/tabs/AdminStatsTab.php @@ -40,8 +40,7 @@ abstract class AdminStatsTab extends AdminPreferences public function postProcess() { - global $cookie, $currentIndex; - + $context = Context::getContext(); if (Tools::isSubmit('submitDatePicker')) { if (!Validate::isDate($from = Tools::getValue('datepickerFrom')) OR !Validate::isDate($to = Tools::getValue('datepickerTo'))) @@ -82,17 +81,16 @@ abstract class AdminStatsTab extends AdminPreferences } if (isset($from) AND isset($to) AND !sizeof($this->_errors)) { - $employee = new Employee($cookie->id_employee); - $employee->stats_date_from = $from; - $employee->stats_date_to = $to; - $employee->update(); + $context->employee->stats_date_from = $from; + $context->employee->stats_date_to = $to; + $context->employee->update(); Tools::redirectAdmin($_SERVER['REQUEST_URI']); } if (Tools::getValue('submitSettings')) { if ($this->tabAccess['edit'] === '1') { - $currentIndex .= '&module='.Tools::getValue('module'); + self::$currentIndex .= '&module='.Tools::getValue('module'); $this->_postConfig($this->_fieldsSettings); } else @@ -104,8 +102,6 @@ abstract class AdminStatsTab extends AdminPreferences protected function displayEngines() { - global $currentIndex, $cookie; - $graphEngine = Configuration::get('PS_STATS_RENDER'); $gridEngine = Configuration::get('PS_STATS_GRID_RENDER'); $arrayGraphEngines = ModuleGraphEngine::getGraphEngines(); @@ -141,10 +137,10 @@ abstract class AdminStatsTab extends AdminPreferences protected function getDate() { - global $cookie; - $year = isset($cookie->stats_year) ? $cookie->stats_year : date('Y'); - $month = isset($cookie->stats_month) ? sprintf('%02d', $cookie->stats_month) : '%'; - $day = isset($cookie->stats_day) ? sprintf('%02d', $cookie->stats_day) : '%'; + $context = Context::getContext(); + $year = isset($context->cookie->stats_year) ? $context->cookie->stats_year : date('Y'); + $month = isset($context->cookie->stats_month) ? sprintf('%02d', $context->cookie->stats_month) : '%'; + $day = isset($context->cookie->stats_day) ? sprintf('%02d', $context->cookie->stats_day) : '%'; return $year.'-'.$month.'-'.$day; } @@ -161,9 +157,7 @@ abstract class AdminStatsTab extends AdminPreferences public static function displayCalendarStatic($translations) { - global $cookie; - $employee = new Employee($cookie->id_employee); - + $context = Context::getContext(); includeDatepicker(array('datepickerFrom', 'datepickerTo')); return '
'.$translations['Calendar'].' @@ -175,8 +169,8 @@ abstract class AdminStatsTab extends AdminPreferences -

'.(isset($translations['From']) ? $translations['From'] : 'From:').'

-

'.(isset($translations['To']) ? $translations['To'] : 'To:').'

+

'.(isset($translations['From']) ? $translations['From'] : 'From:').'

+

'.(isset($translations['To']) ? $translations['To'] : 'To:').'

@@ -207,7 +201,6 @@ abstract class AdminStatsTab extends AdminPreferences public function displayMenu() { - global $currentIndex, $cookie; $modules = $this->getModules(); echo '
'.$this->l('Navigation', 'AdminStatsTab').''; diff --git a/admin-dev/tabs/AdminStatuses.php b/admin-dev/tabs/AdminStatuses.php index 536be1e0c..4e6083909 100644 --- a/admin-dev/tabs/AdminStatuses.php +++ b/admin-dev/tabs/AdminStatuses.php @@ -67,8 +67,6 @@ class AdminStatuses extends AdminTab public function display() { - global $currentIndex; - if (!Tools::isSubmit('updateorder_return_state') AND !Tools::isSubmit('submitAddorder_return_state')) { echo '

'.$this->l('Order statuses').'

'; diff --git a/admin-dev/tabs/AdminStores.php b/admin-dev/tabs/AdminStores.php index af628e5d6..0119a80ab 100644 --- a/admin-dev/tabs/AdminStores.php +++ b/admin-dev/tabs/AdminStores.php @@ -34,8 +34,7 @@ class AdminStores extends AdminTab public function __construct() { - global $cookie; - + $context = Context::getContext(); $this->table = 'store'; $this->className = 'Store'; $this->lang = false; @@ -46,10 +45,10 @@ class AdminStores extends AdminTab $this->_select = 'cl.`name` country, st.`name` state'; $this->_join = ' - LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (cl.`id_country` = a.`id_country` AND cl.`id_lang` = '.(int)($cookie->id_lang).') + LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (cl.`id_country` = a.`id_country` AND cl.`id_lang` = '.(int)$context->language->id.') LEFT JOIN `'._DB_PREFIX_.'state` st ON (st.`id_state` = a.`id_state`)'; - $countries = Country::getCountries((int)($cookie->id_lang)); + $countries = Country::getCountries($context->language->id); foreach ($countries AS $country) $this->countriesArray[$country['id_country']] = $country['name']; @@ -146,7 +145,7 @@ class AdminStores extends AdminTab public function displayForm($isMainTab = true) { - global $currentIndex, $cookie; + $context = Context::getContext(); parent::displayForm(); if (!($obj = $this->loadObject(true))) @@ -260,7 +259,7 @@ class AdminStores extends AdminTab

'.$this->l('Store window picture').'

'; - echo $this->displayImage($obj->id, _PS_STORE_IMG_DIR_.'/'.$obj->id.'.jpg', 350, NULL, Tools::getAdminToken('AdminStores'.(int)(Tab::getIdFromClassName('AdminStores')).(int)($cookie->id_employee)), true); + echo $this->displayImage($obj->id, _PS_STORE_IMG_DIR_.'/'.$obj->id.'.jpg', 350, NULL, Tools::getAdminToken('AdminStores'.(int)(Tab::getIdFromClassName('AdminStores')).(int)$context->employee->id), true); echo '
diff --git a/admin-dev/tabs/AdminSubDomains.php b/admin-dev/tabs/AdminSubDomains.php index c9b96740b..2bbef040a 100644 --- a/admin-dev/tabs/AdminSubDomains.php +++ b/admin-dev/tabs/AdminSubDomains.php @@ -49,7 +49,6 @@ class AdminSubDomains extends AdminTab public function displayForm($isMainTab = true) { - global $currentIndex; parent::displayForm(); if (!($obj = $this->loadObject(true))) diff --git a/admin-dev/tabs/AdminSuppliers.php b/admin-dev/tabs/AdminSuppliers.php index 7fa523aac..27cd37bf5 100644 --- a/admin-dev/tabs/AdminSuppliers.php +++ b/admin-dev/tabs/AdminSuppliers.php @@ -55,23 +55,23 @@ class AdminSuppliers extends AdminTab public function viewsupplier() { - global $cookie; + $context = Context::getContext(); if (!($supplier = $this->loadObject())) return; echo '

'.$supplier->name.'

'; - $products = $supplier->getProductsLite((int)($cookie->id_lang)); + $products = $supplier->getProductsLite($context->language->id); echo '

'.$this->l('Total products:').' '.sizeof($products).'

'; foreach ($products AS $product) { - $product = new Product($product['id_product'], false, (int)($cookie->id_lang)); + $product = new Product($product['id_product'], false, $context->language->id); echo '
'; if (!$product->hasAttributes()) { echo '
- + '.(!empty($product->reference) ? '' : '').' '.(!empty($product->ean13) ? '' : '').' '.(!empty($product->upc) ? '' : '').' @@ -82,7 +82,7 @@ class AdminSuppliers extends AdminTab else { echo ' -

'.$product->name.'

+

'.$product->name.'

'.$product->name.''.$product->name.''.$this->l('Ref:').' '.$product->reference.''.$this->l('EAN13:').' '.$product->ean13.''.$this->l('UPC:').' '.$product->upc.'
@@ -92,7 +92,7 @@ class AdminSuppliers extends AdminTab '.(Configuration::get('PS_STOCK_MANAGEMENT') ? '' : '').' '; /* Build attributes combinaisons */ - $combinaisons = $product->getAttributeCombinaisons((int)($cookie->id_lang)); + $combinaisons = $product->getAttributeCombinaisons($context->language->id); foreach ($combinaisons AS $k => $combinaison) { $combArray[$combinaison['id_product_attribute']]['reference'] = $combinaison['reference']; @@ -125,7 +125,6 @@ class AdminSuppliers extends AdminTab public function displayForm($isMainTab = true) { - global $currentIndex; parent::displayForm(); if (!($supplier = $this->loadObject(true))) diff --git a/admin-dev/tabs/AdminTabs.php b/admin-dev/tabs/AdminTabs.php index a0a70e57b..17c8a5062 100644 --- a/admin-dev/tabs/AdminTabs.php +++ b/admin-dev/tabs/AdminTabs.php @@ -29,20 +29,19 @@ class AdminTabs extends AdminTab { public function __construct() { - global $cookie; - + $context = Context::getContext(); $this->table = 'tab'; $this->className = 'Tab'; $this->lang = true; $this->edit = true; $this->delete = true; - $this->_select = '(SELECT stl.`name` FROM `'._DB_PREFIX_.'tab_lang` stl WHERE stl.`id_tab` = a.`id_parent` AND stl.`id_lang` = '.(int)($cookie->id_lang).' LIMIT 1) AS parent'; + $this->_select = '(SELECT stl.`name` FROM `'._DB_PREFIX_.'tab_lang` stl WHERE stl.`id_tab` = a.`id_parent` AND stl.`id_lang` = '.(int)$context->language->id.' LIMIT 1) AS parent'; $this->fieldImageSettings = array('name' => 'icon', 'dir' => 't'); $this->imageType = 'gif'; $tabs = array(0 => $this->l('Home')); - foreach (Tab::getTabs((int)$cookie->id_lang, 0) AS $tab) + foreach (Tab::getTabs($context->language->id, 0) AS $tab) $tabs[$tab['id_tab']] = $tab['name']; $this->fieldsDisplay = array( 'id_tab' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), @@ -58,7 +57,6 @@ class AdminTabs extends AdminTab { if (($id_tab = (int)(Tools::getValue('id_tab'))) AND ($direction = Tools::getValue('move')) AND Validate::isLoadedObject($tab = new Tab($id_tab))) { - global $currentIndex; if ($tab->move($direction)) Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token); } @@ -72,8 +70,6 @@ class AdminTabs extends AdminTab private function _posTabs($name, $arrayTabs) { - global $currentIndex; - if (sizeof($arrayTabs) > 1) { echo ' @@ -96,22 +92,21 @@ class AdminTabs extends AdminTab public function displayList() { - global $cookie, $currentIndex; - + $context = Context::getContext(); parent::displayList(); - $tabs = Tab::getTabs((int)$cookie->id_lang, 0); + $tabs = Tab::getTabs($context->language->id, 0); echo '

'.$this->l('Positions').'

'.$this->l('Level').' 1

'; $this->_posTabs($this->l('Main'), $tabs); echo '

'.$this->l('Level').' 2

'; foreach ($tabs AS $t) - $this->_posTabs(stripslashes($t['name']), Tab::getTabs((int)$cookie->id_lang, $t['id_tab'])); + $this->_posTabs(stripslashes($t['name']), Tab::getTabs($context->language->id, $t['id_tab'])); } public function displayForm($isMainTab = true) { - global $currentIndex, $cookie; + $context = Context::getContext(); parent::displayForm(); if (!($obj = $this->loadObject(true))) @@ -156,7 +151,7 @@ class AdminTabs extends AdminTab diff --git a/admin-dev/tabs/AdminTags.php b/admin-dev/tabs/AdminTags.php index 66b3b3af8..8c61ddb4a 100644 --- a/admin-dev/tabs/AdminTags.php +++ b/admin-dev/tabs/AdminTags.php @@ -29,8 +29,6 @@ class AdminTags extends AdminTab { public function __construct() { - global $cookie; - $this->table = 'tag'; $this->className = 'Tag'; $this->edit = true; @@ -61,7 +59,6 @@ class AdminTags extends AdminTab public function displayForm($isMainTab = true) { - global $currentIndex, $cookie; parent::displayForm(); if (!($obj = $this->loadObject(true))) diff --git a/admin-dev/tabs/AdminTaxRulesGroup.php b/admin-dev/tabs/AdminTaxRulesGroup.php index 356f6009d..762b935ca 100755 --- a/admin-dev/tabs/AdminTaxRulesGroup.php +++ b/admin-dev/tabs/AdminTaxRulesGroup.php @@ -30,7 +30,6 @@ class AdminTaxRulesGroup extends AdminTab { public function __construct() { - global $cookie; $this->table = 'tax_rules_group'; $this->className = 'TaxRulesGroup'; $this->edit = true; @@ -70,7 +69,7 @@ class AdminTaxRulesGroup extends AdminTab public function displayForm($isMainTab = true) { - global $cookie, $currentIndex; + $context = Context::getContext(); parent::displayForm(); if (!($obj = $this->loadObject(true))) return; @@ -182,7 +181,7 @@ class AdminTaxRulesGroup extends AdminTab - '.$this->renderZones($tax_rules, (int)$cookie->id_lang); + '.$this->renderZones($tax_rules, $context->language->id); echo '
   @@ -383,12 +382,11 @@ class AdminTaxRulesGroup extends AdminTab protected function afterUpdate($object) { - global $cookie; + $context = Context::getContext(); TaxRule::deleteByGroupId($object->id); - - foreach(Country::getCountries($cookie->id_lang, true) AS $country) + foreach(Country::getCountries($context->language->id, true) AS $country) { $id_tax = (int)Tools::getValue('tax_'.$country['id_country'].'_0'); @@ -456,9 +454,9 @@ class AdminTaxRulesGroup extends AdminTab public function postProcess() { - - global $currentIndex, $cookie; - if (!isset($this->table)) + $context = Context::getContext(); + + if (!isset($this->table)) return false; // set token @@ -523,7 +521,7 @@ class AdminTaxRulesGroup extends AdminTab // Default behavior (save and back) $id_product = (int)Tools::getValue('id_product'); if ($id_product) - Tools::redirectAdmin('?tab=AdminCatalog&id_product='.$id_product.'&updateproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee))); + Tools::redirectAdmin('?tab=AdminCatalog&id_product='.$id_product.'&updateproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id)); Tools::redirectAdmin(self::$currentIndex.($parent_id ? '&'.$this->identifier.'='.$object->id : '').'&conf=3&token='.$token); } @@ -555,7 +553,7 @@ class AdminTaxRulesGroup extends AdminTab $this->updateAssoGroupShop($object->id); $id_product = (int)Tools::getValue('id_product'); if ($id_product) - Tools::redirectAdmin('?tab=AdminCatalog&id_product='.$id_product.'&updateproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee))); + Tools::redirectAdmin('?tab=AdminCatalog&id_product='.$id_product.'&updateproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$context->employee->id)); Tools::redirectAdmin(self::$currentIndex.($parent_id ? '&'.$this->identifier.'='.$object->id : '').'&conf=3&token='.$token); // Default behavior (save and back) diff --git a/admin-dev/tabs/AdminTaxes.php b/admin-dev/tabs/AdminTaxes.php index 9d1c72aff..b9c408f80 100644 --- a/admin-dev/tabs/AdminTaxes.php +++ b/admin-dev/tabs/AdminTaxes.php @@ -29,7 +29,6 @@ class AdminTaxes extends AdminTab { public function __construct() { - global $cookie; $this->table = 'tax'; $this->className = 'Tax'; $this->lang = true; @@ -59,13 +58,13 @@ class AdminTaxes extends AdminTab public function displayForm($isMainTab = true) { - global $currentIndex, $cookie; + $context = Context::getContext(); parent::displayForm(); if (!($obj = $this->loadObject(true))) return; $zones = Zone::getZones(true); - $states = State::getStates((int)$cookie->id_lang); + $states = State::getStates($context->language->id); echo '
@@ -104,8 +103,6 @@ class AdminTaxes extends AdminTab public function postProcess() { - global $currentIndex; - if(Tools::getValue('submitAdd'.$this->table)) { /* Checking fields validity */ @@ -164,8 +161,6 @@ class AdminTaxes extends AdminTab protected function _displayDeleteLink($token = NULL, $id) { - global $currentIndex; - $_cacheLang['Delete'] = $this->l('Delete', __CLASS__, TRUE, FALSE); $_cacheLang['DeleteItem'] = $this->l('Delete item #', __CLASS__, TRUE, FALSE).$id.' ?)'; @@ -179,8 +174,6 @@ class AdminTaxes extends AdminTab protected function _displayEnableLink($token, $id, $value, $active, $id_category = NULL, $id_product = NULL) { - global $currentIndex; - $confirm = ($value AND TaxRule::isTaxInUse($id)) ? 'onclick="return confirm(\''. $this->l('This tax is currently in use in a tax rule. If you continue this tax will be removed from the tax rule, are you sure?').'\')"' : ''; echo ''.$this->l('Catalog tracking').''; $this->getObjects('categories_empty'); $this->displayCategories(); @@ -52,8 +50,7 @@ class AdminTracking extends AdminTab public function getObjects($type) { - global $cookie; - + $context = Context::getContext(); switch ($type) { case 'categories_empty': @@ -99,10 +96,10 @@ class AdminTracking extends AdminTab LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON pac.`id_product_attribute` = pa.`id_product_attribute` LEFT JOIN `'._DB_PREFIX_.'attribute` a ON a.`id_attribute` = pac.`id_attribute` LEFT JOIN `'._DB_PREFIX_.'attribute_group` ag ON ag.`id_attribute_group` = a.`id_attribute_group` - LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = '.(int)($cookie->id_lang).') - LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON (ag.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.(int)($cookie->id_lang).') + LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = '.(int)$context->language->id.') + LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON (ag.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.(int)$context->language->id.') LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = pa.`id_product`) - LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int)($cookie->id_lang).') + LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int)$context->language->id.') LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (p.`id_manufacturer` = m.`id_manufacturer`) WHERE pa.quantity <= 0 ORDER BY pa.`id_product_attribute` @@ -115,8 +112,6 @@ class AdminTracking extends AdminTab public function displayCategories() { - global $currentIndex; - if (isset($this->_list['obj'])) { $nbCategories = sizeof($this->_list['obj']); @@ -135,8 +130,7 @@ class AdminTracking extends AdminTab public function displayProducts() { - global $currentIndex, $cookie; - + $context = Context::getContext(); if (isset($this->_list['obj'])) { $nbProducts = sizeof($this->_list['obj']); @@ -166,7 +160,7 @@ class AdminTracking extends AdminTab foreach ($this->_list['obj'] AS $k => $prod) { $product = new Product((int)($prod['id_product'])); - $product->name = $product->name[(int)($cookie->id_lang)]; + $product->name = $product->name[(int)$context->language->id]; $taxrate = Tax::getProductTaxRate($product->id); echo ' @@ -174,16 +168,16 @@ class AdminTracking extends AdminTab
- + - + '; @@ -194,7 +188,7 @@ class AdminTracking extends AdminTab public function displayAttributes() { - global $currentIndex, $cookie; + $context = Context::getContext(); if (isset($this->_list['obj'])) { @@ -246,16 +240,16 @@ class AdminTracking extends AdminTab - + - + '; diff --git a/admin-dev/tabs/AdminTranslations.php b/admin-dev/tabs/AdminTranslations.php index ef699125f..90e2ecbab 100644 --- a/admin-dev/tabs/AdminTranslations.php +++ b/admin-dev/tabs/AdminTranslations.php @@ -110,8 +110,6 @@ class AdminTranslations extends AdminTab protected function writeTranslationFile($type, $path, $mark = false, $fullmark = false) { - global $currentIndex; - if ($fd = fopen($path, 'w')) { unset($_POST['submitTranslations'.$type], $_POST['lang']); @@ -135,8 +133,6 @@ class AdminTranslations extends AdminTab public function submitCopyLang() { - global $currentIndex; - if (!($fromLang = strval(Tools::getValue('fromLang'))) OR !($toLang = strval(Tools::getValue('toLang')))) $this->_errors[] = $this->l('you must select 2 languages in order to copy data from one to another'); elseif (!($fromTheme = strval(Tools::getValue('fromTheme'))) OR !($toTheme = strval(Tools::getValue('toTheme')))) @@ -191,8 +187,6 @@ class AdminTranslations extends AdminTab } public function submitExportLang() { - global $currentIndex; - $lang = strtolower(Tools::getValue('iso_code')); $theme = strval(Tools::getValue('theme')); if ($lang AND $theme) @@ -229,8 +223,6 @@ class AdminTranslations extends AdminTab } public function submitImportLang() { - global $currentIndex; - if (!isset($_FILES['file']['tmp_name']) OR !$_FILES['file']['tmp_name']) $this->_errors[] = Tools::displayError('No file selected'); else @@ -254,8 +246,6 @@ class AdminTranslations extends AdminTab public function submitAddLang() { - global $currentIndex; - $arr_import_lang = explode('|', Tools::getValue('params_import_language')); /* 0 = Language ISO code, 1 = PS version */ if (Validate::isLangIsoCode($arr_import_lang[0])) { @@ -428,8 +418,6 @@ class AdminTranslations extends AdminTab public function postProcess() { - global $currentIndex; - if (Tools::isSubmit('submitCopyLang')) { if ($this->tabAccess['add'] === '1') @@ -582,7 +570,6 @@ class AdminTranslations extends AdminTab */ protected function submitTranslationsMails ($id_lang) { - global $currentIndex; $obj_lang = new Language($id_lang); $params_redirect = (Tools::isSubmit('submitTranslationsMailsAndStay') ? '&lang='.Tools::getValue('lang').'&type='.Tools::getValue('type') : ''); @@ -684,8 +671,7 @@ class AdminTranslations extends AdminTab } public function display() { - global $currentIndex, $cookie; - + $context = Context::getContext(); $translations = array( 'front' => $this->l('Front Office translations'), 'back' => $this->l('Back Office translations'), @@ -794,7 +780,7 @@ class AdminTranslations extends AdminTab
'.$this->l('Copy').'

'.$this->l('Copies data from one language to another.').'
'. $this->l('Be careful, as it will replace all existing data for the destination language!').'
'. - $this->l('If necessary').',
'.$this->l('first create a new language').'.

+ $this->l('If necessary').', '.$this->l('first create a new language').'.

'.$this->l('From:').'
@@ -951,7 +937,6 @@ class AdminTranslations extends AdminTab public function displayFormFront($lang) { - global $currentIndex; $_LANG = $this->fileExists(_PS_THEME_DIR_.'lang', Tools::strtolower($lang).'.php', '_LANG'); $str_output = ''; @@ -1034,7 +1019,6 @@ class AdminTranslations extends AdminTab public function displayFormBack($lang) { - global $currentIndex; $_LANGADM = $this->fileExists(_PS_TRANSLATIONS_DIR_.$lang, 'admin.php', '_LANGADM'); $str_output = ''; /* List templates to parse */ @@ -1108,7 +1092,6 @@ class AdminTranslations extends AdminTab public function displayFormErrors($lang) { - global $currentIndex; $_ERRORS = $this->fileExists(_PS_TRANSLATIONS_DIR_.$lang, 'errors.php', '_ERRORS'); $str_output = ''; @@ -1167,7 +1150,6 @@ class AdminTranslations extends AdminTab public function displayFormFields($lang) { - global $currentIndex; $_FIELDS = $this->fileExists(_PS_TRANSLATIONS_DIR_.$lang, 'fields.php', '_FIELDS'); $str_output = ''; @@ -1487,8 +1469,6 @@ class AdminTranslations extends AdminTab } public function displayFormMails($lang, $noDisplay = false) { - global $cookie, $currentIndex; - $core_mails = array(); $module_mails = array(); $theme_mails = array(); @@ -1662,8 +1642,6 @@ class AdminTranslations extends AdminTab protected function writeSubjectTranslationFile($sub, $path, $mark = false, $fullmark = false) { - global $currentIndex; - if ($fd = @fopen($path, 'w')) { //$tab = ($fullmark ? Tools::strtoupper($fullmark) : 'LANG').($mark ? Tools::strtoupper($mark) : ''); @@ -1746,7 +1724,7 @@ class AdminTranslations extends AdminTab } public function displayFormModules($lang) { - global $currentIndex, $_MODULES; + global $_MODULES; $array_lang_src = Language::getLanguages(false); $str_output = ''; @@ -1837,8 +1815,6 @@ class AdminTranslations extends AdminTab public function displayFormPDF() { - global $currentIndex; - $lang = Tools::strtolower(Tools::getValue('lang')); $_LANG = array(); $str_output = ''; diff --git a/admin-dev/tabs/AdminWebservice.php b/admin-dev/tabs/AdminWebservice.php index 69ed227fe..a5064cfbd 100755 --- a/admin-dev/tabs/AdminWebservice.php +++ b/admin-dev/tabs/AdminWebservice.php @@ -97,7 +97,6 @@ class AdminWebservice extends AdminTab public function displayForm($isMainTab = true) { - global $currentIndex; parent::displayForm(); if (!($obj = $this->loadObject(true))) return; @@ -227,8 +226,7 @@ echo ' public function display() { - global $currentIndex, $cookie; - + $context = Context::getContext(); // Include other tab in current tab if ($this->includeSubTab('display', array('submitAdd2', 'add', 'update', 'view'))){} @@ -246,7 +244,7 @@ echo ' } elseif (isset($_GET['update'.$this->table])) { - if ($this->tabAccess['edit'] === '1' OR ($this->table == 'employee' AND $cookie->id_employee == Tools::getValue('id_employee'))) + if ($this->tabAccess['edit'] === '1' OR ($this->table == 'employee' AND $context->employee->id == Tools::getValue('id_employee'))) { $this->displayForm(); if ($this->tabAccess['view']) @@ -262,7 +260,7 @@ echo ' { $this->checkForWarning(); - $this->getList((int)$cookie->id_lang); + $this->getList($context->language->id); $this->displayList(); $this->displayRequiredFields(); diff --git a/admin-dev/tabs/AdminZones.php b/admin-dev/tabs/AdminZones.php index 5b628db0d..8d8312266 100644 --- a/admin-dev/tabs/AdminZones.php +++ b/admin-dev/tabs/AdminZones.php @@ -48,7 +48,6 @@ class AdminZones extends AdminTab public function displayForm($isMainTab = true) { - global $currentIndex, $cookie; parent::displayForm(); if (!($obj = $this->loadObject(true))) diff --git a/modules/authorizeaim/authorizeaim.php b/modules/authorizeaim/authorizeaim.php index a2f8cf483..b05b95bf9 100755 --- a/modules/authorizeaim/authorizeaim.php +++ b/modules/authorizeaim/authorizeaim.php @@ -65,15 +65,15 @@ class authorizeAIM extends PaymentModule public function hookOrderConfirmation($params) { - global $smarty; + $context = Context::getContext(); if ($params['objOrder']->module != $this->name) return; if ($params['objOrder']->getCurrentState() != _PS_OS_ERROR_) - $smarty->assign(array('status' => 'ok', 'id_order' => intval($params['objOrder']->id))); + $context->controller->smarty->assign(array('status' => 'ok', 'id_order' => intval($params['objOrder']->id))); else - $smarty->assign('status', 'failed'); + $context->controller->smarty->assign('status', 'failed'); return $this->display(__FILE__, 'hookorderconfirmation.tpl'); } @@ -135,7 +135,7 @@ class authorizeAIM extends PaymentModule public function hookPayment($params) { - global $cookie, $smarty; + $context = Context::getContext(); if (!empty($_SERVER['HTTPS']) AND strtolower($_SERVER['HTTPS']) != 'off' AND Configuration::get('PS_SSL_ENABLED')) { @@ -156,8 +156,8 @@ class authorizeAIM extends PaymentModule $authorizeAIMParams['x_amount'] = number_format($params['cart']->getOrderTotal(true, 3), 2, '.', ''); $authorizeAIMParams['x_address'] = $invoiceAddress->address1.' '.$invoiceAddress->address2; $authorizeAIMParams['x_zip'] = $invoiceAddress->postcode; - $authorizeAIMParams['x_first_name'] = $customer->firstname; - $authorizeAIMParams['x_last_name'] = $customer->lastname; + $authorizeAIMParams['x_first_name'] = $context->customer->firstname; + $authorizeAIMParams['x_last_name'] = $context->customer->lastname; $isFailed = Tools::getValue('aimerror'); @@ -167,9 +167,9 @@ class authorizeAIM extends PaymentModule $cards['discover'] = Configuration::get('AUTHORIZE_AIM_CARD_DISCOVER') == 'on' ? 1 : 0; $cards['ax'] = Configuration::get('AUTHORIZE_AIM_CARD_AX') == 'on' ? 1 : 0; - $smarty->assign('p', $authorizeAIMParams); - $smarty->assign('cards', $cards); - $smarty->assign('isFailed', $isFailed); + $context->controller->smarty->assign('p', $authorizeAIMParams); + $context->controller->smarty->assign('cards', $cards); + $context->controller->smarty->assign('isFailed', $isFailed); return $this->display(__FILE__, 'authorizeaim.tpl'); } diff --git a/modules/bankwire/bankwire.php b/modules/bankwire/bankwire.php index fd974e7a4..6f2aa4b5b 100644 --- a/modules/bankwire/bankwire.php +++ b/modules/bankwire/bankwire.php @@ -169,9 +169,9 @@ class BankWire extends PaymentModule if (!$this->_checkCurrency($cart)) Tools::redirect('index.php?controller=order'); - global $cookie, $smarty; + $context = Context::getContext(); - $smarty->assign(array( + $context->controller->smarty->assign(array( 'nbProducts' => $cart->nbProducts(), 'cust_currency' => $cart->id_currency, 'currencies' => $this->getCurrency((int)$cart->id_currency), @@ -190,9 +190,9 @@ class BankWire extends PaymentModule if (!$this->_checkCurrency($params['cart'])) return ; - global $smarty; + $context = Context::getContext(); - $smarty->assign(array( + $context->controller->smarty->assign(array( 'this_path' => $this->_path, 'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/' )); @@ -204,10 +204,10 @@ class BankWire extends PaymentModule if (!$this->active) return ; - global $smarty; + $context = Context::getContext(); $state = $params['objOrder']->getCurrentState(); if ($state == _PS_OS_BANKWIRE_ OR $state == _PS_OS_OUTOFSTOCK_) - $smarty->assign(array( + $context->controller->smarty->assign(array( 'total_to_pay' => Tools::displayPrice($params['total_to_pay'], $params['currencyObj'], false), 'bankwireDetails' => nl2br2($this->details), 'bankwireAddress' => nl2br2($this->address), @@ -216,7 +216,7 @@ class BankWire extends PaymentModule 'id_order' => $params['objOrder']->id )); else - $smarty->assign('status', 'failed'); + $context->controller->smarty->assign('status', 'failed'); return $this->display(__FILE__, 'payment_return.tpl'); } diff --git a/modules/birthdaypresent/birthdaypresent.php b/modules/birthdaypresent/birthdaypresent.php index 91ed0c148..36286222d 100644 --- a/modules/birthdaypresent/birthdaypresent.php +++ b/modules/birthdaypresent/birthdaypresent.php @@ -49,7 +49,7 @@ class BirthdayPresent extends Module public function getContent() { - global $cookie, $currentIndex; + $context = Context::getContext(); if (Tools::isSubmit('submitBirthday')) { @@ -57,7 +57,7 @@ class BirthdayPresent extends Module Configuration::updateValue('BIRTHDAY_DISCOUNT_TYPE', (int)(Tools::getValue('id_discount_type'))); Configuration::updateValue('BIRTHDAY_DISCOUNT_VALUE', (float)(Tools::getValue('discount_value'))); Configuration::updateValue('BIRTHDAY_MINIMAL_ORDER', (float)(Tools::getValue('minimal_order'))); - Tools::redirectAdmin($currentIndex.'&configure=birthdaypresent&token='.Tools::getValue('token').'&conf=4'); + Tools::redirectAdmin(AdminTab::$currentIndex.'&configure=birthdaypresent&token='.Tools::getValue('token').'&conf=4'); } $this->_html = ' @@ -73,7 +73,7 @@ class BirthdayPresent extends Module
'; } else diff --git a/modules/blockbestsellers/blockbestsellers.php b/modules/blockbestsellers/blockbestsellers.php index 3e3ad6c0c..7c3c72b70 100644 --- a/modules/blockbestsellers/blockbestsellers.php +++ b/modules/blockbestsellers/blockbestsellers.php @@ -99,7 +99,7 @@ class BlockBestSellers extends Module if (Configuration::get('PS_CATALOG_MODE')) return ; - global $smarty; + $context = Context::getContext(); $currency = new Currency((int)($params['cookie']->id_currency)); $bestsellers = ProductSale::getBestSalesLight((int)($params['cookie']->id_lang), 0, 5); if (!$bestsellers AND !Configuration::get('PS_BLOCK_BESTSELLERS_DISPLAY')) @@ -110,7 +110,7 @@ class BlockBestSellers extends Module $bestseller['price'] = Tools::displayPrice(Product::getPriceStatic((int)($bestseller['id_product'])), $currency); $best_sellers[] = $bestseller; } - $smarty->assign(array( + $context->controller->smarty->assign(array( 'best_sellers' => $best_sellers, 'mediumSize' => Image::getSize('medium'))); return $this->display(__FILE__, 'blockbestsellers.tpl'); diff --git a/modules/blockcart/blockcart-ajax.php b/modules/blockcart/blockcart-ajax.php index 90106acd6..86dde0721 100644 --- a/modules/blockcart/blockcart-ajax.php +++ b/modules/blockcart/blockcart-ajax.php @@ -24,13 +24,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ - -global $cookie; - include(dirname(__FILE__).'/blockcart.php'); - -$cart = new Cart((int)($cookie->id_cart)); -$cart->id_lang = (int)($cookie->id_lang); - +$context = Context::getContext(); $blockCart = new BlockCart(); -echo $blockCart->hookAjaxCall(array('cookie' => $cookie, 'cart' => $cart)); \ No newline at end of file +echo $blockCart->hookAjaxCall(array('cookie' => $context->cookie, 'cart' => $context->cart)); \ No newline at end of file diff --git a/modules/blockcart/blockcart.php b/modules/blockcart/blockcart.php index f9a9bef38..a544aa6ee 100644 --- a/modules/blockcart/blockcart.php +++ b/modules/blockcart/blockcart.php @@ -46,7 +46,8 @@ class BlockCart extends Module public function smartyAssigns(&$smarty, &$params) { - global $errors, $cookie; + global $errors; + $context = Context::getContext(); // Set currency if (!(int)($params['cart']->id_currency)) @@ -99,7 +100,7 @@ class BlockCart extends Module )); if (sizeof($errors)) $smarty->assign('errors', $errors); - if(isset($cookie->ajax_blockcart_display)) + if(isset($context->cookie->ajax_blockcart_display)) $smarty->assign('colapseExpandStatus', $cookie->ajax_blockcart_display); } @@ -159,9 +160,9 @@ class BlockCart extends Module if (Configuration::get('PS_CATALOG_MODE')) return; - global $smarty; - $smarty->assign('order_page', strpos($_SERVER['PHP_SELF'], 'order') !== false); - $this->smartyAssigns($smarty, $params); + $context = Context::getContext(); + $context->controller->smarty->assign('order_page', strpos($_SERVER['PHP_SELF'], 'order') !== false); + $this->smartyAssigns($context->controller->smarty, $params); return $this->display(__FILE__, 'blockcart.tpl'); } @@ -175,8 +176,8 @@ class BlockCart extends Module if (Configuration::get('PS_CATALOG_MODE')) return; - global $smarty; - $this->smartyAssigns($smarty, $params); + $context = Context::getContext(); + $this->smartyAssigns($context->controller->smarty, $params); $res = $this->display(__FILE__, 'blockcart-json.tpl'); return $res; } diff --git a/modules/blockcategories/blockcategories.php b/modules/blockcategories/blockcategories.php index b5b4b8669..624d4b837 100644 --- a/modules/blockcategories/blockcategories.php +++ b/modules/blockcategories/blockcategories.php @@ -124,7 +124,7 @@ class BlockCategories extends Module public function getTree($resultParents, $resultIds, $maxDepth, $id_category = 1, $currentDepth = 0) { - global $link; + $context = Context::getContext(); $children = array(); if (isset($resultParents[$id_category]) AND sizeof($resultParents[$id_category]) AND ($maxDepth == 0 OR $currentDepth < $maxDepth)) @@ -132,7 +132,7 @@ class BlockCategories extends Module $children[] = $this->getTree($resultParents, $resultIds, $maxDepth, $subcat['id_category'], $currentDepth + 1); if (!isset($resultIds[$id_category])) return false; - $return = array('id' => $id_category, 'link' => $link->getCategoryLink($id_category, $resultIds[$id_category]['link_rewrite']), + $return = array('id' => $id_category, 'link' => $context->link->getCategoryLink($id_category, $resultIds[$id_category]['link_rewrite']), 'name' => $resultIds[$id_category]['name'], 'desc'=> $resultIds[$id_category]['description'], 'children' => $children); return $return; diff --git a/modules/blockcms/blockcms.php b/modules/blockcms/blockcms.php index 748bf877f..93f1f26cb 100755 --- a/modules/blockcms/blockcms.php +++ b/modules/blockcms/blockcms.php @@ -115,14 +115,14 @@ class BlockCms extends Module private function getBlocksCMS($location) { - global $cookie; + $context = Context::getContext(); return Db::getInstance()->ExecuteS(' SELECT bc.`id_cms_block`, bcl.`name` block_name, ccl.`name` category_name, bc.`position`, bc.`id_cms_category`, bc.`display_store` FROM `'._DB_PREFIX_.'cms_block` bc INNER JOIN `'._DB_PREFIX_.'cms_category_lang` ccl ON (bc.`id_cms_category` = ccl.`id_cms_category`) INNER JOIN `'._DB_PREFIX_.'cms_block_lang` bcl ON (bc.`id_cms_block` = bcl.`id_cms_block`) - WHERE ccl.`id_lang` = '.(int)$cookie->id_lang.' AND bc.`location` = '.(int)$location.' AND bcl.`id_lang` = '.(int)$cookie->id_lang.' + WHERE ccl.`id_lang` = '.(int)$context->language->id.' AND bc.`location` = '.(int)$location.' AND bcl.`id_lang` = '.(int)$context->language->id.' ORDER BY bc.`position`'); } @@ -299,8 +299,7 @@ class BlockCms extends Module private function _displayForm() { - global $currentIndex, $cookie; - + $context = Context::getContext(); $cms_blocks_left = $this->getBlocksCMS(0); $cms_blocks_right = $this->getBlocksCMS(1); @@ -311,7 +310,7 @@ class BlockCms extends Module
'.$this->l('CMS block configuration').' -

'.$this->l('Add a new CMS block').'

'; +

'.$this->l('Add a new CMS block').'

'; $this->_html .= '

'.$this->l('List of Left CMS blocks').'

'; if (sizeof($cms_blocks_left)) @@ -337,14 +336,14 @@ class BlockCms extends Module
'; } @@ -380,14 +379,14 @@ class BlockCms extends Module '; } @@ -410,7 +409,7 @@ class BlockCms extends Module '; - $this->displayRecurseCheckboxes(CMSCategory::getRecurseCategory($cookie->id_lang), explode('|', Configuration::get('FOOTER_CMS'))); + $this->displayRecurseCheckboxes(CMSCategory::getRecurseCategory($context->language->id), explode('|', Configuration::get('FOOTER_CMS'))); $this->_html .= '
'.$this->l('Attribute name').''.$this->l('Quantity').'
'.$product->id.' '.($product->manufacturer_name != NULL ? stripslashes($product->manufacturer_name) : '--').' '.$product->reference.''.stripslashes($product->name).''.stripslashes($product->name).' '.Tools::displayPrice($product->getPrice(), $currency).' '.(float)$taxrate.'% '.$product->quantity.' '.$product->weight.' '.Configuration::get('PS_WEIGHT_UNIT').' - + '.$this->l('Modify this product').'  - name)).' ?\');"> + name)).' ?\');"> '.$this->l('Delete this product').'
'.$prod['id_product'].' '.($prod['manufacturer_name'] != NULL ? stripslashes($prod['manufacturer_name']) : '--').' '.$prod['reference'].''.stripslashes($prod['name']).' ('.$prod['combination_name'].')'.''.stripslashes($prod['name']).' ('.$prod['combination_name'].')'.' '.Tools::displayPrice(Product::getPriceStatic((int)($prod['id_product']), true, $prod['id_product_attribute']), $currency).' '.(float)$taxrate.'% '.$prod['quantity'].' '.($prod['weight'] + $prod['product_weight']).' '.Configuration::get('PS_WEIGHT_UNIT').' - + '.$this->l('Modify this product').'  - + '.$this->l('Delete this product').'
'.(empty($cms_block['block_name']) ? $cms_block['category_name'] : $cms_block['block_name']).' '.$cms_block['category_name'].' - + '.$this->l('Down').' - + '.$this->l('Up').' - - + +
'.(empty($cms_block['block_name']) ? $cms_block['category_name'] : $cms_block['block_name']).' '.$cms_block['category_name'].' - + '.$this->l('Down').' - + '.$this->l('Up').' - - + +
'.$this->l('ID').' '.$this->l('Name').'

@@ -420,8 +419,7 @@ class BlockCms extends Module private function _displayAddForm() { - global $currentIndex, $cookie; - + $context = Context::getContext(); $defaultLanguage = (int)Configuration::get('PS_LANG_DEFAULT'); $languages = Language::getLanguages(false); $divLangName = 'name'; @@ -460,7 +458,7 @@ class BlockCms extends Module
@@ -487,7 +485,7 @@ class BlockCms extends Module $this->_html .= '

- '.$this->l('Cancel').' + '.$this->l('Cancel').'

'; $this->_html .= ' @@ -568,13 +566,11 @@ class BlockCms extends Module SET `position` = '.((int)Tools::getValue('position')).' WHERE `id_cms_block` = '.(int)Tools::getValue('id_cms_block')); } - Tools::redirectAdmin($currentIndex.'index.php?tab=AdminModules&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules')); + Tools::redirectAdmin(AdminTab::$currentIndex.'index.php?tab=AdminModules&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules')); } private function _postProcess() { - global $currentIndex; - if (Tools::isSubmit('submitBlockCMS')) { $position = Db::getInstance()->getValue(' @@ -641,9 +637,9 @@ class BlockCms extends Module VALUES('.(int)$id_cms_block.', '.(int)$cms_properties[1].', '.(int)$cms_properties[0].')'); } if (Tools::isSubmit('addBlockCMS')) - Tools::redirectAdmin($currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&addBlockCMSConfirmation'); + Tools::redirectAdmin(AdminTab::$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&addBlockCMSConfirmation'); elseif (Tools::isSubmit('editBlockCMS')) - Tools::redirectAdmin($currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&editBlockCMSConfirmation'); + Tools::redirectAdmin(AdminTab::$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&editBlockCMSConfirmation'); } elseif (Tools::isSubmit('deleteBlockCMS') AND Tools::getValue('id_cms_block')) { @@ -664,7 +660,7 @@ class BlockCms extends Module DELETE FROM `'._DB_PREFIX_.'cms_block_page` WHERE `id_cms_block` = '.(int)(Tools::getValue('id_cms_block'))); - Tools::redirectAdmin($currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&deleteBlockCMSConfirmation'); + Tools::redirectAdmin(AdminTab::$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&deleteBlockCMSConfirmation'); } else $this->_html .= $this->displayError($this->l('Error: you are trying to delete a non-existent block cms')); @@ -705,10 +701,9 @@ class BlockCms extends Module public function hookLeftColumn() { - global $smarty; - + $context = Context::getContext(); $cms_titles = self::getCMStitles(self::LEFT_COLUMN); - $smarty->assign(array( + $context->controller->smarty->assign(array( 'block' => 1, 'cms_titles' => $cms_titles, 'theme_dir' => _PS_THEME_DIR_ @@ -718,10 +713,10 @@ class BlockCms extends Module public function hookRightColumn() { - global $smarty; + $context = Context::getContext(); $cms_titles = self::getCMStitles(self::RIGHT_COLUMN); - $smarty->assign(array( + $context->controller->smarty->assign(array( 'block' => 1, 'cms_titles' => $cms_titles, 'theme_dir' => _PS_THEME_DIR_ @@ -731,12 +726,12 @@ class BlockCms extends Module public function hookFooter() { - global $smarty; + $context = Context::getContext(); if (Configuration::get('FOOTER_BLOCK_ACTIVATION')) { $cms_titles = self::getCMStitlesFooter(); - $smarty->assign(array( + $context->controller->smarty->assign(array( 'block' => 0, 'cmslinks' => $cms_titles, 'theme_dir' => _PS_THEME_DIR_, diff --git a/modules/blockcurrencies/blockcurrencies.php b/modules/blockcurrencies/blockcurrencies.php index 9fbbd3584..8bf2aca30 100644 --- a/modules/blockcurrencies/blockcurrencies.php +++ b/modules/blockcurrencies/blockcurrencies.php @@ -60,13 +60,13 @@ class BlockCurrencies extends Module if (Configuration::get('PS_CATALOG_MODE')) return ; - global $smarty; + $context = Context::getContext(); $id_current_shop = $this->shopID; $currencies = Currency::getCurrencies(false, 1, $id_current_shop); if (!sizeof($currencies)) return ''; - $smarty->assign('currencies', $currencies); + $context->controller->smarty->assign('currencies', $currencies); return $this->display(__FILE__, 'blockcurrencies.tpl'); } diff --git a/modules/blocklanguages/blocklanguages.php b/modules/blocklanguages/blocklanguages.php index 2f8aeaa52..5603deefe 100644 --- a/modules/blocklanguages/blocklanguages.php +++ b/modules/blocklanguages/blocklanguages.php @@ -57,12 +57,12 @@ class BlockLanguages extends Module */ function hookTop($params) { - global $smarty; + $context = Context::getContext(); $languages = Language::getLanguages(true, $this->shopID); if (!sizeof($languages)) return ''; - $smarty->assign('languages', $languages); + $context->controller->smarty->assign('languages', $languages); return $this->display(__FILE__, 'blocklanguages.tpl'); } diff --git a/modules/blocklayered/blocklayered-ajax.php b/modules/blocklayered/blocklayered-ajax.php index 63e60df63..cc15c3f0f 100644 --- a/modules/blocklayered/blocklayered-ajax.php +++ b/modules/blocklayered/blocklayered-ajax.php @@ -25,8 +25,6 @@ * International Registred Trademark & Property of PrestaShop SA */ -global $cookie; - include(dirname(__FILE__).'/../../config/config.inc.php'); include(dirname(__FILE__).'/../../init.php'); include(dirname(__FILE__).'/blocklayered.php'); diff --git a/modules/blocklayered/blocklayered.php b/modules/blocklayered/blocklayered.php index e8b06f4ed..060d24fe6 100644 --- a/modules/blocklayered/blocklayered.php +++ b/modules/blocklayered/blocklayered.php @@ -405,8 +405,7 @@ class BlockLayered extends Module public function generateFiltersBlock($selectedFilters = array()) { - global $smarty, $link, $cookie; - $id_lang = (int)$cookie->id_lang; + $context = Context::getContext(); /* If the current category isn't defined of if it's homepage, we have nothing to display */ $id_parent = (int)Tools::getValue('id_category', Tools::getValue('id_category_layered', 1)); @@ -420,7 +419,7 @@ class BlockLayered extends Module SELECT c.id_category, c.id_parent, cl.name FROM '._DB_PREFIX_.'category c LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = c.id_category) - WHERE c.nleft > '.(int)$category->nleft.' and c.nright <= '.(int)$category->nright.' AND c.active = 1 AND c.id_parent = '.(int)$category->id.' AND cl.id_lang = '.(int)$cookie->id_lang.' + WHERE c.nleft > '.(int)$category->nleft.' and c.nright <= '.(int)$category->nright.' AND c.active = 1 AND c.id_parent = '.(int)$category->id.' AND cl.id_lang = '.(int)$context->language->id.' ORDER BY c.position ASC'); $whereC = ' cp.`id_category` = '.(int)$id_parent.' OR '; @@ -483,7 +482,7 @@ class BlockLayered extends Module SELECT fvl.id_feature_value, fvl.value FROM '._DB_PREFIX_.'feature_value fv LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.id_feature_value = fv.id_feature_value) - WHERE (fv.custom IS NULL OR fv.custom = 0) AND fv.id_feature = '.(int)$filterBlocks[(int)$filter['position']]['id_key'].' AND fvl.id_lang = '.(int)$id_lang); + WHERE (fv.custom IS NULL OR fv.custom = 0) AND fv.id_feature = '.(int)$filterBlocks[(int)$filter['position']]['id_key'].' AND fvl.id_lang = '.(int)$context->language->id); break; @@ -494,7 +493,7 @@ class BlockLayered extends Module SELECT al.id_attribute, al.name, a.color FROM '._DB_PREFIX_.'attribute a LEFT JOIN '._DB_PREFIX_.'attribute_lang al ON (al.id_attribute = a.id_attribute) - WHERE a.id_attribute_group = '.(int)$filterBlocks[(int)$filter['position']]['id_key'].' AND al.id_lang = '.(int)$id_lang); + WHERE a.id_attribute_group = '.(int)$filterBlocks[(int)$filter['position']]['id_key'].' AND al.id_lang = '.(int)$context->language->id); break; } } @@ -505,7 +504,7 @@ class BlockLayered extends Module $fNames = Db::getInstance()->ExecuteS(' SELECT id_feature, name FROM '._DB_PREFIX_.'feature_lang - WHERE id_lang = '.(int)$cookie->id_lang.' AND id_feature IN ('.implode(',', $f).')'); + WHERE id_lang = '.(int)$context->language->id.' AND id_feature IN ('.implode(',', $f).')'); $fNameByID = array(); foreach ($fNames AS $fName) $fNameByID[(int)$fName['id_feature']] = $fName['name']; @@ -518,7 +517,7 @@ class BlockLayered extends Module SELECT ag.id_attribute_group, agl.public_name, ag.is_color_group FROM '._DB_PREFIX_.'attribute_group ag LEFT JOIN '._DB_PREFIX_.'attribute_group_lang agl ON (agl.id_attribute_group = ag.id_attribute_group) - WHERE agl.id_lang = '.(int)$cookie->id_lang.' AND ag.id_attribute_group IN ('.implode(',', $a).')'); + WHERE agl.id_lang = '.(int)$context->language->id.' AND ag.id_attribute_group IN ('.implode(',', $a).')'); $aNameByID = $colorGroups = array(); foreach ($aNames AS $aName) @@ -714,9 +713,9 @@ class BlockLayered extends Module foreach ($_GET as $key => $val) $params .= $key.'='.$val.'&'; - $share_url = $link->getCategoryLink((int)$category->id, $category->link_rewrite[(int)$cookie->id_lang], (int)$cookie->id_lang).rtrim($params, '&'); + $share_url = $context->link->getCategoryLink((int)$category->id, $category->link_rewrite[(int)$context->language->id], $context->language->id).rtrim($params, '&'); - $smarty->assign(array( + $context->controller->smarty->assign(array( 'display_share' => (int)Configuration::get('PS_LAYERED_SHARE'), 'share_url' => $this->getShortLink($share_url), 'layered_use_checkboxes' => (int)Configuration::get('PS_LAYERED_NAVIGATION_CHECKBOXES'), @@ -731,11 +730,11 @@ class BlockLayered extends Module public function ajaxCall() { - global $smarty, $cookie; + $context = Context::getContext(); $selectedFilters = $this->getSelectedFilters(); $products = $this->getProductByFilters($selectedFilters); - $products = Product::getProductsProperties((int)$cookie->id_lang, $products); + $products = Product::getProductsProperties($context->language->id, $products); $nbProducts = $this->nbr_products; $range = 2; /* how many pages around page selected */ @@ -757,7 +756,7 @@ class BlockLayered extends Module if ($stop > $pages_nb) $stop = (int)($pages_nb); - $smarty->assign('nb_products', $nbProducts); + $context->controller->smarty->assign('nb_products', $nbProducts); $pagination_infos = array( 'pages_nb' => (int)($pages_nb), 'p' => (int)($p), @@ -767,15 +766,15 @@ class BlockLayered extends Module 'stop' => (int)($stop), 'nArray' => $nArray = (int)(Configuration::get('PS_PRODUCTS_PER_PAGE')) != 10 ? array((int)(Configuration::get('PS_PRODUCTS_PER_PAGE')), 10, 20, 50) : array(10, 20, 50) ); - $smarty->assign($pagination_infos); + $context->controller->smarty->assign($pagination_infos); - $smarty->assign('products', $products); + $context->controller->smarty->assign('products', $products); /* We are sending an array in jSon to the .js controller, it will update both the filters and the products zones */ return Tools::jsonEncode(array( 'filtersBlock' => $this->generateFiltersBlock($selectedFilters), - 'productList' => $smarty->fetch(_PS_THEME_DIR_.'product-list.tpl'), - 'pagination' => $smarty->fetch(_PS_THEME_DIR_.'pagination.tpl') + 'productList' => $context->controller->smarty->fetch(_PS_THEME_DIR_.'product-list.tpl'), + 'pagination' => $context->controller->smarty->fetch(_PS_THEME_DIR_.'pagination.tpl') )); // return '
'.$this->generateFiltersBlock($selectedFilters).'
'.$smarty->fetch(_PS_THEME_DIR_.'product-list.tpl').'
'; } diff --git a/modules/blocklink/blocklink.php b/modules/blocklink/blocklink.php index ba8b993db..a1bd03db3 100644 --- a/modules/blocklink/blocklink.php +++ b/modules/blocklink/blocklink.php @@ -83,14 +83,14 @@ class BlockLink extends Module public function hookLeftColumn($params) { - global $cookie, $smarty; + $context = Context::getContext(); $links = $this->getLinks(); - $smarty->assign(array( + $context->controller->smarty->assign(array( 'blocklink_links' => $links, - 'title' => Configuration::get('PS_BLOCKLINK_TITLE', $cookie->id_lang), + 'title' => Configuration::get('PS_BLOCKLINK_TITLE', $context->language->id), 'url' => Configuration::get('PS_BLOCKLINK_URL'), - 'lang' => 'text_'.$cookie->id_lang + 'lang' => 'text_'.$context->language->id )); if (!$links) return false; @@ -255,7 +255,6 @@ class BlockLink extends Module private function _displayForm() { - global $cookie; /* Language */ $defaultLanguage = (int)(Configuration::get('PS_LANG_DEFAULT')); $languages = Language::getLanguages(false); @@ -329,15 +328,14 @@ class BlockLink extends Module private function _list() { $links = $this->getLinks(); - - global $currentIndex, $cookie, $adminObj; + $context = Context::getContext(); $languages = Language::getLanguages(); if ($links) { $this->_html .= '