2005-05-22 23:24:09 +00:00
|
|
|
<?PHP
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// + $Id$
|
|
|
|
// +------------------------------------------------------------------+ //
|
|
|
|
// + Cake <https://developers.nextco.com/cake/> + //
|
|
|
|
// + Copyright: (c) 2005, Cake Authors/Developers + //
|
|
|
|
// + Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com> + //
|
|
|
|
// + Larry E. Masters aka PhpNut <nut@phpnut.com> + //
|
|
|
|
// + Kamil Dzielinski aka Brego <brego.dk@gmail.com> + //
|
|
|
|
// +------------------------------------------------------------------+ //
|
|
|
|
// + Licensed under The MIT License + //
|
|
|
|
// + Redistributions of files must retain the above copyright notice. + //
|
|
|
|
// + See: http://www.opensource.org/licenses/mit-license.php + //
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Purpose: Dispatcher
|
|
|
|
* Dispatches the request, creating aproppriate models and controllers.
|
|
|
|
*
|
|
|
|
* @filesource
|
|
|
|
* @author Cake Authors/Developers
|
|
|
|
* @copyright Copyright (c) 2005, Cake Authors/Developers
|
|
|
|
* @link https://developers.nextco.com/cake/wiki/Authors Authors/Developers
|
|
|
|
* @package cake
|
|
|
|
* @subpackage cake.libs
|
|
|
|
* @since Cake v 0.2.9
|
|
|
|
* @version $Revision$
|
|
|
|
* @modifiedby $LastChangedBy$
|
|
|
|
* @lastmodified $Date$
|
|
|
|
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Description:
|
2005-05-31 23:18:22 +00:00
|
|
|
* Dispatches the request, creating appropriate models and controllers.
|
2005-05-22 23:24:09 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
uses('error_messages', 'object', 'router', 'controller');
|
|
|
|
|
|
|
|
/**
|
2005-06-02 19:37:06 +00:00
|
|
|
* Dispatches the request, creating appropriate models and controllers.
|
2005-05-22 23:24:09 +00:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* @package cake
|
|
|
|
* @subpackage cake.libs
|
|
|
|
* @since Cake v 0.2.9
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
class Dispatcher extends Object {
|
|
|
|
/**
|
2005-05-31 23:18:22 +00:00
|
|
|
* Base URL
|
2005-05-22 23:24:09 +00:00
|
|
|
*
|
|
|
|
* @var unknown_type
|
|
|
|
*/
|
|
|
|
var $base = false;
|
|
|
|
/**
|
|
|
|
* Enter description here...
|
|
|
|
*
|
2005-05-31 23:18:22 +00:00
|
|
|
* @var array
|
2005-05-22 23:24:09 +00:00
|
|
|
*/
|
|
|
|
var $passed_args = array();
|
|
|
|
|
|
|
|
/**
|
2005-05-31 23:18:22 +00:00
|
|
|
* Constructor.
|
2005-05-22 23:24:09 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
function __construct () {
|
|
|
|
$this->base = $this->baseUrl();
|
|
|
|
parent::__construct();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Enter description here...
|
|
|
|
*
|
2005-05-31 23:18:22 +00:00
|
|
|
* @param string $url
|
2005-05-22 23:24:09 +00:00
|
|
|
* @return unknown
|
|
|
|
*/
|
|
|
|
function dispatch ($url) {
|
|
|
|
global $_POST, $_GET, $_FILES, $_SESSION;
|
|
|
|
|
I've merged in Olle's changes.
Larry, I've merged in _some_ of your changes, I'll merge in the scaffolding and joins code when you tell me it's ready. But I don't want to break how the Controller class works, can't we really do without the constructClasses() method call? Which reminds me, with your joins code, will we be able to use constructs like $user->post->findAll() and $user->post->save()?
Also, what are your changes to the DBO_MySQL class? I mean the mysqlResultSet(), and fetchResult() methods. I didn't see any MySQL-specific code inside them, perhaps they belong to the DBO class itself?
- I've changed the headers on user-editable files in /app and /config. I hope they will constitute a compromise between readability and legality. I've left file Id, copyright, and licence notices.
- /libs/basic.php::uses() function logs included files in global $loaded. Please, consider it a note to myself. Also, I've moved the NeatArray class out of the /libs/basics.php (into /libs/neat_array.php).
- Some cleanups in the Controller and Dispatcher classes.
- DBO::Prepare() accepts strings _and_ arrays now. It's a step towards a unified params theory.
- I think I've added some comments to DBO sub-classes, but it might have been Olle.
- A fix in Model class (findAll didn't work properly)
- Object's constructor sets $this->db to &DBO, which means all Object-descendand classes have default access to the database if it's connected. We need to clean up the code accordingly (some classes set their own $this->db references).
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@236 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-06-05 11:05:24 +00:00
|
|
|
/* @var $params array */
|
2005-05-22 23:24:09 +00:00
|
|
|
$params = $this->parseParams($url);
|
|
|
|
|
|
|
|
// die if no controller set
|
|
|
|
if (empty($params['controller']))
|
|
|
|
$this->errorNoController($url);
|
|
|
|
|
2005-05-29 19:43:59 +00:00
|
|
|
$ctrl_name = Inflector::camelize($params['controller']);
|
2005-05-22 23:24:09 +00:00
|
|
|
$ctrl_class = $ctrl_name.'Controller';
|
|
|
|
|
I've merged in Olle's changes.
Larry, I've merged in _some_ of your changes, I'll merge in the scaffolding and joins code when you tell me it's ready. But I don't want to break how the Controller class works, can't we really do without the constructClasses() method call? Which reminds me, with your joins code, will we be able to use constructs like $user->post->findAll() and $user->post->save()?
Also, what are your changes to the DBO_MySQL class? I mean the mysqlResultSet(), and fetchResult() methods. I didn't see any MySQL-specific code inside them, perhaps they belong to the DBO class itself?
- I've changed the headers on user-editable files in /app and /config. I hope they will constitute a compromise between readability and legality. I've left file Id, copyright, and licence notices.
- /libs/basic.php::uses() function logs included files in global $loaded. Please, consider it a note to myself. Also, I've moved the NeatArray class out of the /libs/basics.php (into /libs/neat_array.php).
- Some cleanups in the Controller and Dispatcher classes.
- DBO::Prepare() accepts strings _and_ arrays now. It's a step towards a unified params theory.
- I think I've added some comments to DBO sub-classes, but it might have been Olle.
- A fix in Model class (findAll didn't work properly)
- Object's constructor sets $this->db to &DBO, which means all Object-descendand classes have default access to the database if it's connected. We need to clean up the code accordingly (some classes set their own $this->db references).
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@236 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-06-05 11:05:24 +00:00
|
|
|
/**
|
|
|
|
* Find out if the specified controller exists, and die if not.
|
|
|
|
*/
|
2005-05-22 23:24:09 +00:00
|
|
|
if (!loadController($ctrl_name) || !class_exists($ctrl_class))
|
|
|
|
$this->errorUnknownController($url, $ctrl_name);
|
|
|
|
|
I've merged in Olle's changes.
Larry, I've merged in _some_ of your changes, I'll merge in the scaffolding and joins code when you tell me it's ready. But I don't want to break how the Controller class works, can't we really do without the constructClasses() method call? Which reminds me, with your joins code, will we be able to use constructs like $user->post->findAll() and $user->post->save()?
Also, what are your changes to the DBO_MySQL class? I mean the mysqlResultSet(), and fetchResult() methods. I didn't see any MySQL-specific code inside them, perhaps they belong to the DBO class itself?
- I've changed the headers on user-editable files in /app and /config. I hope they will constitute a compromise between readability and legality. I've left file Id, copyright, and licence notices.
- /libs/basic.php::uses() function logs included files in global $loaded. Please, consider it a note to myself. Also, I've moved the NeatArray class out of the /libs/basics.php (into /libs/neat_array.php).
- Some cleanups in the Controller and Dispatcher classes.
- DBO::Prepare() accepts strings _and_ arrays now. It's a step towards a unified params theory.
- I think I've added some comments to DBO sub-classes, but it might have been Olle.
- A fix in Model class (findAll didn't work properly)
- Object's constructor sets $this->db to &DBO, which means all Object-descendand classes have default access to the database if it's connected. We need to clean up the code accordingly (some classes set their own $this->db references).
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@236 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-06-05 11:05:24 +00:00
|
|
|
$ctrl_methods = get_class_methods($ctrl_class);
|
|
|
|
$ctrl_vars = get_class_vars($ctrl_class);
|
2005-05-22 23:24:09 +00:00
|
|
|
|
I've merged in Olle's changes.
Larry, I've merged in _some_ of your changes, I'll merge in the scaffolding and joins code when you tell me it's ready. But I don't want to break how the Controller class works, can't we really do without the constructClasses() method call? Which reminds me, with your joins code, will we be able to use constructs like $user->post->findAll() and $user->post->save()?
Also, what are your changes to the DBO_MySQL class? I mean the mysqlResultSet(), and fetchResult() methods. I didn't see any MySQL-specific code inside them, perhaps they belong to the DBO class itself?
- I've changed the headers on user-editable files in /app and /config. I hope they will constitute a compromise between readability and legality. I've left file Id, copyright, and licence notices.
- /libs/basic.php::uses() function logs included files in global $loaded. Please, consider it a note to myself. Also, I've moved the NeatArray class out of the /libs/basics.php (into /libs/neat_array.php).
- Some cleanups in the Controller and Dispatcher classes.
- DBO::Prepare() accepts strings _and_ arrays now. It's a step towards a unified params theory.
- I think I've added some comments to DBO sub-classes, but it might have been Olle.
- A fix in Model class (findAll didn't work properly)
- Object's constructor sets $this->db to &DBO, which means all Object-descendand classes have default access to the database if it's connected. We need to clean up the code accordingly (some classes set their own $this->db references).
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@236 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-06-05 11:05:24 +00:00
|
|
|
/**
|
|
|
|
* If _no_action_is set, check if the default action, index() exists. If it doesn't, die.
|
|
|
|
*/
|
2005-06-05 19:42:54 +00:00
|
|
|
if (empty($params['action']))
|
I've merged in Olle's changes.
Larry, I've merged in _some_ of your changes, I'll merge in the scaffolding and joins code when you tell me it's ready. But I don't want to break how the Controller class works, can't we really do without the constructClasses() method call? Which reminds me, with your joins code, will we be able to use constructs like $user->post->findAll() and $user->post->save()?
Also, what are your changes to the DBO_MySQL class? I mean the mysqlResultSet(), and fetchResult() methods. I didn't see any MySQL-specific code inside them, perhaps they belong to the DBO class itself?
- I've changed the headers on user-editable files in /app and /config. I hope they will constitute a compromise between readability and legality. I've left file Id, copyright, and licence notices.
- /libs/basic.php::uses() function logs included files in global $loaded. Please, consider it a note to myself. Also, I've moved the NeatArray class out of the /libs/basics.php (into /libs/neat_array.php).
- Some cleanups in the Controller and Dispatcher classes.
- DBO::Prepare() accepts strings _and_ arrays now. It's a step towards a unified params theory.
- I think I've added some comments to DBO sub-classes, but it might have been Olle.
- A fix in Model class (findAll didn't work properly)
- Object's constructor sets $this->db to &DBO, which means all Object-descendand classes have default access to the database if it's connected. We need to clean up the code accordingly (some classes set their own $this->db references).
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@236 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-06-05 11:05:24 +00:00
|
|
|
{
|
2005-06-05 19:42:54 +00:00
|
|
|
if (in_array('index', $ctrl_methods))
|
|
|
|
{
|
|
|
|
$params['action'] = 'index';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$this->errorNoAction($url);
|
|
|
|
}
|
I've merged in Olle's changes.
Larry, I've merged in _some_ of your changes, I'll merge in the scaffolding and joins code when you tell me it's ready. But I don't want to break how the Controller class works, can't we really do without the constructClasses() method call? Which reminds me, with your joins code, will we be able to use constructs like $user->post->findAll() and $user->post->save()?
Also, what are your changes to the DBO_MySQL class? I mean the mysqlResultSet(), and fetchResult() methods. I didn't see any MySQL-specific code inside them, perhaps they belong to the DBO class itself?
- I've changed the headers on user-editable files in /app and /config. I hope they will constitute a compromise between readability and legality. I've left file Id, copyright, and licence notices.
- /libs/basic.php::uses() function logs included files in global $loaded. Please, consider it a note to myself. Also, I've moved the NeatArray class out of the /libs/basics.php (into /libs/neat_array.php).
- Some cleanups in the Controller and Dispatcher classes.
- DBO::Prepare() accepts strings _and_ arrays now. It's a step towards a unified params theory.
- I think I've added some comments to DBO sub-classes, but it might have been Olle.
- A fix in Model class (findAll didn't work properly)
- Object's constructor sets $this->db to &DBO, which means all Object-descendand classes have default access to the database if it's connected. We need to clean up the code accordingly (some classes set their own $this->db references).
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@236 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-06-05 11:05:24 +00:00
|
|
|
}
|
2005-06-05 19:42:54 +00:00
|
|
|
|
I've merged in Olle's changes.
Larry, I've merged in _some_ of your changes, I'll merge in the scaffolding and joins code when you tell me it's ready. But I don't want to break how the Controller class works, can't we really do without the constructClasses() method call? Which reminds me, with your joins code, will we be able to use constructs like $user->post->findAll() and $user->post->save()?
Also, what are your changes to the DBO_MySQL class? I mean the mysqlResultSet(), and fetchResult() methods. I didn't see any MySQL-specific code inside them, perhaps they belong to the DBO class itself?
- I've changed the headers on user-editable files in /app and /config. I hope they will constitute a compromise between readability and legality. I've left file Id, copyright, and licence notices.
- /libs/basic.php::uses() function logs included files in global $loaded. Please, consider it a note to myself. Also, I've moved the NeatArray class out of the /libs/basics.php (into /libs/neat_array.php).
- Some cleanups in the Controller and Dispatcher classes.
- DBO::Prepare() accepts strings _and_ arrays now. It's a step towards a unified params theory.
- I think I've added some comments to DBO sub-classes, but it might have been Olle.
- A fix in Model class (findAll didn't work properly)
- Object's constructor sets $this->db to &DBO, which means all Object-descendand classes have default access to the database if it's connected. We need to clean up the code accordingly (some classes set their own $this->db references).
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@236 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-06-05 11:05:24 +00:00
|
|
|
/**
|
|
|
|
* Check if the specified action really exists.
|
|
|
|
*/
|
|
|
|
if (!in_array($params['action'], $ctrl_methods))
|
|
|
|
{
|
2005-05-22 23:24:09 +00:00
|
|
|
$this->errorUnknownAction($url, $ctrl_class, $params['action']);
|
I've merged in Olle's changes.
Larry, I've merged in _some_ of your changes, I'll merge in the scaffolding and joins code when you tell me it's ready. But I don't want to break how the Controller class works, can't we really do without the constructClasses() method call? Which reminds me, with your joins code, will we be able to use constructs like $user->post->findAll() and $user->post->save()?
Also, what are your changes to the DBO_MySQL class? I mean the mysqlResultSet(), and fetchResult() methods. I didn't see any MySQL-specific code inside them, perhaps they belong to the DBO class itself?
- I've changed the headers on user-editable files in /app and /config. I hope they will constitute a compromise between readability and legality. I've left file Id, copyright, and licence notices.
- /libs/basic.php::uses() function logs included files in global $loaded. Please, consider it a note to myself. Also, I've moved the NeatArray class out of the /libs/basics.php (into /libs/neat_array.php).
- Some cleanups in the Controller and Dispatcher classes.
- DBO::Prepare() accepts strings _and_ arrays now. It's a step towards a unified params theory.
- I think I've added some comments to DBO sub-classes, but it might have been Olle.
- A fix in Model class (findAll didn't work properly)
- Object's constructor sets $this->db to &DBO, which means all Object-descendand classes have default access to the database if it's connected. We need to clean up the code accordingly (some classes set their own $this->db references).
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@236 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-06-05 11:05:24 +00:00
|
|
|
}
|
2005-05-22 23:24:09 +00:00
|
|
|
|
2005-06-05 19:42:54 +00:00
|
|
|
$controller = new $ctrl_class ($params);
|
|
|
|
$controller->base = $this->base;
|
2005-05-22 23:24:09 +00:00
|
|
|
$controller->action = $params['action'];
|
|
|
|
$controller->data = empty($params['data'])? null: $params['data'];
|
I've merged in Olle's changes.
Larry, I've merged in _some_ of your changes, I'll merge in the scaffolding and joins code when you tell me it's ready. But I don't want to break how the Controller class works, can't we really do without the constructClasses() method call? Which reminds me, with your joins code, will we be able to use constructs like $user->post->findAll() and $user->post->save()?
Also, what are your changes to the DBO_MySQL class? I mean the mysqlResultSet(), and fetchResult() methods. I didn't see any MySQL-specific code inside them, perhaps they belong to the DBO class itself?
- I've changed the headers on user-editable files in /app and /config. I hope they will constitute a compromise between readability and legality. I've left file Id, copyright, and licence notices.
- /libs/basic.php::uses() function logs included files in global $loaded. Please, consider it a note to myself. Also, I've moved the NeatArray class out of the /libs/basics.php (into /libs/neat_array.php).
- Some cleanups in the Controller and Dispatcher classes.
- DBO::Prepare() accepts strings _and_ arrays now. It's a step towards a unified params theory.
- I think I've added some comments to DBO sub-classes, but it might have been Olle.
- A fix in Model class (findAll didn't work properly)
- Object's constructor sets $this->db to &DBO, which means all Object-descendand classes have default access to the database if it's connected. We need to clean up the code accordingly (some classes set their own $this->db references).
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@236 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-06-05 11:05:24 +00:00
|
|
|
$controller->passed_args = empty($params['pass'])? null: $params['pass'];
|
|
|
|
|
2005-05-22 23:24:09 +00:00
|
|
|
// EXECUTE THE REQUESTED ACTION
|
|
|
|
call_user_func_array(array(&$controller, $params['action']), empty($params['pass'])? null: $params['pass']);
|
|
|
|
|
|
|
|
if ($controller->autoRender)
|
|
|
|
$controller->render();
|
|
|
|
|
|
|
|
return $params;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2005-05-31 23:18:22 +00:00
|
|
|
* Returns array of GET and POST parameters. GET parameters are taken from given URL.
|
2005-05-22 23:24:09 +00:00
|
|
|
*
|
2005-05-31 23:18:22 +00:00
|
|
|
* @param string $from_url
|
|
|
|
* @return array Parameters found in POST and GET.
|
2005-05-22 23:24:09 +00:00
|
|
|
*/
|
|
|
|
function parseParams ($from_url) {
|
|
|
|
global $_POST, $_FILES;
|
|
|
|
|
|
|
|
// load routes config
|
|
|
|
$Route = new Router();
|
|
|
|
require CONFIGS.'routes.php';
|
2005-06-05 19:42:54 +00:00
|
|
|
$params = $Route->parse ($from_url);
|
2005-05-22 23:24:09 +00:00
|
|
|
|
|
|
|
// add submitted form data
|
|
|
|
$params['form'] = $_POST;
|
|
|
|
if (isset($_POST['data']))
|
|
|
|
$params['data'] = $_POST['data'];
|
|
|
|
|
|
|
|
foreach ($_FILES as $name => $data)
|
|
|
|
$params['form'][$name] = $data;
|
|
|
|
|
|
|
|
return $params;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2005-05-31 23:18:22 +00:00
|
|
|
* Returns a base URL.
|
2005-05-22 23:24:09 +00:00
|
|
|
*
|
2005-05-31 23:18:22 +00:00
|
|
|
* @return string
|
2005-05-22 23:24:09 +00:00
|
|
|
*/
|
|
|
|
function baseUrl () {
|
|
|
|
global $_SERVER;
|
|
|
|
|
|
|
|
//non mod_rewrite use:
|
|
|
|
if (defined('BASE_URL')) return BASE_URL;
|
|
|
|
|
|
|
|
$doc_root = $_SERVER['DOCUMENT_ROOT'];
|
|
|
|
$script_name = $_SERVER['PHP_SELF'];
|
|
|
|
|
|
|
|
// if document root ends with 'public', it's probably correctly set
|
|
|
|
$r = null;
|
2005-05-29 19:43:59 +00:00
|
|
|
if (ereg('/^.*/public(\/)?$/', $doc_root))
|
2005-05-22 23:24:09 +00:00
|
|
|
return preg_match('/^(.*)\/index\.php$/', $script_name, $r)? $r[1]: false;
|
2005-05-29 19:43:59 +00:00
|
|
|
else
|
|
|
|
// document root is probably not set to Cake 'public' dir
|
|
|
|
return preg_match('/^(.*)\/public\/index\.php$/', $script_name, $r)? $r[1]: false;
|
2005-05-22 23:24:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2005-05-31 23:18:22 +00:00
|
|
|
* Displays an error page (e.g. 404 Not found).
|
2005-05-22 23:24:09 +00:00
|
|
|
*
|
2005-05-31 23:18:22 +00:00
|
|
|
* @param int $code Error code (e.g. 404)
|
|
|
|
* @param string $name Name of the error message (e.g. Not found)
|
|
|
|
* @param string $message
|
2005-05-22 23:24:09 +00:00
|
|
|
*/
|
|
|
|
function error ($code, $name, $message) {
|
|
|
|
$controller = new Controller ($this);
|
|
|
|
$controller->base = $this->base;
|
|
|
|
$controller->error($code, $name, $message);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2005-05-31 23:18:22 +00:00
|
|
|
* Convenience method to display a 404 page.
|
2005-05-22 23:24:09 +00:00
|
|
|
*
|
|
|
|
* @param unknown_type $url
|
|
|
|
* @param unknown_type $message
|
|
|
|
*/
|
|
|
|
function error404 ($url, $message) {
|
|
|
|
$this->error('404', 'Not found', sprintf(ERROR_404, $url, $message));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2005-05-31 23:18:22 +00:00
|
|
|
* If DEBUG is set, this displays a 404 error with the message that no controller is set. If DEBUG is not set, nothing happens.
|
2005-05-22 23:24:09 +00:00
|
|
|
*
|
2005-05-31 23:18:22 +00:00
|
|
|
* @param string $url
|
2005-05-22 23:24:09 +00:00
|
|
|
*/
|
|
|
|
function errorNoController ($url) {
|
|
|
|
DEBUG?
|
|
|
|
trigger_error (ERROR_NO_CONTROLLER_SET, E_USER_ERROR):
|
|
|
|
$this->error404($url, "no controller set");
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2005-05-31 23:18:22 +00:00
|
|
|
* If DEBUG is set, this displays a 404 error with the message that the asked-for controller does not exist. If DEBUG is not set, nothing happens.
|
2005-05-22 23:24:09 +00:00
|
|
|
*
|
2005-05-31 23:18:22 +00:00
|
|
|
* @param string $url
|
|
|
|
* @param string $controller_class
|
2005-05-22 23:24:09 +00:00
|
|
|
*/
|
|
|
|
function errorUnknownController ($url, $controller_class) {
|
|
|
|
DEBUG?
|
|
|
|
trigger_error (sprintf(ERROR_UNKNOWN_CONTROLLER, $controller_class), E_USER_ERROR):
|
|
|
|
$this->error404($url, "missing controller \"{$controller_class}\"");
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2005-05-31 23:18:22 +00:00
|
|
|
* If DEBUG is set, this displays a 404 error with the message that no action is set. If DEBUG is not set, nothing happens.
|
2005-05-22 23:24:09 +00:00
|
|
|
*
|
2005-05-31 23:18:22 +00:00
|
|
|
* @param string $url
|
2005-05-22 23:24:09 +00:00
|
|
|
*/
|
|
|
|
function errorNoAction ($url) {
|
|
|
|
DEBUG?
|
|
|
|
trigger_error (ERROR_NO_ACTION_SET, E_USER_ERROR):
|
|
|
|
$this->error404(sprintf(ERROR_404, $url, "no action set"));
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2005-05-31 23:18:22 +00:00
|
|
|
* If DEBUG is set, this displays a 404 error with the message that no such action exists. If DEBUG is not set, nothing happens.
|
2005-05-22 23:24:09 +00:00
|
|
|
*
|
2005-05-31 23:18:22 +00:00
|
|
|
* @param string $url
|
|
|
|
* @param string $controller_class
|
|
|
|
* @param string $action
|
2005-05-22 23:24:09 +00:00
|
|
|
*/
|
|
|
|
function errorUnknownAction ($url,$controller_class, $action) {
|
|
|
|
DEBUG?
|
|
|
|
trigger_error (sprintf(ERROR_NO_ACTION, $action, $controller_class), E_USER_ERROR):
|
|
|
|
$this->error404($url, "missing controller \"{$controller_class}\"");
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-05-16 23:14:37 +00:00
|
|
|
?>
|