2011-11-26 10:45:31 +01:00
< ? php
/**
* Index
*
* The Front Controller for handling every request
*
2012-03-15 15:06:45 +01:00
* PHP 5
2011-11-26 10:45:31 +01:00
*
* CakePHP ( tm ) : Rapid Development Framework ( http :// cakephp . org )
2012-09-25 15:41:58 +02:00
* Copyright 2005 - 2012 , Cake Software Foundation , Inc . ( http :// cakefoundation . org )
2011-11-26 10:45:31 +01:00
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice .
*
2012-09-25 15:41:58 +02:00
* @ copyright Copyright 2005 - 2012 , Cake Software Foundation , Inc . ( http :// cakefoundation . org )
2011-11-26 10:45:31 +01:00
* @ link http :// cakephp . org CakePHP ( tm ) Project
2012-03-15 15:06:45 +01:00
* @ package app . webroot
2011-11-26 10:45:31 +01:00
* @ since CakePHP ( tm ) v 0.2 . 9
* @ license MIT License ( http :// www . opensource . org / licenses / mit - license . php )
*/
/**
* Use the DS to separate the directories in other defines
*/
2012-09-25 15:41:58 +02:00
if ( ! defined ( 'DS' )) {
define ( 'DS' , DIRECTORY_SEPARATOR );
}
2011-11-26 10:45:31 +01:00
/**
* These defines should only be edited if you have cake installed in
* 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 .
*
*/
2012-09-25 15:41:58 +02:00
if ( ! defined ( 'ROOT' )) {
define ( 'ROOT' , dirname ( dirname ( dirname ( __FILE__ ))));
}
2011-11-26 10:45:31 +01:00
/**
* The actual directory name for the " app " .
*
*/
2012-09-25 15:41:58 +02:00
if ( ! defined ( 'APP_DIR' )) {
define ( 'APP_DIR' , basename ( dirname ( dirname ( __FILE__ ))));
}
2012-03-15 15:06:45 +01:00
2011-11-26 10:45:31 +01:00
/**
* The absolute path to the " cake " directory , WITHOUT a trailing DS .
*
2012-03-15 15:06:45 +01:00
* Un - comment this line to specify a fixed path to CakePHP .
* 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
2011-11-26 10:45:31 +01:00
*/
2014-02-09 16:44:48 +01:00
define ( 'CAKE_CORE_INCLUDE_PATH' , ROOT . DS . APP_DIR . DS . 'Lib' . DS . 'cakephp' . DS . 'lib' );
2011-11-26 10:45:31 +01:00
/**
* Editing below this line should NOT be necessary .
* Change at your own risk .
*
*/
2012-09-25 15:41:58 +02:00
if ( ! defined ( 'WEBROOT_DIR' )) {
define ( 'WEBROOT_DIR' , basename ( dirname ( __FILE__ )));
}
if ( ! defined ( 'WWW_ROOT' )) {
define ( 'WWW_ROOT' , dirname ( __FILE__ ) . DS );
}
2012-03-15 15:06:45 +01:00
2012-09-25 15:41:58 +02:00
if ( ! defined ( 'CAKE_CORE_INCLUDE_PATH' )) {
if ( function_exists ( 'ini_set' )) {
ini_set ( 'include_path' , ROOT . DS . 'lib' . PATH_SEPARATOR . ini_get ( 'include_path' ));
2011-11-26 10:45:31 +01:00
}
2012-09-25 15:41:58 +02:00
if ( ! include ( 'Cake' . DS . 'bootstrap.php' )) {
$failed = true ;
2011-11-26 10:45:31 +01:00
}
2012-09-25 15:41:58 +02:00
} else {
if ( ! include ( CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'bootstrap.php' )) {
$failed = true ;
2011-11-26 10:45:31 +01:00
}
2012-09-25 15:41:58 +02:00
}
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 );
}
2012-03-15 15:06:45 +01:00
2012-09-25 15:41:58 +02:00
App :: uses ( 'Dispatcher' , 'Routing' );
2012-03-15 15:06:45 +01:00
2012-09-25 15:41:58 +02:00
$Dispatcher = new Dispatcher ();
$Dispatcher -> dispatch ( new CakeRequest (), new CakeResponse ( array ( 'charset' => Configure :: read ( 'App.encoding' ))));