| 16591 |
anikendra |
1 |
<?php
|
|
|
2 |
/**
|
|
|
3 |
* Index
|
|
|
4 |
*
|
|
|
5 |
* The Front Controller for handling every request
|
|
|
6 |
*
|
|
|
7 |
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
|
|
8 |
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
|
|
9 |
*
|
|
|
10 |
* Licensed under The MIT License
|
|
|
11 |
* For full copyright and license information, please see the LICENSE.txt
|
|
|
12 |
* Redistributions of files must retain the above copyright notice.
|
|
|
13 |
*
|
|
|
14 |
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
|
|
15 |
* @link http://cakephp.org CakePHP(tm) Project
|
|
|
16 |
* @package app.webroot
|
|
|
17 |
* @since CakePHP(tm) v 0.2.9
|
|
|
18 |
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
|
|
19 |
*/
|
|
|
20 |
|
|
|
21 |
/**
|
|
|
22 |
* Use the DS to separate the directories in other defines
|
|
|
23 |
*/
|
|
|
24 |
if (!defined('DS')) {
|
|
|
25 |
define('DS', DIRECTORY_SEPARATOR);
|
|
|
26 |
}
|
|
|
27 |
|
|
|
28 |
/**
|
|
|
29 |
* These defines should only be edited if you have CakePHP installed in
|
|
|
30 |
* a directory layout other than the way it is distributed.
|
|
|
31 |
* When using custom settings be sure to use the DS and do not add a trailing DS.
|
|
|
32 |
*/
|
|
|
33 |
|
|
|
34 |
/**
|
|
|
35 |
* The full path to the directory which holds "app", WITHOUT a trailing DS.
|
|
|
36 |
*
|
|
|
37 |
*/
|
|
|
38 |
if (!defined('ROOT')) {
|
|
|
39 |
define('ROOT', dirname(dirname(dirname(__FILE__))));
|
|
|
40 |
}
|
|
|
41 |
|
|
|
42 |
/**
|
|
|
43 |
* The actual directory name for the "app".
|
|
|
44 |
*
|
|
|
45 |
*/
|
|
|
46 |
if (!defined('APP_DIR')) {
|
|
|
47 |
define('APP_DIR', basename(dirname(dirname(__FILE__))));
|
|
|
48 |
}
|
|
|
49 |
|
|
|
50 |
/**
|
|
|
51 |
* The absolute path to the "cake" directory, WITHOUT a trailing DS.
|
|
|
52 |
*
|
|
|
53 |
* Un-comment this line to specify a fixed path to CakePHP.
|
|
|
54 |
* This should point at the directory containing `Cake`.
|
|
|
55 |
*
|
|
|
56 |
* For ease of development CakePHP uses PHP's include_path. If you
|
|
|
57 |
* cannot modify your include_path set this value.
|
|
|
58 |
*
|
|
|
59 |
* Leaving this constant undefined will result in it being defined in Cake/bootstrap.php
|
|
|
60 |
*
|
|
|
61 |
* The following line differs from its sibling
|
|
|
62 |
* /lib/Cake/Console/Templates/skel/webroot/index.php
|
|
|
63 |
*/
|
|
|
64 |
//define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'lib');
|
|
|
65 |
|
|
|
66 |
/**
|
|
|
67 |
* This auto-detects CakePHP as a composer installed library.
|
|
|
68 |
* You may remove this if you are not planning to use composer (not recommended, though).
|
|
|
69 |
*/
|
|
|
70 |
$vendorPath = ROOT . DS . APP_DIR . DS . 'Vendor' . DS . 'cakephp' . DS . 'cakephp' . DS . 'lib';
|
|
|
71 |
$dispatcher = 'Cake' . DS . 'Console' . DS . 'ShellDispatcher.php';
|
|
|
72 |
if (!defined('CAKE_CORE_INCLUDE_PATH') && file_exists($vendorPath . DS . $dispatcher)) {
|
|
|
73 |
define('CAKE_CORE_INCLUDE_PATH', $vendorPath);
|
|
|
74 |
}
|
|
|
75 |
|
|
|
76 |
/**
|
|
|
77 |
* Editing below this line should NOT be necessary.
|
|
|
78 |
* Change at your own risk.
|
|
|
79 |
*
|
|
|
80 |
*/
|
|
|
81 |
if (!defined('WEBROOT_DIR')) {
|
|
|
82 |
define('WEBROOT_DIR', basename(dirname(__FILE__)));
|
|
|
83 |
}
|
|
|
84 |
if (!defined('WWW_ROOT')) {
|
|
|
85 |
define('WWW_ROOT', dirname(__FILE__) . DS);
|
|
|
86 |
}
|
|
|
87 |
|
|
|
88 |
// for built-in server
|
|
|
89 |
if (php_sapi_name() === 'cli-server') {
|
|
|
90 |
if ($_SERVER['REQUEST_URI'] !== '/' && file_exists(WWW_ROOT . $_SERVER['PHP_SELF'])) {
|
|
|
91 |
return false;
|
|
|
92 |
}
|
|
|
93 |
$_SERVER['PHP_SELF'] = '/' . basename(__FILE__);
|
|
|
94 |
}
|
|
|
95 |
|
|
|
96 |
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
|
|
|
97 |
if (function_exists('ini_set')) {
|
|
|
98 |
ini_set('include_path', ROOT . DS . 'lib' . PATH_SEPARATOR . ini_get('include_path'));
|
|
|
99 |
}
|
|
|
100 |
if (!include 'Cake' . DS . 'bootstrap.php') {
|
|
|
101 |
$failed = true;
|
|
|
102 |
}
|
|
|
103 |
} else {
|
|
|
104 |
if (!include CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'bootstrap.php') {
|
|
|
105 |
$failed = true;
|
|
|
106 |
}
|
|
|
107 |
}
|
|
|
108 |
if (!empty($failed)) {
|
|
|
109 |
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);
|
|
|
110 |
}
|
|
|
111 |
|
|
|
112 |
App::uses('Dispatcher', 'Routing');
|
|
|
113 |
|
|
|
114 |
$Dispatcher = new Dispatcher();
|
|
|
115 |
$Dispatcher->dispatch(
|
|
|
116 |
new CakeRequest(),
|
|
|
117 |
new CakeResponse()
|
|
|
118 |
);
|