From 41cc0908918f48d948fe1e1fc9c74fdec58b7a60 Mon Sep 17 00:00:00 2001 From: Eric Roberts Date: Tue, 24 Jan 2012 00:59:44 -0600 Subject: Better support for using field names and rule parameters in error messages. --- system/language/english/form_validation_lang.php | 46 ++++++++++++------------ system/libraries/Form_validation.php | 25 +++++++++++-- 2 files changed, 46 insertions(+), 25 deletions(-) (limited to 'system') diff --git a/system/language/english/form_validation_lang.php b/system/language/english/form_validation_lang.php index 6afa37a29..a1e02045f 100644 --- a/system/language/english/form_validation_lang.php +++ b/system/language/english/form_validation_lang.php @@ -25,29 +25,29 @@ * @filesource */ -$lang['required'] = "The %s field is required."; -$lang['isset'] = "The %s field must have a value."; -$lang['valid_email'] = "The %s field must contain a valid email address."; -$lang['valid_emails'] = "The %s field must contain all valid email addresses."; -$lang['valid_url'] = "The %s field must contain a valid URL."; -$lang['valid_ip'] = "The %s field must contain a valid IP."; -$lang['min_length'] = "The %s field must be at least %s characters in length."; -$lang['max_length'] = "The %s field cannot exceed %s characters in length."; -$lang['exact_length'] = "The %s field must be exactly %s characters in length."; -$lang['alpha'] = "The %s field may only contain alphabetical characters."; -$lang['alpha_numeric'] = "The %s field may only contain alpha-numeric characters."; -$lang['alpha_dash'] = "The %s field may only contain alpha-numeric characters, underscores, and dashes."; -$lang['numeric'] = "The %s field must contain only numbers."; -$lang['is_numeric'] = "The %s field must contain only numeric characters."; -$lang['integer'] = "The %s field must contain an integer."; -$lang['regex_match'] = "The %s field is not in the correct format."; -$lang['matches'] = "The %s field does not match the %s field."; -$lang['is_unique'] = "The %s field must contain a unique value."; -$lang['is_natural'] = "The %s field must contain only positive numbers."; -$lang['is_natural_no_zero'] = "The %s field must contain a number greater than zero."; -$lang['decimal'] = "The %s field must contain a decimal number."; -$lang['less_than'] = "The %s field must contain a number less than %s."; -$lang['greater_than'] = "The %s field must contain a number greater than %s."; +$lang['required'] = 'The {field} field is required.'; +$lang['isset'] = 'The {field} field must have a value.'; +$lang['valid_email'] = 'The {field} field must contain a valid email address.'; +$lang['valid_emails'] = 'The {field} field must contain all valid email addresses.'; +$lang['valid_url'] = 'The {field} field must contain a valid URL.'; +$lang['valid_ip'] = 'The {field} field must contain a valid IP.'; +$lang['min_length'] = 'The {field} field must be at least {param} characters in length.'; +$lang['max_length'] = 'The {field} field cannot exceed {param} characters in length.'; +$lang['exact_length'] = 'The {field} field must be exactly {param} characters in length.'; +$lang['alpha'] = 'The {field} field may only contain alphabetical characters.'; +$lang['alpha_numeric'] = 'The {field} field may only contain alpha-numeric characters.'; +$lang['alpha_dash'] = 'The {field} field may only contain alpha-numeric characters, underscores, and dashes.'; +$lang['numeric'] = 'The {field} field must contain only numbers.'; +$lang['is_numeric'] = 'The {field} field must contain only numeric characters.'; +$lang['integer'] = 'The {field} field must contain an integer.'; +$lang['regex_match'] = 'The {field} field is not in the correct format.'; +$lang['matches'] = 'The {field} field does not match the {param} field.'; +$lang['is_unique'] = 'The {field} field must contain a unique value.'; +$lang['is_natural'] = 'The {field} field must contain only positive numbers.'; +$lang['is_natural_no_zero'] = 'The {field} field must contain a number greater than zero.'; +$lang['decimal'] = 'The {field} field must contain a decimal number.'; +$lang['less_than'] = 'The {field} field must contain a number less than {param}.'; +$lang['greater_than'] = 'The {field} field must contain a number greater than {param}.'; /* End of file form_validation_lang.php */ diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index 0a6a2af0d..ebd96e402 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -503,7 +503,7 @@ class CI_Form_validation { } // Build the error message - $message = sprintf($line, $this->_translate_fieldname($row['label'])); + $message = $this->_build_error_msg($line, $this->_translate_fieldname($row['label'])); // Save the error message $this->_field_data[$row['field']]['error'] = $message; @@ -651,7 +651,7 @@ class CI_Form_validation { } // Build the error message - $message = sprintf($line, $this->_translate_fieldname($row['label']), $param); + $message = $this->_build_error_msg($line, $this->_translate_fieldname($row['label']), $param); // Save the error message $this->_field_data[$row['field']]['error'] = $message; @@ -693,6 +693,27 @@ class CI_Form_validation { return $fieldname; } + // -------------------------------------------------------------------- + + /** + * Build an error message using the field and param. + * + * @param string The error message line + * @param string A field's human name + * @param mixed A rule's optional parameter + * @return string + */ + protected function _build_error_msg($line, $field = '', $param = '') + { + // Check for %s in the string for legacy support. + if (strpos($line, '%s') !== false) + { + return sprintf($line, $field, $param); + } + + return str_replace(array('{field}', '{param}'), array($field, $param), $line); + } + // -------------------------------------------------------------------- /** -- cgit v1.2.3-24-g4f1b From b4a294d1f2d93b70059c0c40cf2d32760d3e4bc4 Mon Sep 17 00:00:00 2001 From: Eric Roberts Date: Sat, 14 Apr 2012 17:53:30 -0500 Subject: Fix a merge oopsie in the language file. --- system/language/english/form_validation_lang.php | 28 ------------------------ 1 file changed, 28 deletions(-) (limited to 'system') diff --git a/system/language/english/form_validation_lang.php b/system/language/english/form_validation_lang.php index 36de4c36f..703f2e7bf 100644 --- a/system/language/english/form_validation_lang.php +++ b/system/language/english/form_validation_lang.php @@ -25,7 +25,6 @@ * @filesource */ -<<<<<<< HEAD $lang['required'] = 'The {field} field is required.'; $lang['isset'] = 'The {field} field must have a value.'; $lang['valid_email'] = 'The {field} field must contain a valid email address.'; @@ -49,33 +48,6 @@ $lang['is_natural_no_zero'] = 'The {field} field must contain a number greater t $lang['decimal'] = 'The {field} field must contain a decimal number.'; $lang['less_than'] = 'The {field} field must contain a number less than {param}.'; $lang['greater_than'] = 'The {field} field must contain a number greater than {param}.'; -======= -$lang['required'] = "The %s field is required."; -$lang['isset'] = "The %s field must have a value."; -$lang['valid_email'] = "The %s field must contain a valid email address."; -$lang['valid_emails'] = "The %s field must contain all valid email addresses."; -$lang['valid_url'] = "The %s field must contain a valid URL."; -$lang['valid_ip'] = "The %s field must contain a valid IP."; -$lang['min_length'] = "The %s field must be at least %s characters in length."; -$lang['max_length'] = "The %s field cannot exceed %s characters in length."; -$lang['exact_length'] = "The %s field must be exactly %s characters in length."; -$lang['alpha'] = "The %s field may only contain alphabetical characters."; -$lang['alpha_numeric'] = "The %s field may only contain alpha-numeric characters."; -$lang['alpha_dash'] = "The %s field may only contain alpha-numeric characters, underscores, and dashes."; -$lang['numeric'] = "The %s field must contain only numbers."; -$lang['is_numeric'] = "The %s field must contain only numeric characters."; -$lang['integer'] = "The %s field must contain an integer."; -$lang['regex_match'] = "The %s field is not in the correct format."; -$lang['matches'] = "The %s field does not match the %s field."; -$lang['is_unique'] = "The %s field must contain a unique value."; -$lang['is_natural'] = "The %s field must contain only positive numbers."; -$lang['is_natural_no_zero'] = "The %s field must contain a number greater than zero."; -$lang['decimal'] = "The %s field must contain a decimal number."; -$lang['less_than'] = "The %s field must contain a number less than %s."; -$lang['less_than_equal_to'] = "The %s field must contain a number less than or equal to %s."; -$lang['greater_than'] = "The %s field must contain a number greater than %s."; -$lang['greater_than_equal_to'] = "The %s field must contain a number greater than or equal to %s."; ->>>>>>> 0f2211711deceb74157d6811116acc0376d3157d /* End of file form_validation_lang.php */ -- cgit v1.2.3-24-g4f1b From 0b05705c52c3bca7f9b3aee657c888e8ad1ff422 Mon Sep 17 00:00:00 2001 From: Eric Roberts Date: Sat, 14 Apr 2012 18:04:17 -0500 Subject: Combine this feature with Fix Issue #935 in another pull request. --- system/language/english/form_validation_lang.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system') diff --git a/system/language/english/form_validation_lang.php b/system/language/english/form_validation_lang.php index 703f2e7bf..3d77e5eda 100644 --- a/system/language/english/form_validation_lang.php +++ b/system/language/english/form_validation_lang.php @@ -43,8 +43,8 @@ $lang['integer'] = 'The {field} field must contain an integer.'; $lang['regex_match'] = 'The {field} field is not in the correct format.'; $lang['matches'] = 'The {field} field does not match the {param} field.'; $lang['is_unique'] = 'The {field} field must contain a unique value.'; -$lang['is_natural'] = 'The {field} field must contain only positive numbers.'; -$lang['is_natural_no_zero'] = 'The {field} field must contain a number greater than zero.'; +$lang['is_natural'] = 'The {field} field must contain an ordinary number greater or equal to zero.'; +$lang['is_natural_no_zero'] = 'The {field} field must contain an ordinary number greater than zero.'; $lang['decimal'] = 'The {field} field must contain a decimal number.'; $lang['less_than'] = 'The {field} field must contain a number less than {param}.'; $lang['greater_than'] = 'The {field} field must contain a number greater than {param}.'; -- cgit v1.2.3-24-g4f1b From 24a13f513f8352339647bf34b77d1eecae9d3b6e Mon Sep 17 00:00:00 2001 From: Eric Roberts Date: Wed, 12 Dec 2012 07:09:42 -0600 Subject: Format tweaks Signed-off-by: Eric Roberts --- system/libraries/Form_validation.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system') diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index 19041bd95..ecd5b18df 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -819,7 +819,7 @@ class CI_Form_validation { protected function _build_error_msg($line, $field = '', $param = '') { // Check for %s in the string for legacy support. - if (strpos($line, '%s') !== false) + if (strpos($line, '%s') !== FALSE) { return sprintf($line, $field, $param); } @@ -1489,4 +1489,4 @@ class CI_Form_validation { } /* End of file Form_validation.php */ -/* Location: ./system/libraries/Form_validation.php */ +/* Location: ./system/libraries/Form_validation.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 7728e74f4a51576e988602ba2fa4133c2fed7df2 Mon Sep 17 00:00:00 2001 From: Eric Roberts Date: Wed, 12 Dec 2012 07:12:41 -0600 Subject: Find/replace oopsie. Signed-off-by: Eric Roberts --- system/language/english/form_validation_lang.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system') diff --git a/system/language/english/form_validation_lang.php b/system/language/english/form_validation_lang.php index 47c6bbd76..e22b3562c 100644 --- a/system/language/english/form_validation_lang.php +++ b/system/language/english/form_validation_lang.php @@ -42,8 +42,8 @@ $lang['numeric'] = 'The {field} field must contain only numbers.'; $lang['is_numeric'] = 'The {field} field must contain only numeric characters.'; $lang['integer'] = 'The {field} field must contain an integer.'; $lang['regex_match'] = 'The {field} field is not in the correct format.'; -$lang['matches'] = 'The {field} field does not match The {field} field.'; -$lang['differs'] = 'The {field} field must differ from The {field} field.'; +$lang['matches'] = 'The {field} field does not match the {param} field.'; +$lang['differs'] = 'The {field} field must differ from the {param} field.'; $lang['is_unique'] = 'The {field} field must contain a unique value.'; $lang['is_natural'] = 'The {field} field must only contain digits.'; $lang['is_natural_no_zero'] = 'The {field} field must only contain digits and must be greater than zero.'; -- cgit v1.2.3-24-g4f1b From d4eec9f3638cc31dc8965f929b74a2b3b201b8b7 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 14 Dec 2012 11:07:13 +0200 Subject: Fix issue #539 Form validation language line keys were not prefixed. They are now prefixed with 'form_validation_' in order to avoid collisions. The old keys will still work if a prefixed match is not found, but are DEPRECATED and will be removed in the next major version. Also added upgrade notes and changelog entries for the new error message format from PR #961. --- system/language/english/form_validation_lang.php | 52 ++++++++++++------------ system/libraries/Form_validation.php | 14 +++++-- 2 files changed, 36 insertions(+), 30 deletions(-) (limited to 'system') diff --git a/system/language/english/form_validation_lang.php b/system/language/english/form_validation_lang.php index e22b3562c..a809f1fa8 100644 --- a/system/language/english/form_validation_lang.php +++ b/system/language/english/form_validation_lang.php @@ -26,32 +26,32 @@ */ defined('BASEPATH') OR exit('No direct script access allowed'); -$lang['required'] = 'The {field} field is required.'; -$lang['isset'] = 'The {field} field must have a value.'; -$lang['valid_email'] = 'The {field} field must contain a valid email address.'; -$lang['valid_emails'] = 'The {field} field must contain all valid email addresses.'; -$lang['valid_url'] = 'The {field} field must contain a valid URL.'; -$lang['valid_ip'] = 'The {field} field must contain a valid IP.'; -$lang['min_length'] = 'The {field} field must be at least {param} characters in length.'; -$lang['max_length'] = 'The {field} field cannot exceed {param} characters in length.'; -$lang['exact_length'] = 'The {field} field must be exactly {param} characters in length.'; -$lang['alpha'] = 'The {field} field may only contain alphabetical characters.'; -$lang['alpha_numeric'] = 'The {field} field may only contain alpha-numeric characters.'; -$lang['alpha_dash'] = 'The {field} field may only contain alpha-numeric characters, underscores, and dashes.'; -$lang['numeric'] = 'The {field} field must contain only numbers.'; -$lang['is_numeric'] = 'The {field} field must contain only numeric characters.'; -$lang['integer'] = 'The {field} field must contain an integer.'; -$lang['regex_match'] = 'The {field} field is not in the correct format.'; -$lang['matches'] = 'The {field} field does not match the {param} field.'; -$lang['differs'] = 'The {field} field must differ from the {param} field.'; -$lang['is_unique'] = 'The {field} field must contain a unique value.'; -$lang['is_natural'] = 'The {field} field must only contain digits.'; -$lang['is_natural_no_zero'] = 'The {field} field must only contain digits and must be greater than zero.'; -$lang['decimal'] = 'The {field} field must contain a decimal number.'; -$lang['less_than'] = 'The {field} field must contain a number less than {param}.'; -$lang['less_than_equal_to'] = 'The {field} field must contain a number less than or equal to {param}.'; -$lang['greater_than'] = 'The {field} field must contain a number greater than {param}.'; -$lang['greater_than_equal_to'] = 'The {field} field must contain a number greater than or equal to {param}.'; +$lang['form_validation_required'] = 'The {field} field is required.'; +$lang['form_validation_isset'] = 'The {field} field must have a value.'; +$lang['form_validation_valid_email'] = 'The {field} field must contain a valid email address.'; +$lang['form_validation_valid_emails'] = 'The {field} field must contain all valid email addresses.'; +$lang['form_validation_valid_url'] = 'The {field} field must contain a valid URL.'; +$lang['form_validation_valid_ip'] = 'The {field} field must contain a valid IP.'; +$lang['form_validation_min_length'] = 'The {field} field must be at least {param} characters in length.'; +$lang['form_validation_max_length'] = 'The {field} field cannot exceed {param} characters in length.'; +$lang['form_validation_exact_length'] = 'The {field} field must be exactly {param} characters in length.'; +$lang['form_validation_alpha'] = 'The {field} field may only contain alphabetical characters.'; +$lang['form_validation_alpha_numeric'] = 'The {field} field may only contain alpha-numeric characters.'; +$lang['form_validation_alpha_dash'] = 'The {field} field may only contain alpha-numeric characters, underscores, and dashes.'; +$lang['form_validation_numeric'] = 'The {field} field must contain only numbers.'; +$lang['form_validation_is_numeric'] = 'The {field} field must contain only numeric characters.'; +$lang['form_validation_integer'] = 'The {field} field must contain an integer.'; +$lang['form_validation_regex_match'] = 'The {field} field is not in the correct format.'; +$lang['form_validation_matches'] = 'The {field} field does not match the {param} field.'; +$lang['form_validation_differs'] = 'The {field} field must differ from the {param} field.'; +$lang['form_validation_is_unique'] = 'The {field} field must contain a unique value.'; +$lang['form_validation_is_natural'] = 'The {field} field must only contain digits.'; +$lang['form_validation_is_natural_no_zero'] = 'The {field} field must only contain digits and must be greater than zero.'; +$lang['form_validation_decimal'] = 'The {field} field must contain a decimal number.'; +$lang['form_validation_less_than'] = 'The {field} field must contain a number less than {param}.'; +$lang['form_validation_less_than_equal_to'] = 'The {field} field must contain a number less than or equal to {param}.'; +$lang['form_validation_greater_than'] = 'The {field} field must contain a number greater than {param}.'; +$lang['form_validation_greater_than_equal_to'] = 'The {field} field must contain a number greater than or equal to {param}.'; /* End of file form_validation_lang.php */ /* Location: ./system/language/english/form_validation_lang.php */ \ No newline at end of file diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index ecd5b18df..68534251b 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -609,7 +609,9 @@ class CI_Form_validation { { $line = $this->_error_messages[$type]; } - elseif (FALSE === ($line = $this->CI->lang->line($type))) + elseif (FALSE === ($line = $this->CI->lang->line('form_validation_'.$type)) + // DEPRECATED support for non-prefixed keys + && FALSE === ($line = $this->CI->lang->line($type, FALSE))) { $line = 'The field was not set'; } @@ -749,7 +751,9 @@ class CI_Form_validation { { if ( ! isset($this->_error_messages[$rule])) { - if (FALSE === ($line = $this->CI->lang->line($rule))) + if (FALSE === ($line = $this->CI->lang->line('form_validation_'.$rule)) + // DEPRECATED support for non-prefixed keys + && FALSE === ($line = $this->CI->lang->line($rule, FALSE))) { $line = 'Unable to access an error message corresponding to your field name.'; } @@ -797,7 +801,9 @@ class CI_Form_validation { if (sscanf($fieldname, 'lang:%s', $line) === 1) { // Were we able to translate the field name? If not we use $line - if (FALSE === ($fieldname = $this->CI->lang->line($line))) + if (FALSE === ($fieldname = $this->CI->lang->line('form_validation_'.$line)) + // DEPRECATED support for non-prefixed keys + && FALSE === ($fieldname = $this->CI->lang->line($line, FALSE))) { return $line; } @@ -807,7 +813,7 @@ class CI_Form_validation { } // -------------------------------------------------------------------- - + /** * Build an error message using the field and param. * -- cgit v1.2.3-24-g4f1b From 11dc1398a7fd26e726388b6c0f7057896f7e1d42 Mon Sep 17 00:00:00 2001 From: Will Mendes Date: Fri, 14 Dec 2012 14:52:49 -0200 Subject: Minify output in css and javascript code Minify output in css and javascript code --- system/core/Output.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'system') diff --git a/system/core/Output.php b/system/core/Output.php index 5ec8c4bc0..11f484058 100644 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -693,6 +693,7 @@ class CI_Output { break; case 'text/css': + case 'text/javascript': //Remove CSS comments $output = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $output); @@ -701,11 +702,12 @@ class CI_Output { // semi-colons, parenthesis, commas $output = preg_replace('!\s*(:|;|,|}|{|\(|\))\s*!', '$1', $output); - break; + // Remove spaces + $output = preg_replace('/ /s', ' ', $output); - case 'text/javascript': + // Remove breaklines and tabs + $output = preg_replace('/[\r\n\t]/', '', $output); - // Currently leaves JavaScript untouched. break; default: break; @@ -717,4 +719,4 @@ class CI_Output { } /* End of file Output.php */ -/* Location: ./system/core/Output.php */ \ No newline at end of file +/* Location: ./system/core/Output.php */ -- cgit v1.2.3-24-g4f1b From 5e872505a06da30c4643b99643b39bd650d45093 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 15 Dec 2012 20:59:06 +0200 Subject: Fix #2072 --- system/database/drivers/cubrid/cubrid_forge.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system') diff --git a/system/database/drivers/cubrid/cubrid_forge.php b/system/database/drivers/cubrid/cubrid_forge.php index 2a737c5ed..db1ce5f70 100644 --- a/system/database/drivers/cubrid/cubrid_forge.php +++ b/system/database/drivers/cubrid/cubrid_forge.php @@ -109,7 +109,7 @@ class CI_DB_cubrid_forge extends CI_DB_forge { else { $alter_type = empty($field[$i]['new_name']) ? ' MODIFY ' : ' CHANGE '; - $sqls[] = $sql.$alter_type$this->_process_column($field[$i]); + $sqls[] = $sql.$alter_type.$this->_process_column($field[$i]); } } -- cgit v1.2.3-24-g4f1b From ae6346228e4993367a72f272345325f1ddf93110 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 17 Dec 2012 10:30:18 +0200 Subject: Fix function_usable() --- system/core/Common.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'system') diff --git a/system/core/Common.php b/system/core/Common.php index 7feb16bfd..c7ab387a3 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -681,17 +681,22 @@ if ( ! function_exists('function_usable')) { if ( ! isset($_suhosin_func_blacklist)) { - $_suhosin_func_blacklist = extension_loaded('suhosin') - ? array() - : explode(',', trim(@ini_get('suhosin.executor.func.blacklist'))); + if (extension_loaded('suhosin')) + { + $_suhosin_func_blacklist = explode(',', trim(@ini_get('suhosin.executor.func.blacklist'))); - if ( ! in_array('eval', $_suhosin_func_blacklist, TRUE) && @ini_get('suhosin.executor.disable_eval')) + if ( ! in_array('eval', $_suhosin_func_blacklist, TRUE) && @ini_get('suhosin.executor.disable_eval')) + { + $_suhosin_func_blacklist[] = 'eval'; + } + } + else { - $_suhosin_func_blacklist[] = 'eval'; + $_suhosin_func_blacklist = array(); } } - return in_array($function_name, $_suhosin_func_blacklist, TRUE); + return ! in_array($function_name, $_suhosin_func_blacklist, TRUE); } return FALSE; -- cgit v1.2.3-24-g4f1b From a8e34acb42552b4668b327cc6fcefab5c6d3442b Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 17 Dec 2012 10:39:32 +0200 Subject: Fix #2074 --- system/libraries/Session/drivers/Session_cookie.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system') diff --git a/system/libraries/Session/drivers/Session_cookie.php b/system/libraries/Session/drivers/Session_cookie.php index 6d926ae3d..9392a4dbe 100644 --- a/system/libraries/Session/drivers/Session_cookie.php +++ b/system/libraries/Session/drivers/Session_cookie.php @@ -457,7 +457,7 @@ class CI_Session_cookie extends CI_Session_driver { } // No result? Kill it! - if ($query->num_rows() === 0) + if (empty($query) OR $query->num_rows() === 0) { $this->sess_destroy(); return FALSE; -- cgit v1.2.3-24-g4f1b From 3bc548e2c3be4cc76255a586821edf6d943657fb Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 17 Dec 2012 10:48:02 +0200 Subject: Fix 2073 --- system/libraries/Zip.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system') diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php index 9ecd0de9f..5eb33d29c 100644 --- a/system/libraries/Zip.php +++ b/system/libraries/Zip.php @@ -133,7 +133,7 @@ class CI_Zip { protected function _get_mod_time($dir) { // filemtime() may return false, but raises an error for non-existing files - $date = file_exists($dir) ? filemtime($dir) : getdate($this->now); + $date = file_exists($dir) ? @filemtime($dir) : getdate($this->now); return array( 'file_mtime' => ($date['hours'] << 11) + ($date['minutes'] << 5) + $date['seconds'] / 2, -- cgit v1.2.3-24-g4f1b From 4296a65693504736b5e65bee5b163fa08cacb563 Mon Sep 17 00:00:00 2001 From: Andrew Podner Date: Mon, 17 Dec 2012 07:51:15 -0500 Subject: update for Issue #2064 (changed docblocks which return $this or only call a method that returns $this to @return CI_DB_class_name) --- system/core/Output.php | 16 ++++----- system/core/Security.php | 4 +-- system/database/DB_forge.php | 4 +-- system/database/DB_query_builder.php | 68 ++++++++++++++++++------------------ system/libraries/Email.php | 34 +++++++++--------- system/libraries/Encrypt.php | 6 ++-- system/libraries/Form_validation.php | 8 ++--- system/libraries/Zip.php | 2 +- 8 files changed, 71 insertions(+), 71 deletions(-) (limited to 'system') diff --git a/system/core/Output.php b/system/core/Output.php index 98deff55c..7a7380ce1 100644 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -143,7 +143,7 @@ class CI_Output { * Sets the output string. * * @param string $output Output data - * @return object $this + * @return CI_Output */ public function set_output($output) { @@ -159,7 +159,7 @@ class CI_Output { * Appends data onto the output string. * * @param string $output Data to append - * @return object $this + * @return CI_Output */ public function append_output($output) { @@ -187,7 +187,7 @@ class CI_Output { * * @param string $header Header * @param bool $replace Whether to replace the old header value, if already set - * @return object $this + * @return CI_Output */ public function set_header($header, $replace = TRUE) { @@ -211,7 +211,7 @@ class CI_Output { * * @param string $mime_type Extension of the file we're outputting * @param string $charset Character set (default: NULL) - * @return object $this + * @return CI_Output */ public function set_content_type($mime_type, $charset = NULL) { @@ -308,7 +308,7 @@ class CI_Output { * * @param int $code Status code (default: 200) * @param string $text Optional message - * @return object $this + * @return CI_Output */ public function set_status_header($code = 200, $text = '') { @@ -322,7 +322,7 @@ class CI_Output { * Enable/disable Profiler * * @param bool $val TRUE to enable or FALSE to disable - * @return object $this + * @return CI_Output */ public function enable_profiler($val = TRUE) { @@ -339,7 +339,7 @@ class CI_Output { * Profiler section display. * * @param array $sections Profiler sections - * @return object $this + * @return CI_Output */ public function set_profiler_sections($sections) { @@ -363,7 +363,7 @@ class CI_Output { * Set Cache * * @param int $time Cache expiration time in seconds - * @return object $this + * @return CI_Output */ public function cache($time) { diff --git a/system/core/Security.php b/system/core/Security.php index c415544b6..3bf626635 100644 --- a/system/core/Security.php +++ b/system/core/Security.php @@ -151,7 +151,7 @@ class CI_Security { /** * CSRF Verify * - * @return object + * @return CI_Security */ public function csrf_verify() { @@ -202,7 +202,7 @@ class CI_Security { * CSRF Set Cookie * * @codeCoverageIgnore - * @return object + * @return CI_Security */ public function csrf_set_cookie() { diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php index 59c3baf8b..fd224c469 100644 --- a/system/database/DB_forge.php +++ b/system/database/DB_forge.php @@ -229,7 +229,7 @@ abstract class CI_DB_forge { * * @param string $key * @param bool $primary - * @return object + * @return CI_DB_forge */ public function add_key($key = '', $primary = FALSE) { @@ -266,7 +266,7 @@ abstract class CI_DB_forge { * Add Field * * @param array $field - * @return object + * @return CI_DB_forge */ public function add_field($field = '') { diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php index b0e86ed2c..1aa73baab 100644 --- a/system/database/DB_query_builder.php +++ b/system/database/DB_query_builder.php @@ -254,7 +254,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { * * @param string * @param mixed - * @return object + * @return CI_DB_query_builder */ public function select($select = '*', $escape = NULL) { @@ -296,7 +296,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { * * @param string the field * @param string an alias - * @return object + * @return CI_DB_query_builder */ public function select_max($select = '', $alias = '') { @@ -312,7 +312,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { * * @param string the field * @param string an alias - * @return object + * @return CI_DB_query_builder */ public function select_min($select = '', $alias = '') { @@ -328,7 +328,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { * * @param string the field * @param string an alias - * @return object + * @return CI_DB_query_builder */ public function select_avg($select = '', $alias = '') { @@ -344,7 +344,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { * * @param string the field * @param string an alias - * @return object + * @return CI_DB_query_builder */ public function select_sum($select = '', $alias = '') { @@ -364,7 +364,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { * @param string $select Field name * @param string $alias * @param string $type - * @return object + * @return CI_DB_query_builder */ protected function _max_min_avg_sum($select = '', $alias = '', $type = 'MAX') { @@ -426,7 +426,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { * Sets a flag which tells the query string compiler to add DISTINCT * * @param bool $val - * @return object + * @return CI_DB_query_builder */ public function distinct($val = TRUE) { @@ -442,7 +442,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { * Generates the FROM portion of the query * * @param mixed $from can be a string or array - * @return object + * @return CI_DB_query_builder */ public function from($from) { @@ -496,7 +496,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { * @param string the join condition * @param string the type of join * @param string whether not to try to escape identifiers - * @return object + * @return CI_DB_query_builder */ public function join($table, $cond, $type = '', $escape = NULL) { @@ -584,7 +584,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { * @param mixed * @param mixed * @param bool - * @return object + * @return CI_DB_query_builder */ public function where($key, $value = NULL, $escape = NULL) { @@ -602,7 +602,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { * @param mixed * @param mixed * @param bool - * @return object + * @return CI_DB_query_builder */ public function or_where($key, $value = NULL, $escape = NULL) { @@ -624,7 +624,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { * @param mixed $value * @param string $type * @param bool $escape - * @return object + * @return CI_DB_query_builder */ protected function _wh($qb_key, $key, $value = NULL, $type = 'AND ', $escape = NULL) { @@ -685,7 +685,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { * @param string $key The field to search * @param array $values The values searched on * @param bool $escape - * @return object + * @return CI_DB_query_builder */ public function where_in($key = NULL, $values = NULL, $escape = NULL) { @@ -703,7 +703,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { * @param string $key The field to search * @param array $values The values searched on * @param bool $escape - * @return object + * @return CI_DB_query_builder */ public function or_where_in($key = NULL, $values = NULL, $escape = NULL) { @@ -721,7 +721,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { * @param string $key The field to search * @param array $values The values searched on * @param bool $escape - * @return object + * @return CI_DB_query_builder */ public function where_not_in($key = NULL, $values = NULL, $escape = NULL) { @@ -739,7 +739,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { * @param string $key The field to search * @param array $values The values searched on * @param bool $escape - * @return object + * @return CI_DB_query_builder */ public function or_where_not_in($key = NULL, $values = NULL, $escape = NULL) { @@ -761,7 +761,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { * @param bool $not If the statement would be IN or NOT IN * @param string $type * @param bool $escape - * @return object + * @return CI_DB_query_builder */ protected function _where_in($key = NULL, $values = NULL, $not = FALSE, $type = 'AND ', $escape = NULL) { @@ -813,7 +813,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { * @param string $match * @param string $side * @param bool $escape - * @return object + * @return CI_DB_query_builder */ public function like($field, $match = '', $side = 'both', $escape = NULL) { @@ -832,7 +832,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { * @param string $match * @param string $side * @param bool $escape - * @return object + * @return CI_DB_query_builder */ public function not_like($field, $match = '', $side = 'both', $escape = NULL) { @@ -851,7 +851,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { * @param string $match * @param string $side * @param bool $escape - * @return object + * @return CI_DB_query_builder */ public function or_like($field, $match = '', $side = 'both', $escape = NULL) { @@ -870,7 +870,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { * @param string $match * @param string $side * @param bool $escape - * @return object + * @return CI_DB_query_builder */ public function or_not_like($field, $match = '', $side = 'both', $escape = NULL) { @@ -893,7 +893,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { * @param string $side * @param string $not * @param bool $escape - * @return object + * @return CI_DB_query_builder */ protected function _like($field, $match = '', $type = 'AND ', $side = 'both', $not = '', $escape = NULL) { @@ -952,7 +952,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { * * @param string $not (Internal use only) * @param string $type (Internal use only) - * @return object + * @return CI_DB_query_builder */ public function group_start($not = '', $type = 'AND ') { @@ -979,7 +979,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { /** * Starts a query group, but ORs the group * - * @return object + * @return CI_DB_query_builder */ public function or_group_start() { @@ -991,7 +991,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { /** * Starts a query group, but NOTs the group * - * @return object + * @return CI_DB_query_builder */ public function not_group_start() { @@ -1003,7 +1003,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { /** * Starts a query group, but OR NOTs the group * - * @return object + * @return CI_DB_query_builder */ public function or_not_group_start() { @@ -1015,7 +1015,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { /** * Ends a query group * - * @return object + * @return CI_DB_query_builder */ public function group_end() { @@ -1065,7 +1065,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { * * @param string $by * @param bool $escape - * @return object + * @return CI_DB_query_builder */ public function group_by($by, $escape = NULL) { @@ -1140,7 +1140,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { * @param string $orderby * @param string $direction ASC or DESC * @param bool $escape - * @return object + * @return CI_DB_query_builder */ public function order_by($orderby, $direction = '', $escape = NULL) { @@ -1198,7 +1198,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { * * @param int $value LIMIT value * @param int $offset OFFSET value - * @return object + * @return CI_DB_query_builder */ public function limit($value, $offset = FALSE) { @@ -1214,7 +1214,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { * Sets the OFFSET value * * @param int $offset OFFSET value - * @return object + * @return CI_DB_query_builder */ public function offset($offset) { @@ -1247,7 +1247,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { * @param mixed * @param string * @param bool - * @return object + * @return CI_DB_query_builder */ public function set($key, $value = '', $escape = NULL) { @@ -1469,7 +1469,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { * @param mixed * @param string * @param bool - * @return object + * @return CI_DB_query_builder */ public function set_insert_batch($key, $value = '', $escape = NULL) { @@ -1860,7 +1860,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { * @param array * @param string * @param bool - * @return object + * @return CI_DB_query_builder */ public function set_update_batch($key, $index = '', $escape = NULL) { diff --git a/system/libraries/Email.php b/system/libraries/Email.php index 5d8fc8aea..365a8bc79 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -406,7 +406,7 @@ class CI_Email { * Initialize preferences * * @param array - * @return void + * @return CI_Email */ public function initialize($config = array()) { @@ -440,7 +440,7 @@ class CI_Email { * Initialize the Email Data * * @param bool - * @return object + * @return CI_Email */ public function clear($clear_attachments = FALSE) { @@ -474,7 +474,7 @@ class CI_Email { * @param string $from * @param string $name * @param string $return_path = NULL Return-Path - * @return object + * @return CI_Email */ public function from($from, $name = '', $return_path = NULL) { @@ -522,7 +522,7 @@ class CI_Email { * * @param string * @param string - * @return object + * @return CI_Email */ public function reply_to($replyto, $name = '') { @@ -558,7 +558,7 @@ class CI_Email { * Set Recipients * * @param string - * @return object + * @return CI_Email */ public function to($to) { @@ -586,7 +586,7 @@ class CI_Email { * Set CC * * @param string - * @return object + * @return CI_Email */ public function cc($cc) { @@ -614,7 +614,7 @@ class CI_Email { * * @param string * @param string - * @return object + * @return CI_Email */ public function bcc($bcc, $limit = '') { @@ -649,7 +649,7 @@ class CI_Email { * Set Email Subject * * @param string - * @return object + * @return CI_Email */ public function subject($subject) { @@ -664,7 +664,7 @@ class CI_Email { * Set Body * * @param string - * @return object + * @return CI_Email */ public function message($body) { @@ -693,7 +693,7 @@ class CI_Email { * @param string $disposition = 'attachment' * @param string $newname = NULL * @param string $mime = '' - * @return object + * @return CI_Email */ public function attach($filename, $disposition = '', $newname = NULL, $mime = '') { @@ -746,7 +746,7 @@ class CI_Email { * Set Multipart Value * * @param string - * @return object + * @return CI_Email */ public function set_alt_message($str = '') { @@ -760,7 +760,7 @@ class CI_Email { * Set Mailtype * * @param string - * @return object + * @return CI_Email */ public function set_mailtype($type = 'text') { @@ -774,7 +774,7 @@ class CI_Email { * Set Wordwrap * * @param bool - * @return object + * @return CI_Email */ public function set_wordwrap($wordwrap = TRUE) { @@ -788,7 +788,7 @@ class CI_Email { * Set Protocol * * @param string - * @return object + * @return CI_Email */ public function set_protocol($protocol = 'mail') { @@ -802,7 +802,7 @@ class CI_Email { * Set Priority * * @param int - * @return object + * @return CI_Email */ public function set_priority($n = 3) { @@ -816,7 +816,7 @@ class CI_Email { * Set Newline Character * * @param string - * @return object + * @return CI_Email */ public function set_newline($newline = "\n") { @@ -830,7 +830,7 @@ class CI_Email { * Set CRLF * * @param string - * @return object + * @return CI_Email */ public function set_crlf($crlf = "\n") { diff --git a/system/libraries/Encrypt.php b/system/libraries/Encrypt.php index cdb0a6452..e54ce4950 100644 --- a/system/libraries/Encrypt.php +++ b/system/libraries/Encrypt.php @@ -122,7 +122,7 @@ class CI_Encrypt { * Set the encryption key * * @param string - * @return object + * @return CI_Encrypt */ public function set_key($key = '') { @@ -419,7 +419,7 @@ class CI_Encrypt { * Set the Mcrypt Cipher * * @param int - * @return object + * @return CI_Encrypt */ public function set_cipher($cipher) { @@ -433,7 +433,7 @@ class CI_Encrypt { * Set the Mcrypt Mode * * @param int - * @return object + * @return CI_Encrypt */ public function set_mode($mode) { diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index 68534251b..32f7da1b1 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -149,7 +149,7 @@ class CI_Form_validation { * @param mixed $field * @param string $label * @param mixed $rules - * @return object + * @return CI_Form_validation */ public function set_rules($field, $label = '', $rules = '') { @@ -266,7 +266,7 @@ class CI_Form_validation { * * @param array * @param string - * @return object + * @return CI_Form_validation */ public function set_message($lang, $val = '') { @@ -288,7 +288,7 @@ class CI_Form_validation { * * @param string * @param string - * @return object + * @return CI_Form_validation */ public function set_error_delimiters($prefix = '

', $suffix = '

') { @@ -829,7 +829,7 @@ class CI_Form_validation { { return sprintf($line, $field, $param); } - + return str_replace(array('{field}', '{param}'), array($field, $param), $line); } diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php index 9ecd0de9f..77cc45b38 100644 --- a/system/libraries/Zip.php +++ b/system/libraries/Zip.php @@ -438,7 +438,7 @@ class CI_Zip { * Lets you clear current zip data. Useful if you need to create * multiple zips with different data. * - * @return object + * @return CI_Zip */ public function clear_data() { -- cgit v1.2.3-24-g4f1b From d8dba5d3ecbe1ff4502b04a9cf3086908db140d1 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 17 Dec 2012 15:42:01 +0200 Subject: [ci skip] Fix some spaces --- system/core/Output.php | 2 +- system/database/DB_forge.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'system') diff --git a/system/core/Output.php b/system/core/Output.php index 78eb8c654..0ba0a5743 100644 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -806,4 +806,4 @@ class CI_Output { } /* End of file Output.php */ -/* Location: ./system/core/Output.php */ +/* Location: ./system/core/Output.php */ \ No newline at end of file diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php index fd224c469..5c782f875 100644 --- a/system/database/DB_forge.php +++ b/system/database/DB_forge.php @@ -229,7 +229,7 @@ abstract class CI_DB_forge { * * @param string $key * @param bool $primary - * @return CI_DB_forge + * @return CI_DB_forge */ public function add_key($key = '', $primary = FALSE) { -- cgit v1.2.3-24-g4f1b