cakephp2-php8/app/webroot/index.php

119 lines
3.7 KiB
PHP
Raw Permalink Normal View History

<?php
/**
2009-05-01 21:05:46 +00:00
* The Front Controller for handling every request
*
2017-06-10 21:33:55 +00:00
* CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
2017-06-10 21:33:55 +00:00
* @link https://cakephp.org CakePHP(tm) Project
* @package app.webroot
* @since CakePHP(tm) v 0.2.9
* @license https://opensource.org/licenses/mit-license.php MIT License
*/
/**
* Use the DS to separate the directories in other defines
*/
if (!defined('DS')) {
define('DS', DIRECTORY_SEPARATOR);
}
/**
* These defines should only be edited if you have CakePHP installed in
Merging fixes and enhancements into trunk Revision: [1985] Changed DboSource?::order() to allow passing an array in the order param Revision: [1984] Reverting changes from [1983] Revision: [1983] Merging change from [1966] and [1967] Revision: [1982] Adding fix for DboSource::order(). This allows setting the order in the find methods. Revision: [1981] cleaned up code Revision: [1980] Corrected the array keys in the regex I added Revision: [1979] Added check to DboMysql::value() that does not add quotes around a numerical value. Refactored DboSource::conditions() adding better regex. Revision: [1978] Added check for LIKE in a condition array this fixes the = being added. Revision: [1977] Added fix for Ticket #392 Revision: [1976] Adding changes suggested in Ticket #381. These have not been fully tested. Revision: [1975] Added fix for Ticket #391 Revision: [1974] Added patch from Ticket #390 Revision: [1973] Adding patch from Ticket #386 Revision: [1972] Added patch from Ticket #385. Changed wording of a comment. Revision: [1971] Added patch from Ticket #383 Revision: [1970] Adding fix for Ticket #395 Revision: [1969] Adding more detailed comment to path defines Revision: [1968] Making a few more changes to the path settings Revision: [1965] fixing path issue with loading PagesController Revision: [1964] Added model method for getting column types by field Revision: [1963] Corrected paths to the tmp directory. Making a few more changes to the defines in index.php Revision: [1962] Moving tmp directory to app Revision: [1961] Starting separation of core from the application. Revision: [1960] Adding vendors directory to app directory Revision: [1959] Finished support for recursive associations. Still needs some testing... Revision: [1958] Adding fix for Ticket #387, and automagic id's for form inputs Revision: [1957] Revision: [1956] Adding fix for error reported in Google Group: http://groups.google.com/group/cake-php/browse_thread/thread/395593a3cea34174 Revision: [1955] Adding fix for Controller::referer() git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1986 3807eeeb-6ff5-0310-8944-8be069107fe0
2006-02-16 09:29:28 +00:00
* a directory layout other than the way it is distributed.
* When using custom settings be sure to use the DS and do not add a trailing DS.
*/
/**
* The full path to the directory which holds "app", WITHOUT a trailing DS.
*/
if (!defined('ROOT')) {
define('ROOT', dirname(dirname(dirname(__FILE__))));
}
/**
* The actual directory name for the "app".
*/
if (!defined('APP_DIR')) {
define('APP_DIR', basename(dirname(dirname(__FILE__))));
}
2017-05-12 06:02:36 +00:00
/**
* Config Directory
*/
if (!defined('CONFIG')) {
define('CONFIG', ROOT . DS . APP_DIR . DS . 'Config' . DS);
}
Merging fixes and enhancements into trunk Revision: [1985] Changed DboSource?::order() to allow passing an array in the order param Revision: [1984] Reverting changes from [1983] Revision: [1983] Merging change from [1966] and [1967] Revision: [1982] Adding fix for DboSource::order(). This allows setting the order in the find methods. Revision: [1981] cleaned up code Revision: [1980] Corrected the array keys in the regex I added Revision: [1979] Added check to DboMysql::value() that does not add quotes around a numerical value. Refactored DboSource::conditions() adding better regex. Revision: [1978] Added check for LIKE in a condition array this fixes the = being added. Revision: [1977] Added fix for Ticket #392 Revision: [1976] Adding changes suggested in Ticket #381. These have not been fully tested. Revision: [1975] Added fix for Ticket #391 Revision: [1974] Added patch from Ticket #390 Revision: [1973] Adding patch from Ticket #386 Revision: [1972] Added patch from Ticket #385. Changed wording of a comment. Revision: [1971] Added patch from Ticket #383 Revision: [1970] Adding fix for Ticket #395 Revision: [1969] Adding more detailed comment to path defines Revision: [1968] Making a few more changes to the path settings Revision: [1965] fixing path issue with loading PagesController Revision: [1964] Added model method for getting column types by field Revision: [1963] Corrected paths to the tmp directory. Making a few more changes to the defines in index.php Revision: [1962] Moving tmp directory to app Revision: [1961] Starting separation of core from the application. Revision: [1960] Adding vendors directory to app directory Revision: [1959] Finished support for recursive associations. Still needs some testing... Revision: [1958] Adding fix for Ticket #387, and automagic id's for form inputs Revision: [1957] Revision: [1956] Adding fix for error reported in Google Group: http://groups.google.com/group/cake-php/browse_thread/thread/395593a3cea34174 Revision: [1955] Adding fix for Controller::referer() git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1986 3807eeeb-6ff5-0310-8944-8be069107fe0
2006-02-16 09:29:28 +00:00
/**
* The absolute path to the "cake" directory, WITHOUT a trailing DS.
*
* Un-comment this line to specify a fixed path to CakePHP.
2011-10-18 17:06:29 +00:00
* This should point at the directory containing `Cake`.
*
* For ease of development CakePHP uses PHP's include_path. If you
* cannot modify your include_path set this value.
*
* Leaving this constant undefined will result in it being defined in Cake/bootstrap.php
*
* The following line differs from its sibling
* /lib/Cake/Console/Templates/skel/webroot/index.php
Merging fixes and enhancements into trunk Revision: [1985] Changed DboSource?::order() to allow passing an array in the order param Revision: [1984] Reverting changes from [1983] Revision: [1983] Merging change from [1966] and [1967] Revision: [1982] Adding fix for DboSource::order(). This allows setting the order in the find methods. Revision: [1981] cleaned up code Revision: [1980] Corrected the array keys in the regex I added Revision: [1979] Added check to DboMysql::value() that does not add quotes around a numerical value. Refactored DboSource::conditions() adding better regex. Revision: [1978] Added check for LIKE in a condition array this fixes the = being added. Revision: [1977] Added fix for Ticket #392 Revision: [1976] Adding changes suggested in Ticket #381. These have not been fully tested. Revision: [1975] Added fix for Ticket #391 Revision: [1974] Added patch from Ticket #390 Revision: [1973] Adding patch from Ticket #386 Revision: [1972] Added patch from Ticket #385. Changed wording of a comment. Revision: [1971] Added patch from Ticket #383 Revision: [1970] Adding fix for Ticket #395 Revision: [1969] Adding more detailed comment to path defines Revision: [1968] Making a few more changes to the path settings Revision: [1965] fixing path issue with loading PagesController Revision: [1964] Added model method for getting column types by field Revision: [1963] Corrected paths to the tmp directory. Making a few more changes to the defines in index.php Revision: [1962] Moving tmp directory to app Revision: [1961] Starting separation of core from the application. Revision: [1960] Adding vendors directory to app directory Revision: [1959] Finished support for recursive associations. Still needs some testing... Revision: [1958] Adding fix for Ticket #387, and automagic id's for form inputs Revision: [1957] Revision: [1956] Adding fix for error reported in Google Group: http://groups.google.com/group/cake-php/browse_thread/thread/395593a3cea34174 Revision: [1955] Adding fix for Controller::referer() git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1986 3807eeeb-6ff5-0310-8944-8be069107fe0
2006-02-16 09:29:28 +00:00
*/
//define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'lib');
/**
* This auto-detects CakePHP as a composer installed library.
* You may remove this if you are not planning to use composer (not recommended, though).
*/
$vendorPath = ROOT . DS . APP_DIR . DS . 'Vendor' . DS . 'cakephp' . DS . 'cakephp' . DS . 'lib';
$dispatcher = 'Cake' . DS . 'Console' . DS . 'ShellDispatcher.php';
if (!defined('CAKE_CORE_INCLUDE_PATH') && file_exists($vendorPath . DS . $dispatcher)) {
define('CAKE_CORE_INCLUDE_PATH', $vendorPath);
}
/**
* Editing below this line should NOT be necessary.
* Change at your own risk.
*/
if (!defined('WEBROOT_DIR')) {
define('WEBROOT_DIR', basename(dirname(__FILE__)));
}
if (!defined('WWW_ROOT')) {
define('WWW_ROOT', dirname(__FILE__) . DS);
}
// For the built-in server
if (PHP_SAPI === 'cli-server') {
if ($_SERVER['PHP_SELF'] !== '/' . basename(__FILE__) && file_exists(WWW_ROOT . $_SERVER['PHP_SELF'])) {
return false;
}
2012-07-27 01:22:50 +00:00
$_SERVER['PHP_SELF'] = '/' . basename(__FILE__);
}
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
if (function_exists('ini_set')) {
ini_set('include_path', ROOT . DS . 'lib' . PATH_SEPARATOR . ini_get('include_path'));
}
if (!include 'Cake' . DS . 'bootstrap.php') {
$failed = true;
}
} elseif (!include CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'bootstrap.php') {
$failed = true;
}
if (!empty($failed)) {
trigger_error("CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your " . DS . "cake core directory and your " . DS . "vendors root directory.", E_USER_ERROR);
}
App::uses('Dispatcher', 'Routing');
$Dispatcher = new Dispatcher();
$Dispatcher->dispatch(
new CakeRequest(),
new CakeResponse()
);