diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-03-20 14:33:37 +0100 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-03-20 14:33:37 +0100 |
commit | 838ab99854bc3eb2b9495ce5db92cd6611ef813e (patch) | |
tree | eec6eb0bebe3102512df2f532ae90d8d533ecb69 /system/helpers/security_helper.php | |
parent | 65b568fcd444fbeaf6fa9130289c254e34e5bbbd (diff) | |
parent | 820999cb0d82c80d6dc5dde133568812c8113e29 (diff) |
Merge branch 'develop' of github.com:EllisLab/CodeIgniter into develop-db-driver
Diffstat (limited to 'system/helpers/security_helper.php')
-rw-r--r-- | system/helpers/security_helper.php | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/system/helpers/security_helper.php b/system/helpers/security_helper.php index 99fda561a..8c7adea46 100644 --- a/system/helpers/security_helper.php +++ b/system/helpers/security_helper.php @@ -2,7 +2,7 @@ /** * CodeIgniter * - * An open source application development framework for PHP 5.1.6 or newer + * An open source application development framework for PHP 5.2.4 or newer * * NOTICE OF LICENSE * @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * CodeIgniter Security Helpers * @@ -42,7 +40,6 @@ /** * XSS Filtering * - * @access public * @param string * @param bool whether or not the content is an image file * @return string @@ -61,7 +58,6 @@ if ( ! function_exists('xss_clean')) /** * Sanitize Filename * - * @access public * @param string * @return string */ @@ -79,7 +75,6 @@ if ( ! function_exists('sanitize_filename')) /** * Hash encode a string * - * @access public * @param string * @return string */ @@ -87,7 +82,12 @@ if ( ! function_exists('do_hash')) { function do_hash($str, $type = 'sha1') { - return ($type === 'sha1') ? sha1($str) : md5($str); + if ( ! in_array(strtolower($type), hash_algos())) + { + $type = 'md5'; + } + + return hash($type, $str); } } @@ -96,7 +96,6 @@ if ( ! function_exists('do_hash')) /** * Strip Image Tags * - * @access public * @param string * @return string */ @@ -104,7 +103,7 @@ 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); + return preg_replace(array('#<img\s+.*?src\s*=\s*["\'](.+?)["\'].*?\>#', '#<img\s+.*?src\s*=\s*(.+?).*?\>#'), '\\1', $str); } } @@ -113,7 +112,6 @@ if ( ! function_exists('strip_image_tags')) /** * Convert PHP tags to entities * - * @access public * @param string * @return string */ |