From 76bc20a9abd4638b8c2c4326ba72f99ff0c49e1e Mon Sep 17 00:00:00 2001 From: rMalie Date: Thu, 5 Jan 2012 13:34:57 +0000 Subject: [PATCH] // Can access to administration without the good shop url #PSTEST-152 git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@12185 b9a71923-0436-4b27-9f14-aed3839534dd --- classes/shop/Shop.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/classes/shop/Shop.php b/classes/shop/Shop.php index f24f34c87..439b0249c 100644 --- a/classes/shop/Shop.php +++ b/classes/shop/Shop.php @@ -273,7 +273,7 @@ class ShopCore extends ObjectModel } } - if($id_shop) + if ($id_shop) { // Get instance of found shop $shop = new Shop($id_shop); @@ -281,6 +281,7 @@ class ShopCore extends ObjectModel { // No shop found ... too bad, let's redirect to default shop $default_shop = new Shop(Configuration::get('PS_SHOP_DEFAULT')); + // Hmm there is something really bad in your Prestashop ! if (!Validate::isLoadedObject($default_shop)) throw new PrestaShopException('Shop not found'); @@ -293,6 +294,13 @@ class ShopCore extends ObjectModel else if (defined('INSTALL_VERSION')) $shop = new Shop(); + else if (defined('_PS_ADMIN_DIR_')) + { + // If in admin, we can access to the shop without right URL + $shop = new Shop(Configuration::get('PS_SHOP_DEFAULT')); + $shop->physical_uri = str_replace('\\', '/', dirname(dirname($_SERVER['SCRIPT_NAME']))); + $shop->virtual_uri = ''; + } else throw new PrestaShopException('Shop not found');