diff options
author | Phil Sturgeon <email@philsturgeon.co.uk> | 2010-12-27 20:06:28 +0100 |
---|---|---|
committer | Phil Sturgeon <email@philsturgeon.co.uk> | 2010-12-27 20:06:28 +0100 |
commit | c8089154217307a56b60ae8f0cb85087a1531b27 (patch) | |
tree | 18ea049c55438a80d9b3465863ff699063a12304 /system/core/URI.php | |
parent | 2280e8ea67f94e67f2c803e804fb1b8125b579b0 (diff) | |
parent | 5cbe4dd1f0d94791fe86e08111b77c1d57b83f54 (diff) |
Implemented GET string support from Dan Horrigan and modified it slightly. Also tweaked his regex_match changes.
Diffstat (limited to 'system/core/URI.php')
-rw-r--r-- | system/core/URI.php | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/system/core/URI.php b/system/core/URI.php index f6487d3f9..047e3c9bc 100644 --- a/system/core/URI.php +++ b/system/core/URI.php @@ -133,23 +133,25 @@ class CI_URI { if (isset($_SERVER['REQUEST_URI'])) { $uri = $_SERVER['REQUEST_URI']; - if (strpos($uri, $_SERVER['HTTP_HOST']) !== FALSE) + if (strpos($uri, $_SERVER['SERVER_NAME']) !== FALSE) { - $uri = preg_replace('/^\w+:\/\/[^\/]+/','',$uri); + $uri = preg_replace('/^\w+:\/\/[^\/]+/', '', $uri); } } + // Now lets check for IIS elseif (isset($_SERVER['HTTP_X_REWRITE_URL'])) { $uri = $_SERVER['HTTP_X_REWRITE_URL']; } + // Last ditch effort (for older CGI servers, like IIS 5) elseif (isset($_SERVER['ORIG_PATH_INFO'])) { $uri = $_SERVER['ORIG_PATH_INFO']; if ( ! empty($_SERVER['QUERY_STRING'])) { - $uri .= '?'.$_SERVER['QUERY_STRING']; + $uri .= '?' . $_SERVER['QUERY_STRING']; } } @@ -173,8 +175,8 @@ class CI_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 = ltrim(FCPATH . SELF, '/'); + if (strpos($uri, SELF . '?') !== FALSE) { $fc_path .= '?'; } @@ -182,7 +184,7 @@ class CI_URI { $parsed_uri = explode('/', ltrim($uri, '/')); $i = 0; - foreach(explode("/", $fc_path) as $segment) + foreach (explode("/", $fc_path) as $segment) { if (isset($parsed_uri[$i]) && $segment == $parsed_uri[$i]) { @@ -203,7 +205,7 @@ class CI_URI { } // If it is just a / or index.php then just empty it. - if ($uri == '/' || $uri == SELF) + if ($uri == '/' OR $uri == SELF) { $uri = ''; } @@ -266,7 +268,7 @@ class CI_URI { */ function _explode_segments() { - foreach(explode("/", preg_replace("|/*(.+?)/*$|", "\\1", $this->uri_string)) as $val) + foreach (explode("/", preg_replace("|/*(.+?)/*$|", "\\1", $this->uri_string)) as $val) { // Filter segments for security $val = trim($this->_filter_uri($val)); |