From 95d78cf4f78c0fb685a789c280d106ab242318ef Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 16 Jun 2012 19:54:33 +0300 Subject: Fix issue #999 --- system/core/Config.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'system/core/Config.php') diff --git a/system/core/Config.php b/system/core/Config.php index 656382716..4b4e5a7ba 100644 --- a/system/core/Config.php +++ b/system/core/Config.php @@ -235,14 +235,26 @@ class CI_Config { return $this->slash_item('base_url').$this->item('index_page'); } + $uri = $this->_uri_string($uri); + if ($this->item('enable_query_strings') === FALSE) { $suffix = ($this->item('url_suffix') === FALSE) ? '' : $this->item('url_suffix'); - return $this->slash_item('base_url').$this->slash_item('index_page').$this->_uri_string($uri).$suffix; + + if ($suffix !== '' && ($offset = strpos($uri, '?')) !== FALSE) + { + $uri = substr($uri, 0, $offset).$suffix.substr($uri, $offset); + } + else + { + $uri .= $suffix; + } + + return $this->slash_item('base_url').$this->slash_item('index_page').$uri; } - elseif (is_array($uri) OR strpos($uri, '?') === FALSE) + elseif (strpos($uri, '?') === FALSE) { - $uri = '?'.$this->_uri_string($uri); + $uri = '?'.$uri; } return $this->slash_item('base_url').$this->item('index_page').$uri; -- cgit v1.2.3-24-g4f1b