From b75faa1a03a32330e412f0bd0332fb9fa389e914 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Fri, 27 Apr 2012 12:03:32 -0400 Subject: Fix rest of the helpers --- system/helpers/security_helper.php | 63 +++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 31 deletions(-) (limited to 'system/helpers/security_helper.php') diff --git a/system/helpers/security_helper.php b/system/helpers/security_helper.php index d6f134c9f..6187a4a7a 100644 --- a/system/helpers/security_helper.php +++ b/system/helpers/security_helper.php @@ -37,15 +37,15 @@ // ------------------------------------------------------------------------ -/** - * XSS Filtering - * - * @param string - * @param bool whether or not the content is an image file - * @return string - */ if ( ! function_exists('xss_clean')) { + /** + * XSS Filtering + * + * @param string + * @param bool whether or not the content is an image file + * @return string + */ function xss_clean($str, $is_image = FALSE) { $CI =& get_instance(); @@ -55,14 +55,14 @@ if ( ! function_exists('xss_clean')) // ------------------------------------------------------------------------ -/** - * Sanitize Filename - * - * @param string - * @return string - */ if ( ! function_exists('sanitize_filename')) { + /** + * Sanitize Filename + * + * @param string + * @return string + */ function sanitize_filename($filename) { $CI =& get_instance(); @@ -72,14 +72,15 @@ if ( ! function_exists('sanitize_filename')) // -------------------------------------------------------------------- -/** - * Hash encode a string - * - * @param string - * @return string - */ if ( ! function_exists('do_hash')) { + /** + * Hash encode a string + * + * @param string + * @param string + * @return string + */ function do_hash($str, $type = 'sha1') { if ( ! in_array(strtolower($type), hash_algos())) @@ -93,14 +94,14 @@ if ( ! function_exists('do_hash')) // ------------------------------------------------------------------------ -/** - * Strip Image Tags - * - * @param string - * @return string - */ if ( ! function_exists('strip_image_tags')) { + /** + * Strip Image Tags + * + * @param string + * @return string + */ function strip_image_tags($str) { return preg_replace(array('##', '##'), '\\1', $str); @@ -109,14 +110,14 @@ if ( ! function_exists('strip_image_tags')) // ------------------------------------------------------------------------ -/** - * Convert PHP tags to entities - * - * @param string - * @return string - */ if ( ! function_exists('encode_php_tags')) { + /** + * Convert PHP tags to entities + * + * @param string + * @return string + */ function encode_php_tags($str) { return str_replace(array(''), array('<?php', '<?PHP', '<?', '?>'), $str); -- cgit v1.2.3-24-g4f1b From 0f0b76980cb07f39b20c8591882aeae3854f016c Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 7 Jun 2012 14:57:04 +0300 Subject: Deprecated do_hash() and read_file() in favor of hash() and file_get_contents() respectively --- system/helpers/security_helper.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'system/helpers/security_helper.php') diff --git a/system/helpers/security_helper.php b/system/helpers/security_helper.php index 6187a4a7a..3e6e91435 100644 --- a/system/helpers/security_helper.php +++ b/system/helpers/security_helper.php @@ -77,6 +77,9 @@ if ( ! function_exists('do_hash')) /** * Hash encode a string * + * This function is DEPRECATED and should be removed in + * CodeIgniter 3.1+. Use hash() instead. + * * @param string * @param string * @return string -- cgit v1.2.3-24-g4f1b From e446ad337945b7839b73f13531b21ed16ece241e Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 15 Jun 2012 15:23:41 +0300 Subject: Optimize encode_php_tags() --- system/helpers/security_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers/security_helper.php') diff --git a/system/helpers/security_helper.php b/system/helpers/security_helper.php index 3e6e91435..7fcb18437 100644 --- a/system/helpers/security_helper.php +++ b/system/helpers/security_helper.php @@ -123,7 +123,7 @@ if ( ! function_exists('encode_php_tags')) */ function encode_php_tags($str) { - return str_replace(array(''), array('<?php', '<?PHP', '<?', '?>'), $str); + return str_replace(array(''), array('<?', '?>'), $str); } } -- cgit v1.2.3-24-g4f1b From d1cace76965f71107aca63df1057b98df8d3b85a Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sun, 17 Jun 2012 03:01:00 +0300 Subject: Add deprecated docblock tags for do_hash() and read_file() --- system/helpers/security_helper.php | 1 + 1 file changed, 1 insertion(+) (limited to 'system/helpers/security_helper.php') diff --git a/system/helpers/security_helper.php b/system/helpers/security_helper.php index 7fcb18437..7968f9e9f 100644 --- a/system/helpers/security_helper.php +++ b/system/helpers/security_helper.php @@ -80,6 +80,7 @@ if ( ! function_exists('do_hash')) * This function is DEPRECATED and should be removed in * CodeIgniter 3.1+. Use hash() instead. * + * @deprecated * @param string * @param string * @return string -- cgit v1.2.3-24-g4f1b From 1a24a9da3cfbacf8802ffd0b79f5494d30278007 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 27 Jun 2012 00:52:47 +0300 Subject: Fix issue #427 --- system/helpers/security_helper.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'system/helpers/security_helper.php') 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('##', '##'), '\\1', $str); + $CI =& get_instance(); + return $CI->security->strip_image_tags($str); } } -- cgit v1.2.3-24-g4f1b From 3c298dcf7028ad5e6f9b2da15fa9a07e7da505b9 Mon Sep 17 00:00:00 2001 From: vkeranov Date: Thu, 12 Jul 2012 11:04:02 +0300 Subject: Important space fix :) --- system/helpers/security_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers/security_helper.php') diff --git a/system/helpers/security_helper.php b/system/helpers/security_helper.php index 0e8e9f93d..5ecc960bc 100644 --- a/system/helpers/security_helper.php +++ b/system/helpers/security_helper.php @@ -125,7 +125,7 @@ if ( ! function_exists('encode_php_tags')) */ function encode_php_tags($str) { - return str_replace(array(''), array('<?', '?>'), $str); + return str_replace(array(''), array('<?', '?>'), $str); } } -- cgit v1.2.3-24-g4f1b From 29d909d5d1a14efc2e316650946bf43ddf03f1fd Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 27 Oct 2012 01:05:09 +0300 Subject: [ci skip] Update docblocks for deprecated functions --- system/helpers/security_helper.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'system/helpers/security_helper.php') diff --git a/system/helpers/security_helper.php b/system/helpers/security_helper.php index 5ecc960bc..8bbd06684 100644 --- a/system/helpers/security_helper.php +++ b/system/helpers/security_helper.php @@ -77,12 +77,10 @@ if ( ! function_exists('do_hash')) /** * Hash encode a string * - * This function is DEPRECATED and should be removed in - * CodeIgniter 3.1+. Use hash() instead. - * - * @deprecated - * @param string - * @param string + * @todo Remove in version 3.1+. + * @deprecated 3.0.0 Use PHP's native hash() instead. + * @param string $str + * @param string $type = 'sha1' * @return string */ function do_hash($str, $type = 'sha1') -- cgit v1.2.3-24-g4f1b From c5536aac5752054f7f76e448d58b86407d8f574e Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 1 Nov 2012 17:33:58 +0200 Subject: Manually apply PR #1594 (fixing phpdoc page-level generation/warnings) Also partially fixes issue #1295, fixes inconsistencies in some page-level docblocks and adds include checks in language files. --- system/helpers/security_helper.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'system/helpers/security_helper.php') diff --git a/system/helpers/security_helper.php b/system/helpers/security_helper.php index 8bbd06684..898a49c80 100644 --- a/system/helpers/security_helper.php +++ b/system/helpers/security_helper.php @@ -1,4 +1,4 @@ -