blob: 9714d095c9ec0c99d4bd3a1c1c332a72066dd746 [file] [log] [blame]
Andrey Andreev9c5c24a2012-01-07 18:51:21 +02001<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
Derek Allard2067d1a2008-11-13 22:59:24 +00002/**
3 * CodeIgniter
4 *
Phil Sturgeon07c1ac82012-03-09 17:03:37 +00005 * An open source application development framework for PHP 5.2.4 or newer
Derek Allard2067d1a2008-11-13 22:59:24 +00006 *
Derek Jonesf4a4bd82011-10-20 12:18:42 -05007 * NOTICE OF LICENSE
Andrey Andreev9c5c24a2012-01-07 18:51:21 +02008 *
Derek Jonesf4a4bd82011-10-20 12:18:42 -05009 * Licensed under the Open Software License version 3.0
Andrey Andreev9c5c24a2012-01-07 18:51:21 +020010 *
Derek Jonesf4a4bd82011-10-20 12:18:42 -050011 * 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 *
Derek Allard2067d1a2008-11-13 22:59:24 +000019 * @package CodeIgniter
Derek Jonesf4a4bd82011-10-20 12:18:42 -050020 * @author EllisLab Dev Team
Greg Aker0defe5d2012-01-01 18:46:41 -060021 * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
Derek Jonesf4a4bd82011-10-20 12:18:42 -050022 * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
Derek Allard2067d1a2008-11-13 22:59:24 +000023 * @link http://codeigniter.com
24 * @since Version 1.0
25 * @filesource
26 */
27
28// ------------------------------------------------------------------------
29
30/**
Derek Jones218876c2010-03-02 13:11:00 -060031 * System Initialization File
Derek Allard2067d1a2008-11-13 22:59:24 +000032 *
33 * Loads the base classes and executes the request.
34 *
35 * @package CodeIgniter
36 * @subpackage codeigniter
37 * @category Front-controller
Derek Jonesf4a4bd82011-10-20 12:18:42 -050038 * @author EllisLab Dev Team
Derek Allard2067d1a2008-11-13 22:59:24 +000039 * @link http://codeigniter.com/user_guide/
40 */
41
Phil Sturgeond8ef6302011-08-14 12:10:55 -060042/**
43 * CodeIgniter Version
44 *
45 * @var string
46 *
Derek Jones218876c2010-03-02 13:11:00 -060047 */
Derek Jonesf4a4bd82011-10-20 12:18:42 -050048 define('CI_VERSION', '3.0-dev');
Derek Allard2067d1a2008-11-13 22:59:24 +000049
Phil Sturgeonbabfb292011-03-08 21:56:08 +000050/*
51 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -050052 * Load the global functions
Derek Allard2067d1a2008-11-13 22:59:24 +000053 * ------------------------------------------------------
54 */
Greg Aker3a746652011-04-19 10:59:47 -050055 require(BASEPATH.'core/Common.php');
Derek Allard2067d1a2008-11-13 22:59:24 +000056
57/*
58 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -050059 * Load the framework constants
Derek Allard2067d1a2008-11-13 22:59:24 +000060 * ------------------------------------------------------
61 */
Andrey Andreev29ce5d92012-01-08 04:43:31 +020062 if (defined('ENVIRONMENT') && file_exists(APPPATH.'config/'.ENVIRONMENT.'/constants.php'))
Greg Akerd96f8822011-12-27 16:23:47 -060063 {
64 require(APPPATH.'config/'.ENVIRONMENT.'/constants.php');
65 }
66 else
67 {
68 require(APPPATH.'config/constants.php');
69 }
Derek Allard2067d1a2008-11-13 22:59:24 +000070
71/*
72 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -050073 * Define a custom error handler so we can log PHP errors
Derek Allard2067d1a2008-11-13 22:59:24 +000074 * ------------------------------------------------------
75 */
Derek Jones218876c2010-03-02 13:11:00 -060076 set_error_handler('_exception_handler');
Barry Mienydd671972010-10-04 16:33:58 +020077
Derek Jones218876c2010-03-02 13:11:00 -060078 if ( ! is_php('5.3'))
79 {
Barry Mienydd671972010-10-04 16:33:58 +020080 @set_magic_quotes_runtime(0); // Kill magic quotes
Derek Jones218876c2010-03-02 13:11:00 -060081 }
Derek Jones962d2252009-08-05 04:26:11 +000082
Derek Jones218876c2010-03-02 13:11:00 -060083/*
84 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -050085 * Set the subclass_prefix
Derek Jones218876c2010-03-02 13:11:00 -060086 * ------------------------------------------------------
87 *
Barry Mienydd671972010-10-04 16:33:58 +020088 * Normally the "subclass_prefix" is set in the config file.
89 * The subclass prefix allows CI to know if a core class is
Derek Jones218876c2010-03-02 13:11:00 -060090 * being extended via a library in the local application
Barry Mienydd671972010-10-04 16:33:58 +020091 * "libraries" folder. Since CI allows config items to be
92 * overriden via data set in the main index. php file,
93 * before proceeding we need to know if a subclass_prefix
Andrey Andreev9c5c24a2012-01-07 18:51:21 +020094 * override exists. If so, we will set this value now,
Derek Jones218876c2010-03-02 13:11:00 -060095 * before any classes are loaded
Barry Mienydd671972010-10-04 16:33:58 +020096 * Note: Since the config file data is cached it doesn't
Derek Jones218876c2010-03-02 13:11:00 -060097 * hurt to load it here.
98 */
Andrey Andreev29ce5d92012-01-08 04:43:31 +020099 if (isset($assign_to_config['subclass_prefix']) && $assign_to_config['subclass_prefix'] != '')
Derek Jones218876c2010-03-02 13:11:00 -0600100 {
101 get_config(array('subclass_prefix' => $assign_to_config['subclass_prefix']));
102 }
Eric Barnesc5bf6162011-01-30 21:17:11 -0500103
Pascal Krietef566af52010-11-09 13:03:26 -0500104/*
105 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500106 * Set a liberal script execution time limit
Pascal Krietef566af52010-11-09 13:03:26 -0500107 * ------------------------------------------------------
108 */
Andrey Andreev29ce5d92012-01-08 04:43:31 +0200109 if (function_exists('set_time_limit') && @ini_get('safe_mode') == 0
110 && php_sapi_name() !== 'cli') // Do not override the Time Limit value if running from Command Line
Pascal Krietef566af52010-11-09 13:03:26 -0500111 {
Andrey Andreev9c5c24a2012-01-07 18:51:21 +0200112 @set_time_limit(300);
Pascal Krietef566af52010-11-09 13:03:26 -0500113 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000114
115/*
116 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500117 * Start the timer... tick tock tick tock...
Derek Allard2067d1a2008-11-13 22:59:24 +0000118 * ------------------------------------------------------
119 */
Derek Jones218876c2010-03-02 13:11:00 -0600120 $BM =& load_class('Benchmark', 'core');
121 $BM->mark('total_execution_time_start');
122 $BM->mark('loading_time:_base_classes_start');
Derek Allard2067d1a2008-11-13 22:59:24 +0000123
124/*
125 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500126 * Instantiate the hooks class
Derek Allard2067d1a2008-11-13 22:59:24 +0000127 * ------------------------------------------------------
128 */
Derek Jones218876c2010-03-02 13:11:00 -0600129 $EXT =& load_class('Hooks', 'core');
Derek Allard2067d1a2008-11-13 22:59:24 +0000130
131/*
132 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500133 * Is there a "pre_system" hook?
Derek Allard2067d1a2008-11-13 22:59:24 +0000134 * ------------------------------------------------------
135 */
Andrey Andreeva5dd2972012-03-26 14:43:01 +0300136 $EXT->call_hook('pre_system');
Derek Allard2067d1a2008-11-13 22:59:24 +0000137
138/*
139 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500140 * Instantiate the config class
Derek Allard2067d1a2008-11-13 22:59:24 +0000141 * ------------------------------------------------------
Barry Mienydd671972010-10-04 16:33:58 +0200142 */
Derek Jones218876c2010-03-02 13:11:00 -0600143 $CFG =& load_class('Config', 'core');
144
145 // Do we have any manually set config items in the index.php file?
146 if (isset($assign_to_config))
Barry Mienydd671972010-10-04 16:33:58 +0200147 {
Derek Jones218876c2010-03-02 13:11:00 -0600148 $CFG->_assign_to_config($assign_to_config);
149 }
150
151/*
152 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500153 * Instantiate the UTF-8 class
Derek Jones218876c2010-03-02 13:11:00 -0600154 * ------------------------------------------------------
Barry Mienydd671972010-10-04 16:33:58 +0200155 *
Pascal Krieteaaec1e42011-01-20 00:01:21 -0500156 * Note: Order here is rather important as the UTF-8
Derek Jones218876c2010-03-02 13:11:00 -0600157 * class needs to be used very early on, but it cannot
Barry Mienydd671972010-10-04 16:33:58 +0200158 * properly determine if UTf-8 can be supported until
Derek Jones218876c2010-03-02 13:11:00 -0600159 * after the Config class is instantiated.
Barry Mienydd671972010-10-04 16:33:58 +0200160 *
Derek Allard2067d1a2008-11-13 22:59:24 +0000161 */
Pascal Krieteaaec1e42011-01-20 00:01:21 -0500162 $UNI =& load_class('Utf8', 'core');
Barry Mienydd671972010-10-04 16:33:58 +0200163
Derek Jones218876c2010-03-02 13:11:00 -0600164/*
165 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500166 * Instantiate the URI class
Derek Jones218876c2010-03-02 13:11:00 -0600167 * ------------------------------------------------------
168 */
169 $URI =& load_class('URI', 'core');
170
171/*
172 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500173 * Instantiate the routing class and set the routing
Derek Jones218876c2010-03-02 13:11:00 -0600174 * ------------------------------------------------------
Barry Mienydd671972010-10-04 16:33:58 +0200175 */
Derek Jones218876c2010-03-02 13:11:00 -0600176 $RTR =& load_class('Router', 'core');
177 $RTR->_set_routing();
Barry Mienydd671972010-10-04 16:33:58 +0200178
Derek Jones218876c2010-03-02 13:11:00 -0600179 // Set any routing overrides that may exist in the main index file
180 if (isset($routing))
181 {
182 $RTR->_set_overrides($routing);
183 }
184
185/*
186 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500187 * Instantiate the output class
Derek Jones218876c2010-03-02 13:11:00 -0600188 * ------------------------------------------------------
189 */
190 $OUT =& load_class('Output', 'core');
Derek Allard2067d1a2008-11-13 22:59:24 +0000191
192/*
193 * ------------------------------------------------------
Andrey Andreev9c5c24a2012-01-07 18:51:21 +0200194 * Is there a valid cache file? If so, we're done...
Derek Allard2067d1a2008-11-13 22:59:24 +0000195 * ------------------------------------------------------
196 */
Andrey Andreeva5dd2972012-03-26 14:43:01 +0300197 if ($EXT->call_hook('cache_override') === FALSE
Andrey Andreev29ce5d92012-01-08 04:43:31 +0200198 && $OUT->_display_cache($CFG, $URI) == TRUE)
Derek Allard2067d1a2008-11-13 22:59:24 +0000199 {
Andrey Andreev9c5c24a2012-01-07 18:51:21 +0200200 exit;
Derek Allard2067d1a2008-11-13 22:59:24 +0000201 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000202
203/*
Pascal Kriete14a0ac62011-04-05 14:55:56 -0400204 * -----------------------------------------------------
205 * Load the security class for xss and csrf support
206 * -----------------------------------------------------
207 */
208 $SEC =& load_class('Security', 'core');
209
210/*
Derek Allard2067d1a2008-11-13 22:59:24 +0000211 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500212 * Load the Input class and sanitize globals
Derek Allard2067d1a2008-11-13 22:59:24 +0000213 * ------------------------------------------------------
214 */
Barry Mienydd671972010-10-04 16:33:58 +0200215 $IN =& load_class('Input', 'core');
Derek Allard2067d1a2008-11-13 22:59:24 +0000216
Derek Jones218876c2010-03-02 13:11:00 -0600217/*
218 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500219 * Load the Language class
Derek Jones218876c2010-03-02 13:11:00 -0600220 * ------------------------------------------------------
221 */
222 $LANG =& load_class('Lang', 'core');
Derek Allard2067d1a2008-11-13 22:59:24 +0000223
224/*
225 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500226 * Load the app controller and local controller
Derek Allard2067d1a2008-11-13 22:59:24 +0000227 * ------------------------------------------------------
228 *
Derek Allard2067d1a2008-11-13 22:59:24 +0000229 */
Derek Jones218876c2010-03-02 13:11:00 -0600230 // Load the base controller class
Greg Aker3a746652011-04-19 10:59:47 -0500231 require BASEPATH.'core/Controller.php';
Barry Mienydd671972010-10-04 16:33:58 +0200232
Timothy Warrenad475052012-04-19 13:21:06 -0400233 /**
234 * Reference to the CI_Controller method.
235 *
236 * Returns current CI instance object
237 *
238 * @return object
239 */
Greg Aker4abfa682010-11-10 14:44:26 -0600240 function &get_instance()
241 {
242 return CI_Controller::get_instance();
243 }
244
245
Greg Aker3a746652011-04-19 10:59:47 -0500246 if (file_exists(APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller.php'))
Greg Akerfa281352010-03-22 14:41:27 -0500247 {
Greg Aker3a746652011-04-19 10:59:47 -0500248 require APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller.php';
Greg Akerfa281352010-03-22 14:41:27 -0500249 }
Barry Mienydd671972010-10-04 16:33:58 +0200250
Derek Jones218876c2010-03-02 13:11:00 -0600251 // Load the local application controller
Barry Mienydd671972010-10-04 16:33:58 +0200252 // Note: The Router class automatically validates the controller path using the router->_validate_request().
Derek Jones218876c2010-03-02 13:11:00 -0600253 // If this include fails it means that the default controller in the Routes.php file is not resolving to something valid.
Greg Aker3a746652011-04-19 10:59:47 -0500254 if ( ! file_exists(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php'))
Derek Jones218876c2010-03-02 13:11:00 -0600255 {
Pascal Krieteebb6f4b2010-11-10 17:09:21 -0500256 show_error('Unable to load your default controller. Please make sure the controller specified in your Routes.php file is valid.');
Derek Jones218876c2010-03-02 13:11:00 -0600257 }
Barry Mienydd671972010-10-04 16:33:58 +0200258
Greg Aker3a746652011-04-19 10:59:47 -0500259 include(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php');
Barry Mienydd671972010-10-04 16:33:58 +0200260
Derek Jones218876c2010-03-02 13:11:00 -0600261 // Set a mark point for benchmarking
262 $BM->mark('loading_time:_base_classes_end');
Derek Allard2067d1a2008-11-13 22:59:24 +0000263
264/*
265 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500266 * Security check
Derek Allard2067d1a2008-11-13 22:59:24 +0000267 * ------------------------------------------------------
268 *
Derek Jones37f4b9c2011-07-01 17:56:50 -0500269 * None of the functions in the app controller or the
270 * loader class can be called via the URI, nor can
271 * controller functions that begin with an underscore
Derek Allard2067d1a2008-11-13 22:59:24 +0000272 */
Derek Jones37f4b9c2011-07-01 17:56:50 -0500273 $class = $RTR->fetch_class();
Derek Jones218876c2010-03-02 13:11:00 -0600274 $method = $RTR->fetch_method();
Barry Mienydd671972010-10-04 16:33:58 +0200275
Derek Jones218876c2010-03-02 13:11:00 -0600276 if ( ! class_exists($class)
Andrey Andreev176b3632012-01-10 18:14:28 +0200277 OR strpos($method, '_') === 0
Greg Aker63277b82010-11-09 13:46:13 -0600278 OR in_array(strtolower($method), array_map('strtolower', get_class_methods('CI_Controller')))
Derek Jones218876c2010-03-02 13:11:00 -0600279 )
280 {
Shane Pearson664a9352011-08-10 16:02:32 -0500281 if ( ! empty($RTR->routes['404_override']))
282 {
Andrey Andreev9c5c24a2012-01-07 18:51:21 +0200283 $x = explode('/', $RTR->routes['404_override'], 2);
Shane Pearson664a9352011-08-10 16:02:32 -0500284 $class = $x[0];
285 $method = (isset($x[1]) ? $x[1] : 'index');
286 if ( ! class_exists($class))
287 {
288 if ( ! file_exists(APPPATH.'controllers/'.$class.'.php'))
289 {
290 show_404("{$class}/{$method}");
291 }
292
293 include_once(APPPATH.'controllers/'.$class.'.php');
294 }
295 }
296 else
297 {
298 show_404("{$class}/{$method}");
299 }
Derek Jones218876c2010-03-02 13:11:00 -0600300 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000301
302/*
303 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500304 * Is there a "pre_controller" hook?
Derek Allard2067d1a2008-11-13 22:59:24 +0000305 * ------------------------------------------------------
306 */
Andrey Andreeva5dd2972012-03-26 14:43:01 +0300307 $EXT->call_hook('pre_controller');
Derek Allard2067d1a2008-11-13 22:59:24 +0000308
309/*
310 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500311 * Instantiate the requested controller
Derek Allard2067d1a2008-11-13 22:59:24 +0000312 * ------------------------------------------------------
313 */
Derek Jones218876c2010-03-02 13:11:00 -0600314 // Mark a start point so we can benchmark the controller
315 $BM->mark('controller_execution_time_( '.$class.' / '.$method.' )_start');
Barry Mienydd671972010-10-04 16:33:58 +0200316
Derek Jones218876c2010-03-02 13:11:00 -0600317 $CI = new $class();
318
319/*
320 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500321 * Is there a "post_controller_constructor" hook?
Derek Jones218876c2010-03-02 13:11:00 -0600322 * ------------------------------------------------------
323 */
Andrey Andreeva5dd2972012-03-26 14:43:01 +0300324 $EXT->call_hook('post_controller_constructor');
Derek Jones218876c2010-03-02 13:11:00 -0600325
326/*
327 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500328 * Call the requested method
Derek Jones218876c2010-03-02 13:11:00 -0600329 * ------------------------------------------------------
330 */
331 // Is there a "remap" function? If so, we call it instead
Derek Allard2067d1a2008-11-13 22:59:24 +0000332 if (method_exists($CI, '_remap'))
333 {
Pascal Kriete3431ae32010-11-09 15:19:50 -0500334 $CI->_remap($method, array_slice($URI->rsegments, 2));
Derek Allard2067d1a2008-11-13 22:59:24 +0000335 }
336 else
337 {
338 // is_callable() returns TRUE on some versions of PHP 5 for private and protected
339 // methods, so we'll use this workaround for consistent behavior
340 if ( ! in_array(strtolower($method), array_map('strtolower', get_class_methods($CI))))
341 {
Eric Barnesc5bf6162011-01-30 21:17:11 -0500342 // Check and see if we are using a 404 override and use it.
343 if ( ! empty($RTR->routes['404_override']))
344 {
Andrey Andreev9c5c24a2012-01-07 18:51:21 +0200345 $x = explode('/', $RTR->routes['404_override'], 2);
Eric Barnesc5bf6162011-01-30 21:17:11 -0500346 $class = $x[0];
347 $method = (isset($x[1]) ? $x[1] : 'index');
Eric Barnes5519e3d2011-02-01 13:07:37 -0500348 if ( ! class_exists($class))
349 {
Greg Aker3a746652011-04-19 10:59:47 -0500350 if ( ! file_exists(APPPATH.'controllers/'.$class.'.php'))
Eric Barnes5519e3d2011-02-01 13:07:37 -0500351 {
352 show_404("{$class}/{$method}");
353 }
354
Greg Aker3a746652011-04-19 10:59:47 -0500355 include_once(APPPATH.'controllers/'.$class.'.php');
Eric Barnes5519e3d2011-02-01 13:07:37 -0500356 unset($CI);
357 $CI = new $class();
358 }
Eric Barnesc5bf6162011-01-30 21:17:11 -0500359 }
360 else
361 {
362 show_404("{$class}/{$method}");
363 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000364 }
365
366 // Call the requested method.
Barry Mienydd671972010-10-04 16:33:58 +0200367 // Any URI segments present (besides the class/function) will be passed to the method for convenience
368 call_user_func_array(array(&$CI, $method), array_slice($URI->rsegments, 2));
Derek Allard2067d1a2008-11-13 22:59:24 +0000369 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000370
Derek Jones218876c2010-03-02 13:11:00 -0600371 // Mark a benchmark end point
372 $BM->mark('controller_execution_time_( '.$class.' / '.$method.' )_end');
Derek Allard2067d1a2008-11-13 22:59:24 +0000373
374/*
375 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500376 * Is there a "post_controller" hook?
Derek Allard2067d1a2008-11-13 22:59:24 +0000377 * ------------------------------------------------------
378 */
Andrey Andreeva5dd2972012-03-26 14:43:01 +0300379 $EXT->call_hook('post_controller');
Derek Allard2067d1a2008-11-13 22:59:24 +0000380
381/*
382 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500383 * Send the final rendered output to the browser
Derek Allard2067d1a2008-11-13 22:59:24 +0000384 * ------------------------------------------------------
385 */
Andrey Andreeva5dd2972012-03-26 14:43:01 +0300386 if ($EXT->call_hook('display_override') === FALSE)
Derek Jones218876c2010-03-02 13:11:00 -0600387 {
388 $OUT->_display();
389 }
Barry Mienydd671972010-10-04 16:33:58 +0200390
Derek Allard2067d1a2008-11-13 22:59:24 +0000391/*
392 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500393 * Is there a "post_system" hook?
Derek Allard2067d1a2008-11-13 22:59:24 +0000394 * ------------------------------------------------------
395 */
Andrey Andreeva5dd2972012-03-26 14:43:01 +0300396 $EXT->call_hook('post_system');
Derek Allard2067d1a2008-11-13 22:59:24 +0000397
398/*
399 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500400 * Close the DB connection if one exists
Derek Allard2067d1a2008-11-13 22:59:24 +0000401 * ------------------------------------------------------
402 */
Andrey Andreev29ce5d92012-01-08 04:43:31 +0200403 if (class_exists('CI_DB') && isset($CI->db))
Derek Jones218876c2010-03-02 13:11:00 -0600404 {
405 $CI->db->close();
406 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000407
Derek Allard2067d1a2008-11-13 22:59:24 +0000408/* End of file CodeIgniter.php */
Andrey Andreev9c5c24a2012-01-07 18:51:21 +0200409/* Location: ./system/core/CodeIgniter.php */