summaryrefslogtreecommitdiffstats
path: root/system/core
diff options
context:
space:
mode:
Diffstat (limited to 'system/core')
-rw-r--r--system/core/Benchmark.php2
-rw-r--r--system/core/CodeIgniter.php22
-rw-r--r--system/core/Common.php2
-rw-r--r--system/core/Config.php5
-rw-r--r--system/core/Controller.php2
-rw-r--r--system/core/Exceptions.php2
-rw-r--r--system/core/Hooks.php2
-rw-r--r--system/core/Input.php22
-rw-r--r--system/core/Lang.php2
-rw-r--r--system/core/Loader.php11
-rw-r--r--system/core/Model.php2
-rw-r--r--system/core/Output.php6
-rw-r--r--system/core/Router.php6
-rw-r--r--system/core/URI.php112
-rw-r--r--system/core/Utf8.php (renamed from system/core/Unicode.php)24
15 files changed, 105 insertions, 117 deletions
diff --git a/system/core/Benchmark.php b/system/core/Benchmark.php
index d0e1fc683..515550e9f 100644
--- a/system/core/Benchmark.php
+++ b/system/core/Benchmark.php
@@ -6,7 +6,7 @@
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
- * @copyright Copyright (c) 2008 - 2010, EllisLab, Inc.
+ * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
* @link http://codeigniter.com
* @since Version 1.0
diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php
index 595e00f27..0414ffbf1 100644
--- a/system/core/CodeIgniter.php
+++ b/system/core/CodeIgniter.php
@@ -6,7 +6,7 @@
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
- * @copyright Copyright (c) 2008 - 2010, EllisLab, Inc.
+ * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
* @link http://codeigniter.com
* @since Version 1.0
@@ -80,7 +80,7 @@
{
get_config(array('subclass_prefix' => $assign_to_config['subclass_prefix']));
}
-
+
/*
* ------------------------------------------------------
* Set a liberal script execution time limit
@@ -129,17 +129,17 @@
/*
* ------------------------------------------------------
- * Instantiate the Unicode class
+ * Instantiate the UTF-8 class
* ------------------------------------------------------
*
- * Note: Order here is rather important as the Unicode
+ * 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
* after the Config class is instantiated.
*
*/
- $UNI =& load_class('Unicode', 'core');
+ $UNI =& load_class('Utf8', 'core');
/*
* ------------------------------------------------------
@@ -289,7 +289,17 @@
// methods, so we'll use this workaround for consistent behavior
if ( ! in_array(strtolower($method), array_map('strtolower', get_class_methods($CI))))
{
- show_404("{$class}/{$method}");
+ // 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']);
+ $class = $x[0];
+ $method = (isset($x[1]) ? $x[1] : 'index');
+ }
+ else
+ {
+ show_404("{$class}/{$method}");
+ }
}
// Call the requested method.
diff --git a/system/core/Common.php b/system/core/Common.php
index 5c441a56e..cd6b93355 100644
--- a/system/core/Common.php
+++ b/system/core/Common.php
@@ -6,7 +6,7 @@
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
- * @copyright Copyright (c) 2008 - 2010, EllisLab, Inc.
+ * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
* @link http://codeigniter.com
* @since Version 1.0
diff --git a/system/core/Config.php b/system/core/Config.php
index d6b97d7ef..da22222dc 100644
--- a/system/core/Config.php
+++ b/system/core/Config.php
@@ -6,7 +6,7 @@
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
- * @copyright Copyright (c) 2008 - 2010, EllisLab, Inc.
+ * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
* @link http://codeigniter.com
* @since Version 1.0
@@ -237,8 +237,9 @@ class CI_Config {
$uri = implode('/', $uri);
}
+ $index = $this->item('index_page') == '' ? '' : $this->slash_item('index_page');
$suffix = ($this->item('url_suffix') == FALSE) ? '' : $this->item('url_suffix');
- return $this->slash_item('base_url').$this->slash_item('index_page').trim($uri, '/').$suffix;
+ return $this->slash_item('base_url').$index.trim($uri, '/').$suffix;
}
else
{
diff --git a/system/core/Controller.php b/system/core/Controller.php
index c78be8724..469663f09 100644
--- a/system/core/Controller.php
+++ b/system/core/Controller.php
@@ -6,7 +6,7 @@
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
- * @copyright Copyright (c) 2008 - 2010, EllisLab, Inc.
+ * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
* @link http://codeigniter.com
* @since Version 1.0
diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php
index 32cb77baf..f5659561c 100644
--- a/system/core/Exceptions.php
+++ b/system/core/Exceptions.php
@@ -6,7 +6,7 @@
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
- * @copyright Copyright (c) 2008 - 2010, EllisLab, Inc.
+ * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
* @link http://codeigniter.com
* @since Version 1.0
diff --git a/system/core/Hooks.php b/system/core/Hooks.php
index 70dc6870b..75fd811b0 100644
--- a/system/core/Hooks.php
+++ b/system/core/Hooks.php
@@ -6,7 +6,7 @@
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
- * @copyright Copyright (c) 2008 - 2010, EllisLab, Inc.
+ * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
* @link http://codeigniter.com
* @since Version 1.0
diff --git a/system/core/Input.php b/system/core/Input.php
index eb2048e58..3e82874fd 100644
--- a/system/core/Input.php
+++ b/system/core/Input.php
@@ -6,7 +6,7 @@
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
- * @copyright Copyright (c) 2008 - 2010, EllisLab, Inc.
+ * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
* @link http://codeigniter.com
* @since Version 1.0
@@ -59,7 +59,7 @@ class CI_Input {
$this->security =& load_class('Security');
}
- // Do we need the Unicode class?
+ // Do we need the UTF-8 class?
if (UTF8_ENABLED === TRUE)
{
global $UNI;
@@ -618,19 +618,33 @@ class CI_Input {
}
// --------------------------------------------------------------------
-
+
/**
* Is ajax Request?
*
* Test to see if a request contains the HTTP_X_REQUESTED_WITH header
*
- * @return boolean
+ * @return boolean
*/
public function is_ajax_request()
{
return ($this->server('HTTP_X_REQUESTED_WITH') === 'XMLHttpRequest');
}
+ // --------------------------------------------------------------------
+
+ /**
+ * Is cli Request?
+ *
+ * Test to see if a request was made from the command line
+ *
+ * @return boolean
+ */
+ public function is_cli_request()
+ {
+ return (bool) defined('STDIN');
+ }
+
}
// END Input class
diff --git a/system/core/Lang.php b/system/core/Lang.php
index 8ec179771..fb177902e 100644
--- a/system/core/Lang.php
+++ b/system/core/Lang.php
@@ -6,7 +6,7 @@
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
- * @copyright Copyright (c) 2008 - 2010, EllisLab, Inc.
+ * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
* @link http://codeigniter.com
* @since Version 1.0
diff --git a/system/core/Loader.php b/system/core/Loader.php
index 640a6302b..ca2f016e7 100644
--- a/system/core/Loader.php
+++ b/system/core/Loader.php
@@ -6,7 +6,7 @@
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
- * @copyright Copyright (c) 2008 - 2010, EllisLab, Inc.
+ * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
* @link http://codeigniter.com
* @since Version 1.0
@@ -982,6 +982,15 @@ class CI_Loader {
return FALSE;
}
+ // Autoload packages
+ if (isset($autoload['packages']))
+ {
+ foreach ($autoload['packages'] as $package_path)
+ {
+ $this->add_package_path($package_path);
+ }
+ }
+
// Load any custom config file
if (count($autoload['config']) > 0)
{
diff --git a/system/core/Model.php b/system/core/Model.php
index 80f4b04a1..8566a0b66 100644
--- a/system/core/Model.php
+++ b/system/core/Model.php
@@ -6,7 +6,7 @@
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
- * @copyright Copyright (c) 2008 - 2010, EllisLab, Inc.
+ * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
* @link http://codeigniter.com
* @since Version 1.0
diff --git a/system/core/Output.php b/system/core/Output.php
index 0b708e110..7fb9f7916 100644
--- a/system/core/Output.php
+++ b/system/core/Output.php
@@ -6,7 +6,7 @@
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
- * @copyright Copyright (c) 2008 - 2010, EllisLab, Inc.
+ * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
* @link http://codeigniter.com
* @since Version 1.0
@@ -347,7 +347,7 @@ class CI_Output {
$CI =& get_instance();
$path = $CI->config->item('cache_path');
- $cache_path = ($path == '') ? BASEPATH.'cache/' : $path;
+ $cache_path = ($path == '') ? APPPATH.'cache/' : $path;
if ( ! is_dir($cache_path) OR ! is_really_writable($cache_path))
{
@@ -395,7 +395,7 @@ class CI_Output {
*/
function _display_cache(&$CFG, &$URI)
{
- $cache_path = ($CFG->item('cache_path') == '') ? BASEPATH.'cache/' : $CFG->item('cache_path');
+ $cache_path = ($CFG->item('cache_path') == '') ? APPPATH.'cache/' : $CFG->item('cache_path');
// Build the file path. The file name is an MD5 hash of the full URI
$uri = $CFG->item('base_url').
diff --git a/system/core/Router.php b/system/core/Router.php
index 79a8b4fcc..6893e6e92 100644
--- a/system/core/Router.php
+++ b/system/core/Router.php
@@ -6,7 +6,7 @@
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
- * @copyright Copyright (c) 2008 - 2010, EllisLab, Inc.
+ * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
* @link http://codeigniter.com
* @since Version 1.0
@@ -144,7 +144,7 @@ class CI_Router {
$this->set_class($x[0]);
$this->set_method($x[1]);
- $this->_set_request(array($x[0], $x[1]));
+ $this->_set_request($x);
}
else
{
@@ -270,7 +270,7 @@ class CI_Router {
// If we've gotten this far it means that the URI does not correlate to a valid
// controller class. We will now see if there is an override
- if (!empty($this->routes['404_override']))
+ if ( ! empty($this->routes['404_override']))
{
$x = explode('/', $this->routes['404_override']);
diff --git a/system/core/URI.php b/system/core/URI.php
index 769dacd09..1b479e92a 100644
--- a/system/core/URI.php
+++ b/system/core/URI.php
@@ -6,7 +6,7 @@
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
- * @copyright Copyright (c) 2008 - 2010, EllisLab, Inc.
+ * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
* @link http://codeigniter.com
* @since Version 1.0
@@ -61,17 +61,17 @@ class CI_URI {
{
if (strtoupper($this->config->item('uri_protocol')) == 'AUTO')
{
- // Let's try the REQUEST_URI first, this will work in most situations
- if ($uri = $this->_get_request_uri())
+ // Is the request coming from the command line?
+ if (defined('STDIN'))
{
- $this->uri_string = $this->_parse_request_uri($uri);
+ $this->uri_string = $this->_parse_cli_args();
return;
}
- // Arguments exist, it must be a command line request
- if ( ! empty($_SERVER['argv']))
+ // Let's try the REQUEST_URI first, this will work in most situations
+ if ($uri = $this->_detect_uri())
{
- $this->uri_string = $this->_parse_cli_args();
+ $this->uri_string = $uri;
return;
}
@@ -108,7 +108,7 @@ class CI_URI {
if ($uri == 'REQUEST_URI')
{
- $this->uri_string = $this->_parse_request_uri($this->_get_request_uri());
+ $this->uri_string = $this->_detect_uri();
return;
}
elseif ($uri == 'CLI')
@@ -130,99 +130,53 @@ class CI_URI {
// --------------------------------------------------------------------
/**
- * Get REQUEST_URI
+ * Detects the URI
*
- * Retrieves the REQUEST_URI, or equivelent for IIS.
+ * This function will detect the URI automatically and fix the query string
+ * if necessary.
*
* @access private
* @return string
*/
- function _get_request_uri()
+ private function _detect_uri()
{
- $uri = FALSE;
-
- // Let's check for standard servers first
- if (isset($_SERVER['REQUEST_URI']))
+ if ( ! isset($_SERVER['REQUEST_URI']))
{
- $uri = $_SERVER['REQUEST_URI'];
- if (strpos($uri, $_SERVER['SERVER_NAME']) !== FALSE)
- {
- $uri = preg_replace('/^\w+:\/\/[^\/]+/', '', $uri);
- }
+ return '';
}
- // Now lets check for IIS
- elseif (isset($_SERVER['HTTP_X_REWRITE_URL']))
+ $uri = $_SERVER['REQUEST_URI'];
+ if (strpos($uri, $_SERVER['SCRIPT_NAME']) === 0)
{
- $uri = $_SERVER['HTTP_X_REWRITE_URL'];
+ $uri = substr($uri, strlen($_SERVER['SCRIPT_NAME']));
}
-
- // Last ditch effort (for older CGI servers, like IIS 5)
- elseif (isset($_SERVER['ORIG_PATH_INFO']))
+ elseif (strpos($uri, dirname($_SERVER['SCRIPT_NAME'])) === 0)
{
- $uri = $_SERVER['ORIG_PATH_INFO'];
- if ( ! empty($_SERVER['QUERY_STRING']))
- {
- $uri .= '?' . $_SERVER['QUERY_STRING'];
- }
+ $uri = substr($uri, strlen(dirname($_SERVER['SCRIPT_NAME'])));
}
- return $uri;
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Parse REQUEST_URI
- *
- * Due to the way REQUEST_URI works it usually contains path info
- * that makes it unusable as URI data. We'll trim off the unnecessary
- * data, hopefully arriving at a valid URI that we can use.
- *
- * @access private
- * @param string
- * @return string
- */
- private function _parse_request_uri($uri)
- {
- // Some server's require URL's like index.php?/whatever If that is the case,
- // then we need to add that to our parsing.
- $fc_path = ltrim(FCPATH . SELF, '/');
- if (strpos($uri, SELF . '?') !== FALSE)
- {
- $fc_path .= '?';
- }
-
- $parsed_uri = explode('/', ltrim($uri, '/'));
-
- $i = 0;
- foreach (explode("/", $fc_path) as $segment)
+ // This section ensures that even on servers that require the URI to be in the query string (Nginx) a correct
+ // URI is found, and also fixes the QUERY_STRING server var and $_GET array.
+ if (strncmp($uri, '?/', 2) === 0)
{
- if (isset($parsed_uri[$i]) && $segment == $parsed_uri[$i])
- {
- $i++;
- }
+ $uri = substr($uri, 2);
}
-
- $uri = implode("/", array_slice($parsed_uri, $i));
-
- // Let's take off any query string and re-assign $_SERVER['QUERY_STRING'] and $_GET.
- // This is only needed on some servers. However, we are forced to use it to accomodate
- // them.
- if (($qs_pos = strpos($uri, '?')) !== FALSE)
+ $parts = preg_split('#\?#i', $uri, 2);
+ $uri = $parts[0];
+ if (isset($parts[1]))
{
- $_SERVER['QUERY_STRING'] = substr($uri, $qs_pos + 1);
+ $_SERVER['QUERY_STRING'] = $parts[1];
parse_str($_SERVER['QUERY_STRING'], $_GET);
- $uri = substr($uri, 0, $qs_pos);
}
-
- // If it is just a / or index.php then just empty it.
- if ($uri == '/' OR $uri == SELF)
+ else
{
- $uri = '';
+ $_SERVER['QUERY_STRING'] = '';
+ $_GET = array();
}
+ $uri = parse_url($uri, PHP_URL_PATH);
- return $uri;
+ // Do some final cleaning of the URI and return it
+ return str_replace(array('//', '../'), '/', trim($uri, '/'));
}
// --------------------------------------------------------------------
diff --git a/system/core/Unicode.php b/system/core/Utf8.php
index ce1de3022..5d5a7ef72 100644
--- a/system/core/Unicode.php
+++ b/system/core/Utf8.php
@@ -6,7 +6,7 @@
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
- * @copyright Copyright (c) 2008 - 2010, EllisLab, Inc.
+ * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
* @link http://codeigniter.com
* @since Version 2.0
@@ -16,17 +16,17 @@
// ------------------------------------------------------------------------
/**
- * Unicode Class
+ * Utf8 Class
*
- * Provides unicode support for UTF-8 environments
+ * Provides support for UTF-8 environments
*
* @package CodeIgniter
* @subpackage Libraries
- * @category Unicode
+ * @category UTF-8
* @author ExpressionEngine Dev Team
- * @link http://codeigniter.com/user_guide/libraries/unicode.html
+ * @link http://codeigniter.com/user_guide/libraries/utf8.html
*/
-class CI_Unicode {
+class CI_Utf8 {
/**
* Constructor
@@ -36,7 +36,7 @@ class CI_Unicode {
*/
function __construct()
{
- log_message('debug', "Unicode Class Initialized");
+ log_message('debug', "Utf8 Class Initialized");
global $CFG;
@@ -47,7 +47,7 @@ class CI_Unicode {
AND $CFG->item('charset') == 'UTF-8' // Application charset must be UTF-8
)
{
- log_message('debug', "Unicode Class - UTF-8 Support Enabled");
+ log_message('debug', "UTF-8 Support Enabled");
define('UTF8_ENABLED', TRUE);
@@ -66,7 +66,7 @@ class CI_Unicode {
}
else
{
- log_message('debug', "Unicode Class - UTF-8 Support Disabled");
+ log_message('debug', "UTF-8 Support Disabled");
define('UTF8_ENABLED', FALSE);
}
}
@@ -159,7 +159,7 @@ class CI_Unicode {
// --------------------------------------------------------------------
}
-// End Unicode Class
+// End Utf8 Class
-/* End of file Unicode.php */
-/* Location: ./system/core/Unicode.php */ \ No newline at end of file
+/* End of file Utf8.php */
+/* Location: ./system/core/Utf8.php */ \ No newline at end of file