// Fix adminhome and clean Dispatcher
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@12883 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
1 parent
1435f340ef
commit
846eb566c8
3 files changed
+16
-54
No files matched your search
@@ -39,5 +39,4 @@ if (!isset($_REQUEST['controller']) && isset($_REQUEST['tab']))
|
|||||||
// Retrocompatibility with 1.4
|
// Retrocompatibility with 1.4
|
||||||
$_REQUEST['ajaxMode'] = $_POST['ajaxMode'] = $_GET['ajaxMode'] = $_REQUEST['ajax'] = $_POST['ajax'] = $_GET['ajax'] = 1;
|
$_REQUEST['ajaxMode'] = $_POST['ajaxMode'] = $_GET['ajaxMode'] = $_REQUEST['ajax'] = $_POST['ajax'] = $_GET['ajax'] = 1;
|
||||||
|
|
||||||
Dispatcher::getInstance()->setControllerDirectories(array(_PS_ADMIN_DIR_.'/tabs/', _PS_ADMIN_CONTROLLER_DIR_));
|
|
||||||
Dispatcher::getInstance()->dispatch();
|
Dispatcher::getInstance()->dispatch();
|
||||||
@@ -38,7 +38,4 @@ if (!isset($_REQUEST['controller']) && isset($_REQUEST['tab']))
|
|||||||
$_REQUEST['controller'] = strtolower($_REQUEST['tab']);
|
$_REQUEST['controller'] = strtolower($_REQUEST['tab']);
|
||||||
|
|
||||||
// Prepare and trigger admin dispatcher
|
// Prepare and trigger admin dispatcher
|
||||||
Dispatcher::getInstance()->setDefaultController('AdminHome');
|
|
||||||
Dispatcher::getInstance()->setControllerNotFound('AdminNotFound');
|
|
||||||
Dispatcher::getInstance()->setControllerDirectories(array(_PS_ADMIN_DIR_.'/tabs/', _PS_ADMIN_CONTROLLER_DIR_));
|
|
||||||
Dispatcher::getInstance()->dispatch();
|
Dispatcher::getInstance()->dispatch();
|
||||||
+16
-50
@@ -155,7 +155,7 @@ class DispatcherCore
|
|||||||
/**
|
/**
|
||||||
* @var string Set default controller, which will be used if http parameter 'controller' is empty
|
* @var string Set default controller, which will be used if http parameter 'controller' is empty
|
||||||
*/
|
*/
|
||||||
protected $default_controller = 'Index';
|
protected $default_controller = 'index';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string Controller to use if found controller doesn't exist
|
* @var string Controller to use if found controller doesn't exist
|
||||||
@@ -167,11 +167,6 @@ class DispatcherCore
|
|||||||
*/
|
*/
|
||||||
protected $front_controller = self::FC_FRONT;
|
protected $front_controller = self::FC_FRONT;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var array List of controllers where are stored controllers
|
|
||||||
*/
|
|
||||||
protected $controller_directories = array();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get current instance of dispatcher (singleton)
|
* Get current instance of dispatcher (singleton)
|
||||||
*
|
*
|
||||||
@@ -191,14 +186,24 @@ class DispatcherCore
|
|||||||
{
|
{
|
||||||
// Select right front controller
|
// Select right front controller
|
||||||
if (defined('_PS_ADMIN_DIR_'))
|
if (defined('_PS_ADMIN_DIR_'))
|
||||||
$this->setFrontController(self::FC_ADMIN);
|
{
|
||||||
|
$this->front_controller = self::FC_ADMIN;
|
||||||
|
$this->controller_not_found = 'adminnotfound';
|
||||||
|
$this->default_controller = 'adminhome';
|
||||||
|
}
|
||||||
else if (Tools::getValue('fc') == 'module')
|
else if (Tools::getValue('fc') == 'module')
|
||||||
$this->setFrontController(self::FC_MODULE);
|
{
|
||||||
|
$this->front_controller = self::FC_MODULE;
|
||||||
|
$this->controller_not_found = 'pagenotfound';
|
||||||
|
$this->default_controller = 'default';
|
||||||
|
}
|
||||||
else
|
else
|
||||||
$this->setFrontController(self::FC_FRONT);
|
{
|
||||||
|
$this->front_controller = self::FC_FRONT;
|
||||||
|
$this->controller_not_found = 'pagenotfound';
|
||||||
|
$this->default_controller = 'index';
|
||||||
|
}
|
||||||
|
|
||||||
$this->setDefaultController('index');
|
|
||||||
$this->setControllerDirectories(_PS_FRONT_CONTROLLER_DIR_);
|
|
||||||
$this->use_routes = (bool)Configuration::get('PS_REWRITING_SETTINGS');
|
$this->use_routes = (bool)Configuration::get('PS_REWRITING_SETTINGS');
|
||||||
$this->loadRoutes();
|
$this->loadRoutes();
|
||||||
|
|
||||||
@@ -210,45 +215,6 @@ class DispatcherCore
|
|||||||
$this->request_uri = rawurldecode($this->request_uri);
|
$this->request_uri = rawurldecode($this->request_uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set default controller, which will be used if http parameter 'controller' is empty
|
|
||||||
*
|
|
||||||
* @param string $controller
|
|
||||||
*/
|
|
||||||
public function setDefaultController($controller)
|
|
||||||
{
|
|
||||||
$this->default_controller = $controller;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Controller to use if found controller doesn't exist
|
|
||||||
*
|
|
||||||
* @var string $controller
|
|
||||||
*/
|
|
||||||
public function setControllerNotFound($controller)
|
|
||||||
{
|
|
||||||
$this->controller_not_found = $controller;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setFrontController($fc)
|
|
||||||
{
|
|
||||||
if (!in_array($fc, array(self::FC_FRONT, self::FC_ADMIN, self::FC_MODULE)))
|
|
||||||
throw new PrestaShopException('Bad front controller chosen');
|
|
||||||
$this->front_controller = $fc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set list of controllers where are stored controllers
|
|
||||||
*
|
|
||||||
* @param mixed A directory, or an array of directory
|
|
||||||
*/
|
|
||||||
public function setControllerDirectories($dir)
|
|
||||||
{
|
|
||||||
if (!is_array($dir))
|
|
||||||
$dir = array($dir);
|
|
||||||
$this->controller_directories = $dir;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the controller and instantiate it
|
* Find the controller and instantiate it
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in new issue
Block a user