// Fix url of admin when url rewriting is ON

This commit is contained in:
rMalie
2012-03-07 14:15:21 +00:00
parent 8c0a981346
commit e936626f4b
+5 -3
View File
@@ -184,12 +184,15 @@ class DispatcherCore
*/ */
protected function __construct() protected function __construct()
{ {
$this->use_routes = (bool)Configuration::get('PS_REWRITING_SETTINGS');
// Select right front controller // Select right front controller
if (defined('_PS_ADMIN_DIR_')) if (defined('_PS_ADMIN_DIR_'))
{ {
$this->front_controller = self::FC_ADMIN; $this->front_controller = self::FC_ADMIN;
$this->controller_not_found = 'adminnotfound'; $this->controller_not_found = 'adminnotfound';
$this->default_controller = 'adminhome'; $this->default_controller = 'adminhome';
$this->use_routes = false;
} }
else if (Tools::getValue('fc') == 'module') else if (Tools::getValue('fc') == 'module')
{ {
@@ -204,7 +207,6 @@ class DispatcherCore
$this->default_controller = 'index'; $this->default_controller = 'index';
} }
$this->use_routes = (bool)Configuration::get('PS_REWRITING_SETTINGS');
$this->loadRoutes(); $this->loadRoutes();
// Get request uri (HTTP_X_REWRITE_URL is used by IIS) // Get request uri (HTTP_X_REWRITE_URL is used by IIS)
@@ -284,7 +286,7 @@ class DispatcherCore
$controllers = Dispatcher::getControllers(_PS_MODULE_DIR_.$tab->module.'/controllers/admin/'); $controllers = Dispatcher::getControllers(_PS_MODULE_DIR_.$tab->module.'/controllers/admin/');
if (!isset($controllers[$this->controller])) if (!isset($controllers[$this->controller]))
{ {
$this->controller = 'adminnotfound'; $this->controller = $this->controller_not_found;
$controller_class = 'AdminNotFoundController'; $controller_class = 'AdminNotFoundController';
} }
else else
@@ -299,7 +301,7 @@ class DispatcherCore
{ {
$controllers = Dispatcher::getControllers(array(_PS_ADMIN_DIR_.'/tabs/', _PS_ADMIN_CONTROLLER_DIR_)); $controllers = Dispatcher::getControllers(array(_PS_ADMIN_DIR_.'/tabs/', _PS_ADMIN_CONTROLLER_DIR_));
if (!isset($controllers[$this->controller])) if (!isset($controllers[$this->controller]))
$this->controller = 'adminnotfound'; $this->controller = $this->controller_not_found;
$controller_class = $controllers[$this->controller]; $controller_class = $controllers[$this->controller];
if (file_exists(_PS_ADMIN_DIR_.'/tabs/'.$controller_class.'.php')) if (file_exists(_PS_ADMIN_DIR_.'/tabs/'.$controller_class.'.php'))