diff --git a/index.php b/index.php
index 7c910e1..16084c3 100644
--- a/index.php
+++ b/index.php
@@ -76,6 +76,7 @@
define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
define('BASEPATH', $system_folder.'/');
define('APPPATH', BASEPATH.'application/'.$application_folder);
+define('FCPATH', __FILE__);
require_once BASEPATH.'codeigniter/CodeIgniter'.EXT;
?>
\ No newline at end of file
diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php
index 3bded70..3d8d3e0 100644
--- a/system/helpers/inflector_helper.php
+++ b/system/helpers/inflector_helper.php
@@ -31,7 +31,7 @@
/**
* Singular
*
- * Takes a plural word and makes it singular
+ * Takes a singular word and makes it plural
*
* @access public
* @param string
@@ -64,7 +64,7 @@
/**
* Plural
*
- * Takes a singular word and makes it plural
+ * Takes a plural word and makes it singular
*
* @access public
* @param string
diff --git a/system/libraries/Router.php b/system/libraries/Router.php
index 868fd90..5bbf9e6 100644
--- a/system/libraries/Router.php
+++ b/system/libraries/Router.php
@@ -77,45 +77,18 @@
return;
}
-
- // Load the routes.php file
+
+ // Load the routes.php file and set the default controller
@include_once(APPPATH.'config/routes'.EXT);
$this->routes = ( ! isset($route) OR ! is_array($route)) ? array() : $route;
unset($route);
- // Set the default controller
- $this->default_controller = ( ! isset($this->routes['default_controller']) OR $this->routes['default_controller'] == '') ? FALSE : strtolower($this->routes['default_controller']);
-
- // Fetch the URI string Depending on the server,
- // the URI will be available in one of two globals
- if ($this->config->item('uri_protocol') == 'auto')
- {
- $path_info = getenv('PATH_INFO');
- if ($path_info != '' AND $path_info != "/".SELF)
- {
- $this->uri_string = $path_info;
- }
- else
- {
- $path_info = getenv('ORIG_PATH_INFO');
- if ($path_info != '' AND $path_info != "/".SELF)
- {
- $this->uri_string = $path_info;
- }
- else
- {
- $this->uri_string = getenv('QUERY_STRING');
- }
- }
- }
- else
- {
- $this->uri_string = getenv(strtoupper($this->config->item('uri_protocol')));
- }
-
+ $this->default_controller = ( ! isset($this->routes['default_controller']) OR $this->routes['default_controller'] == '') ? FALSE : strtolower($this->routes['default_controller']);
- // Is there a URI string? If not, the default controller specified
- // by the admin in the "routes" file will be shown.
+ // Get the URI string
+ $this->uri_string = $this->_get_uri_string();
+
+ // Is there a URI string? If not, the default controller specified in the "routes" file will be shown.
if ($this->uri_string == '')
{
if ($this->default_controller === FALSE)
@@ -301,6 +274,103 @@
// --------------------------------------------------------------------
/**
+ * Get the URI String
+ *
+ * @access private
+ * @return string
+ */
+ function _get_uri_string()
+ {
+ if (strtoupper($this->config->item('uri_protocol')) == 'AUTO')
+ {
+ $path_info = getenv('PATH_INFO');
+ if ($path_info != '' AND $path_info != "/".SELF)
+ {
+ return $path_info;
+ }
+ else
+ {
+ $req_uri = $this->_parse_request_uri();
+
+ if ($req_uri != "")
+ {
+ return $req_uri;
+ }
+ else
+ {
+ $path_info = getenv('ORIG_PATH_INFO');
+ if ($path_info != '' AND $path_info != "/".SELF)
+ {
+ return $path_info;
+ }
+ else
+ {
+ return getenv('QUERY_STRING');
+ }
+ }
+ }
+ }
+ else
+ {
+ $uri = strtoupper($this->config->item('uri_protocol'));
+
+ if ($uri == 'REQUEST_URI')
+ {
+ return $this->_parse_request_uri();
+ }
+
+ return getenv($uri);
+ }
+ }
+ // END _get_uri_string()
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Parse the 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
+ * @return string
+ */
+ function _parse_request_uri()
+ {
+ $request_uri = getenv('REQUEST_URI');
+ $fc_path = FCPATH;
+
+ if (strpos($request_uri, '?') !== FALSE)
+ {
+ $fc_path .= '?';
+ }
+
+ $parsed_uri = explode("/", preg_replace("|/(.*)|", "\\1", str_replace("\\", "/", $request_uri)));
+
+ $i = 0;
+ foreach(explode("/", $fc_path) as $segment)
+ {
+ if ($segment == $parsed_uri[$i])
+ {
+ $i++;
+ }
+ }
+
+ $parsed_uri = implode("/", array_slice($parsed_uri, $i));
+
+ if ($parsed_uri != '')
+ {
+ $parsed_uri = '/'.$parsed_uri;
+ }
+
+ return $parsed_uri;
+ }
+ // END _parse_request_uri()
+
+ // --------------------------------------------------------------------
+
+ /**
* Filter segments for malicious characters
*
* @access private
diff --git a/user_guide/general/changelog.html b/user_guide/general/changelog.html
index c769914..7aa7789 100644
--- a/user_guide/general/changelog.html
+++ b/user_guide/general/changelog.html
@@ -78,6 +78,7 @@
<li>Added <dfn>delete_cookie()</dfn> and <dfn>get_cookie()</dfn> to <a href="../helpers/cookie_helper.html">Cookie helper</a>, even though the input class has a cookie fetching function.</li>
<li>Added Oracle database driver (still undergoing testing so it might have some bugs).</li>
<li>Added the ability to combine pseudo-variables and php variables in the template parser class.</li>
+<li>Added output compression option to the config file.</li>
<li>Removed the is_numeric test from the db->escape() function.</li>
<li>Fixed a MySQLi bug that was causing error messages not to contain proper error data.</li>
<li>Fixed a bug in the email class which was causing it to ignore explicitly set alternative headers.</li>
diff --git a/user_guide/helpers/inflector_helper.html b/user_guide/helpers/inflector_helper.html
index 379f56a..fc7e406 100644
--- a/user_guide/helpers/inflector_helper.html
+++ b/user_guide/helpers/inflector_helper.html
@@ -120,7 +120,7 @@
<code>
$word = "my_dog_spot";<br />
-echo humanize($word); // Returns "my dog spot"
+echo humanize($word); // Returns "My Dog Spot"
</code>