From 45444faeb0f47ad2967677fba3dc6b8cf4f53d78 Mon Sep 17 00:00:00 2001 From: gwoo Date: Thu, 4 Oct 2007 05:09:26 +0000 Subject: [PATCH] updating dispatcher for automatic plugin git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5716 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/dispatcher.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/cake/dispatcher.php b/cake/dispatcher.php index 4741aa290..daea530b9 100644 --- a/cake/dispatcher.php +++ b/cake/dispatcher.php @@ -482,9 +482,15 @@ class Dispatcher extends Object { $controller = false; if (!$ctrlClass = $this->__loadController($params)) { - $params = $this->_restructureParams($params); + if(!isset($params['plugin'])) { + $params = $this->_restructureParams($params); + } if (!$ctrlClass = $this->__loadController($params)) { - $params = am($params, array('controller'=> $params['plugin'], 'action'=> $params['controller'])); + $params = am($params, array('controller'=> $params['plugin'], + 'action'=> $params['controller'], + 'pass' => am($params['pass'], Router::getArgs($params['action'])) + ) + ); if (!$ctrlClass = $this->__loadController($params)) { return false; } @@ -512,19 +518,17 @@ class Dispatcher extends Object { $this->plugin = $params['plugin']; $pluginName = Inflector::camelize($params['plugin']); $pluginPath = $pluginName . '.'; + $this->params['controller'] = $this->plugin; + $controller = $pluginName; } if (!empty($params['controller'])) { $controller = Inflector::camelize($params['controller']); - $ctrlClass = $controller . 'Controller'; - } elseif ($this->plugin) { - $this->params['controller'] = $this->plugin; - $controller = $pluginName; - $ctrlClass = $controller . 'Controller'; } if ($pluginPath . $controller) { if (loadController($pluginPath . $controller)) { + $ctrlClass = $controller . 'Controller'; return $ctrlClass; } }