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
| - |
|---|
-
+