summaryrefslogtreecommitdiffstats
path: root/system/helpers/url_helper.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2014-01-20 14:03:43 +0100
committerAndrey Andreev <narf@devilix.net>2014-01-20 14:03:43 +0100
commitea801ab4ab80042638ffddc6056483a1ec43fa80 (patch)
treef75f30c0df6a8f861ca7df22af09fa3240b0bbd6 /system/helpers/url_helper.php
parent1c08d557a21ecb0f79cd1a1de4e06817a26e0537 (diff)
parent4d0571666d03511ac5b4a1f2a6882ccb1509a209 (diff)
Merge branch 'develop' into feature/user-guide-cleanup
Diffstat (limited to 'system/helpers/url_helper.php')
-rw-r--r--system/helpers/url_helper.php39
1 files changed, 14 insertions, 25 deletions
diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php
index fbb4a1b24..f9650cd04 100644
--- a/system/helpers/url_helper.php
+++ b/system/helpers/url_helper.php
@@ -52,14 +52,7 @@ if ( ! function_exists('site_url'))
*/
function site_url($uri = '', $protocol = NULL)
{
- $uri = get_instance()->config->site_url($uri);
-
- if (isset($protocol))
- {
- return $protocol.substr($uri, strpos($uri, '://'));
- }
-
- return $uri;
+ return get_instance()->config->site_url($uri, $protocol);
}
}
@@ -80,14 +73,7 @@ if ( ! function_exists('base_url'))
*/
function base_url($uri = '', $protocol = NULL)
{
- $uri = get_instance()->config->base_url($uri);
-
- if (isset($protocol))
- {
- return $protocol.substr($uri, strpos($uri, '://'));
- }
-
- return $uri;
+ return get_instance()->config->base_url($uri, $protocol);
}
}
@@ -123,8 +109,7 @@ if ( ! function_exists('uri_string'))
*/
function uri_string()
{
- $CI =& get_instance();
- return $CI->uri->uri_string();
+ return get_instance()->uri->uri_string();
}
}
@@ -141,8 +126,7 @@ if ( ! function_exists('index_page'))
*/
function index_page()
{
- $CI =& get_instance();
- return $CI->config->item('index_page');
+ return get_instance()->config->item('index_page');
}
}
@@ -548,11 +532,16 @@ if ( ! function_exists('redirect'))
}
elseif ($method !== 'refresh' && (empty($code) OR ! is_numeric($code)))
{
- // Reference: http://en.wikipedia.org/wiki/Post/Redirect/Get
- $code = (isset($_SERVER['REQUEST_METHOD'], $_SERVER['SERVER_PROTOCOL'])
- && $_SERVER['REQUEST_METHOD'] === 'POST'
- && $_SERVER['SERVER_PROTOCOL'] === 'HTTP/1.1')
- ? 303 : 302;
+ if (isset($_SERVER['SERVER_PROTOCOL'], $_SERVER['REQUEST_METHOD']) && $_SERVER['SERVER_PROTOCOL'] === 'HTTP/1.1')
+ {
+ $code = ($_SERVER['REQUEST_METHOD'] !== 'GET')
+ ? 303 // reference: http://en.wikipedia.org/wiki/Post/Redirect/Get
+ : 307;
+ }
+ else
+ {
+ $code = 302;
+ }
}
switch ($method)