From 910ff7ad430f47ebcf3d801314fcee9a3c10f011 Mon Sep 17 00:00:00 2001 From: Michiel Vugteveen Date: Wed, 6 Jun 2012 20:03:14 +0200 Subject: form_checkbox set_value fix --- system/helpers/form_helper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php index 410972187..04d11837e 100644 --- a/system/helpers/form_helper.php +++ b/system/helpers/form_helper.php @@ -378,7 +378,7 @@ if ( ! function_exists('form_checkbox')) { $checked = $data['checked']; - if ($checked === FALSE) + if ($checked == FALSE) { unset($data['checked']); } @@ -388,7 +388,7 @@ if ( ! function_exists('form_checkbox')) } } - if ($checked === TRUE) + if ($checked == TRUE) { $defaults['checked'] = 'checked'; } -- cgit v1.2.3-24-g4f1b From 9640a037c51c1efea2e64caa974c577dc1594f5d Mon Sep 17 00:00:00 2001 From: Michiel Vugteveen Date: Wed, 6 Jun 2012 20:20:27 +0200 Subject: fixes --- system/helpers/form_helper.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php index 04d11837e..40c7d8823 100644 --- a/system/helpers/form_helper.php +++ b/system/helpers/form_helper.php @@ -325,7 +325,10 @@ if ( ! function_exists('form_dropdown')) $selected = array($_POST[$name]); } - if ($extra !== '') $extra = ' '.$extra; + if ($extra != '') + { + $extra = ' '.$extra; + } $multiple = (count($selected) > 1 && strpos($extra, 'multiple') === FALSE) ? ' multiple="multiple"' : ''; @@ -702,7 +705,7 @@ if ( ! function_exists('set_select')) return ''; } } - elseif (($field === '' OR $value === '') OR ($field !== $value)) + elseif (($field == '' OR $value == '') OR ($field != $value)) { return ''; } @@ -753,7 +756,7 @@ if ( ! function_exists('set_checkbox')) return ''; } } - elseif (($field === '' OR $value === '') OR ($field !== $value)) + elseif (($field == '' OR $value == '') OR ($field != $value)) { return ''; } @@ -806,7 +809,7 @@ if ( ! function_exists('set_radio')) } else { - if (($field === '' OR $value === '') OR ($field !== $value)) + if (($field == '' OR $value == '') OR ($field != $value)) { return ''; } -- cgit v1.2.3-24-g4f1b From a6f3423388c2c51119e71d7aac2917b34911bf5c Mon Sep 17 00:00:00 2001 From: Michiel Vugteveen Date: Thu, 7 Jun 2012 10:14:29 +0200 Subject: fixes --- system/helpers/form_helper.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php index 40c7d8823..984634315 100644 --- a/system/helpers/form_helper.php +++ b/system/helpers/form_helper.php @@ -705,7 +705,7 @@ if ( ! function_exists('set_select')) return ''; } } - elseif (($field == '' OR $value == '') OR ($field != $value)) + elseif (($field == '' OR $value == '') OR $field !== $value) { return ''; } @@ -756,7 +756,7 @@ if ( ! function_exists('set_checkbox')) return ''; } } - elseif (($field == '' OR $value == '') OR ($field != $value)) + elseif (($field == '' OR $value == '') OR $field !== $value) { return ''; } @@ -809,7 +809,7 @@ if ( ! function_exists('set_radio')) } else { - if (($field == '' OR $value == '') OR ($field != $value)) + if (($field == '' OR $value == '') OR $field !== $value) { return ''; } -- cgit v1.2.3-24-g4f1b From c839d28f4230dce0c658338f267b821cc16490a2 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 7 Jun 2012 14:35:27 +0300 Subject: Remove some unnecessary function_exists() checks and some minor improvements --- system/helpers/path_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/path_helper.php b/system/helpers/path_helper.php index 13410545c..fec4a1a10 100644 --- a/system/helpers/path_helper.php +++ b/system/helpers/path_helper.php @@ -55,7 +55,7 @@ if ( ! function_exists('set_realpath')) } // Resolve the path - if (function_exists('realpath') && @realpath($path) !== FALSE) + if (@realpath($path) !== FALSE) { $path = realpath($path); } -- 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/file_helper.php | 31 ++++--------------------------- system/helpers/security_helper.php | 3 +++ 2 files changed, 7 insertions(+), 27 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php index d53d986f9..b717aaa0d 100644 --- a/system/helpers/file_helper.php +++ b/system/helpers/file_helper.php @@ -44,38 +44,15 @@ if ( ! function_exists('read_file')) * * Opens the file specfied in the path and returns it as a string. * + * This function is DEPRECATED and should be removed in + * CodeIgniter 3.1+. Use file_get_contents() instead. + * * @param string path to file * @return string */ function read_file($file) { - if ( ! file_exists($file)) - { - return FALSE; - } - - if (function_exists('file_get_contents')) - { - return file_get_contents($file); - } - - if ( ! $fp = @fopen($file, FOPEN_READ)) - { - return FALSE; - } - - flock($fp, LOCK_SH); - - $data = ''; - if (filesize($file) > 0) - { - $data =& fread($fp, filesize($file)); - } - - flock($fp, LOCK_UN); - fclose($fp); - - return $data; + return file_get_contents($file); } } 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 596c51cdca8d623c96243a81bc5212d34f820a97 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 7 Jun 2012 15:51:58 +0300 Subject: Suppress errors from file_get_contents() in read_file() --- system/helpers/file_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php index b717aaa0d..be616f62d 100644 --- a/system/helpers/file_helper.php +++ b/system/helpers/file_helper.php @@ -52,7 +52,7 @@ if ( ! function_exists('read_file')) */ function read_file($file) { - return file_get_contents($file); + return @file_get_contents($file); } } -- cgit v1.2.3-24-g4f1b