diff --git a/admin-dev/functions.php b/admin-dev/functions.php index 00ce52692..6375a438e 100644 --- a/admin-dev/functions.php +++ b/admin-dev/functions.php @@ -235,9 +235,15 @@ function recursiveTab($id_tab) recursiveTab($adminTab['id_parent']); } +/** + * Returns a new Tab object + * + * @param string $tab class name + * @return mixed(AdminTab, bool) tab object or false if failed + */ function checkingTab($tab) { - global $adminObj, $cookie; + global $cookie; $tab = trim($tab); if (!Validate::isTabName($tab)) @@ -268,7 +274,7 @@ function checkingTab($tab) echo $adminObj->displayErrors(); return false; } - return $row['id_tab']; + return $adminObj; } function checkTabRights($id_tab) diff --git a/admin-dev/index.php b/admin-dev/index.php index 017cf08c4..0f29f99b4 100644 --- a/admin-dev/index.php +++ b/admin-dev/index.php @@ -38,11 +38,11 @@ if (empty($tab) and !sizeof($_POST)) $_POST['token'] = Tools::getAdminTokenLite($tab); } - if ($id_tab = checkingTab($tab)) + if ($adminObj = checkingTab($tab)) { $isoUser = Language::getIsoById(intval($cookie->id_lang)); $tabs = array(); - recursiveTab($id_tab); + recursiveTab($adminObj->id); $tabs = array_reverse($tabs); $bread = ''; diff --git a/admin-dev/init.php b/admin-dev/init.php index e6c8e2e23..139216cb6 100644 --- a/admin-dev/init.php +++ b/admin-dev/init.php @@ -39,9 +39,11 @@ if (!$cookie->isLoggedBack()) Tools::redirectAdmin('login.php'.(empty($destination) || ($destination == 'index.php?logout') ? '' : '?redirect='.$destination)); } +// Set current index $currentIndex = $_SERVER['SCRIPT_NAME'].(($tab = Tools::getValue('tab')) ? '?tab='.$tab : ''); if ($back = Tools::getValue('back')) $currentIndex .= '&back='.urlencode($back); +AdminTab::$currentIndex = $currentIndex; /* Server Params */ $protocol_link = (Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://'; @@ -58,9 +60,6 @@ include(_PS_TRANSLATIONS_DIR_.$iso.'/errors.php'); include(_PS_TRANSLATIONS_DIR_.$iso.'/fields.php'); include(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php'); -/* attribute id_lang is often needed, so we create a constant for performance reasons */ -define('_USER_ID_LANG_', (int)$cookie->id_lang); - $path = dirname(__FILE__).'/themes/'; if (empty($employee->bo_theme) OR !file_exists($path.$employee->bo_theme.'/admin.css')) { diff --git a/admin-dev/tabs/AdminAccess.php b/admin-dev/tabs/AdminAccess.php index 3d69914c0..652a4f0cf 100644 --- a/admin-dev/tabs/AdminAccess.php +++ b/admin-dev/tabs/AdminAccess.php @@ -79,7 +79,7 @@ class AdminAccess extends AdminTab @@ -154,15 +154,15 @@ class AdminAttributesGroups extends AdminTab echo '
- '; if ($profiles) foreach ($profiles AS $profile) echo ''; diff --git a/admin-dev/tabs/AdminAddresses.php b/admin-dev/tabs/AdminAddresses.php index d75387d58..d0a729394 100644 --- a/admin-dev/tabs/AdminAddresses.php +++ b/admin-dev/tabs/AdminAddresses.php @@ -233,7 +233,7 @@ class AdminAddresses extends AdminTab return; echo ' -
+ '.((int)($obj->id) ? '' : '').' '.(($id_order = (int)(Tools::getValue('id_order'))) ? '' : '').' '.(($address_type = (int)(Tools::getValue('address_type'))) ? '' : '').' diff --git a/admin-dev/tabs/AdminAliases.php b/admin-dev/tabs/AdminAliases.php index 0efa6df58..8eecdc034 100644 --- a/admin-dev/tabs/AdminAliases.php +++ b/admin-dev/tabs/AdminAliases.php @@ -80,7 +80,7 @@ class AdminAliases extends AdminTab return; echo ' - + '.($obj->id ? '' : '').'
'.$this->l('Aliases').' diff --git a/admin-dev/tabs/AdminAttachments.php b/admin-dev/tabs/AdminAttachments.php index 8b6ebecb5..607badfdf 100644 --- a/admin-dev/tabs/AdminAttachments.php +++ b/admin-dev/tabs/AdminAttachments.php @@ -97,7 +97,7 @@ class AdminAttachments extends AdminTab return; echo ' - + '.($obj->id ? '' : '').'
'.$this->l('Attachment').' diff --git a/admin-dev/tabs/AdminAttributeGenerator.php b/admin-dev/tabs/AdminAttributeGenerator.php index 6e849a61e..5f5b6a140 100644 --- a/admin-dev/tabs/AdminAttributeGenerator.php +++ b/admin-dev/tabs/AdminAttributeGenerator.php @@ -97,7 +97,7 @@ class AdminAttributeGenerator extends AdminTab } } elseif (isset($_POST['back'])) - Tools::redirectAdmin($currentIndex.'&id_product='.(int)(Tools::getValue('id_product')).'&id_category='.(int)(Tools::getValue('id_category')).'&addproduct'.'&tabs=3&token='.Tools::getValue('token')); + Tools::redirectAdmin(self::$currentIndex.'&id_product='.(int)(Tools::getValue('id_product')).'&id_category='.(int)(Tools::getValue('id_category')).'&addproduct'.'&tabs=3&token='.Tools::getValue('token')); parent::postProcess(); } @@ -274,7 +274,7 @@ class AdminAttributeGenerator extends AdminTab '; echo ' - +
'.$this->l('Attributes generator').''. $this->l('Add or modify attributes for product:').' '.$this->product->name[$cookie->id_lang].'

diff --git a/admin-dev/tabs/AdminAttributes.php b/admin-dev/tabs/AdminAttributes.php index 25d723f45..88cb0916f 100644 --- a/admin-dev/tabs/AdminAttributes.php +++ b/admin-dev/tabs/AdminAttributes.php @@ -63,7 +63,7 @@ class AdminAttributes extends AdminTab $strAttributesGroups .= '"'.$attribute_group['id_attribute_group'].'" : '.$attribute_group['is_color_group'].','; echo $strAttributesGroups.'}; - + '.($obj->id ? '' : '').'
'.$this->l('Attribute').' @@ -141,7 +141,7 @@ class AdminAttributes extends AdminTab { $object = new $this->className(); if ($object->deleteSelection($_POST[$this->table.$_POST['groupid'].'Box'])) - Tools::redirectAdmin($currentIndex.'&conf=2'.'&token='.($token ? $token : $this->token)); + Tools::redirectAdmin(self::$currentIndex.'&conf=2'.'&token='.($token ? $token : $this->token)); $this->_errors[] = Tools::displayError('An error occurred while deleting selection.'); } else diff --git a/admin-dev/tabs/AdminAttributesGroups.php b/admin-dev/tabs/AdminAttributesGroups.php index f934e6bd6..bcc4a9727 100644 --- a/admin-dev/tabs/AdminAttributesGroups.php +++ b/admin-dev/tabs/AdminAttributesGroups.php @@ -56,7 +56,7 @@ class AdminAttributesGroups extends AdminTab OR isset($_GET['updateattribute']) OR isset($_GET['addattribute'])) { $this->adminAttributes->displayForm($this->token); - echo '

'.$this->l('Back to list').'
'; + echo '

'.$this->l('Back to list').'
'; } else { @@ -80,7 +80,7 @@ class AdminAttributesGroups extends AdminTab { $object = new $this->className(); if ($object->deleteSelection($_POST[$this->table.'Box'])) - Tools::redirectAdmin($currentIndex.'&conf=2'.'&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&conf=2'.'&token='.$this->token); $this->_errors[] = Tools::displayError('An error occurred while deleting selection.'); } else @@ -104,8 +104,8 @@ class AdminAttributesGroups extends AdminTab { global $currentIndex, $cookie; - echo '
'.$this->l('Add attributes group').'
- '.$this->l('Add attribute').'

+ echo '
'.$this->l('Add attributes group').'
+ '.$this->l('Add attribute').'

'.$this->l('Click on the group name to view its attributes. Click again to hide them.').'

'; if ($this->_list === false) Tools::displayError('No elements found'); @@ -143,9 +143,9 @@ class AdminAttributesGroups extends AdminTab .$attribute['name'].'
- + '.$this->l('Edit').'  - '.$this->l('Delete').'

+ onclick="changeFormParam(this.form, \''.self::$currentIndex.'\', '.$id.'); return confirm(\''.$this->l('Delete selected items?', __CLASS__, true, false).'\');" />

'; echo ' - + '.$this->l('Edit').'  - + '.$this->l('Delete').' '; @@ -180,7 +180,7 @@ class AdminAttributesGroups extends AdminTab return; echo ' - + '.($obj->id ? '' : '').'
'.$this->l('Attributes group').' diff --git a/admin-dev/tabs/AdminBackup.php b/admin-dev/tabs/AdminBackup.php index a684e4174..f258465a1 100644 --- a/admin-dev/tabs/AdminBackup.php +++ b/admin-dev/tabs/AdminBackup.php @@ -122,7 +122,7 @@ class AdminBackup extends AdminTab echo '
'.$this->l('Back-up file should automatically download.'); echo '

'.$this->l('If not,').' '.$this->l('please click here!').''; echo ''; - echo '


'.$this->l('Back to list').'
'; + echo '


'.$this->l('Back to list').'
'; } elseif ($object->error) $this->_errors[] = $object->error; @@ -150,7 +150,7 @@ class AdminBackup extends AdminTab if ($showForm) echo ' - + '; diff --git a/admin-dev/tabs/AdminCMS.php b/admin-dev/tabs/AdminCMS.php index 540f90e35..4a279aac7 100644 --- a/admin-dev/tabs/AdminCMS.php +++ b/admin-dev/tabs/AdminCMS.php @@ -83,7 +83,7 @@ class AdminCMS extends AdminTab $divLangName = 'meta_title¤meta_description¤meta_keywords¤ccontent¤link_rewrite'; echo ' -
+ '.($obj->id ? '' : '').' '.$this->_displayDraftWarning($obj->active).'
'.$this->l('CMS page').''; @@ -194,7 +194,7 @@ class AdminCMS extends AdminTab $id_cms_category = 1; echo '

'.(!$this->_listTotal ? ($this->l('No pages found')) : ($this->_listTotal.' '.($this->_listTotal > 1 ? $this->l('pages') : $this->l('page')))).' '. $this->l('in category').' "'.stripslashes(CMSCategory::hideCMSCategoryPosition($this->_category->getName())).'"

'; - echo ' '.$this->l('Add a new page').' + echo ' '.$this->l('Add a new page').'
'; $this->displayList($token); echo '
'; @@ -243,7 +243,7 @@ class AdminCMS extends AdminTab if (!$cms->delete()) $this->_errors[] = Tools::displayError('An error occurred while deleting object.').' '.$this->table.' ('.mysql_error().')'; else - Tools::redirectAdmin($currentIndex.'&id_cms_category='.$cms->id_cms_category.'&conf=1&token='.Tools::getAdminTokenLite('AdminCMSContent')); + Tools::redirectAdmin(self::$currentIndex.'&id_cms_category='.$cms->id_cms_category.'&conf=1&token='.Tools::getAdminTokenLite('AdminCMSContent')); }/* Delete multiple objects */ elseif (Tools::getValue('submitDel'.$this->table)) { @@ -257,7 +257,7 @@ class AdminCMS extends AdminTab if ($result) { $cms->cleanPositions((int)(Tools::getValue('id_cms_category'))); - Tools::redirectAdmin($currentIndex.'&conf=2&token='.Tools::getAdminTokenLite('AdminCMSContent').'&id_category='.(int)(Tools::getValue('id_cms_category'))); + Tools::redirectAdmin(self::$currentIndex.'&conf=2&token='.Tools::getAdminTokenLite('AdminCMSContent').'&id_category='.(int)(Tools::getValue('id_cms_category'))); } $this->_errors[] = Tools::displayError('An error occurred while deleting selection.'); @@ -294,7 +294,7 @@ class AdminCMS extends AdminTab Tools::redirectAdmin($preview_url); } else - Tools::redirectAdmin($currentIndex.'&id_cms_category='.$cms->id_cms_category.'&conf=3&token='.Tools::getAdminTokenLite('AdminCMSContent')); + Tools::redirectAdmin(self::$currentIndex.'&id_cms_category='.$cms->id_cms_category.'&conf=3&token='.Tools::getAdminTokenLite('AdminCMSContent')); } else { @@ -316,7 +316,7 @@ class AdminCMS extends AdminTab Tools::redirectAdmin($preview_url); } else - Tools::redirectAdmin($currentIndex.'&id_cms_category='.$cms->id_cms_category.'&conf=4&token='.Tools::getAdminTokenLite('AdminCMSContent')); + Tools::redirectAdmin(self::$currentIndex.'&id_cms_category='.$cms->id_cms_category.'&conf=4&token='.Tools::getAdminTokenLite('AdminCMSContent')); } } } @@ -329,7 +329,7 @@ class AdminCMS extends AdminTab elseif (!$object->updatePosition((int)(Tools::getValue('way')), (int)(Tools::getValue('position')))) $this->_errors[] = Tools::displayError('Failed to update the position.'); else - Tools::redirectAdmin($currentIndex.'&'.$this->table.'Orderby=position&'.$this->table.'Orderway=asc&conf=4'.(($id_category = (int)(Tools::getValue('id_cms_category'))) ? ('&id_cms_category='.$id_category) : '').'&token='.Tools::getAdminTokenLite('AdminCMSContent')); + Tools::redirectAdmin(self::$currentIndex.'&'.$this->table.'Orderby=position&'.$this->table.'Orderway=asc&conf=4'.(($id_category = (int)(Tools::getValue('id_cms_category'))) ? ('&id_cms_category='.$id_category) : '').'&token='.Tools::getAdminTokenLite('AdminCMSContent')); } /* Change object statuts (active, inactive) */ elseif (Tools::isSubmit('status') AND Tools::isSubmit($this->identifier)) @@ -339,7 +339,7 @@ class AdminCMS extends AdminTab if (Validate::isLoadedObject($object = $this->loadObject())) { if ($object->toggleStatus()) - Tools::redirectAdmin($currentIndex.'&conf=5'.((int)Tools::getValue('id_cms_category') ? '&id_cms_category='.(int)Tools::getValue('id_cms_category') : '').'&token='.Tools::getValue('token')); + Tools::redirectAdmin(self::$currentIndex.'&conf=5'.((int)Tools::getValue('id_cms_category') ? '&id_cms_category='.(int)Tools::getValue('id_cms_category') : '').'&token='.Tools::getValue('token')); else $this->_errors[] = Tools::displayError('An error occurred while updating status.'); } diff --git a/admin-dev/tabs/AdminCMSCategories.php b/admin-dev/tabs/AdminCMSCategories.php index 515f17bdf..f396827b7 100644 --- a/admin-dev/tabs/AdminCMSCategories.php +++ b/admin-dev/tabs/AdminCMSCategories.php @@ -116,7 +116,7 @@ class AdminCMSCategories extends AdminTab if (Validate::isLoadedObject($object = $this->loadObject())) { if ($object->toggleStatus()) - Tools::redirectAdmin($currentIndex.'&conf=5'.((int)$object->id_parent ? '&id_cms_category='.(int)$object->id_parent : '').'&token='.Tools::getValue('token')); + Tools::redirectAdmin(self::$currentIndex.'&conf=5'.((int)$object->id_parent ? '&id_cms_category='.(int)$object->id_parent : '').'&token='.Tools::getValue('token')); else $this->_errors[] = Tools::displayError('An error occurred while updating status.'); } @@ -143,10 +143,10 @@ class AdminCMSCategories extends AdminTab { $object->deleted = 1; if ($object->update()) - Tools::redirectAdmin($currentIndex.'&conf=1&token='.Tools::getValue('token')); + Tools::redirectAdmin(self::$currentIndex.'&conf=1&token='.Tools::getValue('token')); } elseif ($object->delete()) - Tools::redirectAdmin($currentIndex.'&conf=1&token='.Tools::getValue('token')); + Tools::redirectAdmin(self::$currentIndex.'&conf=1&token='.Tools::getValue('token')); $this->_errors[] = Tools::displayError('An error occurred during deletion.'); } } @@ -165,7 +165,7 @@ class AdminCMSCategories extends AdminTab elseif (!$object->updatePosition((int)(Tools::getValue('way')), (int)(Tools::getValue('position')))) $this->_errors[] = Tools::displayError('Failed to update the position.'); else - Tools::redirectAdmin($currentIndex.'&'.$this->table.'Orderby=position&'.$this->table.'Orderway=asc&conf=5'.(($id_category = (int)(Tools::getValue($this->identifier, Tools::getValue('id_cms_category_parent', 1)))) ? ('&'.$this->identifier.'='.$id_category) : '').'&token='.Tools::getAdminTokenLite('AdminCMSContent')); + Tools::redirectAdmin(self::$currentIndex.'&'.$this->table.'Orderby=position&'.$this->table.'Orderway=asc&conf=5'.(($id_category = (int)(Tools::getValue($this->identifier, Tools::getValue('id_cms_category_parent', 1)))) ? ('&'.$this->identifier.'='.$id_category) : '').'&token='.Tools::getAdminTokenLite('AdminCMSContent')); } /* Delete multiple objects */ elseif (Tools::getValue('submitDel'.$this->table)) @@ -180,7 +180,7 @@ class AdminCMSCategories extends AdminTab if ($result) { $cms_category->cleanPositions((int)(Tools::getValue('id_cms_category'))); - Tools::redirectAdmin($currentIndex.'&conf=2&token='.Tools::getAdminTokenLite('AdminCMSContent').'&id_category='.(int)(Tools::getValue('id_cms_category'))); + Tools::redirectAdmin(self::$currentIndex.'&conf=2&token='.Tools::getAdminTokenLite('AdminCMSContent').'&id_category='.(int)(Tools::getValue('id_cms_category'))); } $this->_errors[] = Tools::displayError('An error occurred while deleting selection.'); @@ -204,7 +204,7 @@ class AdminCMSCategories extends AdminTab $active = $this->getFieldValue($obj, 'active'); echo ' - + '.($obj->id ? '' : '').'
'.$this->l('CMS Category').' diff --git a/admin-dev/tabs/AdminCMSContent.php b/admin-dev/tabs/AdminCMSContent.php index 25774e144..84c2f0ba5 100644 --- a/admin-dev/tabs/AdminCMSContent.php +++ b/admin-dev/tabs/AdminCMSContent.php @@ -96,13 +96,13 @@ class AdminCMSContent extends AdminTab 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); - echo '

'.$this->l('Back to list').'
'; + echo '

'.$this->l('Back to list').'
'; } elseif (((Tools::isSubmit('submitAddcms') OR Tools::isSubmit('submitAddcmsAndStay')) AND sizeof($this->adminCMS->_errors)) OR isset($_GET['updatecms']) OR isset($_GET['addcms'])) { $this->adminCMS->displayForm($this->token); - echo '

'.$this->l('Back to list').'
'; + echo '

'.$this->l('Back to list').'
'; } else diff --git a/admin-dev/tabs/AdminCarriers.php b/admin-dev/tabs/AdminCarriers.php index 43551726a..a4c0f717d 100644 --- a/admin-dev/tabs/AdminCarriers.php +++ b/admin-dev/tabs/AdminCarriers.php @@ -99,7 +99,7 @@ class AdminCarriers extends AdminTab }); }); - + '.($obj->id ? '' : '').'
'.$this->l('Carriers').' @@ -309,7 +309,7 @@ class AdminCarriers extends AdminTab elseif ($this->postImage($objectNew->id)) { $this->changeZones($objectNew->id); - Tools::redirectAdmin($currentIndex.'&id_'.$this->table.'='.$object->id.'&conf=4'.'&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&id_'.$this->table.'='.$object->id.'&conf=4'.'&token='.$this->token); } } else @@ -332,7 +332,7 @@ class AdminCarriers extends AdminTab { $this->changeZones($object->id); $this->changeGroups($object->id); - Tools::redirectAdmin($currentIndex.'&id_'.$this->table.'='.$object->id.'&conf=3'.'&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&id_'.$this->table.'='.$object->id.'&conf=3'.'&token='.$this->token); } } else diff --git a/admin-dev/tabs/AdminCarts.php b/admin-dev/tabs/AdminCarts.php index e3be739ed..0f6e848c0 100644 --- a/admin-dev/tabs/AdminCarts.php +++ b/admin-dev/tabs/AdminCarts.php @@ -336,7 +336,7 @@ class AdminCarts extends AdminTab $_cacheLang['DeleteItem'] = $this->l('Delete item #', __CLASS__, true, false).$id.' ?)'; echo ' - + '.$_cacheLang['Delete'].' '; } diff --git a/admin-dev/tabs/AdminCatalog.php b/admin-dev/tabs/AdminCatalog.php index 6fb690cfb..fc831cdde 100644 --- a/admin-dev/tabs/AdminCatalog.php +++ b/admin-dev/tabs/AdminCatalog.php @@ -141,7 +141,7 @@ class AdminCatalog extends AdminTab if (((Tools::isSubmit('submitAddcategory') OR Tools::isSubmit('submitAddcategoryAndStay')) AND sizeof($this->adminCategories->_errors)) OR isset($_GET['updatecategory']) OR isset($_GET['addcategory'])) { $this->adminCategories->displayForm($this->token); - echo '

'.$this->l('Back to list').'
'; + echo '

'.$this->l('Back to list').'
'; } elseif (((Tools::isSubmit('submitAddproduct') OR Tools::isSubmit('submitAddproductAndPreview') OR Tools::isSubmit('submitAddproductAndStay') OR Tools::isSubmit('submitSpecificPricePriorities') OR Tools::isSubmit('submitPriceAddition') OR Tools::isSubmit('submitPricesModification')) AND sizeof($this->adminProducts->_errors)) OR Tools::isSubmit('updateproduct') OR Tools::isSubmit('addproduct')) { diff --git a/admin-dev/tabs/AdminCategories.php b/admin-dev/tabs/AdminCategories.php index 17fb64e7e..9f588690c 100644 --- a/admin-dev/tabs/AdminCategories.php +++ b/admin-dev/tabs/AdminCategories.php @@ -119,7 +119,7 @@ class AdminCategories extends AdminTab $target = '&id_category='.(int)($matches[1]); } Module::hookExec('categoryUpdate'); - Tools::redirectAdmin($this->currentIndex.'&conf=5'.$target.'&token='.Tools::getValue('token')); + Tools::redirectAdmin(self::$currentIndex.'&conf=5'.$target.'&token='.Tools::getValue('token')); } else $this->_errors[] = Tools::displayError('An error occurred while updating status.'); @@ -147,10 +147,10 @@ class AdminCategories extends AdminTab $object->deleteImage(); $object->deleted = 1; if ($object->update()) - Tools::redirectAdmin($this->currentIndex.'&conf=1&token='.Tools::getValue('token').'&id_category='.(int)($object->id_parent)); + Tools::redirectAdmin(self::$currentIndex.'&conf=1&token='.Tools::getValue('token').'&id_category='.(int)($object->id_parent)); } elseif ($object->delete()) - Tools::redirectAdmin($this->currentIndex.'&conf=1&token='.Tools::getValue('token').'&id_category='.(int)($object->id_parent)); + Tools::redirectAdmin(self::$currentIndex.'&conf=1&token='.Tools::getValue('token').'&id_category='.(int)($object->id_parent)); $this->_errors[] = Tools::displayError('An error occurred during deletion.'); } } @@ -169,7 +169,7 @@ class AdminCategories extends AdminTab if (!$object->updatePosition((int)(Tools::getValue('way')), (int)(Tools::getValue('position')))) $this->_errors[] = Tools::displayError('Failed to update the position.'); else - Tools::redirectAdmin($this->currentIndex.'&'.$this->table.'Orderby=position&'.$this->table.'Orderway=asc&conf=5'.(($id_category = (int)(Tools::getValue($this->identifier, Tools::getValue('id_category_parent', 1)))) ? ('&'.$this->identifier.'='.$id_category) : '').'&token='.Tools::getAdminTokenLite('AdminCatalog')); + Tools::redirectAdmin(self::$currentIndex.'&'.$this->table.'Orderby=position&'.$this->table.'Orderway=asc&conf=5'.(($id_category = (int)(Tools::getValue($this->identifier, Tools::getValue('id_category_parent', 1)))) ? ('&'.$this->identifier.'='.$id_category) : '').'&token='.Tools::getAdminTokenLite('AdminCatalog')); } /* Delete multiple objects */ elseif (Tools::getValue('submitDel'.$this->table)) @@ -184,7 +184,7 @@ class AdminCategories extends AdminTab if ($result) { $category->cleanPositions((int)(Tools::getValue('id_category'))); - Tools::redirectAdmin($this->currentIndex.'&conf=2&token='.Tools::getAdminTokenLite('AdminCatalog').'&id_category='.(int)(Tools::getValue('id_category'))); + Tools::redirectAdmin(self::$currentIndex.'&conf=2&token='.Tools::getAdminTokenLite('AdminCatalog').'&id_category='.(int)(Tools::getValue('id_category'))); } $this->_errors[] = Tools::displayError('An error occurred while deleting selection.'); @@ -226,7 +226,7 @@ class AdminCategories extends AdminTab $id_category = (int)Tools::getValue('id_parent'); echo ' - + '.($obj->id ? '' : '').'
'.$this->l('Category').' diff --git a/admin-dev/tabs/AdminContacts.php b/admin-dev/tabs/AdminContacts.php index f6986f671..84f77c928 100644 --- a/admin-dev/tabs/AdminContacts.php +++ b/admin-dev/tabs/AdminContacts.php @@ -65,7 +65,7 @@ class AdminContacts extends AdminTab return; echo ' - + '.($obj->id ? '' : '').'
'.$this->l('Contacts').' diff --git a/admin-dev/tabs/AdminCountries.php b/admin-dev/tabs/AdminCountries.php index 65d4f715b..12eac54b8 100644 --- a/admin-dev/tabs/AdminCountries.php +++ b/admin-dev/tabs/AdminCountries.php @@ -216,7 +216,7 @@ class AdminCountries extends AdminTab } - + '.($obj->id ? '' : '').'
'.$this->l('Countries').' diff --git a/admin-dev/tabs/AdminCounty.php b/admin-dev/tabs/AdminCounty.php index bf8fb7564..9f8b31cee 100644 --- a/admin-dev/tabs/AdminCounty.php +++ b/admin-dev/tabs/AdminCounty.php @@ -127,7 +127,7 @@ class AdminCounty extends AdminTab } echo $this->renderJS(). - ' + ' '.($obj->id ? '' : '').'
'.$this->l('Counties').''; diff --git a/admin-dev/tabs/AdminCurrencies.php b/admin-dev/tabs/AdminCurrencies.php index cebf64915..d43733c5b 100644 --- a/admin-dev/tabs/AdminCurrencies.php +++ b/admin-dev/tabs/AdminCurrencies.php @@ -76,7 +76,7 @@ class AdminCurrencies extends AdminTab if ($object->id == Configuration::get('PS_CURRENCY_DEFAULT')) $this->_errors[] = $this->l('You can\'t delete the default currency'); elseif ($object->delete()) - Tools::redirectAdmin($currentIndex.'&conf=1'.'&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&conf=1'.'&token='.$this->token); else $this->_errors[] = Tools::displayError('An error occurred during deletion.'); } @@ -95,7 +95,7 @@ class AdminCurrencies extends AdminTab if ($object->active AND $object->id == Configuration::get('PS_CURRENCY_DEFAULT')) $this->_errors[] = $this->l('You can\'t disable the default currency'); elseif ($object->toggleStatus()) - Tools::redirectAdmin($currentIndex.'&conf=5'.((($id_category = (int)(Tools::getValue('id_category'))) AND Tools::getValue('id_product')) ? '&id_category='.$id_category : '').'&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&conf=5'.((($id_category = (int)(Tools::getValue('id_category'))) AND Tools::getValue('id_product')) ? '&id_category='.$id_category : '').'&token='.$this->token); else $this->_errors[] = Tools::displayError('An error occurred while updating status.'); } @@ -113,12 +113,12 @@ class AdminCurrencies extends AdminTab if ($key == 'PS_CURRENCY_DEFAULT') Currency::refreshCurrencies(); } - Tools::redirectAdmin($currentIndex.'&conf=6'.'&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&conf=6'.'&token='.$this->token); } elseif (Tools::isSubmit('submitExchangesRates')) { if (!$this->_errors[] = Currency::refreshCurrencies()) - Tools::redirectAdmin($currentIndex.'&conf=6'.'&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&conf=6'.'&token='.$this->token); } else parent::postProcess(); @@ -130,7 +130,7 @@ class AdminCurrencies extends AdminTab parent::displayOptionsList(); echo '

- +
'.$this->l('Currency rates').' @@ -153,7 +153,7 @@ class AdminCurrencies extends AdminTab return; echo ' - + '.($obj->id ? '' : '').'
'.$this->l('Currencies').' diff --git a/admin-dev/tabs/AdminCustomerThreads.php b/admin-dev/tabs/AdminCustomerThreads.php index af6f9bd30..a6cb4f79e 100644 --- a/admin-dev/tabs/AdminCustomerThreads.php +++ b/admin-dev/tabs/AdminCustomerThreads.php @@ -177,7 +177,7 @@ class AdminCustomerThreads extends AdminTab Mail::Send($ct->id_lang, 'reply_msg', Mail::l('An answer to your message is available'), $params, Tools::getValue('msg_email'), NULL, NULL, NULL, $fileAttachment); $ct->status = 'closed'; $ct->update(); - Tools::redirectAdmin($currentIndex.'&id_customer_thread='.(int)$id_customer_thread.'&viewcustomer_thread&token='.Tools::getValue('token')); + Tools::redirectAdmin(self::$currentIndex.'&id_customer_thread='.(int)$id_customer_thread.'&viewcustomer_thread&token='.Tools::getValue('token')); } else $this->_errors[] = Tools::displayError('An error occurred, your message was not sent. Please contact your system administrator.'); @@ -241,7 +241,7 @@ class AdminCustomerThreads extends AdminTab

 '.$val['name'].'

'. ($dim > 6 ? '' : '

'.$val['description'].'

'). ($totalThread == 0 ? '

'.$this->l('No new message').'

' - : ''.$totalThread.' '.($totalThread > 1 ? $this->l('new messages'): $this->l('new message')).'').' + : ''.$totalThread.' '.($totalThread > 1 ? $this->l('new messages'): $this->l('new message')).'').' '; } echo ''; @@ -349,7 +349,7 @@ class AdminCustomerThreads extends AdminTab else { $output = '
- '.($id_employee ? ''.$this->l('View this thread').'
' : '').' + '.($id_employee ? ''.$this->l('View this thread').'
' : '').' '.$this->l('Sent by:').' '.(!empty($message['customer_name']) ? $message['customer_name'].' ('.$message['email'].')' : $message['email']) .((!empty($message['id_customer']) AND empty($message['employee_name'])) ? '
'.$this->l('Customer ID:').' '.(int)($message['id_customer']).'
' : '') .((!empty($message['id_order']) AND empty($message['employee_name'])) ? '
'.$this->l('Order #').': '.(int)($message['id_order']).'
' : '') @@ -466,7 +466,7 @@ class AdminCustomerThreads extends AdminTab if ($nextThread) echo $this->displayButton(' - +
'.$this->l('Answer to the next unanswered message in this category').' >
'); @@ -477,33 +477,33 @@ class AdminCustomerThreads extends AdminTab if ($thread->status != "closed") echo $this->displayButton(' - +
'.$this->l('Set this message as handled').'
'); if ($thread->status != "pending1") echo $this->displayButton(' - +
'.$this->l('Declare this message').'
'.$this->l('as "pending 1"').'
'.$this->l('(will be answered later)').'
'); else echo $this->displayButton(' - +
'.$this->l('Click here to disable pending status').'
'); if ($thread->status != "pending2") echo $this->displayButton(' - +
'.$this->l('Declare this message').'
'.$this->l('as "pending 2"').'
'.$this->l('(will be answered later)').'
'); else echo $this->displayButton(' - +
'.$this->l('Click here to disable pending status').'
'); diff --git a/admin-dev/tabs/AdminCustomers.php b/admin-dev/tabs/AdminCustomers.php index e9860808b..849d96802 100644 --- a/admin-dev/tabs/AdminCustomers.php +++ b/admin-dev/tabs/AdminCustomers.php @@ -165,12 +165,12 @@ class AdminCustomers extends AdminTab $parent_id = (int)(Tools::getValue('id_parent', 1)); // Save and stay on same form if (Tools::isSubmit('submitAdd'.$this->table.'AndStay')) - Tools::redirectAdmin($currentIndex.'&'.$this->identifier.'='.$object->id.'&conf=3&update'.$this->table.'&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&'.$this->identifier.'='.$object->id.'&conf=3&update'.$this->table.'&token='.$this->token); // Save and back to parent if (Tools::isSubmit('submitAdd'.$this->table.'AndBackToParent')) - Tools::redirectAdmin($currentIndex.'&'.$this->identifier.'='.$parent_id.'&conf=3&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&'.$this->identifier.'='.$parent_id.'&conf=3&token='.$this->token); // Default behavior (save and back) - Tools::redirectAdmin($currentIndex.($parent_id ? '&'.$this->identifier.'='.$object->id : '').'&conf=3&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.($parent_id ? '&'.$this->identifier.'='.$object->id : '').'&conf=3&token='.$this->token); } } else @@ -229,7 +229,7 @@ class AdminCustomers extends AdminTab if(Customer::customerExists($customer->email)) $this->_errors[] = Tools::displayError('This customer already exist as non-guest.'); elseif ($customer->transformToCustomer(Tools::getValue('id_lang', Configuration::get('PS_LANG_DEFAULT')))) - Tools::redirectAdmin($currentIndex.'&'.$this->identifier.'='.$customer->id.'&conf=3&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&'.$this->identifier.'='.$customer->id.'&conf=3&token='.$this->token); else $this->_errors[] = Tools::displayError('An error occurred while updating customer.'); } @@ -244,7 +244,7 @@ class AdminCustomers extends AdminTab $update = Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'customer` SET newsletter = '.($customer->newsletter ? 0 : 1).' WHERE `id_customer` = '.(int)($customer->id)); if (!$update) $this->_errors[] = Tools::displayError('An error occurred while updating customer.'); - Tools::redirectAdmin($currentIndex.'&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token); }elseif (Tools::isSubmit('changeOptinVal') AND Tools::getValue('id_customer')) { @@ -255,7 +255,7 @@ class AdminCustomers extends AdminTab $update = Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'customer` SET optin = '.($customer->optin ? 0 : 1).' WHERE `id_customer` = '.(int)($customer->id)); if (!$update) $this->_errors[] = Tools::displayError('An error occurred while updating customer.'); - Tools::redirectAdmin($currentIndex.'&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token); } return parent::postProcess(); @@ -289,7 +289,7 @@ class AdminCustomers extends AdminTab $countBetterCustomers = '-'; echo ' -
+
'.$customer->firstname.' '.$customer->lastname.'
'.$customer->email.'

@@ -301,7 +301,7 @@ class AdminCustomers extends AdminTab
- +
'.$this->l('Newsletter:').' '.($customer->newsletter ? '' : '').'
'.$this->l('Opt-in:').' '.($customer->optin ? '' : '').'
@@ -678,7 +678,7 @@ class AdminCustomers extends AdminTab '; echo '
 
'; } - echo ' '.$this->l('Back to customer list').'
'; + echo ' '.$this->l('Back to customer list').'
'; } public function displayForm($isMainTab = true) @@ -694,7 +694,7 @@ class AdminCustomers extends AdminTab $groups = Group::getGroups($this->_defaultFormLanguage, true); echo ' - + '.($obj->id ? '' : '').'
'.$this->l('Customer').' diff --git a/admin-dev/tabs/AdminDb.php b/admin-dev/tabs/AdminDb.php index 3b914646a..328782ae9 100644 --- a/admin-dev/tabs/AdminDb.php +++ b/admin-dev/tabs/AdminDb.php @@ -64,7 +64,7 @@ class AdminDb extends AdminPreferences if ($value) $settings['_'.Tools::strtoupper($k).'_'] = $value; rewriteSettingsFile(NULL, NULL, $settings); - Tools::redirectAdmin($currentIndex.'&conf=6'.'&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&conf=6'.'&token='.$this->token); } } else @@ -106,7 +106,7 @@ class AdminDb extends AdminPreferences $this->_displayForm('database', $this->_fieldsDatabase, $this->l('Database'), 'width2', 'database_gear'); $engines = $this->_getEngines(); $irow = 0; - echo '
'.$this->l('MySQL Engine').' + echo '
'.$this->l('MySQL Engine').'
'; $tables_status = $this->_getTablesStatus(); foreach ($tables_status AS $table) diff --git a/admin-dev/tabs/AdminDeliverySlip.php b/admin-dev/tabs/AdminDeliverySlip.php index fab8c0fd6..bdae2abff 100644 --- a/admin-dev/tabs/AdminDeliverySlip.php +++ b/admin-dev/tabs/AdminDeliverySlip.php @@ -50,7 +50,7 @@ class AdminDeliverySlip extends AdminTab $output = '

'.$this->l('Print PDF delivery slips').'

- +
* diff --git a/admin-dev/tabs/AdminDiscounts.php b/admin-dev/tabs/AdminDiscounts.php index 9a4fc9539..b514e57fd 100644 --- a/admin-dev/tabs/AdminDiscounts.php +++ b/admin-dev/tabs/AdminDiscounts.php @@ -142,8 +142,8 @@ class AdminDiscounts extends AdminTab if ($back = Tools::getValue('back')) Tools::redirectAdmin(urldecode($back).'&conf=4'); if (Tools::getValue('stay_here') == 'on' || Tools::getValue('stay_here') == 'true' || Tools::getValue('stay_here') == '1') - Tools::redirectAdmin($currentIndex.'&'.$this->identifier.'='.$object->id.'&conf=4&updatescene&token='.$token); - Tools::redirectAdmin($currentIndex.'&'.$this->identifier.'='.$object->id.'&conf=4&token='.$token); + Tools::redirectAdmin(self::$currentIndex.'&'.$this->identifier.'='.$object->id.'&conf=4&updatescene&token='.$token); + Tools::redirectAdmin(self::$currentIndex.'&'.$this->identifier.'='.$object->id.'&conf=4&token='.$token); } } else @@ -166,7 +166,7 @@ class AdminDiscounts extends AdminTab if (!$object->add(true, false, $categories)) $this->_errors[] = Tools::displayError('An error occurred while creating object.').' '.$this->table.''; elseif (($_POST[$this->identifier] = $object->id /* voluntary */) AND $this->postImage($object->id) AND $this->_redirect) - Tools::redirectAdmin($currentIndex.'&'.$this->identifier.'='.$object->id.'&conf=3&token='.$token); + Tools::redirectAdmin(self::$currentIndex.'&'.$this->identifier.'='.$object->id.'&conf=3&token='.$token); } else $this->_errors[] = Tools::displayError('You do not have permission to add here.'); @@ -217,7 +217,7 @@ class AdminDiscounts extends AdminTab discountType(); }); - + '.($obj->id ? '' : '').'
'.$this->l('Vouchers').' diff --git a/admin-dev/tabs/AdminEmployees.php b/admin-dev/tabs/AdminEmployees.php index 7bbc0eab2..52c3ae033 100644 --- a/admin-dev/tabs/AdminEmployees.php +++ b/admin-dev/tabs/AdminEmployees.php @@ -96,9 +96,9 @@ class AdminEmployees extends AdminTab - + '.($obj->id ? '' : '').' - '.((int)$this->tabAccess['view'] ? '' : '').' + '.((int)$this->tabAccess['view'] ? '' : '').'
'.$this->l('Employees').'
diff --git a/admin-dev/tabs/AdminFeatures.php b/admin-dev/tabs/AdminFeatures.php index b13c5e2de..a78930d51 100644 --- a/admin-dev/tabs/AdminFeatures.php +++ b/admin-dev/tabs/AdminFeatures.php @@ -53,7 +53,7 @@ class AdminFeatures extends AdminTab OR isset($_GET['updatefeature_value']) OR isset($_GET['addfeature_value'])) { $this->adminFeaturesValues->displayForm($this->token); - echo '

'.$this->l('Back to the features list').'
'; + echo '

'.$this->l('Back to the features list').'
'; } else { @@ -68,8 +68,8 @@ class AdminFeatures extends AdminTab global $currentIndex; echo '
- '.$this->l('Add a new feature').'
- '.$this->l('Add a new feature value').'

+ '.$this->l('Add a new feature').'
+ '.$this->l('Add a new feature value').'

'.$this->l('Click on a feature name to view its values and then click again if you want to hide them.').'

'; $this->displayListHeader(); @@ -102,9 +102,9 @@ class AdminFeatures extends AdminTab
@@ -122,9 +122,9 @@ class AdminFeatures extends AdminTab echo ' '; @@ -144,7 +144,7 @@ class AdminFeatures extends AdminTab echo '

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

- + '.($obj->id ? '' : '').'
'.$this->l('Add a new feature').' @@ -195,7 +195,7 @@ class AdminFeatures extends AdminTab { $object = new $this->className(); if ($object->deleteSelection($_POST[$this->table.'Box'])) - Tools::redirectAdmin($currentIndex.'&conf=2'.'&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&conf=2'.'&token='.$this->token); $this->_errors[] = Tools::displayError('An error occurred while deleting selection.'); } else diff --git a/admin-dev/tabs/AdminFeaturesValues.php b/admin-dev/tabs/AdminFeaturesValues.php index 45268c68e..f51217e2d 100644 --- a/admin-dev/tabs/AdminFeaturesValues.php +++ b/admin-dev/tabs/AdminFeaturesValues.php @@ -53,7 +53,7 @@ class AdminFeaturesValues extends AdminTab echo '

'.$this->l('Add a new feature value').'

- + '.($obj->id ? '' : '').'
'.$this->l('Add a new feature value').' @@ -103,7 +103,7 @@ class AdminFeaturesValues extends AdminTab { $object = new $this->className(); if ($object->deleteSelection($_POST[$this->table.$_POST['groupid'].'Box'])) - Tools::redirectAdmin($currentIndex.'&conf=2'.'&token='.($token ? $token : $this->token)); + Tools::redirectAdmin(self::$currentIndex.'&conf=2'.'&token='.($token ? $token : $this->token)); $this->_errors[] = Tools::displayError('An error occurred while deleting selection.'); } else diff --git a/admin-dev/tabs/AdminGenerator.php b/admin-dev/tabs/AdminGenerator.php index 040eadd50..545f5379b 100644 --- a/admin-dev/tabs/AdminGenerator.php +++ b/admin-dev/tabs/AdminGenerator.php @@ -44,7 +44,7 @@ class AdminGenerator extends AdminTab // Htaccess echo ' - +
'.$this->l('Htaccess file generation').'

'.$this->l('Warning:').' '.$this->l('this tool can ONLY be used if you are hosted by an Apache web server. Please ask your webhost.').'

'.$this->l('This tool will automatically generate a ".htaccess" file that will give you the ability to do URL rewriting and to catch 404 errors.').'

@@ -81,7 +81,7 @@ class AdminGenerator extends AdminTab // Robots echo '

- +
'.$this->l('Robots file generation').'

'.$this->l('Warning:').' '.$this->l('Your file robots.txt MUST be in your website\'s root directory and nowhere else.').'

'.$this->l('eg: http://www.yoursite.com/robots.txt').'.

@@ -118,7 +118,7 @@ class AdminGenerator extends AdminTab Configuration::updateValue('PS_REWRITING_SETTINGS', (int)Tools::getValue('PS_REWRITING_SETTINGS')); Configuration::updateValue('PS_HTACCESS_SPECIFIC', Tools::getValue('ps_htaccess_specific'), true); if (Tools::generateHtaccess($this->_htFile, Configuration::get('PS_REWRITING_SETTINGS'), Configuration::get('PS_HTACCESS_CACHE_CONTROL'), Tools::getValue('ps_htaccess_specific'))) - Tools::redirectAdmin($currentIndex.'&conf=4&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token); $this->_errors[] = $this->l('Cannot write into file:').' '.$this->_htFile.'
'.$this->l('Please check write permissions.'); } else @@ -164,7 +164,7 @@ class AdminGenerator extends AdminTab fwrite($writeFd, "\n"); fclose($writeFd); - Tools::redirectAdmin($currentIndex.'&conf=4&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token); } } else $this->_errors[] = Tools::displayError('You do not have permission to edit here.'); diff --git a/admin-dev/tabs/AdminGeolocation.php b/admin-dev/tabs/AdminGeolocation.php index 96ef0fef0..9e611698d 100755 --- a/admin-dev/tabs/AdminGeolocation.php +++ b/admin-dev/tabs/AdminGeolocation.php @@ -39,7 +39,7 @@ class AdminGeolocation extends AdminTab $this->displayWarning($this->l('In order to use Geolocation, please download').' '.$this->l('this file').' '.$this->l('and decompress it into tools/geoip/ directory')); echo ' - +
'.$this->l('Geolocation by IP').' @@ -58,7 +58,7 @@ class AdminGeolocation extends AdminTab '; $allowedCountries = explode(';', Configuration::get('PS_ALLOWED_COUNTRIES')); echo ' - +
'.$this->l('Options').' @@ -116,7 +116,7 @@ class AdminGeolocation extends AdminTab
-
+
'.$this->l('Whitelist of IP addresses').' @@ -146,7 +146,7 @@ class AdminGeolocation extends AdminTab if ($this->_isGeoLiteCityAvailable()) { Configuration::updateValue('PS_GEOLOCATION_ENABLED', intval(Tools::getValue('PS_GEOLOCATION_ENABLED'))); - Tools::redirectAdmin($currentIndex.'&token='.Tools::getValue('token').'&conf=4'); + Tools::redirectAdmin(self::$currentIndex.'&token='.Tools::getValue('token').'&conf=4'); } else $this->_errors[] = Tools::displayError('Geolocation database is unavailable.'); @@ -161,7 +161,7 @@ class AdminGeolocation extends AdminTab Configuration::updateValue('PS_GEOLOCATION_BEHAVIOR', (!(int)(Tools::getValue('PS_GEOLOCATION_BEHAVIOR')) ? _PS_GEOLOCATION_NO_CATALOG_ : _PS_GEOLOCATION_NO_ORDER_)); Configuration::updateValue('PS_GEOLOCATION_NA_BEHAVIOR', (int)Tools::getValue('PS_GEOLOCATION_NA_BEHAVIOR')); Configuration::updateValue('PS_ALLOWED_COUNTRIES', implode(';', Tools::getValue('countries'))); - Tools::redirectAdmin($currentIndex.'&token='.Tools::getValue('token').'&conf=4'); + Tools::redirectAdmin(self::$currentIndex.'&token='.Tools::getValue('token').'&conf=4'); } } @@ -172,7 +172,7 @@ class AdminGeolocation extends AdminTab else { Configuration::updateValue('PS_GEOLOCATION_WHITELIST', str_replace("\n", ';', str_replace("\r", '', Tools::getValue('PS_GEOLOCATION_WHITELIST')))); - Tools::redirectAdmin($currentIndex.'&token='.Tools::getValue('token').'&conf=4'); + Tools::redirectAdmin(self::$currentIndex.'&token='.Tools::getValue('token').'&conf=4'); } } diff --git a/admin-dev/tabs/AdminGroupShop.php b/admin-dev/tabs/AdminGroupShop.php index 9be0571f2..7932ba92a 100755 --- a/admin-dev/tabs/AdminGroupShop.php +++ b/admin-dev/tabs/AdminGroupShop.php @@ -73,7 +73,7 @@ class AdminGroupShop extends AdminTab else $disabled = ''; echo ' - + '.($obj->id ? '' : '').'
'.$this->l('GroupShop').''.$this->l('You can\'t edit GroupShop when you have more than one Shop').'
diff --git a/admin-dev/tabs/AdminGroups.php b/admin-dev/tabs/AdminGroups.php index 1cbbe4ac7..75110b7cd 100644 --- a/admin-dev/tabs/AdminGroups.php +++ b/admin-dev/tabs/AdminGroups.php @@ -67,7 +67,7 @@ class AdminGroups extends AdminTab $categories = Category::getSimpleCategories((int)($cookie->id_lang)); echo ' - + '.($obj->id ? '' : '').'
'.$this->l('Group').' @@ -106,7 +106,7 @@ class AdminGroups extends AdminTab
- + '; echo '
'.$this->l('Table').''.$this->l('Table Engine').'
'.$feature['value'].' - + '.$this->l('Edit').'  - '.$this->l('Delete').' - + '.$this->l('Edit').'  - + '.$this->l('Delete').'
'.Tools::htmlentitiesUTF8($groupReduction['category_name']).' '.$this->l('Delete').''.$this->l('Delete').'
'; } @@ -141,7 +141,7 @@ class AdminGroups extends AdminTab if ($obj->id) { echo ' - +
'.$this->l('New group discount').' @@ -176,7 +176,7 @@ class AdminGroups extends AdminTab echo '
-
+
'.strval($obj->name[(int)($cookie->id_lang)]).'
 
'.$this->l('Discount:').' '.(float)($obj->reduction).$this->l('%').' @@ -295,7 +295,7 @@ class AdminGroups extends AdminTab if (!$groupReduction->delete()) $this->_errors[] = Tools::displayError('An error occurred while deleting the group reduction'); else - Tools::redirectAdmin($currentIndex.'&update'.$this->table.'&id_group='.(int)(Tools::getValue('id_group')).'&conf=1&token='.$token); + Tools::redirectAdmin(self::$currentIndex.'&update'.$this->table.'&id_group='.(int)(Tools::getValue('id_group')).'&conf=1&token='.$token); } } else @@ -322,7 +322,7 @@ class AdminGroups extends AdminTab if (!$groupReduction->add()) $this->_errors[] = Tools::displayError('An error occurred while adding a category group reduction.'); else - Tools::redirectAdmin($currentIndex.'&update'.$this->table.'&id_group='.(int)(Tools::getValue('id_group')).'&conf=3&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&update'.$this->table.'&id_group='.(int)(Tools::getValue('id_group')).'&conf=3&token='.$this->token); } } else @@ -367,7 +367,7 @@ class AdminGroups extends AdminTab else { if ($object->delete()) - Tools::redirectAdmin($currentIndex.'&conf=1&token='.$token); + Tools::redirectAdmin(self::$currentIndex.'&conf=1&token='.$token); $this->_errors[] = Tools::displayError('An error occurred during deletion.'); } } diff --git a/admin-dev/tabs/AdminImageResize.php b/admin-dev/tabs/AdminImageResize.php index 94c1d9404..08699debd 100644 --- a/admin-dev/tabs/AdminImageResize.php +++ b/admin-dev/tabs/AdminImageResize.php @@ -47,9 +47,9 @@ class AdminImageResize extends AdminTab $this->_errors = Tools::displayError('An error occurred while copying image.').' '.stripslashes($imageType['name']); // Save and stay on same form if (Tools::getValue('saveandstay') == 'on') - Tools::redirectAdmin($currentIndex.'&id_product='.Tools::getValue('id_product').'&id_category='.(int)(Tools::getValue('id_category')).'&addproduct&conf=4&tabs=1&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee))); + Tools::redirectAdmin(self::$currentIndex.'&id_product='.Tools::getValue('id_product').'&id_category='.(int)(Tools::getValue('id_category')).'&addproduct&conf=4&tabs=1&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee))); // Default behavior (save and back) - Tools::redirectAdmin($currentIndex.'&id_category='.(int)(Tools::getValue('id_category')).'&conf='.(int)(Tools::getValue('conf')).'&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee))); + Tools::redirectAdmin(self::$currentIndex.'&id_category='.(int)(Tools::getValue('id_category')).'&conf='.(int)(Tools::getValue('conf')).'&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee))); } else parent::postProcess(); } @@ -68,7 +68,7 @@ class AdminImageResize extends AdminTab - + diff --git a/admin-dev/tabs/AdminImages.php b/admin-dev/tabs/AdminImages.php index b0f18faef..d1b324b6d 100644 --- a/admin-dev/tabs/AdminImages.php +++ b/admin-dev/tabs/AdminImages.php @@ -62,7 +62,7 @@ class AdminImages extends AdminTab if ($this->tabAccess['edit'] === '1') { if ($this->_regenerateThumbnails(Tools::getValue('type'), Tools::getValue('erase'))) - Tools::redirectAdmin($currentIndex.'&conf=9'.'&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&conf=9'.'&token='.$this->token); } else $this->_errors[] = Tools::displayError('You do not have permission to edit here.'); @@ -89,7 +89,7 @@ class AdminImages extends AdminTab echo $obj->id ? $this->displayWarning($this->l('After modification, do not forget to regenerate thumbnails')) : ''; echo ' - + '.($obj->id ? '' : '').'
'.$this->l('Images').'
@@ -186,7 +186,7 @@ class AdminImages extends AdminTab '.$this->l('Regenerates thumbnails for all existing product images').'.

'; $this->displayWarning($this->l('Please be patient, as this can take several minutes').'
'.$this->l('Be careful! Manually generated thumbnails will be erased by automatically generated thumbnails.')); echo ' - +
'.$this->l('Regenerate thumbnails').'
@@ -413,7 +413,7 @@ class AdminImages extends AdminTab

'.$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.').'
'. '
- +
'.$this->l('Move images').'
'. $this->l('You can choose to keep your images stored in the previous system - nothing wrong with that.').'
'. @@ -439,6 +439,6 @@ class AdminImages extends AdminTab $result = Image::moveToNewFileSystem($this->max_execution_time); if ($result === 'timeout') $this->_errors[] = Tools::displayError('Not all images have been moved, server timed out before finishing. Click on \"Move images\" again to resume moving images'); - Tools::redirectAdmin($currentIndex.'&conf=25'.'&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&conf=25'.'&token='.$this->token); } } diff --git a/admin-dev/tabs/AdminImport.php b/admin-dev/tabs/AdminImport.php index c1d967647..81491083b 100644 --- a/admin-dev/tabs/AdminImport.php +++ b/admin-dev/tabs/AdminImport.php @@ -1270,7 +1270,7 @@ class AdminImport extends AdminTab echo '
'.$this->l('Upload').' - +

'.$this->l('You can also upload your file by FTP and put it in').' '.realpath(dirname(__FILE__).'/../import/').'. @@ -1295,7 +1295,7 @@ class AdminImport extends AdminTab { echo '
- +
'.$this->l('Import').' @@ -1360,7 +1360,7 @@ class AdminImport extends AdminTab - + '.($obj->id ? '' : '').'
'.$this->l('Languages').' diff --git a/admin-dev/tabs/AdminLocalization.php b/admin-dev/tabs/AdminLocalization.php index 4706abe0f..5dabed396 100644 --- a/admin-dev/tabs/AdminLocalization.php +++ b/admin-dev/tabs/AdminLocalization.php @@ -79,7 +79,7 @@ class AdminLocalization extends AdminPreferences if (!$localizationPack->loadLocalisationPack($pack, $selection)) $this->_errors = array_merge($this->_errors, $localizationPack->getErrors()); else - Tools::redirectAdmin($currentIndex.'&conf=23&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&conf=23&token='.$this->token); } @@ -93,7 +93,7 @@ class AdminLocalization extends AdminPreferences $this->_displayForm('localization', $this->_fieldsLocalization, $this->l('Localization'), 'width2', 'localization'); echo '
- +
'.$this->l('Localization pack import').'
diff --git a/admin-dev/tabs/AdminManufacturers.php b/admin-dev/tabs/AdminManufacturers.php index 51845b737..12ed725de 100644 --- a/admin-dev/tabs/AdminManufacturers.php +++ b/admin-dev/tabs/AdminManufacturers.php @@ -105,7 +105,7 @@ class AdminManufacturers extends AdminTab $langtags = 'cdesc2¤cdesc¤mmeta_title¤mmeta_keywords¤mmeta_description'; echo ' - + '.($manufacturer->id ? '' : '').'
'.$this->l('Manufacturers').' diff --git a/admin-dev/tabs/AdminMessages.php b/admin-dev/tabs/AdminMessages.php index e7dd008b8..81b6bb73c 100644 --- a/admin-dev/tabs/AdminMessages.php +++ b/admin-dev/tabs/AdminMessages.php @@ -154,7 +154,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 963762165..6cbace35e 100644 --- a/admin-dev/tabs/AdminMeta.php +++ b/admin-dev/tabs/AdminMeta.php @@ -69,7 +69,7 @@ class AdminMeta extends AdminTab return; $files = Meta::getPages(true, ($meta->page ? $meta->page : false)); echo ' - + '.($meta->id ? '' : '').'
'.$this->l('Meta-Tags').' diff --git a/admin-dev/tabs/AdminModules.php b/admin-dev/tabs/AdminModules.php index adc14c3dd..34da12722 100644 --- a/admin-dev/tabs/AdminModules.php +++ b/admin-dev/tabs/AdminModules.php @@ -105,12 +105,12 @@ class AdminModules extends AdminTab if (Tools::isSubmit('filterModules')) { $this->setFilterModules(Tools::getValue('module_type'), Tools::getValue('country_module_value'), Tools::getValue('module_install'), Tools::getValue('module_status')); - Tools::redirectAdmin($currentIndex.'&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token); } elseif (Tools::isSubmit('resetFilterModules')) { $this->resetFilterModules(); - Tools::redirectAdmin($currentIndex.'&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token); } if (Tools::isSubmit('active')) { @@ -120,7 +120,7 @@ class AdminModules extends AdminTab if (Validate::isLoadedObject($module)) { $module->enable(); - Tools::redirectAdmin($currentIndex.'&conf=5&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name); + Tools::redirectAdmin(self::$currentIndex.'&conf=5&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name); } else $this->_errors[] = Tools::displayError('Cannot load module object'); } else @@ -134,7 +134,7 @@ class AdminModules extends AdminTab if (Validate::isLoadedObject($module)) { $module->disable(); - Tools::redirectAdmin($currentIndex.'&conf=5&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name); + Tools::redirectAdmin(self::$currentIndex.'&conf=5&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name); } else $this->_errors[] = Tools::displayError('Cannot load module object'); } else @@ -149,7 +149,7 @@ class AdminModules extends AdminTab { if ($module->uninstall()) if ($module->install()) - Tools::redirectAdmin($currentIndex.'&conf=21'.'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name); + Tools::redirectAdmin(self::$currentIndex.'&conf=21'.'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name); else $this->_errors[] = Tools::displayError('Cannot install module'); else @@ -223,9 +223,9 @@ class AdminModules extends AdminTab { $moduleDir = _PS_MODULE_DIR_.str_replace(array('.', '/', '\\'), array('', '', ''), Tools::getValue('module_name')); $this->recursiveDeleteOnDisk($moduleDir); - Tools::redirectAdmin($currentIndex.'&conf=22&token='.$this->token.'&tab_module='.Tools::getValue('tab_module').'&module_name='.Tools::getValue('module_name')); + Tools::redirectAdmin(self::$currentIndex.'&conf=22&token='.$this->token.'&tab_module='.Tools::getValue('tab_module').'&module_name='.Tools::getValue('module_name')); } - Tools::redirectAdmin($currentIndex.'&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token); } else $this->_errors[] = Tools::displayError('You do not have permission to delete here.'); @@ -262,7 +262,7 @@ class AdminModules extends AdminTab { if (((method_exists($module, $method) && ($echo = $module->{$method}())) || ($echo = ' ')) AND $key == 'configure' AND Module::isInstalled($module->name)) { - $backlink = $currentIndex.'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name; + $backlink = self::$currentIndex.'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name; $hooklink = 'index.php?tab=AdminModulesPositions&token='.Tools::getAdminTokenLite('AdminModulesPositions').'&show_modules='.(int)$module->id; $tradlink = 'index.php?tab=AdminTranslations&token='.Tools::getAdminTokenLite('AdminTranslations').'&type=modules&lang='; @@ -323,7 +323,7 @@ class AdminModules extends AdminTab } } if ($return) - Tools::redirectAdmin($currentIndex.'&conf='.$return.'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name); + Tools::redirectAdmin(self::$currentIndex.'&conf='.$return.'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name); } } @@ -347,7 +347,7 @@ class AdminModules extends AdminTab @unlink($file); if ($success) - Tools::redirectAdmin($currentIndex.'&conf=8'.'&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&conf=8'.'&token='.$this->token); } public function display() @@ -386,7 +386,7 @@ class AdminModules extends AdminTab module_list += \'|\'+modules[i].value; } } - document.location.href=\''.$currentIndex.'&token='.$this->token.'&\'+action+\'=\'+module_list.substring(1, module_list.length); + document.location.href=\''.self::$currentIndex.'&token='.$this->token.'&\'+action+\'=\'+module_list.substring(1, module_list.length); } $(\'document\').ready( function() { $(\'input[name="filtername"]\').autocomplete(moduleList, { @@ -599,7 +599,7 @@ class AdminModules extends AdminTab Add '.$this->l('Add a module from PrestaShop Addons').' '; - echo ' + echo '
 
@@ -607,7 +607,7 @@ class AdminModules extends AdminTab

'.$this->l('The module must be either a zip file or a tarball.').'


-
+
@@ -619,7 +619,7 @@ class AdminModules extends AdminTab
-
+
@@ -650,7 +650,7 @@ class AdminModules extends AdminTab foreach ($orderModule AS $tabModule) foreach ($tabModule AS $module) if ($module->active AND isset($module->warning) && $module->warning) - $warnings[] =''.$module->displayName.' - '.stripslashes(pSQL($module->warning)); + $warnings[] =''.$module->displayName.' - '.stripslashes(pSQL($module->warning)); $this->displayWarning($warnings); echo ' @@ -811,16 +811,16 @@ class AdminModules extends AdminTab echo ' @@ -880,19 +880,19 @@ class AdminModules extends AdminTab global $currentIndex; $return = ''; - $href = $currentIndex.'&token='.$this->token.'&module_name='. + $href = self::$currentIndex.'&token='.$this->token.'&module_name='. urlencode($module->name).'&tab_module='.$module->tab; if ($module->id) - $return .= 'active && method_exists($module, 'onclickOption')? 'onclick="'.$module->onclickOption('desactive', $href).'"' : '').' href="'.$currentIndex.'&token='.$this->token.'&module_name='.urlencode($module->name).'&'.($module->active ? 'enable=0' : 'enable=1').'&tab_module='.$module->tab.'&module_name='.urlencode($module->name).'" '.((Tools::isMultiShopActivated()) ? 'title="'.htmlspecialchars($module->active ? $this->l('Disable this module') : $this->l('Enable this module for all shops')).'"' : '').'>'.($module->active ? $this->l('Disable') : $this->l('Enable')).'  '; + $return .= 'active && method_exists($module, 'onclickOption')? 'onclick="'.$module->onclickOption('desactive', $href).'"' : '').' href="'.self::$currentIndex.'&token='.$this->token.'&module_name='.urlencode($module->name).'&'.($module->active ? 'enable=0' : 'enable=1').'&tab_module='.$module->tab.'&module_name='.urlencode($module->name).'" '.((Tools::isMultiShopActivated()) ? 'title="'.htmlspecialchars($module->active ? $this->l('Disable this module') : $this->l('Enable this module for all shops')).'"' : '').'>'.($module->active ? $this->l('Disable') : $this->l('Enable')).'  '; if ($module->id AND $module->active) - $return .= ''.$this->l('Reset').'  '; + $return .= ''.$this->l('Reset').'  '; if ($module->id AND (method_exists($module, 'getContent') OR (isset($module->is_configurable) AND $module->is_configurable) OR Tools::isMultiShopActivated())) - $return .= ''.$this->l('Configure').'  '; + $return .= ''.$this->l('Configure').'  '; - $return .= ''.$this->l('Delete').'  '; + $return .= ''.$this->l('Delete').'  '; return $return; } diff --git a/admin-dev/tabs/AdminModulesPositions.php b/admin-dev/tabs/AdminModulesPositions.php index 3d9a6fef1..d93e3fc43 100644 --- a/admin-dev/tabs/AdminModulesPositions.php +++ b/admin-dev/tabs/AdminModulesPositions.php @@ -46,7 +46,7 @@ class AdminModulesPositions extends AdminTab if (Validate::isLoadedObject($module)) { $module->updatePosition($id_hook, (int)(Tools::getValue('direction'))); - Tools::redirectAdmin($this->currentIndex.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token); } else $this->_errors[] = Tools::displayError('module cannot be loaded'); @@ -87,7 +87,7 @@ class AdminModulesPositions extends AdminTab elseif (!$module->registerExceptions($id_hook, $excepts, Shop::getListFromContext())) $this->_errors[] = Tools::displayError('An error occurred while transplanting module to hook.'); else - Tools::redirectAdmin($this->currentIndex.'&conf=16'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&conf=16'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token); } } else @@ -129,7 +129,7 @@ class AdminModulesPositions extends AdminTab } if (!$this->_errors) - Tools::redirectAdmin($this->currentIndex.'&conf=16'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&conf=16'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token); } else { @@ -144,7 +144,7 @@ class AdminModulesPositions extends AdminTab if (!$module->editExceptions($id_hook, $exceptions, Shop::getListFromContext())) $this->_errors[] = Tools::displayError('An error occurred while transplanting module to hook.'); else - Tools::redirectAdmin($this->currentIndex.'&conf=16'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&conf=16'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token); } } } @@ -170,7 +170,7 @@ class AdminModulesPositions extends AdminTab if (!$module->unregisterHook($id_hook, Shop::getListFromContext()) OR !$module->unregisterExceptions($id_hook, Shop::getListFromContext())) $this->_errors[] = Tools::displayError('An error occurred while deleting module from hook.'); else - Tools::redirectAdmin($this->currentIndex.'&conf=17'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&conf=17'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token); } } else @@ -200,7 +200,7 @@ class AdminModulesPositions extends AdminTab } } if (!sizeof($this->_errors)) - Tools::redirectAdmin($this->currentIndex.'&conf=17'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&conf=17'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token); } } } @@ -227,13 +227,13 @@ class AdminModulesPositions extends AdminTab '; - echo ' '.$this->l('Transplant a module').'

'; + echo ' '.$this->l('Transplant a module').'

'; // Print select list echo ' '.$this->l('Show').' : - '; $modules = Module::getModulesInstalled(); @@ -249,7 +249,7 @@ class AdminModulesPositions extends AdminTab echo '

-   +  
'.$this->l('Live edit').''; @@ -262,7 +262,7 @@ class AdminModulesPositions extends AdminTab echo '
'; // Print hook list - echo ''; + echo ''; $irow = 0; $hooks = Hook::getHooks(!(int)(Tools::getValue('hook_position'))); @@ -303,8 +303,8 @@ class AdminModulesPositions extends AdminTab echo ' = 2) ? ' class="dragHandle"' : '').' id="td_'.$hook['id_hook'].'_'.$instance->id.'" width="40"> - '.(($canMove) ? ''.$this->l('Up').'
- '.$this->l('Down').'' : '').' + '.(($canMove) ? ''.$this->l('Up').'
+ '.$this->l('Down').'' : '').'
@@ -341,7 +341,7 @@ class AdminModulesPositions extends AdminTab { // Check auth for this page if (!$id_module || !$id_hook) - Tools::redirectAdmin($this->currentIndex . '&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex . '&token='.$this->token); $sql = 'SELECT id_module FROM '._DB_PREFIX_.'hook_module @@ -349,7 +349,7 @@ class AdminModulesPositions extends AdminTab AND id_hook = '.$id_hook.' AND id_shop IN('.implode(', ', ShopCore::getListFromContext()).')'; if (!Db::getInstance()->getValue($sql)) - Tools::redirectAdmin($this->currentIndex . '&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex . '&token='.$this->token); $slModule = Module::getInstanceById($id_module); $exceptsList = $slModule->getExceptions($id_hook, true); @@ -381,7 +381,7 @@ class AdminModulesPositions extends AdminTab $modules = $instances; $hooks = Hook::getHooks(0); echo ' - '; + '; if ($this->displayKey) echo ''; echo '
'.$this->l('Transplant a module').' diff --git a/admin-dev/tabs/AdminOrderMessage.php b/admin-dev/tabs/AdminOrderMessage.php index 66deb4409..c82630807 100644 --- a/admin-dev/tabs/AdminOrderMessage.php +++ b/admin-dev/tabs/AdminOrderMessage.php @@ -52,7 +52,7 @@ class AdminOrderMessage extends AdminTab return; echo ' - + '.($obj->id ? '' : '').'
'.$this->l('Order messages').' diff --git a/admin-dev/tabs/AdminOrders.php b/admin-dev/tabs/AdminOrders.php index 7b8ac20ca..a3db69f4d 100644 --- a/admin-dev/tabs/AdminOrders.php +++ b/admin-dev/tabs/AdminOrders.php @@ -135,7 +135,7 @@ class AdminOrders extends AdminTab '{bankwire_details}' => (Configuration::get('BANK_WIRE_DETAILS') ? nl2br(Configuration::get('BANK_WIRE_DETAILS')) : ''), '{bankwire_address}' => (Configuration::get('BANK_WIRE_ADDRESS') ? nl2br(Configuration::get('BANK_WIRE_ADDRESS')) : '')); if ($history->addWithemail(true, $templateVars)) - Tools::redirectAdmin($currentIndex.'&id_order='.$id_order.'&vieworder'.'&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&id_order='.$id_order.'&vieworder'.'&token='.$this->token); $this->_errors[] = Tools::displayError('An error occurred while changing the status or was unable to send e-mail to the customer.'); } } @@ -178,7 +178,7 @@ class AdminOrders extends AdminTab if (!$message->add()) $this->_errors[] = Tools::displayError('An error occurred while sending message.'); elseif ($message->private) - Tools::redirectAdmin($currentIndex.'&id_order='.$id_order.'&vieworder&conf=11'.'&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&id_order='.$id_order.'&vieworder&conf=11'.'&token='.$this->token); elseif (Validate::isLoadedObject($customer = new Customer($id_customer))) { $order = new Order((int)($message->id_order)); @@ -186,7 +186,7 @@ class AdminOrders extends AdminTab { $varsTpl = array('{lastname}' => $customer->lastname, '{firstname}' => $customer->firstname, '{id_order}' => $message->id_order, '{message}' => (Configuration::get('PS_MAIL_TYPE') == 2 ? $message->message : nl2br2($message->message))); if (@Mail::Send((int)($order->id_lang), 'order_merchant_comment', Mail::l('New message regarding your order'), $varsTpl, $customer->email, $customer->firstname.' '.$customer->lastname)) - Tools::redirectAdmin($currentIndex.'&id_order='.$id_order.'&vieworder&conf=11'.'&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&id_order='.$id_order.'&vieworder&conf=11'.'&token='.$this->token); } } $this->_errors[] = Tools::displayError('An error occurred while sending e-mail to customer.'); @@ -345,7 +345,7 @@ class AdminOrders extends AdminTab // Redirect if no errors if (!sizeof($this->_errors)) - Tools::redirectAdmin($currentIndex.'&id_order='.$order->id.'&vieworder&conf=24&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order->id.'&vieworder&conf=24&token='.$this->token); } else $this->_errors[] = Tools::displayError('You do not have permission to delete here.'); @@ -483,9 +483,9 @@ class AdminOrders extends AdminTab $row = array_shift($history); if ($prevOrder = Db::getInstance()->getValue('SELECT id_order FROM '._DB_PREFIX_.'orders WHERE id_order < '.(int)$order->id.' ORDER BY id_order DESC')) - $prevOrder = ''; + $prevOrder = ''; if ($nextOrder = Db::getInstance()->getValue('SELECT id_order FROM '._DB_PREFIX_.'orders WHERE id_order > '.(int)$order->id.' ORDER BY id_order ASC')) - $nextOrder = ''; + $nextOrder = ''; if ($order->total_paid != $order->total_paid_real) @@ -545,7 +545,7 @@ class AdminOrders extends AdminTab /* Display status form */ echo ' - + @@ -719,7 +719,7 @@ class AdminOrders extends AdminTab // List of products echo '
- +
'.$this->l('Products').''.$this->l('Products').' @@ -942,7 +942,7 @@ class AdminOrders extends AdminTab echo '
'; echo '
 
'; - echo '

'.$this->l('Back to list').'
'; + echo '

'.$this->l('Back to list').'
'; } public function displayAddressDetail($addressDelivery) diff --git a/admin-dev/tabs/AdminOrdersStates.php b/admin-dev/tabs/AdminOrdersStates.php index bfc913c05..1a6af1b70 100644 --- a/admin-dev/tabs/AdminOrdersStates.php +++ b/admin-dev/tabs/AdminOrdersStates.php @@ -115,7 +115,7 @@ class AdminOrdersStates extends AdminTab return; echo ' - + '.($obj->id ? '' : '').'
'.$this->l('Order statuses').' diff --git a/admin-dev/tabs/AdminPayment.php b/admin-dev/tabs/AdminPayment.php index 3796c804e..398ec3813 100644 --- a/admin-dev/tabs/AdminPayment.php +++ b/admin-dev/tabs/AdminPayment.php @@ -93,7 +93,7 @@ class AdminPayment extends AdminTab $values[] = '('.(int)$module->id.', '.Context::getContext()->shop->getID().', '.(int)$selected.')'; if (sizeof($values)) Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'module_'.$type.' (`id_module`, `id_shop`, `id_'.$type.'`) VALUES '.implode(',', $values)); - Tools::redirectAdmin($currentIndex.'&conf=4'.'&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&conf=4'.'&token='.$this->token); } public function display() @@ -141,7 +141,7 @@ class AdminPayment extends AdminTab $irow = 0; echo ' - +
'.$title.'

'.$desc.'
'.$this->youEditFieldFor().'

diff --git a/admin-dev/tabs/AdminPerformance.php b/admin-dev/tabs/AdminPerformance.php index 6f18fb381..d1dd0b6b3 100644 --- a/admin-dev/tabs/AdminPerformance.php +++ b/admin-dev/tabs/AdminPerformance.php @@ -64,7 +64,7 @@ class AdminPerformance extends AdminTab { $settings = preg_replace('/define\(\'_PS_CACHE_ENABLED_\', \'([0-9])\'\);/Ui', 'define(\'_PS_CACHE_ENABLED_\', \''.(int)$cache_active.'\');', $settings); if (file_put_contents(dirname(__FILE__).'/../../config/settings.inc.php', $settings)) - Tools::redirectAdmin($currentIndex.'&token='.Tools::getValue('token').'&conf=4'); + Tools::redirectAdmin(self::$currentIndex.'&token='.Tools::getValue('token').'&conf=4'); else $this->_errors[] = Tools::displayError('Cannot overwrite settings file.'); } @@ -85,7 +85,7 @@ class AdminPerformance extends AdminTab if (!sizeof($this->_errors)) { if (MCached::addServer(pSQL(Tools::getValue('memcachedIp')), (int)Tools::getValue('memcachedPort'), (int)Tools::getValue('memcachedWeight'))) - Tools::redirectAdmin($currentIndex.'&token='.Tools::getValue('token').'&conf=4'); + Tools::redirectAdmin(self::$currentIndex.'&token='.Tools::getValue('token').'&conf=4'); else $this->_errors[] = Tools::displayError('Cannot add Memcached server'); } @@ -98,7 +98,7 @@ class AdminPerformance extends AdminTab if ($this->tabAccess['add'] === '1') { if (MCached::deleteServer((int)Tools::getValue('deleteMemcachedServer'))) - Tools::redirectAdmin($currentIndex.'&token='.Tools::getValue('token').'&conf=4'); + Tools::redirectAdmin(self::$currentIndex.'&token='.Tools::getValue('token').'&conf=4'); else $this->_errors[] = Tools::displayError('Error in deleting Memcached server'); } @@ -137,7 +137,7 @@ class AdminPerformance extends AdminTab if (file_put_contents(dirname(__FILE__).'/../../config/settings.inc.php', $settings)) { Configuration::updateValue('PS_CIPHER_ALGORITHM', $algo); - Tools::redirectAdmin($currentIndex.'&token='.Tools::getValue('token').'&conf=4'); + Tools::redirectAdmin(self::$currentIndex.'&token='.Tools::getValue('token').'&conf=4'); } else $this->_errors[] = Tools::displayError('Cannot overwrite settings file.'); @@ -160,7 +160,7 @@ class AdminPerformance extends AdminTab ) $this->_errors[] = Tools::displayError('Unknown error.'); else - Tools::redirectAdmin($currentIndex.'&token='.Tools::getValue('token').'&conf=4'); + Tools::redirectAdmin(self::$currentIndex.'&token='.Tools::getValue('token').'&conf=4'); } else $this->_errors[] = Tools::displayError('You do not have permission to edit here.'); @@ -185,7 +185,7 @@ class AdminPerformance extends AdminTab unset($this->_fieldsGeneral['_MEDIA_SERVER_1_']); unset($this->_fieldsGeneral['_MEDIA_SERVER_2_']); unset($this->_fieldsGeneral['_MEDIA_SERVER_3_']); - Tools::redirectAdmin($currentIndex.'&token='.Tools::getValue('token').'&conf=4'); + Tools::redirectAdmin(self::$currentIndex.'&token='.Tools::getValue('token').'&conf=4'); } } else @@ -197,7 +197,7 @@ class AdminPerformance extends AdminTab { Configuration::updateValue('PS_SMARTY_FORCE_COMPILE', Tools::getValue('smarty_force_compile', 0)); Configuration::updateValue('PS_SMARTY_CACHE', Tools::getValue('smarty_cache', 0)); - Tools::redirectAdmin($currentIndex.'&token='.Tools::getValue('token').'&conf=4'); + Tools::redirectAdmin(self::$currentIndex.'&token='.Tools::getValue('token').'&conf=4'); } else $this->_errors[] = Tools::displayError('You do not have permission to edit here.'); @@ -246,7 +246,7 @@ class AdminPerformance extends AdminTab '; echo ' - +

'.$this->l('Smarty').' @@ -270,7 +270,7 @@ class AdminPerformance extends AdminTab '; echo ' -
+
'.$this->l('CCC (Combine, Compress and Cache)').'

'.$this->l('CCC allows you to reduce the loading time of your page. With these settings you will gain performance without even touching the code of your theme. Make sure, however, that your theme is compatible with PrestaShop 1.4+. Otherwise, CCC will cause problems.').'

@@ -325,7 +325,7 @@ class AdminPerformance extends AdminTab
'; - echo '
+ echo '
'.$this->l('Media servers (used only with CCC)').'

'.$this->l('You must enter another domain or subdomain in order to use cookieless static content.').'

@@ -353,7 +353,7 @@ class AdminPerformance extends AdminTab echo '
'.$this->l('Ciphering').' - +

'.$this->l('Mcrypt is faster than our custom BlowFish class, but requires the PHP extension "mcrypt". If you change this configuration, all cookies will be reset.').'

@@ -373,7 +373,7 @@ class AdminPerformance extends AdminTab $depth = Configuration::get('PS_CACHEFS_DIRECTORY_DEPTH'); echo '
'.$this->l('Caching').' - +
@@ -404,7 +404,7 @@ class AdminPerformance extends AdminTab '.$this->l('Add server').'
'; echo ' diff --git a/admin-dev/tabs/AdminPreferences.php b/admin-dev/tabs/AdminPreferences.php index 29c8a7419..bf4a8c27a 100644 --- a/admin-dev/tabs/AdminPreferences.php +++ b/admin-dev/tabs/AdminPreferences.php @@ -149,7 +149,7 @@ class AdminPreferences extends AdminTab if ($val = Tools::getValue('PS_THEME')) { if (rewriteSettingsFile(NULL, $val, NULL)) - Tools::redirectAdmin($this->currentIndex.'&conf=6'.'&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&conf=6'.'&token='.$this->token); else $this->_errors[] = Tools::displayError('Cannot access settings file.'); } @@ -277,7 +277,7 @@ class AdminPreferences extends AdminTab if (!sizeof($this->_errors)) { $this->submitConfiguration($fields); - Tools::redirectAdmin($this->currentIndex.'&conf=6'.'&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&conf=6'.'&token='.$this->token); } } } @@ -347,7 +347,7 @@ class AdminPreferences extends AdminTab $(\'input[name=PS_MAINTENANCE_IP]\').attr(\'value\',\''.Tools::getRemoteAddr().'\'); } - +
'.$tabname.''; foreach ($fields AS $key => $field) { diff --git a/admin-dev/tabs/AdminProducts.php b/admin-dev/tabs/AdminProducts.php index 37919f350..7208349c7 100644 --- a/admin-dev/tabs/AdminProducts.php +++ b/admin-dev/tabs/AdminProducts.php @@ -37,7 +37,7 @@ class AdminProducts extends AdminTab { global $currentIndex; $context = Context::getContext(); - + $this->table = 'product'; $this->className = 'Product'; $this->lang = true; @@ -173,7 +173,6 @@ class AdminProducts extends AdminTab public function postProcess($token = NULL) { global $cookie, $currentIndex; - /* Add a new product */ if (Tools::isSubmit('submitAddproduct') OR Tools::isSubmit('submitAddproductAndStay') OR Tools::isSubmit('submitAddProductAndPreview')) { @@ -260,7 +259,7 @@ class AdminProducts extends AdminTab if (!sizeof($this->_errors)) { $attachment->add(); - Tools::redirectAdmin($currentIndex.'&id_product='.(int)(Tools::getValue($this->identifier)).'&id_category='.(int)(Tools::getValue('id_category')).'&addproduct&conf=4&tabs=6&token='.($token ? $token : $this->token)); + Tools::redirectAdmin(self::$currentIndex.'&id_product='.(int)(Tools::getValue($this->identifier)).'&id_category='.(int)(Tools::getValue('id_category')).'&addproduct&conf=4&tabs=6&token='.($token ? $token : $this->token)); } else $this->_errors[] = Tools::displayError('Invalid file'); @@ -275,7 +274,7 @@ class AdminProducts extends AdminTab if ($this->tabAccess['edit'] === '1') if ($id = (int)(Tools::getValue($this->identifier))) if (Attachment::attachToProduct($id, $_POST['attachments'])) - Tools::redirectAdmin($currentIndex.'&id_product='.(int)$id.(isset($_POST['id_category']) ? '&id_category='.(int)$_POST['id_category'] : '').'&conf=4&add'.$this->table.'&tabs=6&token='.($token ? $token : $this->token)); + Tools::redirectAdmin(self::$currentIndex.'&id_product='.(int)$id.(isset($_POST['id_category']) ? '&id_category='.(int)$_POST['id_category'] : '').'&conf=4&add'.$this->table.'&tabs=6&token='.($token ? $token : $this->token)); } /* Product duplication */ @@ -310,7 +309,7 @@ class AdminProducts extends AdminTab { Hook::addProduct($product); Search::indexation(false); - Tools::redirectAdmin($currentIndex.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&conf=19&token='.($token ? $token : $this->token)); + Tools::redirectAdmin(self::$currentIndex.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&conf=19&token='.($token ? $token : $this->token)); } } else @@ -328,7 +327,7 @@ class AdminProducts extends AdminTab if (Validate::isLoadedObject($object = $this->loadObject())) { if ($object->toggleStatus()) - Tools::redirectAdmin($currentIndex.'&conf=5'.((($id_category = (!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1')) AND Tools::getValue('id_product')) ? '&id_category='.$id_category : '').'&token='.$token); + Tools::redirectAdmin(self::$currentIndex.'&conf=5'.((($id_category = (!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1')) AND Tools::getValue('id_product')) ? '&id_category='.$id_category : '').'&token='.$token); else $this->_errors[] = Tools::displayError('An error occurred while updating status.'); } @@ -358,10 +357,10 @@ class AdminProducts extends AdminTab $object->deleteImages(); $object->deleted = 1; if ($object->update()) - Tools::redirectAdmin($currentIndex.'&conf=1&token='.($token ? $token : $this->token).$category_url); + Tools::redirectAdmin(self::$currentIndex.'&conf=1&token='.($token ? $token : $this->token).$category_url); } elseif ($object->delete()) - Tools::redirectAdmin($currentIndex.'&conf=1&token='.($token ? $token : $this->token).$category_url); + Tools::redirectAdmin(self::$currentIndex.'&conf=1&token='.($token ? $token : $this->token).$category_url); $this->_errors[] = Tools::displayError('An error occurred during deletion.'); } } @@ -405,7 +404,7 @@ class AdminProducts extends AdminTab $id_category = Tools::getValue('id_category'); $category_url = empty($id_category) ? '' : '&id_category='.$id_category; - Tools::redirectAdmin($currentIndex.'&conf=2&token='.$token.$category_url); + Tools::redirectAdmin(self::$currentIndex.'&conf=2&token='.$token.$category_url); } $this->_errors[] = Tools::displayError('An error occurred while deleting selection.'); } @@ -439,7 +438,7 @@ class AdminProducts extends AdminTab } @unlink(_PS_TMP_IMG_DIR_.'/product_'.$image->id_product.'.jpg'); @unlink(_PS_TMP_IMG_DIR_.'/product_mini_'.$image->id_product.'.jpg'); - Tools::redirectAdmin($currentIndex.'&id_product='.$image->id_product.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&add'.$this->table.'&tabs=1'.'&token='.($token ? $token : $this->token)); + Tools::redirectAdmin(self::$currentIndex.'&id_product='.$image->id_product.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&add'.$this->table.'&tabs=1'.'&token='.($token ? $token : $this->token)); } /* Update product image/legend */ @@ -467,7 +466,7 @@ class AdminProducts extends AdminTab $productId = (int)(Tools::getValue('id_product')); @unlink(_PS_TMP_IMG_DIR_.'/product_'.$productId.'.jpg'); @unlink(_PS_TMP_IMG_DIR_.'/product_mini_'.$productId.'.jpg'); - Tools::redirectAdmin($currentIndex.'&id_product='.$image->id_product.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&addproduct&tabs=1'.'&token='.($token ? $token : $this->token)); + Tools::redirectAdmin(self::$currentIndex.'&id_product='.$image->id_product.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&addproduct&tabs=1'.'&token='.($token ? $token : $this->token)); } } @@ -475,7 +474,7 @@ class AdminProducts extends AdminTab elseif (isset($_GET['imgPosition']) AND isset($_GET['imgDirection'])) { $image->positionImage((int)(Tools::getValue('imgPosition')), (int)(Tools::getValue('imgDirection'))); - Tools::redirectAdmin($currentIndex.'&id_product='.$image->id_product.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&add'.$this->table.'&tabs=1&token='.($token ? $token : $this->token)); + Tools::redirectAdmin(self::$currentIndex.'&id_product='.$image->id_product.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&add'.$this->table.'&tabs=1&token='.($token ? $token : $this->token)); } } else @@ -570,7 +569,7 @@ class AdminProducts extends AdminTab { if (!$product->cache_default_attribute) Product::updateDefaultAttribute($product->id); - Tools::redirectAdmin($currentIndex.'&id_product='.$product->id.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&add'.$this->table.'&tabs=3&token='.($token ? $token : $this->token)); + Tools::redirectAdmin(self::$currentIndex.'&id_product='.$product->id.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&add'.$this->table.'&tabs=3&token='.($token ? $token : $this->token)); } } } @@ -592,7 +591,7 @@ class AdminProducts extends AdminTab else Product::updateDefaultAttribute($id_product); - Tools::redirectAdmin($currentIndex.'&add'.$this->table.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&tabs=3&id_product='.$product->id.'&token='.($token ? $token : $this->token)); + Tools::redirectAdmin(self::$currentIndex.'&add'.$this->table.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&tabs=3&id_product='.$product->id.'&token='.($token ? $token : $this->token)); } else $this->_errors[] = Tools::displayError('Cannot delete attribute'); @@ -613,7 +612,7 @@ class AdminProducts extends AdminTab $product->cache_default_attribute = 0; $product->update(); } - Tools::redirectAdmin($currentIndex.'&add'.$this->table.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&tabs=3&id_product='.$product->id.'&token='.($token ? $token : $this->token)); + Tools::redirectAdmin(self::$currentIndex.'&add'.$this->table.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&tabs=3&id_product='.$product->id.'&token='.($token ? $token : $this->token)); } else $this->_errors[] = Tools::displayError('Cannot delete attributes'); @@ -627,7 +626,7 @@ class AdminProducts extends AdminTab { $product->deleteDefaultAttributes(); $product->setDefaultAttribute((int)(Tools::getValue('id_product_attribute'))); - Tools::redirectAdmin($currentIndex.'&add'.$this->table.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&tabs=3&id_product='.$product->id.'&token='.($token ? $token : $this->token)); + Tools::redirectAdmin(self::$currentIndex.'&add'.$this->table.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&tabs=3&id_product='.$product->id.'&token='.($token ? $token : $this->token)); } else $this->_errors[] = Tools::displayError('Cannot make default attribute'); @@ -668,7 +667,7 @@ class AdminProducts extends AdminTab } } if (!sizeof($this->_errors)) - Tools::redirectAdmin($currentIndex.'&id_product='.(int)$product->id.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&add'.$this->table.'&tabs=4&conf=4&token='.($token ? $token : $this->token)); + Tools::redirectAdmin(self::$currentIndex.'&id_product='.(int)$product->id.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&add'.$this->table.'&tabs=4&conf=4&token='.($token ? $token : $this->token)); } else $this->_errors[] = Tools::displayError('Product must be created before adding features.'); @@ -711,7 +710,7 @@ class AdminProducts extends AdminTab $this->_errors = Tools::displayError('An error occurred while updating the specific price.'); } if (!sizeof($this->_errors)) - Tools::redirectAdmin($currentIndex.'&id_product='.(int)(Tools::getValue('id_product')).'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&update'.$this->table.'&tabs=2&token='.($token ? $token : $this->token)); + Tools::redirectAdmin(self::$currentIndex.'&id_product='.(int)(Tools::getValue('id_product')).'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&update'.$this->table.'&tabs=2&token='.($token ? $token : $this->token)); } else $this->_errors[] = Tools::displayError('You do not have permission to add here.'); @@ -748,7 +747,7 @@ class AdminProducts extends AdminTab if (!$specificPrice->add()) $this->_errors = Tools::displayError('An error occurred while updating the specific price.'); else - Tools::redirectAdmin($currentIndex.'&id_product='.$id_product.'&add'.$this->table.'&tabs=2&conf=3&token='.($token ? $token : $this->token)); + Tools::redirectAdmin(self::$currentIndex.'&id_product='.$id_product.'&add'.$this->table.'&tabs=2&conf=3&token='.($token ? $token : $this->token)); } } else @@ -768,7 +767,7 @@ class AdminProducts extends AdminTab if (!$specificPrice->delete()) $this->_errors[] = Tools::displayError('An error occurred while deleting the specific price'); else - Tools::redirectAdmin($currentIndex.'&id_product='.$obj->id.'&add'.$this->table.'&tabs=2&conf=1&token='.($token ? $token : $this->token)); + Tools::redirectAdmin(self::$currentIndex.'&id_product='.$obj->id.'&add'.$this->table.'&tabs=2&conf=1&token='.($token ? $token : $this->token)); } } else @@ -785,12 +784,12 @@ class AdminProducts extends AdminTab if (!SpecificPrice::setPriorities($priorities)) $this->_errors[] = Tools::displayError('An error occurred while updating priorities.'); else - Tools::redirectAdmin($currentIndex.'&id_product='.$obj->id.'&add'.$this->table.'&tabs=2&conf=4&token='.($token ? $token : $this->token)); + Tools::redirectAdmin(self::$currentIndex.'&id_product='.$obj->id.'&add'.$this->table.'&tabs=2&conf=4&token='.($token ? $token : $this->token)); } elseif (!SpecificPrice::setSpecificPriority((int)($obj->id), $priorities)) $this->_errors[] = Tools::displayError('An error occurred while setting priorities.'); else - Tools::redirectAdmin($currentIndex.'&id_product='.$obj->id.'&add'.$this->table.'&tabs=2&conf=4&token='.($token ? $token : $this->token)); + Tools::redirectAdmin(self::$currentIndex.'&id_product='.$obj->id.'&add'.$this->table.'&tabs=2&conf=4&token='.($token ? $token : $this->token)); } /* Customization management */ elseif (Tools::isSubmit('submitCustomizationConfiguration')) @@ -809,7 +808,7 @@ class AdminProducts extends AdminTab if (!sizeof($this->_errors) AND !$product->update()) $this->_errors[] = Tools::displayError('An error occurred while updating customization configuration.'); if (!sizeof($this->_errors)) - Tools::redirectAdmin($currentIndex.'&id_product='.$product->id.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&add'.$this->table.'&tabs=5&token='.($token ? $token : $this->token)); + Tools::redirectAdmin(self::$currentIndex.'&id_product='.$product->id.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&add'.$this->table.'&tabs=5&token='.($token ? $token : $this->token)); } else $this->_errors[] = Tools::displayError('Product must be created before adding customization possibilities.'); @@ -829,7 +828,7 @@ class AdminProducts extends AdminTab if (!sizeof($this->_errors) AND !$product->updateLabels()) $this->_errors[] = Tools::displayError('An error occurred while updating customization.'); if (!sizeof($this->_errors)) - Tools::redirectAdmin($currentIndex.'&id_product='.$product->id.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&add'.$this->table.'&tabs=5&token='.($token ? $token : $this->token)); + Tools::redirectAdmin(self::$currentIndex.'&id_product='.$product->id.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&add'.$this->table.'&tabs=5&token='.($token ? $token : $this->token)); } else $this->_errors[] = Tools::displayError('Product must be created before adding customization possibilities.'); @@ -846,7 +845,7 @@ class AdminProducts extends AdminTab if (!$object->updatePosition((int)(Tools::getValue('way')), (int)(Tools::getValue('position')))) $this->_errors[] = Tools::displayError('Failed to update the position.'); else - Tools::redirectAdmin($currentIndex.'&'.$this->table.'Orderby=position&'.$this->table.'Orderway=asc&conf=5'.(($id_category = (!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1')) ? ('&id_category='.$id_category) : '').'&token='.Tools::getAdminTokenLite('AdminCatalog')); + Tools::redirectAdmin(self::$currentIndex.'&'.$this->table.'Orderby=position&'.$this->table.'Orderway=asc&conf=5'.(($id_category = (!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1')) ? ('&id_category='.$id_category) : '').'&token='.Tools::getAdminTokenLite('AdminCatalog')); } else parent::postProcess(true); @@ -1197,7 +1196,7 @@ class AdminProducts extends AdminTab Hook::updateProduct($object); Search::indexation(false); if (Tools::getValue('resizer') == 'man' && isset($id_image) AND is_int($id_image) AND $id_image) - Tools::redirectAdmin($currentIndex.'&id_product='.$object->id.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&edit='.strval(Tools::getValue('productCreated')).'&id_image='.$id_image.'&imageresize&toconf=4&submitAddAndStay='.((Tools::isSubmit('submitAdd'.$this->table.'AndStay') OR Tools::getValue('productCreated') == 'on') ? 'on' : 'off').'&token='.(($token ? $token : $this->token))); + Tools::redirectAdmin(self::$currentIndex.'&id_product='.$object->id.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&edit='.strval(Tools::getValue('productCreated')).'&id_image='.$id_image.'&imageresize&toconf=4&submitAddAndStay='.((Tools::isSubmit('submitAdd'.$this->table.'AndStay') OR Tools::getValue('productCreated') == 'on') ? 'on' : 'off').'&token='.(($token ? $token : $this->token))); // Save and preview if (Tools::isSubmit('submitAddProductAndPreview')) @@ -1214,10 +1213,10 @@ class AdminProducts extends AdminTab } else if (Tools::isSubmit('submitAdd'.$this->table.'AndStay') OR ($id_image AND $id_image !== true)) // Save and stay on same form // Save and stay on same form if (Tools::isSubmit('submitAdd'.$this->table.'AndStay')) - Tools::redirectAdmin($currentIndex.'&id_product='.$object->id.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&addproduct&conf=4&tabs='.(int)(Tools::getValue('tabs')).'&token='.($token ? $token : $this->token)); + Tools::redirectAdmin(self::$currentIndex.'&id_product='.$object->id.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&addproduct&conf=4&tabs='.(int)(Tools::getValue('tabs')).'&token='.($token ? $token : $this->token)); // Default behavior (save and back) - Tools::redirectAdmin($currentIndex.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&conf=4&token='.($token ? $token : $this->token).'&onredirigeici'); + Tools::redirectAdmin(self::$currentIndex.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&conf=4&token='.($token ? $token : $this->token).'&onredirigeici'); } } else @@ -1267,12 +1266,12 @@ class AdminProducts extends AdminTab } if (Tools::getValue('resizer') == 'man' && isset($id_image) AND is_int($id_image) AND $id_image) - Tools::redirectAdmin($currentIndex.'&id_product='.$object->id.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&id_image='.$id_image.'&imageresize&toconf=3&submitAddAndStay='.(Tools::isSubmit('submitAdd'.$this->table.'AndStay') ? 'on' : 'off').'&token='.(($token ? $token : $this->token))); + Tools::redirectAdmin(self::$currentIndex.'&id_product='.$object->id.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&id_image='.$id_image.'&imageresize&toconf=3&submitAddAndStay='.(Tools::isSubmit('submitAdd'.$this->table.'AndStay') ? 'on' : 'off').'&token='.(($token ? $token : $this->token))); // Save and stay on same form if (Tools::isSubmit('submitAdd'.$this->table.'AndStay')) - Tools::redirectAdmin($currentIndex.'&id_product='.$object->id.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&addproduct&conf=3&tabs='.(int)(Tools::getValue('tabs')).'&token='.($token ? $token : $this->token)); + Tools::redirectAdmin(self::$currentIndex.'&id_product='.$object->id.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&addproduct&conf=3&tabs='.(int)(Tools::getValue('tabs')).'&token='.($token ? $token : $this->token)); // Default behavior (save and back) - Tools::redirectAdmin($currentIndex.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&conf=3&token='.($token ? $token : $this->token)); + Tools::redirectAdmin(self::$currentIndex.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&conf=3&token='.($token ? $token : $this->token)); } } else @@ -1401,9 +1400,8 @@ class AdminProducts extends AdminTab public function display($token = NULL) { global $currentIndex, $cookie; - + $id_shop = Context::getContext()->shop->getID(); - if (($id_category = (int)Tools::getValue('id_category'))) $currentIndex .= '&id_category='.$id_category; $this->getList((int)($cookie->id_lang), !$cookie->__get($this->table.'Orderby') ? 'position' : NULL, !$cookie->__get($this->table.'Orderway') ? 'ASC' : NULL, 0, NULL, $id_shop); @@ -1413,12 +1411,11 @@ class AdminProducts extends AdminTab echo '

'.(!$this->_listTotal ? ($this->l('No products found')) : ($this->_listTotal.' '.($this->_listTotal > 1 ? $this->l('products') : $this->l('product')))).' '. $this->l('in category').' "'.stripslashes($this->_category->getName()).'"

'; if ($this->tabAccess['add'] === '1') - echo ' '.$this->l('Add a new product').''; + echo ' '.$this->l('Add a new product').''; echo '
'; $this->displayList($token); $this->displayAssoShop(); echo '
'; - } /** @@ -1561,7 +1558,7 @@ class AdminProducts extends AdminTab - + '.$this->_displayDraftWarning($obj->active).' @@ -1742,7 +1739,7 @@ class AdminProducts extends AdminTab
- + '; $i++; } @@ -3060,25 +3057,25 @@ class AdminProducts extends AdminTab if ($image['position'] == $imagesTotal) echo '[ ]'; else - echo '[ ]'; + echo '[ ]'; } elseif ($image['position'] == $imagesTotal) echo ' - [ ] + [ ][ ]'; else echo ' - [ ] - [ ]'; + [ ] + [ ]'; echo ''; if(Tools::isMultiShopActivated()) foreach ($shops AS $shop) echo ''; echo ' - + '; } @@ -3410,13 +3407,13 @@ class AdminProducts extends AdminTab '.$this->l('Modify this combination').'  - '.(!$product_attribute['default_on'] ? ' + '.(!$product_attribute['default_on'] ? ' '.$this->l('Make this the default combination').'' : '').' - + '.$this->l('Delete this combination').''; } - echo ''; + echo ''; } else echo ''; diff --git a/admin-dev/tabs/AdminProfiles.php b/admin-dev/tabs/AdminProfiles.php index 0188e5435..79b48bccc 100644 --- a/admin-dev/tabs/AdminProfiles.php +++ b/admin-dev/tabs/AdminProfiles.php @@ -66,7 +66,7 @@ class AdminProfiles extends AdminTab return; echo ' - + '.($obj->id ? '' : '').'
'.$this->l('Profiles').' diff --git a/admin-dev/tabs/AdminQuickAccesses.php b/admin-dev/tabs/AdminQuickAccesses.php index f1aaf8709..a06c3e9ad 100644 --- a/admin-dev/tabs/AdminQuickAccesses.php +++ b/admin-dev/tabs/AdminQuickAccesses.php @@ -54,7 +54,7 @@ class AdminQuickAccesses extends AdminTab $new_window = $this->getFieldValue($obj, 'new_window'); echo ' - + '.($obj->id ? '' : '').'
'.$this->l('Quick Access menu').' diff --git a/admin-dev/tabs/AdminRangePrice.php b/admin-dev/tabs/AdminRangePrice.php index 54f05695b..3f27a8351 100644 --- a/admin-dev/tabs/AdminRangePrice.php +++ b/admin-dev/tabs/AdminRangePrice.php @@ -81,7 +81,7 @@ class AdminRangePrice extends AdminTab $carrierArray[] = '*'; echo ' - + '.($obj->id ? '' : '').'
'.$this->l('Price ranges').' diff --git a/admin-dev/tabs/AdminRangeWeight.php b/admin-dev/tabs/AdminRangeWeight.php index d691595f9..cbbda643b 100644 --- a/admin-dev/tabs/AdminRangeWeight.php +++ b/admin-dev/tabs/AdminRangeWeight.php @@ -80,7 +80,7 @@ class AdminRangeWeight extends AdminTab $carrierArray[] = '*'; echo ' - + '.($obj->id ? '' : '').'
'.$this->l('Weight ranges').' diff --git a/admin-dev/tabs/AdminReferrers.php b/admin-dev/tabs/AdminReferrers.php index 984e66061..f85d5d23c 100644 --- a/admin-dev/tabs/AdminReferrers.php +++ b/admin-dev/tabs/AdminReferrers.php @@ -166,7 +166,7 @@ class AdminReferrers extends AdminTab echo '
'.$this->l('Settings').' - +
@@ -181,13 +181,13 @@ class AdminReferrers extends AdminTab
-
+

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

'.$this->l('There is a huge quantity of data, so each connection corresponding to a referrer is indexed. You can refresh this index by clicking on the button below. Be aware that it may take a long time and it is only needed if you modified or added a referrer and if you want your changes to be retroactive.').'


-
+

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

'.$this->l('For you to sort and filter your data, it is cached. You can refresh the cache by clicking on the button below.').'

@@ -213,7 +213,7 @@ class AdminReferrers extends AdminTab if (Tools::isSubmit('submitSettings')) if ($this->tabAccess['edit'] === '1') if (Configuration::updateValue('TRACKING_DIRECT_TRAFFIC', (int)(Tools::getValue('tracking_dt')))) - Tools::redirectAdmin($currentIndex.'&conf=4&token='.Tools::getValue('token')); + Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.Tools::getValue('token')); if (ModuleGraph::getDateBetween() != Configuration::get('PS_REFERRERS_CACHE_LIKE') OR Tools::isSubmit('submitRefreshCache')) Referrer::refreshCache(); @@ -235,7 +235,7 @@ class AdminReferrers extends AdminTab $uri = Tools::getHttpHost(true, true).__PS_BASE_URI__; echo ' - + '.($obj->id ? '' : '').'
'.$this->l('Affiliate').' @@ -470,11 +470,11 @@ class AdminReferrers extends AdminTab } echo '
'; } diff --git a/admin-dev/tabs/AdminReturn.php b/admin-dev/tabs/AdminReturn.php index b06a1ad8b..6d6c3bbd7 100644 --- a/admin-dev/tabs/AdminReturn.php +++ b/admin-dev/tabs/AdminReturn.php @@ -70,7 +70,7 @@ class AdminReturn extends AdminTab if ((int)($orderReturn->countProduct()) > 1) { if (OrderReturn::deleteOrderReturnDetail($id_order_return, $id_order_detail, (int)(Tools::getValue('id_customization', 0)))) - Tools::redirectAdmin($currentIndex.'&conf=4token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&conf=4token='.$this->token); else $this->_errors[] = Tools::displayError('An error occurred while deleting an order return detail.'); } @@ -104,7 +104,7 @@ class AdminReturn extends AdminTab '{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); - Tools::redirectAdmin($currentIndex.'&conf=4&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token); } } else @@ -126,7 +126,7 @@ class AdminReturn extends AdminTab if ($this->tabAccess['edit'] === '1') { $this->displayForm(); - echo '

'.$this->l('Back to list').'
'; + echo '

'.$this->l('Back to list').'
'; } else echo $this->l('You do not have permission to edit here'); @@ -152,7 +152,7 @@ class AdminReturn extends AdminTab $id = $tr['id_'.$this->table]; echo 'color) AND $this->colorOnBackground) ? 'style="background-color: '.$state->color.'"' : '').'>'; foreach ($this->fieldsDisplay AS $key => $params) - echo ''; + echo ''; echo ''; } } @@ -166,7 +166,7 @@ class AdminReturn extends AdminTab return; echo ' - + '.($obj->id ? '' : '').' @@ -226,7 +226,7 @@ class AdminReturn extends AdminTab - + '; $customizationDatas = &$allCustomizedDatas[(int)($returnedCustomization['product_id'])][(int)($returnedCustomization['product_attribute_id'])][(int)($returnedCustomization['id_customization'])]['datas']; foreach ($customizationDatas AS $type => $datas) @@ -267,7 +267,7 @@ class AdminReturn extends AdminTab - + '; echo ' diff --git a/admin-dev/tabs/AdminReturnStates.php b/admin-dev/tabs/AdminReturnStates.php index 029456f16..8e69cf2f2 100644 --- a/admin-dev/tabs/AdminReturnStates.php +++ b/admin-dev/tabs/AdminReturnStates.php @@ -54,7 +54,7 @@ class AdminReturnStates extends AdminTab return; echo ' - + '.($obj->id ? '' : '').'
'.$this->l('Order statuses').' diff --git a/admin-dev/tabs/AdminScenes.php b/admin-dev/tabs/AdminScenes.php index 576dc977f..9b9f94f7b 100644 --- a/admin-dev/tabs/AdminScenes.php +++ b/admin-dev/tabs/AdminScenes.php @@ -145,7 +145,7 @@ class AdminScenes extends AdminTab echo ' - + '.($obj->id ? '' : '').'
'.$this->l('Image Maps').''; echo ' diff --git a/admin-dev/tabs/AdminSearch.php b/admin-dev/tabs/AdminSearch.php index b35a6908f..b1018be9c 100644 --- a/admin-dev/tabs/AdminSearch.php +++ b/admin-dev/tabs/AdminSearch.php @@ -203,7 +203,7 @@ class AdminSearch extends AdminTab echo '
'; if ($module->id) - echo ''; + echo ''; echo $img; if ($module->id) ''; - $href = $currentIndex.'&uninstall='.urlencode($module->name).'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name; + $href = self::$currentIndex.'&uninstall='.urlencode($module->name).'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name; echo ' '.((!$module->id) ? '' + onclick="javascript:document.location.href=\''.self::$currentIndex.'&install='.urlencode($module->name).'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name.'\'">' : '').'
'.(int)($position).' '; echo ' - '.$this->l('Edit').' - '.$this->l('Delete').' + '.$this->l('Edit').' + '.$this->l('Delete').' '; echo ' '.$server['port'].' '.$server['weight'].' - +
'.$period.' '.$specificPrice['from_quantity'].' '.Tools::displayPrice(Tools::ps_round((float)($this->_getFinalPrice($specificPrice, (float)($obj->price), $taxRate)), 2), $current_specific_currency).''.$this->l('Delete').''.$this->l('Delete').'
isAssociatedToShop($shop['id_shop']) ? 'checked="1"' : '').' /> - '.$this->l('Modify this image').' - '.$this->l('Delete this image').' + '.$this->l('Modify this image').' + '.$this->l('Delete this image').'
'.$this->l('Delete this combination').' '.$this->l('Delete all combinations').'
'.$this->l('Delete this combination').' '.$this->l('Delete all combinations').'
'.$this->l('No combination yet').'.
- + '.$this->l('View').' - + '.$this->l('Edit').' - + '.$this->l('Delete').'
'.$tr[$key].''.$tr[$key].'
'.$returnedCustomization['reference'].' '.$returnedCustomization['name'].' '.(int)($returnedCustomization['product_quantity']).'
'.$product['product_reference'].' '.$product['product_name'].' '.$product['product_quantity'].'
'; $irow = 0; foreach ($this->_list['categories'] AS $k => $category) - echo ''; + echo ''; echo '
'.rtrim(getPath($currentIndex.'?tab=AdminCatalog', $category['id_category'], '', $query), ' >').'
'.rtrim(getPath(self::$currentIndex.'?tab=AdminCatalog', $category['id_category'], '', $query), ' >').'
 
'; } @@ -224,17 +224,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').' @@ -268,11 +268,11 @@ class AdminSearch extends AdminTab '.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/AdminSearchEngines.php b/admin-dev/tabs/AdminSearchEngines.php index 8adbd4499..e43db7005 100644 --- a/admin-dev/tabs/AdminSearchEngines.php +++ b/admin-dev/tabs/AdminSearchEngines.php @@ -52,7 +52,7 @@ class AdminSearchEngines extends AdminTab return; echo ' - + '.($obj->id ? '' : '').'
'.$this->l('Referrer').' diff --git a/admin-dev/tabs/AdminShipping.php b/admin-dev/tabs/AdminShipping.php index 59bdaad01..691db0860 100644 --- a/admin-dev/tabs/AdminShipping.php +++ b/admin-dev/tabs/AdminShipping.php @@ -76,7 +76,7 @@ class AdminShipping extends AdminTab Configuration::updateValue($field, call_user_func($function, Tools::getValue($field))); } - Tools::redirectAdmin($currentIndex.'&conf=6'.'&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&conf=6'.'&token='.$this->token); } } else @@ -113,7 +113,7 @@ class AdminShipping extends AdminTab $priceList = rtrim($priceList, ','); /* Update delivery prices */ $carrier->addDeliveryPrice($priceList); - Tools::redirectAdmin($currentIndex.'&conf=6'.'&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&conf=6'.'&token='.$this->token); } else $this->_errors[] = Tools::displayError('An error occurred while updating fees (cannot load carrier object).'); @@ -147,7 +147,7 @@ class AdminShipping extends AdminTab unset($confKeys['PS_SHIPPING_METHOD']); echo ' - +
'.$this->l('Handling').''; @@ -215,7 +215,7 @@ class AdminShipping extends AdminTab echo '

'.$this->l('Fees by carrier, geographical zone, and ranges').'

- +
'.$this->l('Fees').''; diff --git a/admin-dev/tabs/AdminShop.php b/admin-dev/tabs/AdminShop.php index c1ffe1bbb..e3f9e6039 100755 --- a/admin-dev/tabs/AdminShop.php +++ b/admin-dev/tabs/AdminShop.php @@ -92,7 +92,7 @@ class AdminShop extends AdminTab $disabled = ''; echo ' - + '.($obj->id ? '' : '').'
'.$this->l('Shop').' '.$this->l('You can\'t change the GroupShop when you have more than one Shop').'
diff --git a/admin-dev/tabs/AdminShopUrl.php b/admin-dev/tabs/AdminShopUrl.php index ab5c8cdab..2704cee2b 100755 --- a/admin-dev/tabs/AdminShopUrl.php +++ b/admin-dev/tabs/AdminShopUrl.php @@ -93,7 +93,7 @@ class AdminShopUrl extends AdminTab return; echo ' - + '.($obj->id ? '' : '').'
'.$this->l('Shop Url').' diff --git a/admin-dev/tabs/AdminSlip.php b/admin-dev/tabs/AdminSlip.php index a6760d671..de1bd70f6 100644 --- a/admin-dev/tabs/AdminSlip.php +++ b/admin-dev/tabs/AdminSlip.php @@ -75,7 +75,7 @@ class AdminSlip extends AdminTab echo '
'.$this->l('Print PDF').' - +
@@ -110,7 +110,7 @@ class AdminSlip extends AdminTab '.$this->l('View').''; echo ' - + '.$this->l('Delete').''; echo ''; echo ''; diff --git a/admin-dev/tabs/AdminStates.php b/admin-dev/tabs/AdminStates.php index 122f6f54d..b1e50817f 100644 --- a/admin-dev/tabs/AdminStates.php +++ b/admin-dev/tabs/AdminStates.php @@ -76,11 +76,11 @@ class AdminStates extends AdminTab if ($this->deleted) { $object->deleted = 1; - if ($object->update()) Tools::redirectAdmin($currentIndex.'&conf=1&token='.$token); + if ($object->update()) Tools::redirectAdmin(self::$currentIndex.'&conf=1&token='.$token); } else if ($object->delete()) { - Tools::redirectAdmin($currentIndex.'&conf=1&token='.$token); + Tools::redirectAdmin(self::$currentIndex.'&conf=1&token='.$token); } $this->_errors[] = Tools::displayError('An error occurred during deletion.'); } @@ -107,7 +107,7 @@ class AdminStates extends AdminTab return; echo ' - + '.($obj->id ? '' : '').'
'.$this->l('States').' diff --git a/admin-dev/tabs/AdminStatsConf.php b/admin-dev/tabs/AdminStatsConf.php index 9f06a839c..bd3228bb8 100644 --- a/admin-dev/tabs/AdminStatsConf.php +++ b/admin-dev/tabs/AdminStatsConf.php @@ -64,7 +64,7 @@ class AdminStatsConf extends AdminPreferences 'month' => $this->l('Month'), 'year' => $this->l('Year')); - echo ' + echo '
'.$this->l('Settings').''; #Graph Engines diff --git a/admin-dev/tabs/AdminStatsTab.php b/admin-dev/tabs/AdminStatsTab.php index 34f052882..2b9fc68f9 100644 --- a/admin-dev/tabs/AdminStatsTab.php +++ b/admin-dev/tabs/AdminStatsTab.php @@ -215,7 +215,7 @@ abstract class AdminStatsTab extends AdminPreferences { foreach ($modules AS $module) if ($moduleInstance = Module::getInstanceByName($module['name'])) - echo '

'.$moduleInstance->displayName.'

'; + echo '

'.$moduleInstance->displayName.'

'; } else echo $this->l('No module installed', 'AdminStatsTab'); diff --git a/admin-dev/tabs/AdminStockMvt.php b/admin-dev/tabs/AdminStockMvt.php index 024869420..946c1ffcc 100755 --- a/admin-dev/tabs/AdminStockMvt.php +++ b/admin-dev/tabs/AdminStockMvt.php @@ -71,7 +71,7 @@ class AdminStockMvt extends AdminTab if (!($obj = $this->loadObject(true))) return; $dl = 'name'; - echo ' + echo ' '.($obj->id ? '' : '').'
'.$this->l('Stock Movement').' @@ -149,7 +149,7 @@ class AdminStockMvt extends AdminTab if (!isset($_GET['view'.$this->table])) echo '
- +
diff --git a/admin-dev/tabs/AdminStores.php b/admin-dev/tabs/AdminStores.php index 5aff5e8d0..af628e5d6 100644 --- a/admin-dev/tabs/AdminStores.php +++ b/admin-dev/tabs/AdminStores.php @@ -182,7 +182,7 @@ class AdminStores extends AdminTab }; }); - + '.($obj->id ? '' : '').'
'.$this->l('Stores').' diff --git a/admin-dev/tabs/AdminSubDomains.php b/admin-dev/tabs/AdminSubDomains.php index 44378314c..c9b96740b 100644 --- a/admin-dev/tabs/AdminSubDomains.php +++ b/admin-dev/tabs/AdminSubDomains.php @@ -56,7 +56,7 @@ class AdminSubDomains extends AdminTab return; echo ' - + '.($obj->id ? '' : '').'
'.$this->l('Subdomains').' diff --git a/admin-dev/tabs/AdminSuppliers.php b/admin-dev/tabs/AdminSuppliers.php index dde94a74f..7fa523aac 100644 --- a/admin-dev/tabs/AdminSuppliers.php +++ b/admin-dev/tabs/AdminSuppliers.php @@ -133,7 +133,7 @@ class AdminSuppliers extends AdminTab $langtags = 'description¤smeta_title¤smeta_keywords¤smeta_description'; echo ' - + '.($supplier->id ? '' : '').'
'.$this->l('Suppliers').' diff --git a/admin-dev/tabs/AdminTabs.php b/admin-dev/tabs/AdminTabs.php index 656b6e9f2..a0a70e57b 100644 --- a/admin-dev/tabs/AdminTabs.php +++ b/admin-dev/tabs/AdminTabs.php @@ -60,7 +60,7 @@ class AdminTabs extends AdminTab { global $currentIndex; if ($tab->move($direction)) - Tools::redirectAdmin($currentIndex.'&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token); } else { @@ -84,9 +84,9 @@ class AdminTabs extends AdminTab $tab = $arrayTabs[$i]; echo ''.stripslashes($tab['name']).'
'; if ($i) - echo ' '; + echo ' '; if ($i < sizeof($arrayTabs) - 1) - echo ''; + echo ''; } echo ' @@ -118,7 +118,7 @@ class AdminTabs extends AdminTab return; echo ' - + '.($obj->id ? '' : '').' '.($obj->position ? '' : '').'
'.$this->l('Tabs').' diff --git a/admin-dev/tabs/AdminTags.php b/admin-dev/tabs/AdminTags.php index bc3bbd3b2..66b3b3af8 100644 --- a/admin-dev/tabs/AdminTags.php +++ b/admin-dev/tabs/AdminTags.php @@ -70,7 +70,7 @@ class AdminTags extends AdminTab $products2 = $obj->getProducts(false); echo ' - + '.($obj->id ? '' : '').'
'.$this->l('Tag').' diff --git a/admin-dev/tabs/AdminTaxRulesGroup.php b/admin-dev/tabs/AdminTaxRulesGroup.php index 13f3d2ba9..3aa2b0bb1 100755 --- a/admin-dev/tabs/AdminTaxRulesGroup.php +++ b/admin-dev/tabs/AdminTaxRulesGroup.php @@ -78,7 +78,7 @@ class AdminTaxRulesGroup extends AdminTab $param_product = Tools::getValue('id_product') ? '&id_product='.Tools::getValue('id_product') : ''; - echo ' + echo ' '.($obj->id ? '' : '').'
'.$this->l('Tax Rules').' @@ -515,14 +515,14 @@ class AdminTaxRulesGroup extends AdminTab // Save and stay on same form if (Tools::isSubmit('submitAdd'.$this->table.'AndStay')) - Tools::redirectAdmin($currentIndex.'&'.$this->identifier.'='.$object->id.'&conf=4&update'.$this->table.'&token='.$token); + Tools::redirectAdmin(self::$currentIndex.'&'.$this->identifier.'='.$object->id.'&conf=4&update'.$this->table.'&token='.$token); // 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($currentIndex.($parent_id ? '&'.$this->identifier.'='.$object->id : '').'&conf=3&token='.$token); + Tools::redirectAdmin(self::$currentIndex.($parent_id ? '&'.$this->identifier.'='.$object->id : '').'&conf=3&token='.$token); } } else @@ -547,16 +547,16 @@ class AdminTaxRulesGroup extends AdminTab $this->afterAdd($object); // Save and stay on same form if (Tools::isSubmit('submitAdd'.$this->table.'AndStay')) - Tools::redirectAdmin($currentIndex.'&'.$this->identifier.'='.$object->id.'&conf=3&update'.$this->table.'&token='.$token); + Tools::redirectAdmin(self::$currentIndex.'&'.$this->identifier.'='.$object->id.'&conf=3&update'.$this->table.'&token='.$token); $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($currentIndex.($parent_id ? '&'.$this->identifier.'='.$object->id : '').'&conf=3&token='.$token); + Tools::redirectAdmin(self::$currentIndex.($parent_id ? '&'.$this->identifier.'='.$object->id : '').'&conf=3&token='.$token); // Default behavior (save and back) - Tools::redirectAdmin($currentIndex.($parent_id ? '&'.$this->identifier.'='.$object->id : '').'&conf=3&token='.$token); + Tools::redirectAdmin(self::$currentIndex.($parent_id ? '&'.$this->identifier.'='.$object->id : '').'&conf=3&token='.$token); } } else diff --git a/admin-dev/tabs/AdminTaxes.php b/admin-dev/tabs/AdminTaxes.php index 560a6976d..9d1c72aff 100644 --- a/admin-dev/tabs/AdminTaxes.php +++ b/admin-dev/tabs/AdminTaxes.php @@ -68,7 +68,7 @@ class AdminTaxes extends AdminTab $states = State::getStates((int)$cookie->id_lang); echo ' - + '.($obj->id ? '' : '').'
'.$this->l('Taxes').' @@ -129,7 +129,7 @@ class AdminTaxes extends AdminTab $this->_errors[] = Tools::displayError('An error occurred while updating object.').' '.$this->table.''; elseif ($this->postImage($object->id)) { - Tools::redirectAdmin($currentIndex.'&id_'.$this->table.'='.$object->id.'&conf=4'.'&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&id_'.$this->table.'='.$object->id.'&conf=4'.'&token='.$this->token); } } else @@ -150,7 +150,7 @@ class AdminTaxes extends AdminTab $this->_errors[] = Tools::displayError('An error occurred while creating object.').' '.$this->table.''; elseif (($_POST['id_'.$this->table] = $object->id /* voluntary */) AND $this->postImage($object->id) AND $this->_redirect) { - Tools::redirectAdmin($currentIndex.'&id_'.$this->table.'='.$object->id.'&conf=3'.'&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&id_'.$this->table.'='.$object->id.'&conf=3'.'&token='.$this->token); } } else @@ -173,7 +173,7 @@ class AdminTaxes extends AdminTab $_cacheLang['DeleteItem'] = $this->l('This tax is currently in use in a tax rule. Are you sure?'); echo ' - + '.$_cacheLang['Delete'].''; } @@ -183,7 +183,7 @@ class AdminTaxes extends AdminTab $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 'identifier.'='.$id.'&'.$active. ((int)$id_category AND (int)$id_product ? '&id_category='.$id_category : '').'&token='.($token!=NULL ? $token : $this->token).'" '.$confirm.'> '.($value ? $this->l('Enabled') : $this->l('Disabled')).''; diff --git a/admin-dev/tabs/AdminTranslations.php b/admin-dev/tabs/AdminTranslations.php index 48e00ff79..ef699125f 100644 --- a/admin-dev/tabs/AdminTranslations.php +++ b/admin-dev/tabs/AdminTranslations.php @@ -127,7 +127,7 @@ class AdminTranslations extends AdminTab fwrite($fd, '$_'.$tab.'[\''.pSQL($key, true).'\'] = \''.pSQL($value, true).'\';'."\n"); fwrite($fd, "\n?>"); fclose($fd); - Tools::redirectAdmin($currentIndex.'&conf=4&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token); } else die('Cannot write language file'); @@ -161,7 +161,7 @@ class AdminTranslations extends AdminTab } } if ($bool) - Tools::redirectLink($currentIndex.'&conf=14&token='.$this->token); + Tools::redirectLink(self::$currentIndex.'&conf=14&token='.$this->token); $this->_errors[] = $this->l('a part of the data has been copied but some language files could not be found or copied'); } @@ -246,7 +246,7 @@ class AdminTranslations extends AdminTab if (!Language::checkAndAddLanguage($iso_code)) $conf = 20; } - Tools::redirectAdmin($currentIndex.'&conf='.(isset($conf) ? $conf : '15').'&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&conf='.(isset($conf) ? $conf : '15').'&token='.$this->token); } $this->_errors[] = Tools::displayError('Archive cannot be extracted.'); } @@ -273,7 +273,7 @@ class AdminTranslations extends AdminTab $conf = 20; if (!unlink($file)) $this->_errors[] = Tools::displayError('Cannot delete archive'); - Tools::redirectAdmin($currentIndex.'&conf='.(isset($conf) ? $conf : '15').'&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&conf='.(isset($conf) ? $conf : '15').'&token='.$this->token); } $this->_errors[] = Tools::displayError('Archive cannot be extracted.'); if (!unlink($file)) @@ -551,7 +551,7 @@ class AdminTranslations extends AdminTab foreach ($arr_find_and_write as $key=>$value) $this->findAndWriteTranslationsIntoFile($value['file_name'], $value['files'], $value['theme'], $value['module'], $value['dir']); - Tools::redirectAdmin($currentIndex.'&conf=4&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token); } } else @@ -680,7 +680,7 @@ class AdminTranslations extends AdminTab } } if (count($this->_errors) == 0) - Tools::redirectAdmin($currentIndex.'&conf=4&token='.$this->token.$params_redirect); + Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token.$params_redirect); } public function display() { @@ -717,7 +717,7 @@ class AdminTranslations extends AdminTab '; echo '


'.$this->l('Translation exchange').'

'; - echo '
+ echo '
'.$this->l('Add / Update a language').' @@ -755,7 +755,7 @@ class AdminTranslations extends AdminTab echo '


'; - echo '
+ echo '
'.$this->l('Import a language pack manually').' @@ -768,7 +768,7 @@ class AdminTranslations extends AdminTab


-
+
'.$this->l('Export a language').'

'.$this->l('Export data from one language to a file (language pack).').'
'. $this->l('Choose the theme from which you want to export translations.').'
@@ -790,7 +790,7 @@ class AdminTranslations extends AdminTab

'; $allLanguages = Language::getLanguages(false); echo ' - +

'.$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!').'
'. @@ -996,7 +996,7 @@ class AdminTranslations extends AdminTab if (!$this->suhosin_limit_exceed) { $str_output .= ' - '; + '; $str_output .= $this->displayToggleButton(sizeof($_LANG) >= $count); $str_output .= $this->displayAutoTranslate(); $str_output .= '

'; @@ -1075,7 +1075,7 @@ class AdminTranslations extends AdminTab if (!$this->suhosin_limit_exceed) { $str_output .= ' - '; + '; $str_output .= $this->displayToggleButton(); $str_output .= $this->displayAutoTranslate(); $str_output .= '

'; @@ -1154,7 +1154,7 @@ class AdminTranslations extends AdminTab if (!$this->suhosin_limit_exceed) { $str_output .= ' - +

'; ksort($stringToTranslate); @@ -1197,7 +1197,7 @@ class AdminTranslations extends AdminTab if (!$this->suhosin_limit_exceed) { $str_output .= $this->l('Fields to translate').' : '.$count.'. '.$this->l('Click on the titles to open fieldsets').'.

- '; + '; $str_output .= $this->displayToggleButton(); $str_output .= '

'; foreach ($classArray AS $className => $rules) @@ -1569,7 +1569,7 @@ class AdminTranslations extends AdminTab // display form $str_output .= ' - '; + '; $str_output .= $this->displayToggleButton(); $str_output .= $this->displaySubmitButtons(Tools::getValue('type')); $str_output .= '

'; @@ -1785,7 +1785,7 @@ class AdminTranslations extends AdminTab if (!$this->suhosin_limit_exceed) { $str_output .= ' - '; + '; $str_output .= $this->displayToggleButton(); $str_output .= $this->displayAutoTranslate(); $str_output .= '

'; @@ -1873,7 +1873,7 @@ class AdminTranslations extends AdminTab if (!$this->suhosin_limit_exceed) { $str_output .= ' - + - +
'; echo (isset($this->optionTitle) ? ' ' @@ -2033,7 +2039,7 @@ abstract class AdminTabCore { $html = '
- + '; @@ -2091,7 +2097,7 @@ abstract class AdminTabCore $assos[$row['id_group_shop']][] = $row[$this->identifier]; if (!$this->_object) { - $html = ' + $html = '
'.$this->l('Shop association').'
diff --git a/classes/CMSCategory.php b/classes/CMSCategory.php index 45b96638a..05ac857ad 100644 --- a/classes/CMSCategory.php +++ b/classes/CMSCategory.php @@ -176,11 +176,13 @@ class CMSCategoryCore extends ObjectModel ); } - static public function getRecurseCategory($id_lang = _USER_ID_LANG_, $current = 1, $active = 1, $links = 0, $id_shop = false, $context = null) + static public function getRecurseCategory($id_lang = null, $current = 1, $active = 1, $links = 0, $id_shop = false, $context = null) { if (!$context) $context = Context::getContext(); + $id_lang = is_null($id_lang) ? $context->language->id : $id_lang; + $category = Db::getInstance()->getRow(' SELECT c.`id_cms_category`, c.`id_parent`, c.`level_depth`, cl.`name`, cl.`link_rewrite` FROM `'._DB_PREFIX_.'cms_category` c @@ -399,16 +401,6 @@ class CMSCategoryCore extends ObjectModel { return self::getChildren(1, $id_lang, $active); } - /** - * @deprecated - **/ - static public function getRootCMSCategory($id_lang = NULL) - { - Tools::displayAsDeprecated(); - //get idLang - $id_lang = is_null($id_lang) ? _USER_ID_LANG_ : (int)($id_lang); - return new CMSCategory (1, $id_lang); - } static public function getChildren($id_parent, $id_lang, $active = true) { @@ -544,20 +536,22 @@ class CMSCategoryCore extends ObjectModel * @param integer $id_lang Language ID * @return array Corresponding categories */ - public function getParentsCategories($idLang = null) + public function getParentsCategories($idLang = null, $context = null) { + if (!$context) + $context = Context::getContext(); //get idLang - $idLang = is_null($idLang) ? _USER_ID_LANG_ : (int)($idLang); + $idLang = is_null($idLang) ? $context->language->id : $idLang; $categories = null; - $idCurrent = (int)($this->id); + $idCurrent = $this->id; while (true) { $query = ' SELECT c.*, cl.* FROM `'._DB_PREFIX_.'cms_category` c - LEFT JOIN `'._DB_PREFIX_.'cms_category_lang` cl ON (c.`id_cms_category` = cl.`id_cms_category` AND `id_lang` = '.(int)($idLang).') - WHERE c.`id_cms_category` = '.$idCurrent.' AND c.`id_parent` != 0 + LEFT JOIN `'._DB_PREFIX_.'cms_category_lang` cl ON (c.`id_cms_category` = cl.`id_cms_category` AND `id_lang` = '.(int)$idLang.') + WHERE c.`id_cms_category` = '.(int)$idCurrent.' AND c.`id_parent` != 0 '; $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($query); diff --git a/classes/Category.php b/classes/Category.php index 5ba96da4c..1197f85af 100644 --- a/classes/Category.php +++ b/classes/Category.php @@ -193,18 +193,18 @@ class CategoryCore extends ObjectModel { if (!$context) $context = Context::getContext(); - $idLang = is_null($idLang) ? _USER_ID_LANG_ : (int)($idLang); + $idLang = is_null($idLang) ? $context->language->id : (int)$idLang; $children = array(); - if (($maxDepth == 0 OR $currentDepth < $maxDepth) AND $subcats = $this->getSubCategories((int)$idLang, true) AND sizeof($subcats)) + if (($maxDepth == 0 OR $currentDepth < $maxDepth) AND $subcats = $this->getSubCategories($idLang, true) AND sizeof($subcats)) foreach ($subcats AS &$subcat) { if (!$subcat['id_category']) break; elseif (!is_array($excludedIdsArray) || !in_array($subcat['id_category'], $excludedIdsArray)) { - $categ = new Category((int)$subcat['id_category'], (int)$idLang); - $children[] = $categ->recurseLiteCategTree($maxDepth, $currentDepth + 1, (int)$idLang, $excludedIdsArray); + $categ = new Category((int)$subcat['id_category'], $idLang); + $children[] = $categ->recurseLiteCategTree($maxDepth, $currentDepth + 1, $idLang, $excludedIdsArray); } } @@ -574,13 +574,13 @@ class CategoryCore extends ObjectModel return self::getChildren(1, $id_lang, $active); } - static public function getRootCategory($id_lang = NULL, $id_shop = false) + static public function getRootCategory($id_lang = NULL, $id_shop = false, $context = null) { if (!$id_shop) $id_shop = Configuration::get('PS_SHOP_DEFAULT'); - $shop = new Shop((int)$id_shop); + $shop = new Shop($id_shop); - return new Category ((int)$shop->id_category, is_null($id_lang) ? (int)_USER_ID_LANG_ : (int)($id_lang)); + return new Category ($shop->id_category, is_null($id_lang) ? $context->language->id : $id_lang); } /** @@ -790,19 +790,19 @@ class CategoryCore extends ObjectModel * @param integer $id_lang Language ID * @return array Corresponding categories */ - public function getParentsCategories($idLang = null) + public function getParentsCategories($idLang = null, $context = null) { //get idLang - $idLang = is_null($idLang) ? _USER_ID_LANG_ : (int)($idLang); + $idLang = is_null($idLang) ? $context->language->id : $idLang; $categories = null; - $idCurrent = (int)($this->id); + $idCurrent = $this->id; while (true) { $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' SELECT c.*, cl.* FROM `'._DB_PREFIX_.'category` c - LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND `id_lang` = '.(int)($idLang).') + LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND `id_lang` = '.(int)$idLang.') WHERE c.`id_category` = '.(int)$idCurrent.' AND c.`id_parent` != 0 '); diff --git a/classes/FrontController.php b/classes/FrontController.php index 1dd45f1eb..1d73384dc 100755 --- a/classes/FrontController.php +++ b/classes/FrontController.php @@ -122,10 +122,6 @@ class FrontControllerCore Tools::switchLanguage(); Tools::setCookieLanguage($cookie); - /* attribute id_lang is often needed, so we create a constant for performance reasons */ - if (!defined('_USER_ID_LANG_')) - define('_USER_ID_LANG_', (int)$cookie->id_lang); - if (isset($_GET['logout']) OR ($cookie->logged AND Customer::isBanned((int)$cookie->id_customer))) { $cookie->logout(); @@ -153,12 +149,13 @@ class FrontControllerCore $cart->nbProducts() AND intval(Configuration::get('PS_GEOLOCATION_NA_BEHAVIOR')) != -1 AND !self::isInWhitelistForGeolocation()) unset($cookie->id_cart, $cart); - elseif ($cookie->id_customer != $cart->id_customer OR $cookie->id_lang != $cart->id_lang OR $cookie->id_currency != $cart->id_currency) + // update cart values + elseif ($cookie->id_customer != $cart->id_customer OR $cookie->id_lang != $cart->id_lang OR $currency->id != $cart->id_currency) { if ($cookie->id_customer) $cart->id_customer = (int)($cookie->id_customer); $cart->id_lang = (int)($cookie->id_lang); - $cart->id_currency = (int)($cookie->id_currency); + $cart->id_currency = (int)$currency->id; $cart->update(); } /* Select an address if not set */ @@ -212,14 +209,16 @@ class FrontControllerCore if (Validate::isLoadedObject($currency)) $smarty->ps_currency = $currency; - if (Validate::isLoadedObject($ps_language = new Language((int)$cookie->id_lang))) - $smarty->ps_language = $ps_language; + if (!Validate::isLoadedObject($language = new Language($cookie->id_lang))) + $language = new Language(Configuration::get('PS_LANG_DEFAULT')); + $smarty->ps_language = $language; + $context->language = $language; /* get page name to display it in body id */ $pathinfo = pathinfo(__FILE__); $page_name = Dispatcher::$controller; $page_name = (preg_match('/^[0-9]/', $page_name)) ? 'page_'.$page_name : $page_name; - $smarty->assign(Tools::getMetaTags($cookie->id_lang, $page_name)); + $smarty->assign(Tools::getMetaTags($language->id, $page_name)); $smarty->assign('request_uri', Tools::safeOutput(urldecode($_SERVER['REQUEST_URI']))); /* Breadcrumb */ @@ -228,15 +227,14 @@ class FrontControllerCore $protocol_link = (Configuration::get('PS_SSL_ENABLED') OR (!empty($_SERVER['HTTPS']) AND strtolower($_SERVER['HTTPS']) != 'off')) ? 'https://' : 'http://'; $protocol_content = ((isset($useSSL) AND $useSSL AND Configuration::get('PS_SSL_ENABLED')) OR (!empty($_SERVER['HTTPS']) AND strtolower($_SERVER['HTTPS']) != 'off')) ? 'https://' : 'http://'; + $link = new Link($protocol_link, $protocol_content); + $context->link = $link; if (!defined('_PS_BASE_URL_')) define('_PS_BASE_URL_', Tools::getShopDomain(true)); if (!defined('_PS_BASE_URL_SSL_')) define('_PS_BASE_URL_SSL_', Tools::getShopDomainSsl(true)); - $link = new Link($protocol_link, $protocol_content); - $context->link = $link; - $context->language = $ps_language; $link->preloadPageLinks(); $this->canonicalRedirection(); @@ -262,7 +260,7 @@ class FrontControllerCore 'tpl_dir' => _PS_THEME_DIR_, 'modules_dir' => _MODULE_DIR_, 'mail_dir' => _MAIL_DIR_, - 'lang_iso' => $ps_language->iso_code, + 'lang_iso' => $language->iso_code, 'come_from' => Tools::getHttpHost(true, true).Tools::htmlentitiesUTF8(str_replace('\'', '', urldecode($_SERVER['REQUEST_URI']))), 'cart_qties' => (int)$cart->nbProducts(), 'currencies' => Currency::getCurrencies(), diff --git a/classes/Module.php b/classes/Module.php index f7b9d91e9..8d36ab544 100644 --- a/classes/Module.php +++ b/classes/Module.php @@ -489,7 +489,7 @@ abstract class ModuleCore if (substr(realpath($filePath), 0, strlen($realpathModuleDir)) == $realpathModuleDir) { self::$classInModule[$currentClass] = substr(dirname($filePath), strlen($realpathModuleDir)+1); - $file = _PS_MODULE_DIR_.self::$classInModule[$currentClass].'/'.$context->getContext()->language->iso_code.'.php'; + $file = _PS_MODULE_DIR_.self::$classInModule[$currentClass].'/'.Context::getContext()->language->iso_code.'.php'; if (Tools::file_exists_cache($file) AND include_once($file)) $_MODULES = !empty($_MODULES) ? array_merge($_MODULES, $_MODULE) : $_MODULE; } @@ -578,7 +578,7 @@ abstract class ModuleCore if (!count($errors) AND (int)$xml_module->need_instance == 0 AND !$needNewConfigFile) { - $file = _PS_MODULE_DIR_.$module.'/'.$context->getContext()->language->iso_code.'.php'; + $file = _PS_MODULE_DIR_.$module.'/'.Context::getContext()->language->iso_code.'.php'; if (Tools::file_exists_cache($file) AND include_once($file)) if(isset($_MODULE) AND is_array($_MODULE)) $_MODULES = !empty($_MODULES) ? array_merge($_MODULES, $_MODULE) : $_MODULE; diff --git a/classes/ModuleGraph.php b/classes/ModuleGraph.php index 184d23800..a8c833f18 100644 --- a/classes/ModuleGraph.php +++ b/classes/ModuleGraph.php @@ -286,8 +286,10 @@ abstract class ModuleGraphCore extends Module return call_user_func(array($render, 'hookGraphEngine'), $params, $drawer); } - protected static function getEmployee($employee = null) + protected static function getEmployee($employee = null, $context = null) { + if (!$context) + $context = Context::getContext(); if (!$employee) $employee = $context->employee; diff --git a/classes/Product.php b/classes/Product.php index 2add1418a..3da67ff1e 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -829,33 +829,6 @@ class ProductCore extends ObjectModel ORDER BY pl.`name`'); } - /** - * Return the products in the same category than the default category of the instancied product - * - * @param integer $id_lang Language ID - * @return array Products - * @deprecated - */ - public function getDefaultCategoryProducts($idLang = NULL, $limit = NULL) - { - Tools::displayAsDeprecated(); - //get idLang - $idLang = is_null($idLang) ? _USER_ID_LANG_ : (int)($idLang); - - $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' - SELECT p.`id_product`, pl.`description_short`set, pl.`link_rewrite`, pl.`name`, i.`id_image` - FROM `'._DB_PREFIX_.'category_product` cp - LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.id_product = cp.id_product) - LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product`) - LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product`) - WHERE cp.id_category = ' . (int)($this->id_category_default) . ' - AND id_lang = ' . (int)($idLang) . ' - AND p.`active` = 1 - AND i.`cover` = 1 - '. (is_null($limit) ? '' : ' LIMIT 0 , ' . (int)($limit))); - return $result; - } - public function isNew() { $result = Db::getInstance()->ExecuteS(' @@ -867,7 +840,6 @@ class ProductCore extends ObjectModel return sizeof($result) > 0; } - public function productAttributeExists($attributesList, $currentProductAttribute = false) { $result = Db::getInstance()->ExecuteS('SELECT pac.`id_attribute`, pac.`id_product_attribute` diff --git a/classes/Scene.php b/classes/Scene.php index 8a450c425..2cf8e2545 100644 --- a/classes/Scene.php +++ b/classes/Scene.php @@ -181,21 +181,23 @@ class SceneCore extends ObjectModel * * @return array Products */ - static public function getScenes($id_category, $id_lang = NULL, $onlyActive = true, $liteResult = true, $hideScenePosition = true) + static public function getScenes($id_category, $id_lang = NULL, $onlyActive = true, $liteResult = true, $hideScenePosition = true, $context = null) { - $id_lang = is_null($id_lang) ? _USER_ID_LANG_ : (int)($id_lang); + if (!$context) + $context = Context::getContext(); + $id_lang = is_null($id_lang) ? $context->language->id : $id_lang; $scenes = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' SELECT s.* FROM `'._DB_PREFIX_.'scene_category` sc LEFT JOIN `'._DB_PREFIX_.'scene` s ON (sc.id_scene = s.id_scene) LEFT JOIN `'._DB_PREFIX_.'scene_lang` sl ON (sl.id_scene = s.id_scene) - WHERE sc.id_category = '.(int)($id_category).' AND sl.id_lang = '.(int)($id_lang).($onlyActive ? ' AND s.active = 1' : '').' + WHERE sc.id_category = '.(int)$id_category.' AND sl.id_lang = '.(int)$id_lang.($onlyActive ? ' AND s.active = 1' : '').' ORDER BY sl.name ASC'); if (!$liteResult AND $scenes) foreach($scenes AS &$scene) - $scene = new Scene((int)($scene['id_scene']), (int)($id_lang), false, $hideScenePosition); + $scene = new Scene($scene['id_scene'], $id_lang, false, $hideScenePosition); return $scenes; } @@ -204,28 +206,28 @@ class SceneCore extends ObjectModel * * @return array Products */ - public function getProducts($onlyActive = true, $id_lang = NULL, $liteResult = true) + public function getProducts($onlyActive = true, $id_lang = NULL, $liteResult = true, $context = null) { global $link; - - $id_lang = is_null($id_lang) ? _USER_ID_LANG_ : (int)($id_lang); + if (!$context) + $context = Context::getContext(); + $id_lang = is_null($id_lang) ? $context->language->id : $id_lang; $products = Db::getInstance()->ExecuteS(' SELECT s.* FROM `'._DB_PREFIX_.'scene_products` s LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.id_product = s.id_product) - WHERE s.id_scene = '.(int)($this->id).($onlyActive ? ' AND p.active = 1' : '')); + WHERE s.id_scene = '.(int)$this->id.($onlyActive ? ' AND p.active = 1' : '')); if (!$liteResult AND $products) foreach ($products AS &$product) { - $product['details'] = new Product((int)($product['id_product']), !$liteResult, (int)($id_lang)); - $product['link'] = $link->getProductLink((int)($product['details']->id), $product['details']->link_rewrite, $product['details']->category, $product['details']->ean13); - $cover = Product::getCover((int)($product['details']->id)); + $product['details'] = new Product($product['id_product'], !$liteResult, $id_lang); + $product['link'] = $link->getProductLink($product['details']->id, $product['details']->link_rewrite, $product['details']->category, $product['details']->ean13); + $cover = Product::getCover($product['details']->id); if(is_array($cover)) $product = array_merge($cover, $product); } - return $products; } diff --git a/controllers/SitemapController.php b/controllers/SitemapController.php index 4819cd483..8e961fd73 100644 --- a/controllers/SitemapController.php +++ b/controllers/SitemapController.php @@ -44,9 +44,9 @@ class SitemapControllerCore extends FrontController public function process() { parent::process(); - $this->smarty->assign('categoriesTree', Category::getRootCategory(NULL, (int)$this->id_current_shop)->recurseLiteCategTree(0)); - $this->smarty->assign('categoriescmsTree', CMSCategory::getRecurseCategory(_USER_ID_LANG_, 1, 1, 1, (int)$this->id_current_shop)); - $this->smarty->assign('voucherAllowed', (int)(Configuration::get('PS_VOUCHERS'))); + $this->smarty->assign('categoriesTree', Category::getRootCategory(NULL, $this->id_current_shop)->recurseLiteCategTree(0)); + $this->smarty->assign('categoriescmsTree', CMSCategory::getRecurseCategory(Context::getContext()->language->id, 1, 1, 1, $this->id_current_shop)); + $this->smarty->assign('voucherAllowed', (int)Configuration::get('PS_VOUCHERS')); $blockmanufacturer = Module::getInstanceByName('blockmanufacturer'); $blocksupplier = Module::getInstanceByName('blocksupplier'); $this->smarty->assign('display_manufacturer_link', (((int)$blockmanufacturer->id) ? true : false));