// 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
This commit is contained in:
rMalie
2012-01-05 13:34:57 +00:00
parent b2ba9f4519
commit 76bc20a9ab
+9 -1
View File
@@ -273,7 +273,7 @@ class ShopCore extends ObjectModel
} }
} }
if($id_shop) if ($id_shop)
{ {
// Get instance of found shop // Get instance of found shop
$shop = new Shop($id_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 // No shop found ... too bad, let's redirect to default shop
$default_shop = new Shop(Configuration::get('PS_SHOP_DEFAULT')); $default_shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
// Hmm there is something really bad in your Prestashop ! // Hmm there is something really bad in your Prestashop !
if (!Validate::isLoadedObject($default_shop)) if (!Validate::isLoadedObject($default_shop))
throw new PrestaShopException('Shop not found'); throw new PrestaShopException('Shop not found');
@@ -293,6 +294,13 @@ class ShopCore extends ObjectModel
else else
if (defined('INSTALL_VERSION')) if (defined('INSTALL_VERSION'))
$shop = new Shop(); $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 else
throw new PrestaShopException('Shop not found'); throw new PrestaShopException('Shop not found');