diff --git a/admin-dev/tabs/AdminCMSCategories.php b/admin-dev/tabs/AdminCMSCategories.php index f396827b7..d41eea8cc 100644 --- a/admin-dev/tabs/AdminCMSCategories.php +++ b/admin-dev/tabs/AdminCMSCategories.php @@ -35,9 +35,7 @@ class AdminCMSCategories extends AdminTab private $_CMSCategory; public function __construct() - { - global $cookie; - + { $this->table = 'cms_category'; $this->className = 'CMSCategory'; $this->lang = true; @@ -62,7 +60,6 @@ class AdminCMSCategories extends AdminTab public function displayList($token = NULL) { - global $currentIndex; /* Display list header (filtering, pagination and column names) */ $this->displayListHeader($token); if (!sizeof($this->_list)) @@ -77,10 +74,9 @@ class AdminCMSCategories extends AdminTab public function display($token = NULL) { - global $currentIndex, $cookie; $id_cms_category = (int)(Tools::getValue('id_cms_category', 1)); - $this->getList((int)($cookie->id_lang), !$cookie->__get($this->table.'Orderby') ? 'position' : NULL, !$cookie->__get($this->table.'Orderway') ? 'ASC' : NULL); + $this->getList((int)($cookie->id_lang), !$context->cookie->__get($this->table.'Orderby') ? 'position' : NULL, !$context->cookie->__get($this->table.'Orderway') ? 'ASC' : NULL); echo '

'.(!$this->_listTotal ? ($this->l('There are no subcategories')) : ($this->_listTotal.' '.($this->_listTotal > 1 ? $this->l('subcategories') : $this->l('subCMS Category')))).' '.$this->l('in CMS Category').' "'.stripslashes(CMSCategory::hideCMSCategoryPosition($this->_CMSCategory->getName())).'"

'; echo ' '.$this->l('Add a new sub CMS Category').' @@ -90,11 +86,9 @@ class AdminCMSCategories extends AdminTab } public function postProcess($token = NULL) - { - global $cookie, $currentIndex; - - $this->tabAccess = Profile::getProfileAccess($cookie->profile, $this->id); - + { + $context = Context::getContext(); + $this->tabAccess = Profile::getProfileAccess($context->employee->id_profile, $this->id); if (Tools::isSubmit('submitAdd'.$this->table)) { @@ -196,7 +190,7 @@ class AdminCMSCategories extends AdminTab public function displayForm($token=NULL) { - global $currentIndex, $cookie; + $context = Context::getContext(); parent::displayForm(); if (!($obj = $this->loadObject(true))) @@ -227,7 +221,7 @@ class AdminCMSCategories extends AdminTab
diff --git a/admin-dev/tabs/AdminCMSContent.php b/admin-dev/tabs/AdminCMSContent.php index 84c2f0ba5..6771c2674 100644 --- a/admin-dev/tabs/AdminCMSContent.php +++ b/admin-dev/tabs/AdminCMSContent.php @@ -91,8 +91,6 @@ class AdminCMSContent extends AdminTab public function display() { - global $currentIndex; - if (((Tools::isSubmit('submitAddcms_category') OR Tools::isSubmit('submitAddcms_categoryAndStay')) AND sizeof($this->adminCMSCategories->_errors)) OR isset($_GET['updatecms_category']) OR isset($_GET['addcms_category'])) { $this->adminCMSCategories->displayForm($this->token); diff --git a/admin-dev/tabs/AdminCarriers.php b/admin-dev/tabs/AdminCarriers.php index e60bccc40..f90672528 100644 --- a/admin-dev/tabs/AdminCarriers.php +++ b/admin-dev/tabs/AdminCarriers.php @@ -135,7 +135,7 @@ class AdminCarriers extends AdminTab
'; - $groups = Group::getGroups(Context::getContext()->language->id)); + $groups = Group::getGroups(Context::getContext()->language->id); if (sizeof($groups)) { echo ' diff --git a/admin-dev/tabs/AdminContact.php b/admin-dev/tabs/AdminContact.php index afd9933c5..412d0de53 100644 --- a/admin-dev/tabs/AdminContact.php +++ b/admin-dev/tabs/AdminContact.php @@ -44,15 +44,14 @@ class AdminContact extends AdminPreferences private function _getDefaultFieldsContent() { - global $cookie; - + $context = Context::getContext(); $countryList = array(); $countryList[] = array('id' => '0', 'name' => $this->l('Choose your country')); - foreach (Country::getCountries(intval($cookie->id_lang)) AS $country) + foreach (Country::getCountries($context->language->id) AS $country) $countryList[] = array('id' => $country['id_country'], 'name' => $country['name']); $stateList = array(); $stateList[] = array('id' => '0', 'name' => $this->l('Choose your state (if applicable)')); - foreach (State::getStates(intval($cookie->id_lang)) AS $state) + foreach (State::getStates($context->language->id) AS $state) $stateList[] = array('id' => $state['id_state'], 'name' => $state['name']); $formFields = array( @@ -109,10 +108,10 @@ class AdminContact extends AdminPreferences protected function _postConfig($fields) { - global $cookie; + $context = Context::getContext(); if (!$this->_errors && isset($_POST['PS_SHOP_COUNTRY_ID'])) { - $country = new Country((int)($_POST['PS_SHOP_COUNTRY_ID']), intval($cookie->id_lang)); + $country = new Country($_POST['PS_SHOP_COUNTRY_ID'], $context->language->id); Configuration::updateValue('PS_SHOP_COUNTRY', pSQL($country->name)); } if (!$this->_errors && isset($_POST['PS_SHOP_STATE_ID'])) diff --git a/admin-dev/tabs/AdminCounty.php b/admin-dev/tabs/AdminCounty.php index 9f8b31cee..68ad4868d 100644 --- a/admin-dev/tabs/AdminCounty.php +++ b/admin-dev/tabs/AdminCounty.php @@ -29,8 +29,6 @@ class AdminCounty extends AdminTab { public function __construct() { - global $cookie; - $this->table = 'county'; $this->className = 'County'; $this->edit = true; @@ -108,7 +106,7 @@ class AdminCounty extends AdminTab public function displayForm($isMainTab = true) { - global $currentIndex, $cookie; + $context = Context::getContext(); parent::displayForm(); if (!($obj = $this->loadObject(true))) @@ -134,7 +132,7 @@ class AdminCounty extends AdminTab if (!isset($obj->id)) echo '
'.$this->l('Save this county then you will be able to associate zipcodes').'

'; - $countries = Country::getCountries($cookie->id_lang, true, true); + $countries = Country::getCountries($context->language->id, true, true); echo '
'; - $discountTypes = Discount::getDiscountTypes((int)($cookie->id_lang)); + $discountTypes = Discount::getDiscountTypes($context->language->id); foreach ($discountTypes AS $discountType) echo ''; @@ -284,7 +282,7 @@ class AdminDiscounts extends AdminTab $done = array(); $index = array(); $indexedCategories = isset($_POST['categoryBox']) ? $_POST['categoryBox'] : ($obj->id ? Discount::getCategories($obj->id) : array()); - $categories = Category::getCategories((int)($cookie->id_lang), false); + $categories = Category::getCategories($context->language->id, false); foreach ($indexedCategories AS $k => $row) $index[] = $row['id_category']; $this->recurseCategoryForInclude((int)(Tools::getValue($this->identifier)), $index, $categories, $categories[0][1], 1, $obj->id); diff --git a/admin-dev/tabs/AdminEmails.php b/admin-dev/tabs/AdminEmails.php index 639f388ab..d52937aa6 100644 --- a/admin-dev/tabs/AdminEmails.php +++ b/admin-dev/tabs/AdminEmails.php @@ -31,12 +31,11 @@ class AdminEmails extends AdminPreferences { public function __construct() { - global $cookie; - + $context = Context::getContext(); $this->className = 'Configuration'; $this->table = 'configuration'; - foreach (Contact::getContacts((int)$cookie->id_lang) AS $contact) + foreach (Contact::getContacts($context->language->id) AS $contact) $arr[] = array('email_message' => $contact['id_contact'], 'name' => $contact['name']); $this->_fieldsEmail = array( diff --git a/admin-dev/tabs/AdminEmployees.php b/admin-dev/tabs/AdminEmployees.php index 52c3ae033..97c7685ad 100644 --- a/admin-dev/tabs/AdminEmployees.php +++ b/admin-dev/tabs/AdminEmployees.php @@ -32,8 +32,7 @@ class AdminEmployees extends AdminTab public function __construct() { - global $cookie; - + $context = Context::getContext(); $this->table = 'employee'; $this->className = 'Employee'; $this->lang = false; @@ -41,9 +40,9 @@ class AdminEmployees extends AdminTab $this->delete = true; $this->_select = 'pl.`name` AS profile'; $this->_join = 'LEFT JOIN `'._DB_PREFIX_.'profile` p ON a.`id_profile` = p.`id_profile` - LEFT JOIN `'._DB_PREFIX_.'profile_lang` pl ON (pl.`id_profile` = p.`id_profile` AND pl.`id_lang` = '.(int)($cookie->id_lang).')'; + LEFT JOIN `'._DB_PREFIX_.'profile_lang` pl ON (pl.`id_profile` = p.`id_profile` AND pl.`id_lang` = '.(int)$context->language->id.')'; - $profiles = Profile::getProfiles((int)($cookie->id_lang)); + $profiles = Profile::getProfiles($context->language->id); if (!$profiles) $this->_errors[] = Tools::displayError('No profile'); else @@ -83,12 +82,12 @@ class AdminEmployees extends AdminTab public function displayForm($isMainTab = true) { - global $currentIndex, $cookie; + $context = Context::getContext(); parent::displayForm(); if (!($obj = $this->loadObject(true))) return; - $profiles = Profile::getProfiles((int)($cookie->id_lang)); + $profiles = Profile::getProfiles($context->language->id); echo ' -
+ diff --git a/admin-dev/tabs/AdminImages.php b/admin-dev/tabs/AdminImages.php index d1b324b6d..c75ed23c0 100644 --- a/admin-dev/tabs/AdminImages.php +++ b/admin-dev/tabs/AdminImages.php @@ -56,7 +56,6 @@ class AdminImages extends AdminTab public function postProcess() { - global $currentIndex; if (Tools::getValue('submitRegenerate'.$this->table)) { if ($this->tabAccess['edit'] === '1') @@ -80,7 +79,6 @@ class AdminImages extends AdminTab public function displayForm($isMainTab = true) { - global $currentIndex; parent::displayForm(); if (!($obj = $this->loadObject(true))) @@ -166,13 +164,9 @@ class AdminImages extends AdminTab /** * Display form for thumbnails regeneration - * - * @global string $currentIndex Current URL in order to keep current Tab */ public function displayRegenerate() { - global $currentIndex; - $types = array( 'categories' => $this->l('Categories'), 'manufacturers' => $this->l('Manufacturers'), @@ -407,8 +401,6 @@ class AdminImages extends AdminTab */ public function displayMoveImages() { - global $currentIndex; - echo '

'.$this->l('Move images').'

'. $this->l('A new storage system for product images is now used by PrestaShop. It offers better performance if your shop has a very large number of products.').'
'. @@ -433,7 +425,6 @@ class AdminImages extends AdminTab */ private function _moveImagesToNewFileSystem() { - global $currentIndex; ini_set('max_execution_time', $this->max_execution_time); // ini_set may be disabled, we need the real value $this->max_execution_time = (int)ini_get('max_execution_time'); $result = Image::moveToNewFileSystem($this->max_execution_time); diff --git a/admin-dev/tabs/AdminInformation.php b/admin-dev/tabs/AdminInformation.php index ca74e4006..ca54d1f19 100644 --- a/admin-dev/tabs/AdminInformation.php +++ b/admin-dev/tabs/AdminInformation.php @@ -127,8 +127,6 @@ class AdminInformation extends AdminTab public function display() { - global $currentIndex; - echo '

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

diff --git a/admin-dev/tabs/AdminInvoices.php b/admin-dev/tabs/AdminInvoices.php index d33b6fbc7..e9ee1445d 100644 --- a/admin-dev/tabs/AdminInvoices.php +++ b/admin-dev/tabs/AdminInvoices.php @@ -29,8 +29,6 @@ class AdminInvoices extends AdminTab { public function __construct() { - global $cookie; - $this->table = 'invoice'; $this->optionTitle = $this->l('Invoice options'); @@ -45,9 +43,8 @@ class AdminInvoices extends AdminTab public function displayForm($isMainTab = true) { - global $currentIndex, $cookie; - - $statuses = OrderState::getOrderStates($cookie->id_lang); + $context = Context::getContext(); + $statuses = OrderState::getOrderStates($context->language->id); $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' SELECT COUNT(*) as nbOrders, ( SELECT oh.id_order_state @@ -117,8 +114,6 @@ class AdminInvoices extends AdminTab public function postProcess() { - global $currentIndex; - if (Tools::isSubmit('submitPrint')) { if (!Validate::isDate(Tools::getValue('date_from'))) diff --git a/admin-dev/tabs/AdminLanguages.php b/admin-dev/tabs/AdminLanguages.php index 979f7fbcb..9f8e776a3 100644 --- a/admin-dev/tabs/AdminLanguages.php +++ b/admin-dev/tabs/AdminLanguages.php @@ -120,8 +120,7 @@ class AdminLanguages extends AdminTab public function postProcess() { - global $currentIndex, $cookie; - + $context = Context::getContext(); if (isset($_GET['delete'.$this->table])) { if ($this->tabAccess['delete'] === '1') @@ -133,7 +132,7 @@ class AdminLanguages extends AdminTab $this->_errors[] = $this->l('You cannot delete the English language as it is a system requirement, you can only deactivate it.'); if ($object->id == Configuration::get('PS_LANG_DEFAULT')) $this->_errors[] = $this->l('you cannot delete the default language'); - elseif ($object->id == $cookie->id_lang) + elseif ($object->id == clan) $this->_errors[] = $this->l('You cannot delete the language currently in use. Please change languages before deleting.'); elseif ($this->deleteNoPictureImages((int)(Tools::getValue('id_lang'))) AND $object->delete()) Tools::redirectAdmin(self::$currentIndex.'&conf=1'.'&token='.$this->token); @@ -150,7 +149,7 @@ class AdminLanguages extends AdminTab { if (in_array(Configuration::get('PS_LANG_DEFAULT'), $_POST[$this->table.'Box'])) $this->_errors[] = $this->l('you cannot delete the default language'); - elseif (in_array($cookie->id_lang, $_POST[$this->table.'Box'])) + elseif (in_array($context->language->id, $_POST[$this->table.'Box'])) $this->_errors[] = $this->l('you cannot delete the language currently in use, please change languages before deleting'); else { @@ -244,8 +243,6 @@ class AdminLanguages extends AdminTab public function displayList() { - global $currentIndex; - $this->displayWarning($this->l('When you delete a language, all related translations in the database will be deleted.')); parent::displayList(); $languages = Language::getLanguages(false); @@ -253,8 +250,6 @@ class AdminLanguages extends AdminTab public function displayListContent($token=NULL) { - global $currentIndex; - $irow = 0; if ($this->_list) @@ -313,7 +308,6 @@ class AdminLanguages extends AdminTab public function displayForm($isMainTab = true) { - global $currentIndex; parent::displayForm(); if (!($obj = $this->loadObject(true))) diff --git a/admin-dev/tabs/AdminLocalization.php b/admin-dev/tabs/AdminLocalization.php index 5dabed396..759dae5fc 100644 --- a/admin-dev/tabs/AdminLocalization.php +++ b/admin-dev/tabs/AdminLocalization.php @@ -31,9 +31,6 @@ class AdminLocalization extends AdminPreferences { public function __construct() { - global $cookie; - - $lang = strtoupper(Language::getIsoById($cookie->id_lang)); $this->className = 'Configuration'; $this->table = 'configuration'; @@ -52,8 +49,6 @@ class AdminLocalization extends AdminPreferences public function postProcess() { - global $currentIndex; - if (isset($_POST['submitLocalization'.$this->table])) { if ($this->tabAccess['edit'] === '1') @@ -89,8 +84,6 @@ class AdminLocalization extends AdminPreferences public function display() { - global $currentIndex; - $this->_displayForm('localization', $this->_fieldsLocalization, $this->l('Localization'), 'width2', 'localization'); echo '
diff --git a/admin-dev/tabs/AdminManufacturers.php b/admin-dev/tabs/AdminManufacturers.php index 12ed725de..872b0a5af 100644 --- a/admin-dev/tabs/AdminManufacturers.php +++ b/admin-dev/tabs/AdminManufacturers.php @@ -34,7 +34,7 @@ class AdminManufacturers extends AdminTab public function __construct() { - global $cookie; + $context = Context::getContext(); $this->table = 'manufacturer'; $this->className = 'Manufacturer'; @@ -43,7 +43,7 @@ class AdminManufacturers extends AdminTab $this->delete = true; // Sub tab addresses - $countries = Country::getCountries((int)($cookie->id_lang)); + $countries = Country::getCountries($context->language->id); foreach ($countries AS $country) $this->countriesArray[$country['id_country']] = $country['name']; $this->fieldsDisplayAddresses = array( @@ -56,7 +56,7 @@ class AdminManufacturers extends AdminTab 'country' => array('title' => $this->l('Country'), 'width' => 100, 'type' => 'select', 'select' => $this->countriesArray, 'filter_key' => 'cl!id_country')); $this->_includeTabTitle = array($this->l('Manufacturers addresses')); $this->_joinAddresses = 'LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON - (cl.`id_country` = a.`id_country` AND cl.`id_lang` = '.(int)($cookie->id_lang).') '; + (cl.`id_country` = a.`id_country` AND cl.`id_lang` = '.(int)$context->language->id.') '; $this->_joinAddresses .= 'LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (a.`id_manufacturer` = m.`id_manufacturer`)'; $this->_selectAddresses = 'cl.`name` as country, m.`name` AS manufacturer_name'; $this->_includeTab = array('Addresses' => array('addressType' => 'manufacturer', 'fieldsDisplay' => $this->fieldsDisplayAddresses, '_join' => $this->_joinAddresses, '_select' => $this->_selectAddresses)); @@ -77,10 +77,6 @@ class AdminManufacturers extends AdminTab 'active' => array('title' => $this->l('Enabled'), 'width' => 25, 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false) ); - $countries = Country::getCountries((int)($cookie->id_lang)); - foreach ($countries AS $country) - $this->countriesArray[$country['id_country']] = $country['name']; - parent::__construct(); } @@ -97,7 +93,7 @@ class AdminManufacturers extends AdminTab public function displayForm($isMainTab = true) { - global $currentIndex, $cookie; + $context = Context::getContext(); parent::displayForm(); if (!($manufacturer = $this->loadObject(true))) @@ -136,8 +132,7 @@ class AdminManufacturers extends AdminTab echo '
'; // TinyMCE - global $cookie; - $iso = Language::getIsoById((int)($cookie->id_lang)); + $iso = $context->language->iso_code; $isoTinyMCE = (file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$iso.'.js') ? $iso : 'en'); $ad = dirname($_SERVER["PHP_SELF"]); echo ' @@ -210,13 +205,13 @@ class AdminManufacturers extends AdminTab public function viewmanufacturer() { - global $cookie; + $context = Context::getContext(); if (!($manufacturer = $this->loadObject())) return; echo '

'.$manufacturer->name.'

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

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

'; echo '
'; @@ -250,14 +245,14 @@ class AdminManufacturers extends AdminTab 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 '
- '.$this->l('Edit').' - '.$this->l('Delete').' + '.$this->l('Edit').' + '.$this->l('Delete').'
@@ -273,10 +268,10 @@ class AdminManufacturers extends AdminTab { echo '
- '.$this->l('Edit').' - '.$this->l('Delete').' + '.$this->l('Edit').' + '.$this->l('Delete').'
-

'.$product->name.'

+

'.$product->name.'

@@ -286,7 +281,7 @@ class AdminManufacturers 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']; diff --git a/admin-dev/tabs/AdminMessages.php b/admin-dev/tabs/AdminMessages.php index 81b6bb73c..e85b1475c 100644 --- a/admin-dev/tabs/AdminMessages.php +++ b/admin-dev/tabs/AdminMessages.php @@ -29,8 +29,8 @@ class AdminMessages extends AdminTab { public function __construct() { - global $cookie; - $this->table = 'order'; + $context = Context::getContext(); + $this->table = 'order'; $this->className = 'Order'; $this->view = 'noActionColumn'; $this->colorOnBackground = true; @@ -40,7 +40,7 @@ class AdminMessages extends AdminTab /* Manage default params values */ if (empty($limit)) - $limit = ((!isset($cookie->{$this->table.'_pagination'})) ? $this->_pagination[0] : $limit = $cookie->{$this->table.'_pagination'}); + $limit = ((!isset($context->cookie->{$this->table.'_pagination'})) ? $this->_pagination[0] : $limit = $context->cookie->{$this->table.'_pagination'}); if (!Validate::isTableOrIdentifier($this->table)) die (Tools::displayError('Table name is invalid:').' "'.$this->table.'"'); @@ -54,7 +54,7 @@ class AdminMessages extends AdminTab $orderWay = Tools::getValue($this->table.'Orderway', 'ASC'); $limit = (int)(Tools::getValue('pagination', $limit)); - $cookie->{$this->table.'_pagination'} = $limit; + $context->cookie->{$this->table.'_pagination'} = $limit; /* Check params validity */ if (!Validate::isOrderBy($orderBy) OR !Validate::isOrderWay($orderWay) @@ -76,7 +76,7 @@ class AdminMessages extends AdminTab SELECT SQL_CALC_FOUND_ROWS m.id_message, m.id_cart, m.id_employee, IF(m.id_order > 0, m.id_order, \'--\') id_order, m.message, m.private, m.date_add, CONCAT(LEFT(c.`firstname`, 1), \'. \', c.`lastname`) AS customer, c.id_customer, count(m.id_message) nb_messages, (SELECT message FROM '._DB_PREFIX_.'message WHERE id_order = m.id_order ORDER BY date_add DESC LIMIT 1) last_message, (SELECT COUNT(m2.id_message) FROM '._DB_PREFIX_.'message m2 WHERE 1 AND m2.id_customer != 0 AND m2.id_order = m.id_order AND m2.id_message NOT IN - (SELECT mr2.id_message FROM '._DB_PREFIX_.'message_readed mr2 WHERE mr2.id_employee = '.(int)($cookie->id_employee).') GROUP BY m2.id_order) nb_messages_not_read_by_me + (SELECT mr2.id_message FROM '._DB_PREFIX_.'message_readed mr2 WHERE mr2.id_employee = '.(int)$context->employee->id.') GROUP BY m2.id_order) nb_messages_not_read_by_me FROM '._DB_PREFIX_.'message m LEFT JOIN '._DB_PREFIX_.'orders o ON (o.id_order = m.id_order) LEFT JOIN '._DB_PREFIX_.'customer c ON (c.id_customer = m.id_customer) @@ -98,8 +98,7 @@ class AdminMessages extends AdminTab public function display() { - global $cookie, $currentIndex; - + $context = Context::getContext(); if (isset($_GET['ajax']) && !empty($_GET['id_cart'])) { ob_clean(); @@ -129,7 +128,7 @@ class AdminMessages extends AdminTab - +
'.$this->l('Attribute name').''.$this->l('Quantity').'
'.$this->l('Date:').''.Tools::displayDate($message['date_add'], (int)$cookie->id_lang, true).''.Tools::displayDate($message['date_add'], $context->language->id, true).'

'.$this->l('Message:').' '.Tools::htmlentitiesUTF8($message['message']).'

@@ -139,7 +138,7 @@ class AdminMessages extends AdminTab die; } elseif (isset($_GET['view'.$this->table]) AND !empty($_GET['id_order']) AND $_GET['id_order'] != '--') - Tools::redirectAdmin('index.php?tab=AdminOrders&id_order='.(int)($_GET['id_order']).'&vieworder'.'&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee))); + Tools::redirectAdmin('index.php?tab=AdminOrders&id_order='.(int)($_GET['id_order']).'&vieworder'.'&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$context->employee->id)); else { if (isset($_GET['id_order']) AND (empty($_GET['id_order']) OR $_GET['id_order'] == '--')) @@ -154,7 +153,7 @@ class AdminMessages extends AdminTab foreach ($this->_list AS $k => &$item) if ($item['id_order'] == '--') - $this->_list[$k]['last_message'] .= ' '.$this->l('View details').''; + $this->_list[$k]['last_message'] .= ' '.$this->l('View details').''; echo ' diff --git a/admin-dev/tabs/AdminMeta.php b/admin-dev/tabs/AdminMeta.php index 6cbace35e..1a93c6830 100644 --- a/admin-dev/tabs/AdminMeta.php +++ b/admin-dev/tabs/AdminMeta.php @@ -29,6 +29,7 @@ class AdminMeta extends AdminTab { public function __construct() { + $context = Context::getContext(); $this->table = 'meta'; $this->className = 'Meta'; $this->lang = true; @@ -42,11 +43,10 @@ class AdminMeta extends AdminTab 'url_rewrite' => array('title' => $this->l('Friendly URL'), 'width' => 120) ); - global $cookie; $this->optionTitle = $this->l('URLs Setup'); $this->_fieldsOptions = array( 'PS_HOMEPAGE_PHP_SELF' => array('title' => $this->l('Homepage file'), 'desc' => $this->l('Usually "index.php", but may be different for a few hosts.'), 'type' => 'string', 'size' => 50), - 'PS_REWRITING_SETTINGS' => array('title' => $this->l('Friendly URL'), 'desc' => $this->l('Enable only if your server allows URL rewriting (recommended)').'

'.$this->l('If you turn on this feature, you must').' '.$this->l('generate a .htaccess file').'

', 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), + 'PS_REWRITING_SETTINGS' => array('title' => $this->l('Friendly URL'), 'desc' => $this->l('Enable only if your server allows URL rewriting (recommended)').'

'.$this->l('If you turn on this feature, you must').' '.$this->l('generate a .htaccess file').'

', 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_CANONICAL_REDIRECT' => array('title' => $this->l('Automatically redirect to Canonical url'), 'desc' => $this->l('Recommended but your theme must be compliant'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), ); if (!Tools::getValue('__PS_BASE_URI__')) @@ -62,7 +62,6 @@ class AdminMeta extends AdminTab public function displayForm($isMainTab = true) { - global $currentIndex, $cookie; parent::displayForm(); if (!($meta = $this->loadObject(true))) diff --git a/admin-dev/tabs/AdminModules.php b/admin-dev/tabs/AdminModules.php index 34da12722..67fb0b8dd 100644 --- a/admin-dev/tabs/AdminModules.php +++ b/admin-dev/tabs/AdminModules.php @@ -79,9 +79,8 @@ class AdminModules extends AdminTab public function postProcess() { - global $currentIndex, $cookie; - - $id_employee = (int)($cookie->id_employee); + $context = Context::getContext(); + $id_employee = (int)$context->employee->id; $filter_conf = Configuration::getMultiple(array( 'PS_SHOW_TYPE_MODULES_'.$id_employee, 'PS_SHOW_COUNTRY_MODULES_'.$id_employee, @@ -310,7 +309,7 @@ class AdminModules extends AdminTab $module_errors[] = $name; } if ($key != 'configure' AND isset($_GET['bpay'])) - Tools::redirectAdmin('index.php?tab=AdminPayment&token='.Tools::getAdminToken('AdminPayment'.(int)(Tab::getIdFromClassName('AdminPayment')).(int)($cookie->id_employee))); + Tools::redirectAdmin('index.php?tab=AdminPayment&token='.Tools::getAdminToken('AdminPayment'.(int)(Tab::getIdFromClassName('AdminPayment')).(int)$context->employee->id)); } if (sizeof($module_errors)) { @@ -329,7 +328,6 @@ class AdminModules extends AdminTab function extractArchive($file) { - global $currentIndex; $success = false; if (substr($file, -4) == '.zip') { @@ -358,13 +356,11 @@ class AdminModules extends AdminTab public function displayJavascript() { - global $currentIndex; - echo '