diff --git a/cake/dispatcher.php b/cake/dispatcher.php index 9f9d3c15b..58ce9da34 100644 --- a/cake/dispatcher.php +++ b/cake/dispatcher.php @@ -45,6 +45,11 @@ class Dispatcher extends Object { * @var string */ var $base = false; +/** + * Current URL + * @var string + */ + var $here = false; /** * @var string */ @@ -150,6 +155,12 @@ class Dispatcher extends Object { $privateAction = true; } } + $base = Router::stripPlugin($this->base, $this->plugin); + if(defined('BASE_URL')) { + $this->here = $base . $this->admin . $url; + } else { + $this->here = $base . $this->admin . '/' . $url; + } if ($missingController) { Router::setParams(array($params, array('base' => $this->base, 'webroot' => $this->webroot))); @@ -194,12 +205,7 @@ class Dispatcher extends Object { } $controller->base = $this->base; - $base = Router::stripPlugin($this->base, $this->plugin); - if(defined("BASE_URL")) { - $controller->here = $base . $this->admin . $url; - } else { - $controller->here = $base . $this->admin . '/' . $url; - } + $controller->here = $this->here; $controller->webroot = $this->webroot; $controller->params = $params; $controller->action = $params['action']; @@ -266,11 +272,10 @@ class Dispatcher extends Object { array_push($controller->helpers, $controller->webservices); $component =& new Component($controller); } + Router::setParams(array($params, array('base' => $this->base, 'here' => $this->here, 'webroot' => $this->webroot, 'passedArgs' => $controller->passedArgs, 'argSeparator' => $controller->argSeparator, 'namedArgs' => $controller->namedArgs, 'webservices' => $controller->webservices))); $controller->_initComponents(); $controller->constructClasses(); - Router::setParams(array($params, array('base' => $controller->base, 'here' => $controller->here, 'webroot' => $controller->webroot, 'passedArgs' => $controller->passedArgs, 'argSeparator' => $controller->argSeparator, 'namedArgs' => $controller->namedArgs, 'webservices' => $controller->webservices))); - if ($missingAction && !in_array('scaffold', array_keys($classVars))){ $this->start($controller); return $this->cakeError('missingAction', array( @@ -363,7 +368,7 @@ class Dispatcher extends Object { $Route = Router::getInstance(); extract(Router::getNamedExpressions()); include CONFIGS.'routes.php'; - $params = $Route->parse ($from_url); + $params = Router::parse($from_url); if (ini_get('magic_quotes_gpc') == 1) { if(!empty($_POST)) { diff --git a/cake/libs/router.php b/cake/libs/router.php index bf6c71021..952fd7601 100644 --- a/cake/libs/router.php +++ b/cake/libs/router.php @@ -298,10 +298,16 @@ class Router extends Overloadable { * @return void */ function setParams($params) { + $_this =& Router::getInstance(); - if (!isset($params[1]['plugin'])) { - $params[1]['plugin'] = null; - } + $params[1] = am( + array( + 'plugin' => null, + 'controller' => null, + 'action' => null + ), + $params[1] + ); list($_this->__params[], $_this->__paths[]) = $params; } /** @@ -511,7 +517,6 @@ class Router extends Overloadable { foreach ($route[4] as $key => $reg) { if (isset($url[$key]) && !preg_match('/' . $reg . '/', $url[$key])) { - pr($route[0].':break4'); return false; } }