From e5c68ba9aed23693be617aae13a1fd49ff1cd735 Mon Sep 17 00:00:00 2001
From: tDidierjean
Date: Wed, 13 Jul 2011 15:24:38 +0000
Subject: [PATCH] // Context part 5
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@7624 b9a71923-0436-4b27-9f14-aed3839534dd
---
admin-dev/functions.php | 10 ++-
admin-dev/index.php | 4 +-
admin-dev/init.php | 5 +-
admin-dev/tabs/AdminAccess.php | 2 +-
admin-dev/tabs/AdminAddresses.php | 2 +-
admin-dev/tabs/AdminAliases.php | 2 +-
admin-dev/tabs/AdminAttachments.php | 2 +-
admin-dev/tabs/AdminAttributeGenerator.php | 4 +-
admin-dev/tabs/AdminAttributes.php | 4 +-
admin-dev/tabs/AdminAttributesGroups.php | 20 ++---
admin-dev/tabs/AdminBackup.php | 4 +-
admin-dev/tabs/AdminCMS.php | 16 ++--
admin-dev/tabs/AdminCMSCategories.php | 12 +--
admin-dev/tabs/AdminCMSContent.php | 4 +-
admin-dev/tabs/AdminCarriers.php | 6 +-
admin-dev/tabs/AdminCarts.php | 2 +-
admin-dev/tabs/AdminCatalog.php | 2 +-
admin-dev/tabs/AdminCategories.php | 12 +--
admin-dev/tabs/AdminContacts.php | 2 +-
admin-dev/tabs/AdminCountries.php | 2 +-
admin-dev/tabs/AdminCounty.php | 2 +-
admin-dev/tabs/AdminCurrencies.php | 12 +--
admin-dev/tabs/AdminCustomerThreads.php | 18 ++---
admin-dev/tabs/AdminCustomers.php | 20 ++---
admin-dev/tabs/AdminDb.php | 4 +-
admin-dev/tabs/AdminDeliverySlip.php | 2 +-
admin-dev/tabs/AdminDiscounts.php | 8 +-
admin-dev/tabs/AdminEmployees.php | 4 +-
admin-dev/tabs/AdminFeatures.php | 18 ++---
admin-dev/tabs/AdminFeaturesValues.php | 4 +-
admin-dev/tabs/AdminGenerator.php | 8 +-
admin-dev/tabs/AdminGeolocation.php | 12 +--
admin-dev/tabs/AdminGroupShop.php | 2 +-
admin-dev/tabs/AdminGroups.php | 14 ++--
admin-dev/tabs/AdminImageResize.php | 6 +-
admin-dev/tabs/AdminImages.php | 10 +--
admin-dev/tabs/AdminImport.php | 10 +--
admin-dev/tabs/AdminInvoices.php | 4 +-
admin-dev/tabs/AdminLanguages.php | 12 +--
admin-dev/tabs/AdminLocalization.php | 4 +-
admin-dev/tabs/AdminManufacturers.php | 2 +-
admin-dev/tabs/AdminMessages.php | 2 +-
admin-dev/tabs/AdminMeta.php | 2 +-
admin-dev/tabs/AdminModules.php | 46 +++++------
admin-dev/tabs/AdminModulesPositions.php | 34 ++++----
admin-dev/tabs/AdminOrderMessage.php | 2 +-
admin-dev/tabs/AdminOrders.php | 20 ++---
admin-dev/tabs/AdminOrdersStates.php | 2 +-
admin-dev/tabs/AdminPayment.php | 4 +-
admin-dev/tabs/AdminPerformance.php | 28 +++----
admin-dev/tabs/AdminPreferences.php | 6 +-
admin-dev/tabs/AdminProducts.php | 91 +++++++++++-----------
admin-dev/tabs/AdminProfiles.php | 2 +-
admin-dev/tabs/AdminQuickAccesses.php | 2 +-
admin-dev/tabs/AdminRangePrice.php | 2 +-
admin-dev/tabs/AdminRangeWeight.php | 2 +-
admin-dev/tabs/AdminReferrers.php | 16 ++--
admin-dev/tabs/AdminReturn.php | 14 ++--
admin-dev/tabs/AdminReturnStates.php | 2 +-
admin-dev/tabs/AdminScenes.php | 2 +-
admin-dev/tabs/AdminSearch.php | 16 ++--
admin-dev/tabs/AdminSearchEngines.php | 2 +-
admin-dev/tabs/AdminShipping.php | 8 +-
admin-dev/tabs/AdminShop.php | 2 +-
admin-dev/tabs/AdminShopUrl.php | 2 +-
admin-dev/tabs/AdminSlip.php | 4 +-
admin-dev/tabs/AdminStates.php | 6 +-
admin-dev/tabs/AdminStatsConf.php | 2 +-
admin-dev/tabs/AdminStatsTab.php | 2 +-
admin-dev/tabs/AdminStockMvt.php | 4 +-
admin-dev/tabs/AdminStores.php | 2 +-
admin-dev/tabs/AdminSubDomains.php | 2 +-
admin-dev/tabs/AdminSuppliers.php | 2 +-
admin-dev/tabs/AdminTabs.php | 8 +-
admin-dev/tabs/AdminTags.php | 2 +-
admin-dev/tabs/AdminTaxRulesGroup.php | 12 +--
admin-dev/tabs/AdminTaxes.php | 10 +--
admin-dev/tabs/AdminTranslations.php | 34 ++++----
admin-dev/tabs/AdminWebservice.php | 6 +-
admin-dev/tabs/AdminZones.php | 2 +-
classes/AdminTab.php | 18 +++--
classes/CMSCategory.php | 26 +++----
classes/Category.php | 22 +++---
classes/FrontController.php | 24 +++---
classes/Module.php | 4 +-
classes/ModuleGraph.php | 4 +-
classes/Product.php | 28 -------
classes/Scene.php | 26 ++++---
controllers/SitemapController.php | 6 +-
89 files changed, 417 insertions(+), 441 deletions(-)
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
|
- |
+ onclick="changeFormParam(this.form, \''.self::$currentIndex.'\', '.$id.'); return confirm(\''.$this->l('Delete selected items?', __CLASS__, true, false).'\');" />
';
echo '
-
+
-
+
|
';
@@ -180,7 +180,7 @@ class AdminAttributesGroups extends AdminTab
return;
echo '
-