summaryrefslogtreecommitdiffstats
path: root/system/helpers
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-06-28 13:08:40 +0200
committerAndrey Andreev <narf@bofh.bg>2012-06-28 13:08:40 +0200
commit89db8ee4c16c5cdd589e51f27fcd3fc23cf41aae (patch)
tree0a667b4e332fe5181bba4531d025740bc892821a /system/helpers
parentcbd78d826b965ad6dfc953686594749cbdf21af3 (diff)
parentd580999cead0aa37d705c2f32e02712a2d522deb (diff)
Merge branch 'develop' of github.com:EllisLab/CodeIgniter into feature/db_subdrivers
Diffstat (limited to 'system/helpers')
-rw-r--r--system/helpers/email_helper.php4
-rw-r--r--system/helpers/security_helper.php3
-rw-r--r--system/helpers/url_helper.php14
3 files changed, 15 insertions, 6 deletions
diff --git a/system/helpers/email_helper.php b/system/helpers/email_helper.php
index 0516e938a..2a63b36c9 100644
--- a/system/helpers/email_helper.php
+++ b/system/helpers/email_helper.php
@@ -45,9 +45,9 @@ if ( ! function_exists('valid_email'))
* @param string
* @return bool
*/
- function valid_email($address)
+ function valid_email($email)
{
- return (bool) preg_match('/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix', $address);
+ return (bool) filter_var($email, FILTER_VALIDATE_EMAIL);
}
}
diff --git a/system/helpers/security_helper.php b/system/helpers/security_helper.php
index 7968f9e9f..0e8e9f93d 100644
--- a/system/helpers/security_helper.php
+++ b/system/helpers/security_helper.php
@@ -108,7 +108,8 @@ if ( ! function_exists('strip_image_tags'))
*/
function strip_image_tags($str)
{
- return preg_replace(array('#<img\s+.*?src\s*=\s*["\'](.+?)["\'].*?\>#', '#<img\s+.*?src\s*=\s*(.+?).*?\>#'), '\\1', $str);
+ $CI =& get_instance();
+ return $CI->security->strip_image_tags($str);
}
}
diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php
index 40ce807df..39e6343a6 100644
--- a/system/helpers/url_helper.php
+++ b/system/helpers/url_helper.php
@@ -526,7 +526,7 @@ if ( ! function_exists('redirect'))
* @param int
* @return string
*/
- function redirect($uri = '', $method = 'auto', $http_response_code = 302)
+ function redirect($uri = '', $method = 'auto', $code = NULL)
{
if ( ! preg_match('#^https?://#i', $uri))
{
@@ -538,14 +538,22 @@ if ( ! function_exists('redirect'))
{
$method = 'refresh';
}
+ 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;
+ }
- switch($method)
+ switch ($method)
{
case 'refresh':
header('Refresh:0;url='.$uri);
break;
default:
- header('Location: '.$uri, TRUE, $http_response_code);
+ header('Location: '.$uri, TRUE, $code);
break;
}
exit;