summaryrefslogtreecommitdiffstats
path: root/system/core/CodeIgniter.php
diff options
context:
space:
mode:
Diffstat (limited to 'system/core/CodeIgniter.php')
-rw-r--r--[-rwxr-xr-x]system/core/CodeIgniter.php134
1 files changed, 53 insertions, 81 deletions
diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php
index aca4fb23c..8159b19f5 100755..100644
--- a/system/core/CodeIgniter.php
+++ b/system/core/CodeIgniter.php
@@ -1,59 +1,49 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
+ *
+ * NOTICE OF LICENSE
+ *
+ * Licensed under the Open Software License version 3.0
+ *
+ * This source file is subject to the Open Software License (OSL 3.0) that is
+ * bundled with this package in the files license.txt / license.rst. It is
+ * also available through the world wide web at this URL:
+ * http://opensource.org/licenses/OSL-3.0
+ * If you did not receive a copy of the license and are unable to obtain it
+ * through the world wide web, please send an email to
+ * licensing@ellislab.com so we can send you a copy immediately.
*
* @package CodeIgniter
- * @author ExpressionEngine Dev Team
- * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
- * @license http://codeigniter.com/user_guide/license.html
+ * @author EllisLab Dev Team
+ * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
+ * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 1.0
* @filesource
*/
-// ------------------------------------------------------------------------
-
/**
* System Initialization File
*
* Loads the base classes and executes the request.
*
* @package CodeIgniter
- * @subpackage codeigniter
+ * @subpackage CodeIgniter
* @category Front-controller
- * @author ExpressionEngine Dev Team
+ * @author EllisLab Dev Team
* @link http://codeigniter.com/user_guide/
*/
/**
* CodeIgniter Version
*
- * @var string
- *
- */
- /**
- * CodeIgniter Version
- *
- * @var string
- *
- */
- define('CI_VERSION', '2.1.0-dev');
-
-/**
- * CodeIgniter Branch (Core = TRUE, Reactor = FALSE)
- *
- * @var boolean
+ * @var string
*
*/
- /**
- * CodeIgniter Branch (Core = TRUE, Reactor = FALSE)
- *
- * @var string
- *
- */
- define('CI_CORE', FALSE);
+ define('CI_VERSION', '3.0-dev');
/*
* ------------------------------------------------------
@@ -67,7 +57,7 @@
* Load the framework constants
* ------------------------------------------------------
*/
- if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/constants.php'))
+ if (defined('ENVIRONMENT') && file_exists(APPPATH.'config/'.ENVIRONMENT.'/constants.php'))
{
require(APPPATH.'config/'.ENVIRONMENT.'/constants.php');
}
@@ -83,9 +73,9 @@
*/
set_error_handler('_exception_handler');
- if ( ! is_php('5.3'))
+ if ( ! is_php('5.4'))
{
- @set_magic_quotes_runtime(0); // Kill magic quotes
+ @ini_set('magic_quotes_runtime', 0); // Kill magic quotes
}
/*
@@ -99,28 +89,18 @@
* "libraries" folder. Since CI allows config items to be
* overriden via data set in the main index. php file,
* before proceeding we need to know if a subclass_prefix
- * override exists. If so, we will set this value now,
+ * override exists. If so, we will set this value now,
* before any classes are loaded
* Note: Since the config file data is cached it doesn't
* hurt to load it here.
*/
- if (isset($assign_to_config['subclass_prefix']) AND $assign_to_config['subclass_prefix'] != '')
+ if ( ! empty($assign_to_config['subclass_prefix']))
{
get_config(array('subclass_prefix' => $assign_to_config['subclass_prefix']));
}
/*
* ------------------------------------------------------
- * Set a liberal script execution time limit
- * ------------------------------------------------------
- */
- if (function_exists("set_time_limit") == TRUE AND @ini_get("safe_mode") == 0)
- {
- @set_time_limit(300);
- }
-
-/*
- * ------------------------------------------------------
* Start the timer... tick tock tick tock...
* ------------------------------------------------------
*/
@@ -140,7 +120,7 @@
* Is there a "pre_system" hook?
* ------------------------------------------------------
*/
- $EXT->_call_hook('pre_system');
+ $EXT->call_hook('pre_system');
/*
* ------------------------------------------------------
@@ -162,11 +142,10 @@
*
* Note: Order here is rather important as the UTF-8
* class needs to be used very early on, but it cannot
- * properly determine if UTf-8 can be supported until
+ * properly determine if UTF-8 can be supported until
* after the Config class is instantiated.
*
*/
-
$UNI =& load_class('Utf8', 'core');
/*
@@ -199,15 +178,13 @@
/*
* ------------------------------------------------------
- * Is there a valid cache file? If so, we're done...
+ * Is there a valid cache file? If so, we're done...
* ------------------------------------------------------
*/
- if ($EXT->_call_hook('cache_override') === FALSE)
+ if ($EXT->call_hook('cache_override') === FALSE
+ && $OUT->_display_cache($CFG, $URI) === TRUE)
{
- if ($OUT->_display_cache($CFG, $URI) == TRUE)
- {
- exit;
- }
+ exit;
}
/*
@@ -240,6 +217,13 @@
// Load the base controller class
require BASEPATH.'core/Controller.php';
+ /**
+ * Reference to the CI_Controller method.
+ *
+ * Returns current CI instance object
+ *
+ * @return object
+ */
function &get_instance()
{
return CI_Controller::get_instance();
@@ -277,20 +261,20 @@
$method = $RTR->fetch_method();
if ( ! class_exists($class)
- OR strncmp($method, '_', 1) == 0
+ OR strpos($method, '_') === 0
OR in_array(strtolower($method), array_map('strtolower', get_class_methods('CI_Controller')))
)
{
if ( ! empty($RTR->routes['404_override']))
{
- $x = explode('/', $RTR->routes['404_override']);
+ $x = explode('/', $RTR->routes['404_override'], 2);
$class = $x[0];
- $method = (isset($x[1]) ? $x[1] : 'index');
+ $method = isset($x[1]) ? $x[1] : 'index';
if ( ! class_exists($class))
{
if ( ! file_exists(APPPATH.'controllers/'.$class.'.php'))
{
- show_404("{$class}/{$method}");
+ show_404($class.'/'.$method);
}
include_once(APPPATH.'controllers/'.$class.'.php');
@@ -298,7 +282,7 @@
}
else
{
- show_404("{$class}/{$method}");
+ show_404($class.'/'.$method);
}
}
@@ -307,7 +291,7 @@
* Is there a "pre_controller" hook?
* ------------------------------------------------------
*/
- $EXT->_call_hook('pre_controller');
+ $EXT->call_hook('pre_controller');
/*
* ------------------------------------------------------
@@ -324,7 +308,7 @@
* Is there a "post_controller_constructor" hook?
* ------------------------------------------------------
*/
- $EXT->_call_hook('post_controller_constructor');
+ $EXT->call_hook('post_controller_constructor');
/*
* ------------------------------------------------------
@@ -345,14 +329,14 @@
// Check and see if we are using a 404 override and use it.
if ( ! empty($RTR->routes['404_override']))
{
- $x = explode('/', $RTR->routes['404_override']);
+ $x = explode('/', $RTR->routes['404_override'], 2);
$class = $x[0];
- $method = (isset($x[1]) ? $x[1] : 'index');
+ $method = isset($x[1]) ? $x[1] : 'index';
if ( ! class_exists($class))
{
if ( ! file_exists(APPPATH.'controllers/'.$class.'.php'))
{
- show_404("{$class}/{$method}");
+ show_404($class.'/'.$method);
}
include_once(APPPATH.'controllers/'.$class.'.php');
@@ -362,7 +346,7 @@
}
else
{
- show_404("{$class}/{$method}");
+ show_404($class.'/'.$method);
}
}
@@ -371,7 +355,6 @@
call_user_func_array(array(&$CI, $method), array_slice($URI->rsegments, 2));
}
-
// Mark a benchmark end point
$BM->mark('controller_execution_time_( '.$class.' / '.$method.' )_end');
@@ -380,14 +363,14 @@
* Is there a "post_controller" hook?
* ------------------------------------------------------
*/
- $EXT->_call_hook('post_controller');
+ $EXT->call_hook('post_controller');
/*
* ------------------------------------------------------
* Send the final rendered output to the browser
* ------------------------------------------------------
*/
- if ($EXT->_call_hook('display_override') === FALSE)
+ if ($EXT->call_hook('display_override') === FALSE)
{
$OUT->_display();
}
@@ -397,18 +380,7 @@
* Is there a "post_system" hook?
* ------------------------------------------------------
*/
- $EXT->_call_hook('post_system');
-
-/*
- * ------------------------------------------------------
- * Close the DB connection if one exists
- * ------------------------------------------------------
- */
- if (class_exists('CI_DB') AND isset($CI->db))
- {
- $CI->db->close();
- }
-
+ $EXT->call_hook('post_system');
/* End of file CodeIgniter.php */
/* Location: ./system/core/CodeIgniter.php */ \ No newline at end of file