|
32 | 32 | * Define the CodeIgniter Version |
33 | 33 | * ------------------------------------------------------ |
34 | 34 | */ |
35 | | - define('CI_VERSION', '2.0'); |
| 35 | + define('CI_VERSION', '2.0.3'); |
| 36 | + |
| 37 | +/* |
| 38 | + * ------------------------------------------------------ |
| 39 | + * Define the CodeIgniter Branch (Core = TRUE, Reactor = FALSE) |
| 40 | + * ------------------------------------------------------ |
| 41 | + */ |
| 42 | + define('CI_CORE', FALSE); |
36 | 43 |
|
37 | 44 | /* |
38 | 45 | * ------------------------------------------------------ |
39 | 46 | * Load the global functions |
40 | 47 | * ------------------------------------------------------ |
41 | 48 | */ |
42 | | - require(BASEPATH.'core/Common'.EXT); |
| 49 | + require(BASEPATH.'core/Common.php'); |
43 | 50 |
|
44 | 51 | /* |
45 | 52 | * ------------------------------------------------------ |
46 | 53 | * Load the framework constants |
47 | 54 | * ------------------------------------------------------ |
48 | 55 | */ |
49 | | - require(APPPATH.'config/constants'.EXT); |
| 56 | + if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/constants.php')) |
| 57 | + { |
| 58 | + require(APPPATH.'config/'.ENVIRONMENT.'/constants.php'); |
| 59 | + } |
| 60 | + else |
| 61 | + { |
| 62 | + require(APPPATH.'config/constants.php'); |
| 63 | + } |
50 | 64 |
|
51 | 65 | /* |
52 | 66 | * ------------------------------------------------------ |
|
80 | 94 | { |
81 | 95 | get_config(array('subclass_prefix' => $assign_to_config['subclass_prefix'])); |
82 | 96 | } |
83 | | - |
| 97 | + |
84 | 98 | /* |
85 | 99 | * ------------------------------------------------------ |
86 | 100 | * Set a liberal script execution time limit |
|
182 | 196 | } |
183 | 197 | } |
184 | 198 |
|
| 199 | +/* |
| 200 | + * ----------------------------------------------------- |
| 201 | + * Load the security class for xss and csrf support |
| 202 | + * ----------------------------------------------------- |
| 203 | + */ |
| 204 | + $SEC =& load_class('Security', 'core'); |
| 205 | + |
185 | 206 | /* |
186 | 207 | * ------------------------------------------------------ |
187 | 208 | * Load the Input class and sanitize globals |
|
203 | 224 | * |
204 | 225 | */ |
205 | 226 | // Load the base controller class |
206 | | - require BASEPATH.'core/Controller'.EXT; |
| 227 | + require BASEPATH.'core/Controller.php'; |
207 | 228 |
|
208 | 229 | function &get_instance() |
209 | 230 | { |
210 | 231 | return CI_Controller::get_instance(); |
211 | 232 | } |
212 | 233 |
|
213 | 234 |
|
214 | | - if (file_exists(APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller'.EXT)) |
| 235 | + if (file_exists(APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller.php')) |
215 | 236 | { |
216 | | - require APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller'.EXT; |
| 237 | + require APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller.php'; |
217 | 238 | } |
218 | 239 |
|
219 | 240 | // Load the local application controller |
220 | 241 | // Note: The Router class automatically validates the controller path using the router->_validate_request(). |
221 | 242 | // If this include fails it means that the default controller in the Routes.php file is not resolving to something valid. |
222 | | - if ( ! file_exists(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().EXT)) |
| 243 | + if ( ! file_exists(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php')) |
223 | 244 | { |
224 | 245 | show_error('Unable to load your default controller. Please make sure the controller specified in your Routes.php file is valid.'); |
225 | 246 | } |
226 | 247 |
|
227 | | - include(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().EXT); |
| 248 | + include(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php'); |
228 | 249 |
|
229 | 250 | // Set a mark point for benchmarking |
230 | 251 | $BM->mark('loading_time:_base_classes_end'); |
@@ -289,7 +310,28 @@ function &get_instance() |
289 | 310 | // methods, so we'll use this workaround for consistent behavior |
290 | 311 | if ( ! in_array(strtolower($method), array_map('strtolower', get_class_methods($CI)))) |
291 | 312 | { |
292 | | - show_404("{$class}/{$method}"); |
| 313 | + // Check and see if we are using a 404 override and use it. |
| 314 | + if ( ! empty($RTR->routes['404_override'])) |
| 315 | + { |
| 316 | + $x = explode('/', $RTR->routes['404_override']); |
| 317 | + $class = $x[0]; |
| 318 | + $method = (isset($x[1]) ? $x[1] : 'index'); |
| 319 | + if ( ! class_exists($class)) |
| 320 | + { |
| 321 | + if ( ! file_exists(APPPATH.'controllers/'.$class.'.php')) |
| 322 | + { |
| 323 | + show_404("{$class}/{$method}"); |
| 324 | + } |
| 325 | + |
| 326 | + include_once(APPPATH.'controllers/'.$class.'.php'); |
| 327 | + unset($CI); |
| 328 | + $CI = new $class(); |
| 329 | + } |
| 330 | + } |
| 331 | + else |
| 332 | + { |
| 333 | + show_404("{$class}/{$method}"); |
| 334 | + } |
293 | 335 | } |
294 | 336 |
|
295 | 337 | // Call the requested method. |
|
0 commit comments