blob: df5fa3b0266b116c3af4abf3d1ecb047a11813cc [file] [log] [blame]
Andrey Andreevc5536aa2012-11-01 17:33:58 +02001<?php
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
darwinel871754a2014-02-11 17:34:57 +010021 * @copyright Copyright (c) 2008 - 2014, 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 */
Andrey Andreevc5536aa2012-11-01 17:33:58 +020027defined('BASEPATH') OR exit('No direct script access allowed');
Derek Allard2067d1a2008-11-13 22:59:24 +000028
Derek Allard2067d1a2008-11-13 22:59:24 +000029/**
Derek Jones218876c2010-03-02 13:11:00 -060030 * System Initialization File
Derek Allard2067d1a2008-11-13 22:59:24 +000031 *
32 * Loads the base classes and executes the request.
33 *
34 * @package CodeIgniter
Andrey Andreev92ebfb62012-05-17 12:49:24 +030035 * @subpackage CodeIgniter
Derek Allard2067d1a2008-11-13 22:59:24 +000036 * @category Front-controller
Derek Jonesf4a4bd82011-10-20 12:18:42 -050037 * @author EllisLab Dev Team
Derek Allard2067d1a2008-11-13 22:59:24 +000038 * @link http://codeigniter.com/user_guide/
39 */
40
Phil Sturgeond8ef6302011-08-14 12:10:55 -060041/**
42 * CodeIgniter Version
43 *
Timothy Warren48a7fbb2012-04-23 11:58:16 -040044 * @var string
Phil Sturgeond8ef6302011-08-14 12:10:55 -060045 *
Derek Jones218876c2010-03-02 13:11:00 -060046 */
Derek Jonesf4a4bd82011-10-20 12:18:42 -050047 define('CI_VERSION', '3.0-dev');
Andrey Andreevb6fbcbe2013-11-17 18:06:18 +020048
Derek Allard2067d1a2008-11-13 22:59:24 +000049/*
50 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -050051 * Load the framework constants
Derek Allard2067d1a2008-11-13 22:59:24 +000052 * ------------------------------------------------------
53 */
Andrey Andreevdb529ca2013-01-28 11:00:02 +020054 if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/constants.php'))
Greg Akerd96f8822011-12-27 16:23:47 -060055 {
Andrey Andreev30d53242014-01-16 14:41:46 +020056 require_once(APPPATH.'config/'.ENVIRONMENT.'/constants.php');
Greg Akerd96f8822011-12-27 16:23:47 -060057 }
Andrey Andreevb6fbcbe2013-11-17 18:06:18 +020058
Andrey Andreev30d53242014-01-16 14:41:46 +020059 require_once(APPPATH.'config/constants.php');
Derek Allard2067d1a2008-11-13 22:59:24 +000060
61/*
62 * ------------------------------------------------------
josephok1095d112013-11-16 09:33:37 +080063 * Load the global functions
64 * ------------------------------------------------------
65 */
66 require_once(BASEPATH.'core/Common.php');
67
68/*
69 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -050070 * Define a custom error handler so we can log PHP errors
Derek Allard2067d1a2008-11-13 22:59:24 +000071 * ------------------------------------------------------
72 */
Derek Jones218876c2010-03-02 13:11:00 -060073 set_error_handler('_exception_handler');
Kaiwang Chen21fe9da2013-09-11 13:09:41 +080074 register_shutdown_function('_shutdown_handler');
Barry Mienydd671972010-10-04 16:33:58 +020075
Andrey Andreev5932a732013-09-13 14:45:53 +030076 // Kill magic quotes
Andrey Andreevca39f2e2014-02-20 02:30:14 +020077 is_php('5.4') OR ini_set('magic_quotes_runtime', 0);
Derek Jones962d2252009-08-05 04:26:11 +000078
Derek Jones218876c2010-03-02 13:11:00 -060079/*
80 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -050081 * Set the subclass_prefix
Derek Jones218876c2010-03-02 13:11:00 -060082 * ------------------------------------------------------
83 *
Barry Mienydd671972010-10-04 16:33:58 +020084 * Normally the "subclass_prefix" is set in the config file.
85 * The subclass prefix allows CI to know if a core class is
Derek Jones218876c2010-03-02 13:11:00 -060086 * being extended via a library in the local application
Barry Mienydd671972010-10-04 16:33:58 +020087 * "libraries" folder. Since CI allows config items to be
vlakoff8d70c0a2013-08-17 07:31:29 +020088 * overriden via data set in the main index.php file,
Barry Mienydd671972010-10-04 16:33:58 +020089 * before proceeding we need to know if a subclass_prefix
Andrey Andreev9c5c24a2012-01-07 18:51:21 +020090 * override exists. If so, we will set this value now,
Derek Jones218876c2010-03-02 13:11:00 -060091 * before any classes are loaded
Barry Mienydd671972010-10-04 16:33:58 +020092 * Note: Since the config file data is cached it doesn't
Derek Jones218876c2010-03-02 13:11:00 -060093 * hurt to load it here.
94 */
Andrey Andreev9ba661b2012-06-04 14:44:34 +030095 if ( ! empty($assign_to_config['subclass_prefix']))
Derek Jones218876c2010-03-02 13:11:00 -060096 {
97 get_config(array('subclass_prefix' => $assign_to_config['subclass_prefix']));
98 }
Eric Barnesc5bf6162011-01-30 21:17:11 -050099
Pascal Krietef566af52010-11-09 13:03:26 -0500100/*
101 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500102 * Start the timer... tick tock tick tock...
Derek Allard2067d1a2008-11-13 22:59:24 +0000103 * ------------------------------------------------------
104 */
Derek Jones218876c2010-03-02 13:11:00 -0600105 $BM =& load_class('Benchmark', 'core');
106 $BM->mark('total_execution_time_start');
107 $BM->mark('loading_time:_base_classes_start');
Derek Allard2067d1a2008-11-13 22:59:24 +0000108
109/*
110 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500111 * Instantiate the hooks class
Derek Allard2067d1a2008-11-13 22:59:24 +0000112 * ------------------------------------------------------
113 */
Derek Jones218876c2010-03-02 13:11:00 -0600114 $EXT =& load_class('Hooks', 'core');
Derek Allard2067d1a2008-11-13 22:59:24 +0000115
116/*
117 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500118 * Is there a "pre_system" hook?
Derek Allard2067d1a2008-11-13 22:59:24 +0000119 * ------------------------------------------------------
120 */
Andrey Andreeva5dd2972012-03-26 14:43:01 +0300121 $EXT->call_hook('pre_system');
Derek Allard2067d1a2008-11-13 22:59:24 +0000122
123/*
124 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500125 * Instantiate the config class
Derek Allard2067d1a2008-11-13 22:59:24 +0000126 * ------------------------------------------------------
Andrey Andreeveb555ed2014-02-12 19:25:01 +0200127 *
128 * Note: It is important that Config is loaded first as
129 * most other classes depend on it either directly or by
130 * depending on another class that uses it.
131 *
Barry Mienydd671972010-10-04 16:33:58 +0200132 */
Derek Jones218876c2010-03-02 13:11:00 -0600133 $CFG =& load_class('Config', 'core');
134
135 // Do we have any manually set config items in the index.php file?
Andrey Andreev5232ba02012-10-27 15:25:05 +0300136 if (isset($assign_to_config) && is_array($assign_to_config))
Barry Mienydd671972010-10-04 16:33:58 +0200137 {
Andrey Andreev5232ba02012-10-27 15:25:05 +0300138 foreach ($assign_to_config as $key => $value)
139 {
140 $CFG->set_item($key, $value);
141 }
Derek Jones218876c2010-03-02 13:11:00 -0600142 }
143
144/*
145 * ------------------------------------------------------
Andrey Andreeveb555ed2014-02-12 19:25:01 +0200146 * Important charset-related stuff
Derek Jones218876c2010-03-02 13:11:00 -0600147 * ------------------------------------------------------
Barry Mienydd671972010-10-04 16:33:58 +0200148 *
Andrey Andreeveb555ed2014-02-12 19:25:01 +0200149 * Configure mbstring and/or iconv if they are enabled
150 * and set MB_ENABLED and ICONV_ENABLED constants, so
151 * that we don't repeatedly do extension_loaded() or
152 * function_exists() calls.
Barry Mienydd671972010-10-04 16:33:58 +0200153 *
Andrey Andreeveb555ed2014-02-12 19:25:01 +0200154 * Note: UTF-8 class depends on this. It used to be done
155 * in it's constructor, but it's _not_ class-specific.
156 *
157 */
158 $charset = strtoupper(config_item('charset'));
159
160 if (extension_loaded('mbstring'))
161 {
162 define('MB_ENABLED', TRUE);
163 mb_internal_encoding($charset);
164 // This is required for mb_convert_encoding() to strip invalid characters.
165 // That's utilized by CI_Utf8, but it's also done for consistency with iconv.
166 mb_substitute_character('none');
167 }
168 else
169 {
170 define('MB_ENABLED', FALSE);
171 }
172
173 // There's an ICONV_IMPL constant, but the PHP manual says that using
174 // iconv's predefined constants is "strongly discouraged".
175 if (extension_loaded('iconv'))
176 {
177 define('ICONV_ENABLED', TRUE);
178 iconv_set_encoding('internal_encoding', $charset);
179 }
180 else
181 {
182 define('ICONV_ENABLED', FALSE);
183 }
184
185/*
186 * ------------------------------------------------------
Andrey Andreev3fd1b382014-02-13 03:01:31 +0200187 * Load compatibility features
188 * ------------------------------------------------------
189 */
190
Andrey Andreev376b2152014-02-13 12:35:52 +0200191 require_once(BASEPATH.'core/compat/mbstring.php');
Andrey Andreev9a152a92014-02-18 16:29:53 +0200192 require_once(BASEPATH.'core/compat/hash.php');
Andrey Andreev376b2152014-02-13 12:35:52 +0200193 require_once(BASEPATH.'core/compat/password.php');
Andrey Andreev02545892014-02-19 23:49:31 +0200194 require_once(BASEPATH.'core/compat/array.php');
Andrey Andreev3fd1b382014-02-13 03:01:31 +0200195
196/*
197 * ------------------------------------------------------
Andrey Andreeveb555ed2014-02-12 19:25:01 +0200198 * Instantiate the UTF-8 class
199 * ------------------------------------------------------
Derek Allard2067d1a2008-11-13 22:59:24 +0000200 */
Pascal Krieteaaec1e42011-01-20 00:01:21 -0500201 $UNI =& load_class('Utf8', 'core');
Barry Mienydd671972010-10-04 16:33:58 +0200202
Derek Jones218876c2010-03-02 13:11:00 -0600203/*
204 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500205 * Instantiate the URI class
Derek Jones218876c2010-03-02 13:11:00 -0600206 * ------------------------------------------------------
207 */
208 $URI =& load_class('URI', 'core');
209
210/*
211 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500212 * Instantiate the routing class and set the routing
Derek Jones218876c2010-03-02 13:11:00 -0600213 * ------------------------------------------------------
Barry Mienydd671972010-10-04 16:33:58 +0200214 */
Andrey Andreevc26b9eb2014-02-24 11:31:36 +0200215 $RTR =& load_class('Router', 'core', isset($routing) ? $routing : NULL);
Barry Mienydd671972010-10-04 16:33:58 +0200216
Derek Jones218876c2010-03-02 13:11:00 -0600217/*
218 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500219 * Instantiate the output class
Derek Jones218876c2010-03-02 13:11:00 -0600220 * ------------------------------------------------------
221 */
222 $OUT =& load_class('Output', 'core');
Derek Allard2067d1a2008-11-13 22:59:24 +0000223
224/*
225 * ------------------------------------------------------
Andrey Andreev9c5c24a2012-01-07 18:51:21 +0200226 * Is there a valid cache file? If so, we're done...
Derek Allard2067d1a2008-11-13 22:59:24 +0000227 * ------------------------------------------------------
228 */
Andrey Andreevc26b9eb2014-02-24 11:31:36 +0200229 if ($EXT->call_hook('cache_override') === FALSE && $OUT->_display_cache($CFG, $URI) === TRUE)
Derek Allard2067d1a2008-11-13 22:59:24 +0000230 {
Andrey Andreev9c5c24a2012-01-07 18:51:21 +0200231 exit;
Derek Allard2067d1a2008-11-13 22:59:24 +0000232 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000233
234/*
Pascal Kriete14a0ac62011-04-05 14:55:56 -0400235 * -----------------------------------------------------
236 * Load the security class for xss and csrf support
237 * -----------------------------------------------------
238 */
239 $SEC =& load_class('Security', 'core');
240
241/*
Derek Allard2067d1a2008-11-13 22:59:24 +0000242 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500243 * Load the Input class and sanitize globals
Derek Allard2067d1a2008-11-13 22:59:24 +0000244 * ------------------------------------------------------
245 */
Barry Mienydd671972010-10-04 16:33:58 +0200246 $IN =& load_class('Input', 'core');
Derek Allard2067d1a2008-11-13 22:59:24 +0000247
Derek Jones218876c2010-03-02 13:11:00 -0600248/*
249 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500250 * Load the Language class
Derek Jones218876c2010-03-02 13:11:00 -0600251 * ------------------------------------------------------
252 */
253 $LANG =& load_class('Lang', 'core');
Derek Allard2067d1a2008-11-13 22:59:24 +0000254
255/*
256 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500257 * Load the app controller and local controller
Derek Allard2067d1a2008-11-13 22:59:24 +0000258 * ------------------------------------------------------
259 *
Derek Allard2067d1a2008-11-13 22:59:24 +0000260 */
Derek Jones218876c2010-03-02 13:11:00 -0600261 // Load the base controller class
Andrey Andreev30d53242014-01-16 14:41:46 +0200262 require_once BASEPATH.'core/Controller.php';
Barry Mienydd671972010-10-04 16:33:58 +0200263
Timothy Warrenad475052012-04-19 13:21:06 -0400264 /**
265 * Reference to the CI_Controller method.
266 *
267 * Returns current CI instance object
268 *
269 * @return object
270 */
Greg Aker4abfa682010-11-10 14:44:26 -0600271 function &get_instance()
272 {
273 return CI_Controller::get_instance();
274 }
275
Greg Aker3a746652011-04-19 10:59:47 -0500276 if (file_exists(APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller.php'))
Greg Akerfa281352010-03-22 14:41:27 -0500277 {
Andrey Andreev30d53242014-01-16 14:41:46 +0200278 require_once APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller.php';
Greg Akerfa281352010-03-22 14:41:27 -0500279 }
Barry Mienydd671972010-10-04 16:33:58 +0200280
Derek Jones218876c2010-03-02 13:11:00 -0600281 // Set a mark point for benchmarking
282 $BM->mark('loading_time:_base_classes_end');
Derek Allard2067d1a2008-11-13 22:59:24 +0000283
284/*
285 * ------------------------------------------------------
Andrey Andreev30d53242014-01-16 14:41:46 +0200286 * Sanity checks
Derek Allard2067d1a2008-11-13 22:59:24 +0000287 * ------------------------------------------------------
288 *
Andrey Andreev30d53242014-01-16 14:41:46 +0200289 * The Router class has already validated the request,
290 * leaving us with 3 options here:
291 *
292 * 1) an empty class name, if we reached the default
293 * controller, but it didn't exist;
294 * 2) a query string which doesn't go through a
295 * file_exists() check
296 * 3) a regular request for a non-existing page
297 *
298 * We handle all of these as a 404 error.
299 *
300 * Furthermore, none of the methods in the app controller
301 * or the loader class can be called via the URI, nor can
Andrey Andreev20292312013-07-22 14:29:10 +0300302 * controller methods that begin with an underscore.
Derek Allard2067d1a2008-11-13 22:59:24 +0000303 */
Barry Mienydd671972010-10-04 16:33:58 +0200304
Andrey Andreev30d53242014-01-16 14:41:46 +0200305 $e404 = FALSE;
306 $class = ucfirst($RTR->class);
307 $method = $RTR->method;
308
309 if (empty($class) OR ! file_exists(APPPATH.'controllers/'.$RTR->directory.$class.'.php'))
Derek Jones218876c2010-03-02 13:11:00 -0600310 {
Andrey Andreev30d53242014-01-16 14:41:46 +0200311 $e404 = TRUE;
Andrey Andreev38e32f62012-11-03 00:16:47 +0200312 }
313 else
314 {
Andrey Andreev30d53242014-01-16 14:41:46 +0200315 require_once(APPPATH.'controllers/'.$RTR->directory.$class.'.php');
316
317 if ( ! class_exists($class, FALSE) OR $method[0] === '_' OR method_exists('CI_Controller', $method))
318 {
319 $e404 = TRUE;
320 }
321 elseif (method_exists($class, '_remap'))
322 {
323 $params = array($method, array_slice($URI->rsegments, 2));
324 $method = '_remap';
325 }
Andrey Andreev522c7362012-11-05 16:40:32 +0200326 // WARNING: It appears that there are issues with is_callable() even in PHP 5.2!
327 // Furthermore, there are bug reports and feature/change requests related to it
328 // that make it unreliable to use in this context. Please, DO NOT change this
329 // work-around until a better alternative is available.
Andrey Andreev30d53242014-01-16 14:41:46 +0200330 elseif ( ! in_array(strtolower($method), array_map('strtolower', get_class_methods($class)), TRUE))
Andrey Andreev38e32f62012-11-03 00:16:47 +0200331 {
Andrey Andreev30d53242014-01-16 14:41:46 +0200332 $e404 = TRUE;
333 }
334 }
335
336 if ($e404)
337 {
338 if ( ! empty($RTR->routes['404_override']))
339 {
340 if (sscanf($RTR->routes['404_override'], '%[^/]/%s', $error_class, $error_method) !== 2)
Andrey Andreev38e32f62012-11-03 00:16:47 +0200341 {
Andrey Andreev30d53242014-01-16 14:41:46 +0200342 $error_method = 'index';
Andrey Andreev38e32f62012-11-03 00:16:47 +0200343 }
344
Andrey Andreev30d53242014-01-16 14:41:46 +0200345 $error_class = ucfirst($error_class);
Andrey Andreev20292312013-07-22 14:29:10 +0300346
Andrey Andreev30d53242014-01-16 14:41:46 +0200347 if ( ! class_exists($error_class, FALSE))
Andrey Andreev38e32f62012-11-03 00:16:47 +0200348 {
Andrey Andreev30d53242014-01-16 14:41:46 +0200349 if (file_exists(APPPATH.'controllers/'.$RTR->directory.$error_class.'.php'))
Andrey Andreev38e32f62012-11-03 00:16:47 +0200350 {
Andrey Andreev30d53242014-01-16 14:41:46 +0200351 require_once(APPPATH.'controllers/'.$RTR->directory.$error_class.'.php');
352 $e404 = ! class_exists($error_class, FALSE);
Andrey Andreev38e32f62012-11-03 00:16:47 +0200353 }
Andrey Andreev30d53242014-01-16 14:41:46 +0200354 // Were we in a directory? If so, check for a global override
355 elseif ( ! empty($RTR->directory) && file_exists(APPPATH.'controllers/'.$error_class.'.php'))
356 {
357 require_once(APPPATH.'controllers/'.$error_class.'.php');
358 if (($e404 = ! class_exists($error_class, FALSE)) === FALSE)
359 {
360 $RTR->directory = '';
361 }
362 }
363 }
364 else
365 {
366 $e404 = FALSE;
Andrey Andreev38e32f62012-11-03 00:16:47 +0200367 }
368 }
369
Andrey Andreev30d53242014-01-16 14:41:46 +0200370 // Did we reset the $e404 flag? If so, set the rsegments, starting from index 1
371 if ( ! $e404)
372 {
373 $class = $error_class;
374 $method = $error_method;
375
376 $URI->rsegments = array(
377 1 => $class,
378 2 => $method
379 );
380 }
381 else
382 {
383 show_404($RTR->directory.$class.'/'.$method);
384 }
385 }
386
387 if ($method !== '_remap')
388 {
Andrey Andreev38e32f62012-11-03 00:16:47 +0200389 $params = array_slice($URI->rsegments, 2);
390 }
391
Derek Allard2067d1a2008-11-13 22:59:24 +0000392/*
393 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500394 * Is there a "pre_controller" hook?
Derek Allard2067d1a2008-11-13 22:59:24 +0000395 * ------------------------------------------------------
396 */
Andrey Andreeva5dd2972012-03-26 14:43:01 +0300397 $EXT->call_hook('pre_controller');
Derek Allard2067d1a2008-11-13 22:59:24 +0000398
399/*
400 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500401 * Instantiate the requested controller
Derek Allard2067d1a2008-11-13 22:59:24 +0000402 * ------------------------------------------------------
403 */
Derek Jones218876c2010-03-02 13:11:00 -0600404 // Mark a start point so we can benchmark the controller
405 $BM->mark('controller_execution_time_( '.$class.' / '.$method.' )_start');
Barry Mienydd671972010-10-04 16:33:58 +0200406
Derek Jones218876c2010-03-02 13:11:00 -0600407 $CI = new $class();
408
409/*
410 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500411 * Is there a "post_controller_constructor" hook?
Derek Jones218876c2010-03-02 13:11:00 -0600412 * ------------------------------------------------------
413 */
Andrey Andreeva5dd2972012-03-26 14:43:01 +0300414 $EXT->call_hook('post_controller_constructor');
Derek Jones218876c2010-03-02 13:11:00 -0600415
416/*
417 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500418 * Call the requested method
Derek Jones218876c2010-03-02 13:11:00 -0600419 * ------------------------------------------------------
420 */
Andrey Andreev38e32f62012-11-03 00:16:47 +0200421 call_user_func_array(array(&$CI, $method), $params);
Derek Allard2067d1a2008-11-13 22:59:24 +0000422
Derek Jones218876c2010-03-02 13:11:00 -0600423 // Mark a benchmark end point
424 $BM->mark('controller_execution_time_( '.$class.' / '.$method.' )_end');
Derek Allard2067d1a2008-11-13 22:59:24 +0000425
426/*
427 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500428 * Is there a "post_controller" hook?
Derek Allard2067d1a2008-11-13 22:59:24 +0000429 * ------------------------------------------------------
430 */
Andrey Andreeva5dd2972012-03-26 14:43:01 +0300431 $EXT->call_hook('post_controller');
Derek Allard2067d1a2008-11-13 22:59:24 +0000432
433/*
434 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500435 * Send the final rendered output to the browser
Derek Allard2067d1a2008-11-13 22:59:24 +0000436 * ------------------------------------------------------
437 */
Andrey Andreeva5dd2972012-03-26 14:43:01 +0300438 if ($EXT->call_hook('display_override') === FALSE)
Derek Jones218876c2010-03-02 13:11:00 -0600439 {
440 $OUT->_display();
441 }
Barry Mienydd671972010-10-04 16:33:58 +0200442
Derek Allard2067d1a2008-11-13 22:59:24 +0000443/*
444 * ------------------------------------------------------
Derek Jones37f4b9c2011-07-01 17:56:50 -0500445 * Is there a "post_system" hook?
Derek Allard2067d1a2008-11-13 22:59:24 +0000446 * ------------------------------------------------------
447 */
Andrey Andreeva5dd2972012-03-26 14:43:01 +0300448 $EXT->call_hook('post_system');
Derek Allard2067d1a2008-11-13 22:59:24 +0000449
Derek Allard2067d1a2008-11-13 22:59:24 +0000450/* End of file CodeIgniter.php */
Andrey Andreevb6fbcbe2013-11-17 18:06:18 +0200451/* Location: ./system/core/CodeIgniter.php */