blob: 793c4687e411e5731213cc246070b41b231357d9 [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
Derek Allard2067d1a2008-11-13 22:59:24 +000028/**
Derek Jones218876c2010-03-02 13:11:00 -060029 * System Initialization File
Derek Allard2067d1a2008-11-13 22:59:24 +000030 *
31 * Loads the base classes and executes the request.
32 *
33 * @package CodeIgniter
34 * @subpackage codeigniter
35 * @category Front-controller
Derek Jonesf4a4bd82011-10-20 12:18:42 -050036 * @author EllisLab Dev Team
Derek Allard2067d1a2008-11-13 22:59:24 +000037 * @link http://codeigniter.com/user_guide/
38 */
39
Phil Sturgeond8ef6302011-08-14 12:10:55 -060040/**
41 * CodeIgniter Version
42 *
Timothy Warren48a7fbb2012-04-23 11:58:16 -040043 * @var string
Phil Sturgeond8ef6302011-08-14 12:10:55 -060044 *
Derek Jones218876c2010-03-02 13:11:00 -060045 */
Derek Jonesf4a4bd82011-10-20 12:18:42 -050046 define('CI_VERSION', '3.0-dev');
Derek Allard2067d1a2008-11-13 22:59:24 +000047
Phil Sturgeonbabfb292011-03-08 21:56:08 +000048/*
49 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -050050 * Load the global functions
Derek Allard2067d1a2008-11-13 22:59:24 +000051 * ------------------------------------------------------
52 */
Greg Aker3a746652011-04-19 10:59:47 -050053 require(BASEPATH.'core/Common.php');
Derek Allard2067d1a2008-11-13 22:59:24 +000054
55/*
56 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -050057 * Load the framework constants
Derek Allard2067d1a2008-11-13 22:59:24 +000058 * ------------------------------------------------------
59 */
Andrey Andreev29ce5d92012-01-08 04:43:31 +020060 if (defined('ENVIRONMENT') && file_exists(APPPATH.'config/'.ENVIRONMENT.'/constants.php'))
Greg Akerd96f8822011-12-27 16:23:47 -060061 {
62 require(APPPATH.'config/'.ENVIRONMENT.'/constants.php');
63 }
64 else
65 {
66 require(APPPATH.'config/constants.php');
67 }
Derek Allard2067d1a2008-11-13 22:59:24 +000068
69/*
70 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -050071 * Define a custom error handler so we can log PHP errors
Derek Allard2067d1a2008-11-13 22:59:24 +000072 * ------------------------------------------------------
73 */
Derek Jones218876c2010-03-02 13:11:00 -060074 set_error_handler('_exception_handler');
Barry Mienydd671972010-10-04 16:33:58 +020075
Derek Jones218876c2010-03-02 13:11:00 -060076 if ( ! is_php('5.3'))
77 {
Barry Mienydd671972010-10-04 16:33:58 +020078 @set_magic_quotes_runtime(0); // Kill magic quotes
Derek Jones218876c2010-03-02 13:11:00 -060079 }
Derek Jones962d2252009-08-05 04:26:11 +000080
Derek Jones218876c2010-03-02 13:11:00 -060081/*
82 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -050083 * Set the subclass_prefix
Derek Jones218876c2010-03-02 13:11:00 -060084 * ------------------------------------------------------
85 *
Barry Mienydd671972010-10-04 16:33:58 +020086 * Normally the "subclass_prefix" is set in the config file.
87 * The subclass prefix allows CI to know if a core class is
Derek Jones218876c2010-03-02 13:11:00 -060088 * being extended via a library in the local application
Barry Mienydd671972010-10-04 16:33:58 +020089 * "libraries" folder. Since CI allows config items to be
90 * overriden via data set in the main index. php file,
91 * before proceeding we need to know if a subclass_prefix
Andrey Andreev9c5c24a2012-01-07 18:51:21 +020092 * override exists. If so, we will set this value now,
Derek Jones218876c2010-03-02 13:11:00 -060093 * before any classes are loaded
Barry Mienydd671972010-10-04 16:33:58 +020094 * Note: Since the config file data is cached it doesn't
Derek Jones218876c2010-03-02 13:11:00 -060095 * hurt to load it here.
96 */
Andrey Andreev29ce5d92012-01-08 04:43:31 +020097 if (isset($assign_to_config['subclass_prefix']) && $assign_to_config['subclass_prefix'] != '')
Derek Jones218876c2010-03-02 13:11:00 -060098 {
99 get_config(array('subclass_prefix' => $assign_to_config['subclass_prefix']));
100 }
Eric Barnesc5bf6162011-01-30 21:17:11 -0500101
Pascal Krietef566af52010-11-09 13:03:26 -0500102/*
103 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500104 * Set a liberal script execution time limit
Pascal Krietef566af52010-11-09 13:03:26 -0500105 * ------------------------------------------------------
106 */
Andrey Andreev29ce5d92012-01-08 04:43:31 +0200107 if (function_exists('set_time_limit') && @ini_get('safe_mode') == 0
108 && php_sapi_name() !== 'cli') // Do not override the Time Limit value if running from Command Line
Pascal Krietef566af52010-11-09 13:03:26 -0500109 {
Andrey Andreev9c5c24a2012-01-07 18:51:21 +0200110 @set_time_limit(300);
Pascal Krietef566af52010-11-09 13:03:26 -0500111 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000112
113/*
114 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500115 * Start the timer... tick tock tick tock...
Derek Allard2067d1a2008-11-13 22:59:24 +0000116 * ------------------------------------------------------
117 */
Derek Jones218876c2010-03-02 13:11:00 -0600118 $BM =& load_class('Benchmark', 'core');
119 $BM->mark('total_execution_time_start');
120 $BM->mark('loading_time:_base_classes_start');
Derek Allard2067d1a2008-11-13 22:59:24 +0000121
122/*
123 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500124 * Instantiate the hooks class
Derek Allard2067d1a2008-11-13 22:59:24 +0000125 * ------------------------------------------------------
126 */
Derek Jones218876c2010-03-02 13:11:00 -0600127 $EXT =& load_class('Hooks', 'core');
Derek Allard2067d1a2008-11-13 22:59:24 +0000128
129/*
130 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500131 * Is there a "pre_system" hook?
Derek Allard2067d1a2008-11-13 22:59:24 +0000132 * ------------------------------------------------------
133 */
Andrey Andreeva5dd2972012-03-26 14:43:01 +0300134 $EXT->call_hook('pre_system');
Derek Allard2067d1a2008-11-13 22:59:24 +0000135
136/*
137 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500138 * Instantiate the config class
Derek Allard2067d1a2008-11-13 22:59:24 +0000139 * ------------------------------------------------------
Barry Mienydd671972010-10-04 16:33:58 +0200140 */
Derek Jones218876c2010-03-02 13:11:00 -0600141 $CFG =& load_class('Config', 'core');
142
143 // Do we have any manually set config items in the index.php file?
144 if (isset($assign_to_config))
Barry Mienydd671972010-10-04 16:33:58 +0200145 {
Derek Jones218876c2010-03-02 13:11:00 -0600146 $CFG->_assign_to_config($assign_to_config);
147 }
148
149/*
150 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500151 * Instantiate the UTF-8 class
Derek Jones218876c2010-03-02 13:11:00 -0600152 * ------------------------------------------------------
Barry Mienydd671972010-10-04 16:33:58 +0200153 *
Pascal Krieteaaec1e42011-01-20 00:01:21 -0500154 * Note: Order here is rather important as the UTF-8
Derek Jones218876c2010-03-02 13:11:00 -0600155 * class needs to be used very early on, but it cannot
Barry Mienydd671972010-10-04 16:33:58 +0200156 * properly determine if UTf-8 can be supported until
Derek Jones218876c2010-03-02 13:11:00 -0600157 * after the Config class is instantiated.
Barry Mienydd671972010-10-04 16:33:58 +0200158 *
Derek Allard2067d1a2008-11-13 22:59:24 +0000159 */
Pascal Krieteaaec1e42011-01-20 00:01:21 -0500160 $UNI =& load_class('Utf8', 'core');
Barry Mienydd671972010-10-04 16:33:58 +0200161
Derek Jones218876c2010-03-02 13:11:00 -0600162/*
163 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500164 * Instantiate the URI class
Derek Jones218876c2010-03-02 13:11:00 -0600165 * ------------------------------------------------------
166 */
167 $URI =& load_class('URI', 'core');
168
169/*
170 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500171 * Instantiate the routing class and set the routing
Derek Jones218876c2010-03-02 13:11:00 -0600172 * ------------------------------------------------------
Barry Mienydd671972010-10-04 16:33:58 +0200173 */
Derek Jones218876c2010-03-02 13:11:00 -0600174 $RTR =& load_class('Router', 'core');
175 $RTR->_set_routing();
Barry Mienydd671972010-10-04 16:33:58 +0200176
Derek Jones218876c2010-03-02 13:11:00 -0600177 // Set any routing overrides that may exist in the main index file
178 if (isset($routing))
179 {
180 $RTR->_set_overrides($routing);
181 }
182
183/*
184 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500185 * Instantiate the output class
Derek Jones218876c2010-03-02 13:11:00 -0600186 * ------------------------------------------------------
187 */
188 $OUT =& load_class('Output', 'core');
Derek Allard2067d1a2008-11-13 22:59:24 +0000189
190/*
191 * ------------------------------------------------------
Andrey Andreev9c5c24a2012-01-07 18:51:21 +0200192 * Is there a valid cache file? If so, we're done...
Derek Allard2067d1a2008-11-13 22:59:24 +0000193 * ------------------------------------------------------
194 */
Andrey Andreeva5dd2972012-03-26 14:43:01 +0300195 if ($EXT->call_hook('cache_override') === FALSE
Andrey Andreev29ce5d92012-01-08 04:43:31 +0200196 && $OUT->_display_cache($CFG, $URI) == TRUE)
Derek Allard2067d1a2008-11-13 22:59:24 +0000197 {
Andrey Andreev9c5c24a2012-01-07 18:51:21 +0200198 exit;
Derek Allard2067d1a2008-11-13 22:59:24 +0000199 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000200
201/*
Pascal Kriete14a0ac62011-04-05 14:55:56 -0400202 * -----------------------------------------------------
203 * Load the security class for xss and csrf support
204 * -----------------------------------------------------
205 */
206 $SEC =& load_class('Security', 'core');
207
208/*
Derek Allard2067d1a2008-11-13 22:59:24 +0000209 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500210 * Load the Input class and sanitize globals
Derek Allard2067d1a2008-11-13 22:59:24 +0000211 * ------------------------------------------------------
212 */
Barry Mienydd671972010-10-04 16:33:58 +0200213 $IN =& load_class('Input', 'core');
Derek Allard2067d1a2008-11-13 22:59:24 +0000214
Derek Jones218876c2010-03-02 13:11:00 -0600215/*
216 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500217 * Load the Language class
Derek Jones218876c2010-03-02 13:11:00 -0600218 * ------------------------------------------------------
219 */
220 $LANG =& load_class('Lang', 'core');
Derek Allard2067d1a2008-11-13 22:59:24 +0000221
222/*
223 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500224 * Load the app controller and local controller
Derek Allard2067d1a2008-11-13 22:59:24 +0000225 * ------------------------------------------------------
226 *
Derek Allard2067d1a2008-11-13 22:59:24 +0000227 */
Derek Jones218876c2010-03-02 13:11:00 -0600228 // Load the base controller class
Greg Aker3a746652011-04-19 10:59:47 -0500229 require BASEPATH.'core/Controller.php';
Barry Mienydd671972010-10-04 16:33:58 +0200230
Timothy Warrenad475052012-04-19 13:21:06 -0400231 /**
232 * Reference to the CI_Controller method.
233 *
234 * Returns current CI instance object
235 *
236 * @return object
237 */
Greg Aker4abfa682010-11-10 14:44:26 -0600238 function &get_instance()
239 {
240 return CI_Controller::get_instance();
241 }
242
243
Greg Aker3a746652011-04-19 10:59:47 -0500244 if (file_exists(APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller.php'))
Greg Akerfa281352010-03-22 14:41:27 -0500245 {
Greg Aker3a746652011-04-19 10:59:47 -0500246 require APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller.php';
Greg Akerfa281352010-03-22 14:41:27 -0500247 }
Barry Mienydd671972010-10-04 16:33:58 +0200248
Derek Jones218876c2010-03-02 13:11:00 -0600249 // Load the local application controller
Barry Mienydd671972010-10-04 16:33:58 +0200250 // Note: The Router class automatically validates the controller path using the router->_validate_request().
Derek Jones218876c2010-03-02 13:11:00 -0600251 // 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 -0500252 if ( ! file_exists(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php'))
Derek Jones218876c2010-03-02 13:11:00 -0600253 {
Pascal Krieteebb6f4b2010-11-10 17:09:21 -0500254 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 -0600255 }
Barry Mienydd671972010-10-04 16:33:58 +0200256
Greg Aker3a746652011-04-19 10:59:47 -0500257 include(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php');
Barry Mienydd671972010-10-04 16:33:58 +0200258
Derek Jones218876c2010-03-02 13:11:00 -0600259 // Set a mark point for benchmarking
260 $BM->mark('loading_time:_base_classes_end');
Derek Allard2067d1a2008-11-13 22:59:24 +0000261
262/*
263 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500264 * Security check
Derek Allard2067d1a2008-11-13 22:59:24 +0000265 * ------------------------------------------------------
266 *
Derek Jones37f4b9c2011-07-01 17:56:50 -0500267 * None of the functions in the app controller or the
268 * loader class can be called via the URI, nor can
269 * controller functions that begin with an underscore
Derek Allard2067d1a2008-11-13 22:59:24 +0000270 */
Derek Jones37f4b9c2011-07-01 17:56:50 -0500271 $class = $RTR->fetch_class();
Derek Jones218876c2010-03-02 13:11:00 -0600272 $method = $RTR->fetch_method();
Barry Mienydd671972010-10-04 16:33:58 +0200273
Derek Jones218876c2010-03-02 13:11:00 -0600274 if ( ! class_exists($class)
Andrey Andreev176b3632012-01-10 18:14:28 +0200275 OR strpos($method, '_') === 0
Greg Aker63277b82010-11-09 13:46:13 -0600276 OR in_array(strtolower($method), array_map('strtolower', get_class_methods('CI_Controller')))
Derek Jones218876c2010-03-02 13:11:00 -0600277 )
278 {
Shane Pearson664a9352011-08-10 16:02:32 -0500279 if ( ! empty($RTR->routes['404_override']))
280 {
Andrey Andreev9c5c24a2012-01-07 18:51:21 +0200281 $x = explode('/', $RTR->routes['404_override'], 2);
Shane Pearson664a9352011-08-10 16:02:32 -0500282 $class = $x[0];
Andrey Andreevb3f774b2012-04-23 12:57:57 +0300283 $method = isset($x[1]) ? $x[1] : 'index';
Shane Pearson664a9352011-08-10 16:02:32 -0500284 if ( ! class_exists($class))
285 {
286 if ( ! file_exists(APPPATH.'controllers/'.$class.'.php'))
287 {
Andrey Andreevb3f774b2012-04-23 12:57:57 +0300288 show_404($class.'/'.$method);
Shane Pearson664a9352011-08-10 16:02:32 -0500289 }
290
291 include_once(APPPATH.'controllers/'.$class.'.php');
292 }
293 }
294 else
295 {
Andrey Andreevb3f774b2012-04-23 12:57:57 +0300296 show_404($class.'/'.$method);
Shane Pearson664a9352011-08-10 16:02:32 -0500297 }
Derek Jones218876c2010-03-02 13:11:00 -0600298 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000299
300/*
301 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500302 * Is there a "pre_controller" hook?
Derek Allard2067d1a2008-11-13 22:59:24 +0000303 * ------------------------------------------------------
304 */
Andrey Andreeva5dd2972012-03-26 14:43:01 +0300305 $EXT->call_hook('pre_controller');
Derek Allard2067d1a2008-11-13 22:59:24 +0000306
307/*
308 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500309 * Instantiate the requested controller
Derek Allard2067d1a2008-11-13 22:59:24 +0000310 * ------------------------------------------------------
311 */
Derek Jones218876c2010-03-02 13:11:00 -0600312 // Mark a start point so we can benchmark the controller
313 $BM->mark('controller_execution_time_( '.$class.' / '.$method.' )_start');
Barry Mienydd671972010-10-04 16:33:58 +0200314
Derek Jones218876c2010-03-02 13:11:00 -0600315 $CI = new $class();
316
317/*
318 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500319 * Is there a "post_controller_constructor" hook?
Derek Jones218876c2010-03-02 13:11:00 -0600320 * ------------------------------------------------------
321 */
Andrey Andreeva5dd2972012-03-26 14:43:01 +0300322 $EXT->call_hook('post_controller_constructor');
Derek Jones218876c2010-03-02 13:11:00 -0600323
324/*
325 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500326 * Call the requested method
Derek Jones218876c2010-03-02 13:11:00 -0600327 * ------------------------------------------------------
328 */
329 // Is there a "remap" function? If so, we call it instead
Derek Allard2067d1a2008-11-13 22:59:24 +0000330 if (method_exists($CI, '_remap'))
331 {
Pascal Kriete3431ae32010-11-09 15:19:50 -0500332 $CI->_remap($method, array_slice($URI->rsegments, 2));
Derek Allard2067d1a2008-11-13 22:59:24 +0000333 }
334 else
335 {
336 // is_callable() returns TRUE on some versions of PHP 5 for private and protected
337 // methods, so we'll use this workaround for consistent behavior
338 if ( ! in_array(strtolower($method), array_map('strtolower', get_class_methods($CI))))
339 {
Eric Barnesc5bf6162011-01-30 21:17:11 -0500340 // Check and see if we are using a 404 override and use it.
341 if ( ! empty($RTR->routes['404_override']))
342 {
Andrey Andreev9c5c24a2012-01-07 18:51:21 +0200343 $x = explode('/', $RTR->routes['404_override'], 2);
Eric Barnesc5bf6162011-01-30 21:17:11 -0500344 $class = $x[0];
Andrey Andreevb3f774b2012-04-23 12:57:57 +0300345 $method = isset($x[1]) ? $x[1] : 'index';
Eric Barnes5519e3d2011-02-01 13:07:37 -0500346 if ( ! class_exists($class))
347 {
Greg Aker3a746652011-04-19 10:59:47 -0500348 if ( ! file_exists(APPPATH.'controllers/'.$class.'.php'))
Eric Barnes5519e3d2011-02-01 13:07:37 -0500349 {
Andrey Andreevb3f774b2012-04-23 12:57:57 +0300350 show_404($class.'/'.$method);
Eric Barnes5519e3d2011-02-01 13:07:37 -0500351 }
352
Greg Aker3a746652011-04-19 10:59:47 -0500353 include_once(APPPATH.'controllers/'.$class.'.php');
Eric Barnes5519e3d2011-02-01 13:07:37 -0500354 unset($CI);
355 $CI = new $class();
356 }
Eric Barnesc5bf6162011-01-30 21:17:11 -0500357 }
358 else
359 {
Andrey Andreevb3f774b2012-04-23 12:57:57 +0300360 show_404($class.'/'.$method);
Eric Barnesc5bf6162011-01-30 21:17:11 -0500361 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000362 }
363
364 // Call the requested method.
Barry Mienydd671972010-10-04 16:33:58 +0200365 // Any URI segments present (besides the class/function) will be passed to the method for convenience
366 call_user_func_array(array(&$CI, $method), array_slice($URI->rsegments, 2));
Derek Allard2067d1a2008-11-13 22:59:24 +0000367 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000368
Derek Jones218876c2010-03-02 13:11:00 -0600369 // Mark a benchmark end point
370 $BM->mark('controller_execution_time_( '.$class.' / '.$method.' )_end');
Derek Allard2067d1a2008-11-13 22:59:24 +0000371
372/*
373 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500374 * Is there a "post_controller" hook?
Derek Allard2067d1a2008-11-13 22:59:24 +0000375 * ------------------------------------------------------
376 */
Andrey Andreeva5dd2972012-03-26 14:43:01 +0300377 $EXT->call_hook('post_controller');
Derek Allard2067d1a2008-11-13 22:59:24 +0000378
379/*
380 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500381 * Send the final rendered output to the browser
Derek Allard2067d1a2008-11-13 22:59:24 +0000382 * ------------------------------------------------------
383 */
Andrey Andreeva5dd2972012-03-26 14:43:01 +0300384 if ($EXT->call_hook('display_override') === FALSE)
Derek Jones218876c2010-03-02 13:11:00 -0600385 {
386 $OUT->_display();
387 }
Barry Mienydd671972010-10-04 16:33:58 +0200388
Derek Allard2067d1a2008-11-13 22:59:24 +0000389/*
390 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500391 * Is there a "post_system" hook?
Derek Allard2067d1a2008-11-13 22:59:24 +0000392 * ------------------------------------------------------
393 */
Andrey Andreeva5dd2972012-03-26 14:43:01 +0300394 $EXT->call_hook('post_system');
Derek Allard2067d1a2008-11-13 22:59:24 +0000395
396/*
397 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500398 * Close the DB connection if one exists
Derek Allard2067d1a2008-11-13 22:59:24 +0000399 * ------------------------------------------------------
400 */
Andrey Andreevb3f774b2012-04-23 12:57:57 +0300401 if (class_exists('CI_DB') && isset($CI->db) && ! $CI->db->pconnect)
Derek Jones218876c2010-03-02 13:11:00 -0600402 {
403 $CI->db->close();
404 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000405
Derek Allard2067d1a2008-11-13 22:59:24 +0000406/* End of file CodeIgniter.php */
Timothy Warren31d30bc2012-04-23 08:58:42 -0400407/* Location: ./system/core/CodeIgniter.php */