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