Fixing Notice on "Missing Model" page

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@3886 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
nate 2006-11-21 22:03:52 +00:00
parent c773b64bfe
commit 91b9b3be6c
2 changed files with 23 additions and 13 deletions

View file

@ -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)) {

View file

@ -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;
}
}