summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDerek Jones <derek.jones@ellislab.com>2009-02-10 19:47:47 +0100
committerDerek Jones <derek.jones@ellislab.com>2009-02-10 19:47:47 +0100
commit534be03fdc52bdaeb48ffe89cb6aa042ad1890ad (patch)
tree6139d88256dc80871c345a750f6d2d4f9b5510e5
parentf0bcb3c9c41ba4a7236908e2997eb56109ad9592 (diff)
changed redirect() to only force site_url() when the supplied URL doesn't start with an http protocol, allowing you to use the helper for external URLs.
-rw-r--r--system/helpers/url_helper.php9
-rw-r--r--user_guide/changelog.html1
2 files changed, 8 insertions, 2 deletions
diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php
index 6c3bc837a..5be43300e 100644
--- a/system/helpers/url_helper.php
+++ b/system/helpers/url_helper.php
@@ -528,11 +528,16 @@ if ( ! function_exists('redirect'))
{
function redirect($uri = '', $method = 'location', $http_response_code = 302)
{
+ if ( ! preg_match('#^https?://#i', $uri))
+ {
+ $uri = site_url($uri);
+ }
+
switch($method)
{
- case 'refresh' : header("Refresh:0;url=".site_url($uri));
+ case 'refresh' : header("Refresh:0;url=".$uri);
break;
- default : header("Location: ".site_url($uri), TRUE, $http_response_code);
+ default : header("Location: ".$uri, TRUE, $http_response_code);
break;
}
exit;
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index 7a26cb39a..48f356703 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -84,6 +84,7 @@ SVN Revision: </p>
<li>Added a doctype() function to the <a href="helpers/html_helper.html">HTML helper</a>.</li>
<li>Added ability to force lowercase for <kbd>url_title()</kbd> in the <a href="helpers/url_helper.html">URL helper</a>.</li>
<li>Changed the default "type" of <kbd>form_button()</kbd> to "button" from "submit" in the <a href="helpers/form_helper.html">form helper</a>.</li>
+ <li>Changed redirect() in the URL helper to allow redirections to URLs outside of the CI site.</li>
</ul>
</li>
<li>Other Changes