Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 274 lines (241 sloc) 8.759 kb
2067d1a Changing EOL style to LF
Derek Allard authored
1 <?php
f4a4bd8 @derekjones adding new license file (OSL 3.0) and updating readme to ReST
derekjones authored
2 /**
3 * CodeIgniter
4 *
07c1ac8 @philsturgeon Bumped CodeIgniter's PHP requirement to 5.2.4.
philsturgeon authored
5 * An open source application development framework for PHP 5.2.4 or newer
f4a4bd8 @derekjones adding new license file (OSL 3.0) and updating readme to ReST
derekjones authored
6 *
7 * NOTICE OF LICENSE
282592c @narfbg Clear some spaces from index.php
narfbg authored
8 *
f4a4bd8 @derekjones adding new license file (OSL 3.0) and updating readme to ReST
derekjones authored
9 * Licensed under the Open Software License version 3.0
282592c @narfbg Clear some spaces from index.php
narfbg authored
10 *
f4a4bd8 @derekjones adding new license file (OSL 3.0) and updating readme to ReST
derekjones authored
11 * This source file is subject to the Open Software License (OSL 3.0) that is
12 * bundled with this package in the files license.txt / license.rst. It is
13 * also available through the world wide web at this URL:
14 * http://opensource.org/licenses/OSL-3.0
15 * If you did not receive a copy of the license and are unable to obtain it
16 * through the world wide web, please send an email to
17 * licensing@ellislab.com so we can send you a copy immediately.
18 *
19 * @package CodeIgniter
20 * @author EllisLab Dev Team
0defe5d @gaker Updating copyright date to 2012
gaker authored
21 * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
f4a4bd8 @derekjones adding new license file (OSL 3.0) and updating readme to ReST
derekjones authored
22 * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
23 * @link http://codeigniter.com
24 * @since Version 1.0
25 * @filesource
26 */
0c1e405 @derekjones updating index.php file
derekjones authored
27
2067d1a Changing EOL style to LF
Derek Allard authored
28 /*
0c1e405 @derekjones updating index.php file
derekjones authored
29 *---------------------------------------------------------------
cee8075 @joelcox Split basic configuration in three environments, providing fallback to g...
joelcox authored
30 * APPLICATION ENVIRONMENT
31 *---------------------------------------------------------------
32 *
33 * You can load different configurations depending on your
bf2b912 @joelcox Removed default error_reporting and set it depending on environment
joelcox authored
34 * current environment. Setting the environment also influences
d88b315 @philsturgeon Merged recent changes and tweaked multi-env changes.
philsturgeon authored
35 * things like logging and error reporting.
0c1e405 @derekjones updating index.php file
derekjones authored
36 *
d88b315 @philsturgeon Merged recent changes and tweaked multi-env changes.
philsturgeon authored
37 * This can be set to anything, but default usage is:
38 *
4b9c629 @derekjones backed out 648b42a75739, which was a NON-trivial whitespace commit. It ...
derekjones authored
39 * development
40 * testing
41 * production
d88b315 @philsturgeon Merged recent changes and tweaked multi-env changes.
philsturgeon authored
42 *
43 * NOTE: If you change these, also change the error_reporting() code below
cee8075 @joelcox Split basic configuration in three environments, providing fallback to g...
joelcox authored
44 */
dda21f6 @philsturgeon Added support for $_SERVER['CI_ENV'] in index.php
philsturgeon authored
45 define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development');
fe83249 @vlakoff Some adjustments in inline documentation
vlakoff authored
46
d88b315 @philsturgeon Merged recent changes and tweaked multi-env changes.
philsturgeon authored
47 /*
48 *---------------------------------------------------------------
49 * ERROR REPORTING
50 *---------------------------------------------------------------
51 *
52 * Different environments will require different levels of error reporting.
53 * By default development will show errors but testing and live will hide them.
0c1e405 @derekjones updating index.php file
derekjones authored
54 */
35ac46d Changed instead of turning off of the error messaging to hide them
Root authored
55 switch (ENVIRONMENT)
05fa611 @philsturgeon Made Environment Support optional. Comment out or delete the constant to...
philsturgeon authored
56 {
35ac46d Changed instead of turning off of the error messaging to hide them
Root authored
57 case 'development':
8d021e6 @gintsmurans E_ALL -> -1
gintsmurans authored
58 error_reporting(-1);
35ac46d Changed instead of turning off of the error messaging to hide them
Root authored
59 ini_set('display_errors', 1);
60 break;
61
62 case 'testing':
63 case 'production':
3cc8502 Changed to show all the errors on dev
Root authored
64 error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_STRICT);
35ac46d Changed instead of turning off of the error messaging to hide them
Root authored
65 ini_set('display_errors', 0);
66 break;
67
68 default:
cbb654d @narfbg Follow-up to #1398, #1548
narfbg authored
69 header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
35ac46d Changed instead of turning off of the error messaging to hide them
Root authored
70 exit('The application environment is not set correctly.');
05fa611 @philsturgeon Made Environment Support optional. Comment out or delete the constant to...
philsturgeon authored
71 }
cee8075 @joelcox Split basic configuration in three environments, providing fallback to g...
joelcox authored
72
73 /*
74 *---------------------------------------------------------------
0c1e405 @derekjones updating index.php file
derekjones authored
75 * SYSTEM FOLDER NAME
76 *---------------------------------------------------------------
77 *
78 * This variable must contain the name of your "system" folder.
4b9c629 @derekjones backed out 648b42a75739, which was a NON-trivial whitespace commit. It ...
derekjones authored
79 * Include the path if the folder is not in the same directory
0c1e405 @derekjones updating index.php file
derekjones authored
80 * as this file.
81 */
d88b315 @philsturgeon Merged recent changes and tweaked multi-env changes.
philsturgeon authored
82 $system_path = 'system';
2067d1a Changing EOL style to LF
Derek Allard authored
83
84 /*
0c1e405 @derekjones updating index.php file
derekjones authored
85 *---------------------------------------------------------------
86 * APPLICATION FOLDER NAME
87 *---------------------------------------------------------------
88 *
89 * If you want this front controller to use a different "application"
dd67197 @barrymieny Cleanup of stray spaces and tabs
barrymieny authored
90 * folder then the default one you can set its name here. The folder
282592c @narfbg Clear some spaces from index.php
narfbg authored
91 * can also be renamed or relocated anywhere on your server. If
0c1e405 @derekjones updating index.php file
derekjones authored
92 * you do, use a full server path. For more info please see the user guide:
93 * http://codeigniter.com/user_guide/general/managing_apps.html
94 *
95 * NO TRAILING SLASH!
96 */
d88b315 @philsturgeon Merged recent changes and tweaked multi-env changes.
philsturgeon authored
97 $application_folder = 'application';
282592c @narfbg Clear some spaces from index.php
narfbg authored
98
8eef9c7 Ability to move the view folder out of the Application directory
Joe Cianflone authored
99 /*
100 *---------------------------------------------------------------
101 * VIEW FOLDER NAME
102 *---------------------------------------------------------------
282592c @narfbg Clear some spaces from index.php
narfbg authored
103 *
104 * If you want to move the view folder out of the application
8eef9c7 Ability to move the view folder out of the Application directory
Joe Cianflone authored
105 * folder set the path to the folder here. The folder can be renamed
282592c @narfbg Clear some spaces from index.php
narfbg authored
106 * and relocated anywhere on your server. If blank, it will default
107 * to the standard location inside your application folder. If you
108 * do move this, use the full server path to this folder.
8eef9c7 Ability to move the view folder out of the Application directory
Joe Cianflone authored
109 *
110 * NO TRAILING SLASH!
111 */
282592c @narfbg Clear some spaces from index.php
narfbg authored
112 $view_folder = '';
8eef9c7 Ability to move the view folder out of the Application directory
Joe Cianflone authored
113
2067d1a Changing EOL style to LF
Derek Allard authored
114
115 /*
0c1e405 @derekjones updating index.php file
derekjones authored
116 * --------------------------------------------------------------------
117 * DEFAULT CONTROLLER
118 * --------------------------------------------------------------------
119 *
120 * Normally you will set your default controller in the routes.php file.
dd67197 @barrymieny Cleanup of stray spaces and tabs
barrymieny authored
121 * You can, however, force a custom routing by hard-coding a
282592c @narfbg Clear some spaces from index.php
narfbg authored
122 * specific controller class/function here. For most applications, you
dd67197 @barrymieny Cleanup of stray spaces and tabs
barrymieny authored
123 * WILL NOT set your routing here, but it's an option for those
0c1e405 @derekjones updating index.php file
derekjones authored
124 * special instances where you might want to override the standard
125 * routing in a specific front controller that shares a common CI installation.
126 *
282592c @narfbg Clear some spaces from index.php
narfbg authored
127 * IMPORTANT: If you set the routing here, NO OTHER controller will be
0c1e405 @derekjones updating index.php file
derekjones authored
128 * callable. In essence, this preference limits your application to ONE
282592c @narfbg Clear some spaces from index.php
narfbg authored
129 * specific controller. Leave the function name blank if you need
0c1e405 @derekjones updating index.php file
derekjones authored
130 * to call functions dynamically via the URI.
131 *
132 * Un-comment the $routing array below to use this feature
133 */
4b9c629 @derekjones backed out 648b42a75739, which was a NON-trivial whitespace commit. It ...
derekjones authored
134 // The directory name, relative to the "controllers" folder. Leave blank
dd67197 @barrymieny Cleanup of stray spaces and tabs
barrymieny authored
135 // if your controller is not in a sub-folder within the "controllers" folder
0c1e405 @derekjones updating index.php file
derekjones authored
136 // $routing['directory'] = '';
dd67197 @barrymieny Cleanup of stray spaces and tabs
barrymieny authored
137
e40e56f @vlakoff Fix in index.php inline documentation
vlakoff authored
138 // The controller class file name. Example: mycontroller
0c1e405 @derekjones updating index.php file
derekjones authored
139 // $routing['controller'] = '';
dd67197 @barrymieny Cleanup of stray spaces and tabs
barrymieny authored
140
141 // The controller function you wish to be called.
0c1e405 @derekjones updating index.php file
derekjones authored
142 // $routing['function'] = '';
2067d1a Changing EOL style to LF
Derek Allard authored
143
144
145 /*
0c1e405 @derekjones updating index.php file
derekjones authored
146 * -------------------------------------------------------------------
4b9c629 @derekjones backed out 648b42a75739, which was a NON-trivial whitespace commit. It ...
derekjones authored
147 * CUSTOM CONFIG VALUES
0c1e405 @derekjones updating index.php file
derekjones authored
148 * -------------------------------------------------------------------
149 *
150 * The $assign_to_config array below will be passed dynamically to the
dd67197 @barrymieny Cleanup of stray spaces and tabs
barrymieny authored
151 * config class when initialized. This allows you to set custom config
152 * items or override any default config values found in the config.php file.
0c1e405 @derekjones updating index.php file
derekjones authored
153 * This can be handy as it permits you to share one application between
dd67197 @barrymieny Cleanup of stray spaces and tabs
barrymieny authored
154 * multiple front controller files, with each file containing different
0c1e405 @derekjones updating index.php file
derekjones authored
155 * config values.
156 *
157 * Un-comment the $assign_to_config array below to use this feature
158 */
159 // $assign_to_config['name_of_config_item'] = 'value of config item';
160
161
162
163 // --------------------------------------------------------------------
4b9c629 @derekjones backed out 648b42a75739, which was a NON-trivial whitespace commit. It ...
derekjones authored
164 // END OF USER CONFIGURABLE SETTINGS. DO NOT EDIT BELOW THIS LINE
0c1e405 @derekjones updating index.php file
derekjones authored
165 // --------------------------------------------------------------------
166
bf2b912 @joelcox Removed default error_reporting and set it depending on environment
joelcox authored
167 /*
168 * ---------------------------------------------------------------
4b9c629 @derekjones backed out 648b42a75739, which was a NON-trivial whitespace commit. It ...
derekjones authored
169 * Resolve the system path for increased reliability
0c1e405 @derekjones updating index.php file
derekjones authored
170 * ---------------------------------------------------------------
171 */
01d1a5b @philsturgeon CLI requests can now be run from any folder, not just when CD'ed next to...
philsturgeon authored
172
173 // Set the current directory correctly for CLI requests
174 if (defined('STDIN'))
175 {
176 chdir(dirname(__FILE__));
177 }
178
806ca60 @narfbg Some more index.php improvements
narfbg authored
179 if (($_temp = realpath($system_path)) !== FALSE)
2067d1a Changing EOL style to LF
Derek Allard authored
180 {
806ca60 @narfbg Some more index.php improvements
narfbg authored
181 $system_path = $_temp.'/';
2067d1a Changing EOL style to LF
Derek Allard authored
182 }
079fbfc @narfbg Changed APPPATH, BASEPATH and VIEWPATH to be absolute paths (fixes issue...
narfbg authored
183 else
184 {
185 // Ensure there's a trailing slash
186 $system_path = rtrim($system_path, '/').'/';
187 }
2067d1a Changing EOL style to LF
Derek Allard authored
188
eba3508 @derekjones fixed spelling in code comment
derekjones authored
189 // Is the system path correct?
0c1e405 @derekjones updating index.php file
derekjones authored
190 if ( ! is_dir($system_path))
191 {
806ca60 @narfbg Some more index.php improvements
narfbg authored
192 header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
282592c @narfbg Clear some spaces from index.php
narfbg authored
193 exit('Your system folder path does not appear to be set correctly. Please open the following file and correct this: '.pathinfo(__FILE__, PATHINFO_BASENAME));
0c1e405 @derekjones updating index.php file
derekjones authored
194 }
2067d1a Changing EOL style to LF
Derek Allard authored
195
196 /*
0c1e405 @derekjones updating index.php file
derekjones authored
197 * -------------------------------------------------------------------
4b9c629 @derekjones backed out 648b42a75739, which was a NON-trivial whitespace commit. It ...
derekjones authored
198 * Now that we know the path, set the main path constants
0c1e405 @derekjones updating index.php file
derekjones authored
199 * -------------------------------------------------------------------
dd67197 @barrymieny Cleanup of stray spaces and tabs
barrymieny authored
200 */
0c1e405 @derekjones updating index.php file
derekjones authored
201 // The name of THIS file
202 define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
203
dd67197 @barrymieny Cleanup of stray spaces and tabs
barrymieny authored
204 // Path to the system folder
282592c @narfbg Clear some spaces from index.php
narfbg authored
205 define('BASEPATH', str_replace('\\', '/', $system_path));
dd67197 @barrymieny Cleanup of stray spaces and tabs
barrymieny authored
206
0c1e405 @derekjones updating index.php file
derekjones authored
207 // Path to the front controller (this file)
208 define('FCPATH', str_replace(SELF, '', __FILE__));
dd67197 @barrymieny Cleanup of stray spaces and tabs
barrymieny authored
209
0c1e405 @derekjones updating index.php file
derekjones authored
210 // Name of the "system folder"
dd67197 @barrymieny Cleanup of stray spaces and tabs
barrymieny authored
211 define('SYSDIR', trim(strrchr(trim(BASEPATH, '/'), '/'), '/'));
2067d1a Changing EOL style to LF
Derek Allard authored
212
0c1e405 @derekjones updating index.php file
derekjones authored
213 // The path to the "application" folder
214 if (is_dir($application_folder))
215 {
cce9180 @narfbg Fix APPPATH
narfbg authored
216 if (($_temp = realpath($application_folder)) !== FALSE)
079fbfc @narfbg Changed APPPATH, BASEPATH and VIEWPATH to be absolute paths (fixes issue...
narfbg authored
217 {
806ca60 @narfbg Some more index.php improvements
narfbg authored
218 $application_folder = $_temp;
079fbfc @narfbg Changed APPPATH, BASEPATH and VIEWPATH to be absolute paths (fixes issue...
narfbg authored
219 }
220
0c1e405 @derekjones updating index.php file
derekjones authored
221 define('APPPATH', $application_folder.'/');
222 }
223 else
dd67197 @barrymieny Cleanup of stray spaces and tabs
barrymieny authored
224 {
0c1e405 @derekjones updating index.php file
derekjones authored
225 if ( ! is_dir(BASEPATH.$application_folder.'/'))
226 {
806ca60 @narfbg Some more index.php improvements
narfbg authored
227 header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
282592c @narfbg Clear some spaces from index.php
narfbg authored
228 exit('Your application folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF);
0c1e405 @derekjones updating index.php file
derekjones authored
229 }
dd67197 @barrymieny Cleanup of stray spaces and tabs
barrymieny authored
230
0c1e405 @derekjones updating index.php file
derekjones authored
231 define('APPPATH', BASEPATH.$application_folder.'/');
232 }
282592c @narfbg Clear some spaces from index.php
narfbg authored
233
8eef9c7 Ability to move the view folder out of the Application directory
Joe Cianflone authored
234 // The path to the "views" folder
079fbfc @narfbg Changed APPPATH, BASEPATH and VIEWPATH to be absolute paths (fixes issue...
narfbg authored
235 if ( ! is_dir($view_folder))
8eef9c7 Ability to move the view folder out of the Application directory
Joe Cianflone authored
236 {
079fbfc @narfbg Changed APPPATH, BASEPATH and VIEWPATH to be absolute paths (fixes issue...
narfbg authored
237 if ( ! empty($view_folder) && is_dir(APPPATH.$view_folder.'/'))
238 {
239 $view_folder = APPPATH.$view_folder;
240 }
241 elseif ( ! is_dir(APPPATH.'views/'))
8eef9c7 Ability to move the view folder out of the Application directory
Joe Cianflone authored
242 {
806ca60 @narfbg Some more index.php improvements
narfbg authored
243 header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
282592c @narfbg Clear some spaces from index.php
narfbg authored
244 exit('Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF);
8eef9c7 Ability to move the view folder out of the Application directory
Joe Cianflone authored
245 }
079fbfc @narfbg Changed APPPATH, BASEPATH and VIEWPATH to be absolute paths (fixes issue...
narfbg authored
246 else
247 {
248 $view_folder = APPPATH.'views';
249 }
250 }
282592c @narfbg Clear some spaces from index.php
narfbg authored
251
806ca60 @narfbg Some more index.php improvements
narfbg authored
252 if (($_temp = realpath($view_folder)) !== FALSE)
079fbfc @narfbg Changed APPPATH, BASEPATH and VIEWPATH to be absolute paths (fixes issue...
narfbg authored
253 {
254 $view_folder = realpath($view_folder).'/';
8eef9c7 Ability to move the view folder out of the Application directory
Joe Cianflone authored
255 }
079fbfc @narfbg Changed APPPATH, BASEPATH and VIEWPATH to be absolute paths (fixes issue...
narfbg authored
256 else
257 {
258 $view_folder = rtrim($view_folder, '/').'/';
259 }
260
cce9180 @narfbg Fix APPPATH
narfbg authored
261 define('VIEWPATH', $view_folder);
0c1e405 @derekjones updating index.php file
derekjones authored
262
263 /*
264 * --------------------------------------------------------------------
265 * LOAD THE BOOTSTRAP FILE
266 * --------------------------------------------------------------------
267 *
268 * And away we go...
269 */
3a74665 @gaker Removing internal references to the EXT constant. Additionally, marked ...
gaker authored
270 require_once BASEPATH.'core/CodeIgniter.php';
0c1e405 @derekjones updating index.php file
derekjones authored
271
2067d1a Changing EOL style to LF
Derek Allard authored
272 /* End of file index.php */
282592c @narfbg Clear some spaces from index.php
narfbg authored
273 /* Location: ./index.php */
Something went wrong with that request. Please try again.