From c1a66512eacc76968cbf01e2ee37c3c65584b1f0 Mon Sep 17 00:00:00 2001 From: Repox Date: Mon, 23 Apr 2012 13:14:27 +0200 Subject: Corrected the migration_missing_down_method language string --- system/language/english/migration_lang.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/language/english/migration_lang.php b/system/language/english/migration_lang.php index 4763ca243..f17530f00 100644 --- a/system/language/english/migration_lang.php +++ b/system/language/english/migration_lang.php @@ -5,7 +5,7 @@ $lang['migration_not_found'] = "This migration could not be found."; $lang['migration_multiple_version'] = "This are multiple migrations with the same version number: %d."; $lang['migration_class_doesnt_exist'] = "The migration class \"%s\" could not be found."; $lang['migration_missing_up_method'] = "The migration class \"%s\" is missing an 'up' method."; -$lang['migration_missing_down_method'] = "The migration class \"%s\" is missing an 'up' method."; +$lang['migration_missing_down_method'] = "The migration class \"%s\" is missing an 'down' method."; $lang['migration_invalid_filename'] = "Migration \"%s\" has an invalid filename."; -- cgit v1.2.3-24-g4f1b From 5335bc317f07f12c0f0bae5ac9189f75fcad0f1c Mon Sep 17 00:00:00 2001 From: Wes Baker Date: Tue, 24 Apr 2012 15:17:14 -0400 Subject: Updating XSS cleaning to better handle base64 encoded attributes. --- system/core/Security.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/system/core/Security.php b/system/core/Security.php index ac39ce97b..65746637b 100755 --- a/system/core/Security.php +++ b/system/core/Security.php @@ -99,7 +99,8 @@ class CI_Security { 'javascript\s*:', 'expression\s*(\(|&\#40;)', // CSS and IE 'vbscript\s*:', // IE, surprise! - 'Redirect\s+302' + 'Redirect\s+302', + "([\"'])?data\s*:[^\\1]*?base64[^\\1]*?,[^\\1]*?\\1?" ); public function __construct() @@ -362,7 +363,7 @@ class CI_Security { * These words are compacted back to their correct state. */ $words = array( - 'javascript', 'expression', 'vbscript', 'script', + 'javascript', 'expression', 'vbscript', 'script', 'base64', 'applet', 'alert', 'document', 'write', 'cookie', 'window' ); @@ -602,10 +603,11 @@ class CI_Security { $attribs = array(); // find occurrences of illegal attribute strings without quotes - preg_match_all('/('.implode('|', $evil_attributes).')\s*=\s*([^\s]*)/is', $str, $matches, PREG_SET_ORDER); + preg_match_all('/('.implode('|', $evil_attributes).')\s*=\s*([^\s>]*)/is', $str, $matches, PREG_SET_ORDER); foreach ($matches as $attr) { + $attribs[] = preg_quote($attr[0], '/'); } @@ -620,7 +622,7 @@ class CI_Security { // replace illegal attribute strings that are inside an html tag if (count($attribs) > 0) { - $str = preg_replace('/<(\/?[^><]+?)([^A-Za-z\-])('.implode('|', $attribs).')([\s><])([><]*)/i', '<$1$2$4$5', $str, -1, $count); + $str = preg_replace("/<(\/?[^><]+?)([^A-Za-z<>\-])(.*?)(".implode('|', $attribs).")(.*?)([\s><])([><]*)/i", '<$1 $3$5$6$7', $str, -1, $count); } } while ($count); @@ -661,7 +663,7 @@ class CI_Security { protected function _js_link_removal($match) { return str_replace($match[1], - preg_replace('#href=.*?(alert\(|alert&\#40;|javascript\:|livescript\:|mocha\:|charset\=|window\.|document\.|\.cookie|_filter_attributes(str_replace(array('<', '>'), '', $match[1])) ), @@ -801,7 +803,7 @@ class CI_Security { foreach ($this->_never_allowed_regex as $regex) { - $str = preg_replace('#'.$regex.'#i', '[removed]', $str); + $str = preg_replace('#'.$regex.'#is', '[removed]', $str); } return $str; -- cgit v1.2.3-24-g4f1b 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/inflector_helper.php | 98 ++++++------- system/helpers/language_helper.php | 18 +-- system/helpers/number_helper.php | 13 +- system/helpers/path_helper.php | 14 +- system/helpers/security_helper.php | 63 ++++---- system/helpers/smiley_helper.php | 103 ++++++-------- system/helpers/string_helper.php | 204 +++++++++++++------------- system/helpers/text_helper.php | 194 ++++++++++++------------- system/helpers/typography_helper.php | 47 +++--- system/helpers/url_helper.php | 268 ++++++++++++++++++----------------- system/helpers/xml_helper.php | 14 +- 11 files changed, 509 insertions(+), 527 deletions(-) diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php index feeaf57d7..72615671c 100644 --- a/system/helpers/inflector_helper.php +++ b/system/helpers/inflector_helper.php @@ -37,16 +37,16 @@ // -------------------------------------------------------------------- -/** - * Singular - * - * Takes a plural word and makes it singular - * - * @param string - * @return str - */ if ( ! function_exists('singular')) { + /** + * Singular + * + * Takes a plural word and makes it singular + * + * @param string + * @return str + */ function singular($str) { $result = strval($str); @@ -101,17 +101,17 @@ if ( ! function_exists('singular')) // -------------------------------------------------------------------- -/** - * Plural - * - * Takes a singular word and makes it plural - * - * @param string - * @param bool - * @return str - */ if ( ! function_exists('plural')) { + /** + * Plural + * + * Takes a singular word and makes it plural + * + * @param string + * @param bool + * @return str + */ function plural($str, $force = FALSE) { $result = strval($str); @@ -158,16 +158,16 @@ if ( ! function_exists('plural')) // -------------------------------------------------------------------- -/** - * Camelize - * - * Takes multiple words separated by spaces or underscores and camelizes them - * - * @param string - * @return str - */ if ( ! function_exists('camelize')) { + /** + * Camelize + * + * Takes multiple words separated by spaces or underscores and camelizes them + * + * @param string + * @return str + */ function camelize($str) { return strtolower($str[0]).substr(str_replace(' ', '', ucwords(preg_replace('/[\s_]+/', ' ', $str))), 1); @@ -176,16 +176,16 @@ if ( ! function_exists('camelize')) // -------------------------------------------------------------------- -/** - * Underscore - * - * Takes multiple words separated by spaces and underscores them - * - * @param string - * @return str - */ if ( ! function_exists('underscore')) { + /** + * Underscore + * + * Takes multiple words separated by spaces and underscores them + * + * @param string + * @return str + */ function underscore($str) { return preg_replace('/[\s]+/', '_', strtolower(trim($str))); @@ -194,31 +194,33 @@ if ( ! function_exists('underscore')) // -------------------------------------------------------------------- -/** - * Humanize - * - * Takes multiple words separated by the separator and changes them to spaces - * - * @param string $str - * @param string $separator - * @return str - */ if ( ! function_exists('humanize')) { + /** + * Humanize + * + * Takes multiple words separated by the separator and changes them to spaces + * + * @param string $str + * @param string $separator + * @return str + */ function humanize($str, $separator = '_') { return ucwords(preg_replace('/['.$separator.']+/', ' ', strtolower(trim($str)))); } } -/** - * Checks if the given word has a plural version. - * - * @param string the word to check - * @return bool if the word is countable - */ +// -------------------------------------------------------------------- + if ( ! function_exists('is_countable')) { + /** + * Checks if the given word has a plural version. + * + * @param string the word to check + * @return bool if the word is countable + */ function is_countable($word) { return ! in_array(strtolower(strval($word)), diff --git a/system/helpers/language_helper.php b/system/helpers/language_helper.php index b31c97107..34f030716 100644 --- a/system/helpers/language_helper.php +++ b/system/helpers/language_helper.php @@ -37,17 +37,17 @@ // ------------------------------------------------------------------------ -/** - * Lang - * - * Fetches a language variable and optionally outputs a form label - * - * @param string the language line - * @param string the id of the form element - * @return string - */ if ( ! function_exists('lang')) { + /** + * Lang + * + * Fetches a language variable and optionally outputs a form label + * + * @param string the language line + * @param string the id of the form element + * @return string + */ function lang($line, $id = '') { $CI =& get_instance(); diff --git a/system/helpers/number_helper.php b/system/helpers/number_helper.php index 40da6e7bf..2a906ba1b 100644 --- a/system/helpers/number_helper.php +++ b/system/helpers/number_helper.php @@ -37,14 +37,15 @@ // ------------------------------------------------------------------------ -/** - * Formats a numbers as bytes, based on size, and adds the appropriate suffix - * - * @param mixed // will be cast as int - * @return string - */ if ( ! function_exists('byte_format')) { + /** + * Formats a numbers as bytes, based on size, and adds the appropriate suffix + * + * @param mixed // will be cast as int + * @param int + * @return string + */ function byte_format($num, $precision = 1) { $CI =& get_instance(); diff --git a/system/helpers/path_helper.php b/system/helpers/path_helper.php index 6ee99072c..13410545c 100644 --- a/system/helpers/path_helper.php +++ b/system/helpers/path_helper.php @@ -37,15 +37,15 @@ // ------------------------------------------------------------------------ -/** - * Set Realpath - * - * @param string - * @param bool checks to see if the path exists - * @return string - */ if ( ! function_exists('set_realpath')) { + /** + * Set Realpath + * + * @param string + * @param bool checks to see if the path exists + * @return string + */ function set_realpath($path, $check_existance = FALSE) { // Security check to make sure the path is NOT a URL. No remote file inclusion! 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); diff --git a/system/helpers/smiley_helper.php b/system/helpers/smiley_helper.php index 8dba74e73..6b4daf6d9 100644 --- a/system/helpers/smiley_helper.php +++ b/system/helpers/smiley_helper.php @@ -37,18 +37,19 @@ // ------------------------------------------------------------------------ -/** - * Smiley Javascript - * - * Returns the javascript required for the smiley insertion. Optionally takes - * an array of aliases to loosely couple the smiley array to the view. - * - * @param mixed alias name or array of alias->field_id pairs - * @param string field_id if alias name was passed in - * @return array - */ if ( ! function_exists('smiley_js')) { + /** + * Smiley Javascript + * + * Returns the javascript required for the smiley insertion. Optionally takes + * an array of aliases to loosely couple the smiley array to the view. + * + * @param mixed alias name or array of alias->field_id pairs + * @param string field_id if alias name was passed in + * @param bool + * @return array + */ function smiley_js($alias = '', $field_id = '', $inline = TRUE) { static $do_setup = TRUE; @@ -130,17 +131,20 @@ EOF; // ------------------------------------------------------------------------ -/** - * Get Clickable Smileys - * - * Returns an array of image tag links that can be clicked to be inserted - * into a form field. - * - * @param string the URL to the folder containing the smiley images - * @return array - */ + if ( ! function_exists('get_clickable_smileys')) { + /** + * Get Clickable Smileys + * + * Returns an array of image tag links that can be clicked to be inserted + * into a form field. + * + * @param string the URL to the folder containing the smiley images + * @param array + * @param array + * @return array + */ function get_clickable_smileys($image_url, $alias = '', $smileys = NULL) { // For backward compatibility with js_insert_smiley @@ -184,17 +188,18 @@ if ( ! function_exists('get_clickable_smileys')) // ------------------------------------------------------------------------ -/** - * Parse Smileys - * - * Takes a string as input and swaps any contained smileys for the actual image - * - * @param string the text to be parsed - * @param string the URL to the folder containing the smiley images - * @return string - */ if ( ! function_exists('parse_smileys')) { + /** + * Parse Smileys + * + * Takes a string as input and swaps any contained smileys for the actual image + * + * @param string the text to be parsed + * @param string the URL to the folder containing the smiley images + * @param array + * @return string + */ function parse_smileys($str = '', $image_url = '', $smileys = NULL) { if ($image_url == '') @@ -224,15 +229,15 @@ if ( ! function_exists('parse_smileys')) // ------------------------------------------------------------------------ -/** - * Get Smiley Array - * - * Fetches the config/smiley.php file - * - * @return mixed - */ if ( ! function_exists('_get_smiley_array')) { + /** + * Get Smiley Array + * + * Fetches the config/smiley.php file + * + * @return mixed + */ function _get_smiley_array() { if (defined('ENVIRONMENT') && file_exists(APPPATH.'config/'.ENVIRONMENT.'/smileys.php')) @@ -253,33 +258,5 @@ if ( ! function_exists('_get_smiley_array')) } } -// ------------------------------------------------------------------------ - -/** - * JS Insert Smiley - * - * Generates the javascript function needed to insert smileys into a form field - * - * DEPRECATED as of version 1.7.2, use smiley_js instead - * - * @param string form name - * @param string field name - * @return string - */ -if ( ! function_exists('js_insert_smiley')) -{ - function js_insert_smiley($form_name = '', $form_field = '') - { - return << - function insert_smiley(smiley) - { - document.{$form_name}.{$form_field}.value += " " + smiley; - } - -EOF; - } -} - /* End of file smiley_helper.php */ /* Location: ./system/helpers/smiley_helper.php */ \ No newline at end of file diff --git a/system/helpers/string_helper.php b/system/helpers/string_helper.php index aed35c157..b42799a8e 100644 --- a/system/helpers/string_helper.php +++ b/system/helpers/string_helper.php @@ -37,22 +37,22 @@ // ------------------------------------------------------------------------ -/** - * Trim Slashes - * - * Removes any leading/trailing slashes from a string: - * - * /this/that/theother/ - * - * becomes: - * - * this/that/theother - * - * @param string - * @return string - */ if ( ! function_exists('trim_slashes')) { + /** + * Trim Slashes + * + * Removes any leading/trailing slashes from a string: + * + * /this/that/theother/ + * + * becomes: + * + * this/that/theother + * + * @param string + * @return string + */ function trim_slashes($str) { return trim($str, '/'); @@ -61,16 +61,16 @@ if ( ! function_exists('trim_slashes')) // ------------------------------------------------------------------------ -/** - * Strip Slashes - * - * Removes slashes contained in a string or in an array - * - * @param mixed string or array - * @return mixed string or array - */ if ( ! function_exists('strip_slashes')) { + /** + * Strip Slashes + * + * Removes slashes contained in a string or in an array + * + * @param mixed string or array + * @return mixed string or array + */ function strip_slashes($str) { if (is_array($str)) @@ -91,16 +91,16 @@ if ( ! function_exists('strip_slashes')) // ------------------------------------------------------------------------ -/** - * Strip Quotes - * - * Removes single and double quotes from a string - * - * @param string - * @return string - */ if ( ! function_exists('strip_quotes')) { + /** + * Strip Quotes + * + * Removes single and double quotes from a string + * + * @param string + * @return string + */ function strip_quotes($str) { return str_replace(array('"', "'"), '', $str); @@ -109,16 +109,16 @@ if ( ! function_exists('strip_quotes')) // ------------------------------------------------------------------------ -/** - * Quotes to Entities - * - * Converts single and double quotes to entities - * - * @param string - * @return string - */ if ( ! function_exists('quotes_to_entities')) { + /** + * Quotes to Entities + * + * Converts single and double quotes to entities + * + * @param string + * @return string + */ function quotes_to_entities($str) { return str_replace(array("\'","\"","'",'"'), array("'",""","'","""), $str); @@ -127,23 +127,23 @@ if ( ! function_exists('quotes_to_entities')) // ------------------------------------------------------------------------ -/** - * Reduce Double Slashes - * - * Converts double slashes in a string to a single slash, - * except those found in http:// - * - * http://www.some-site.com//index.php - * - * becomes: - * - * http://www.some-site.com/index.php - * - * @param string - * @return string - */ if ( ! function_exists('reduce_double_slashes')) { + /** + * Reduce Double Slashes + * + * Converts double slashes in a string to a single slash, + * except those found in http:// + * + * http://www.some-site.com//index.php + * + * becomes: + * + * http://www.some-site.com/index.php + * + * @param string + * @return string + */ function reduce_double_slashes($str) { return preg_replace('#(^|[^:])//+#', '\\1/', $str); @@ -152,24 +152,24 @@ if ( ! function_exists('reduce_double_slashes')) // ------------------------------------------------------------------------ -/** - * Reduce Multiples - * - * Reduces multiple instances of a particular character. Example: - * - * Fred, Bill,, Joe, Jimmy - * - * becomes: - * - * Fred, Bill, Joe, Jimmy - * - * @param string - * @param string the character you wish to reduce - * @param bool TRUE/FALSE - whether to trim the character from the beginning/end - * @return string - */ if ( ! function_exists('reduce_multiples')) { + /** + * Reduce Multiples + * + * Reduces multiple instances of a particular character. Example: + * + * Fred, Bill,, Joe, Jimmy + * + * becomes: + * + * Fred, Bill, Joe, Jimmy + * + * @param string + * @param string the character you wish to reduce + * @param bool TRUE/FALSE - whether to trim the character from the beginning/end + * @return string + */ function reduce_multiples($str, $character = ',', $trim = FALSE) { $str = preg_replace('#'.preg_quote($character, '#').'{2,}#', $character, $str); @@ -185,17 +185,17 @@ if ( ! function_exists('reduce_multiples')) // ------------------------------------------------------------------------ -/** - * Create a Random String - * - * Useful for generating passwords or hashes. - * - * @param string type of random string. basic, alpha, alunum, numeric, nozero, unique, md5, encrypt and sha1 - * @param int number of characters - * @return string - */ if ( ! function_exists('random_string')) { + /** + * Create a Random String + * + * Useful for generating passwords or hashes. + * + * @param string type of random string. basic, alpha, alunum, numeric, nozero, unique, md5, encrypt and sha1 + * @param int number of characters + * @return string + */ function random_string($type = 'alnum', $len = 8) { switch($type) @@ -242,16 +242,16 @@ if ( ! function_exists('random_string')) // ------------------------------------------------------------------------ -/** - * Add's _1 to a string or increment the ending number to allow _2, _3, etc - * - * @param string required - * @param string What should the duplicate number be appended with - * @param string Which number should be used for the first dupe increment - * @return string - */ if ( ! function_exists('increment_string')) { + /** + * Add's _1 to a string or increment the ending number to allow _2, _3, etc + * + * @param string required + * @param string What should the duplicate number be appended with + * @param string Which number should be used for the first dupe increment + * @return string + */ function increment_string($str, $separator = '_', $first = 1) { preg_match('/(.+)'.$separator.'([0-9]+)$/', $str, $match); @@ -262,17 +262,17 @@ if ( ! function_exists('increment_string')) // ------------------------------------------------------------------------ -/** - * Alternator - * - * Allows strings to be alternated. See docs... - * - * @param string (as many parameters as needed) - * @return string - */ if ( ! function_exists('alternator')) { - function alternator() + /** + * Alternator + * + * Allows strings to be alternated. See docs... + * + * @param string (as many parameters as needed) + * @return string + */ + function alternator($args) { static $i; @@ -288,15 +288,15 @@ if ( ! function_exists('alternator')) // ------------------------------------------------------------------------ -/** - * Repeater function - * - * @param string - * @param int number of repeats - * @return string - */ if ( ! function_exists('repeater')) { + /** + * Repeater function + * + * @param string + * @param int number of repeats + * @return string + */ function repeater($data, $num = 1) { return ($num > 0) ? str_repeat($data, $num) : ''; diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php index cc501c334..f53b06b93 100644 --- a/system/helpers/text_helper.php +++ b/system/helpers/text_helper.php @@ -37,18 +37,18 @@ // ------------------------------------------------------------------------ -/** - * Word Limiter - * - * Limits a string to X number of words. - * - * @param string - * @param int - * @param string the end character. Usually an ellipsis - * @return string - */ if ( ! function_exists('word_limiter')) { + /** + * Word Limiter + * + * Limits a string to X number of words. + * + * @param string + * @param int + * @param string the end character. Usually an ellipsis + * @return string + */ function word_limiter($str, $limit = 100, $end_char = '…') { if (trim($str) == '') @@ -69,19 +69,19 @@ if ( ! function_exists('word_limiter')) // ------------------------------------------------------------------------ -/** - * Character Limiter - * - * Limits the string based on the character count. Preserves complete words - * so the character count may not be exactly as specified. - * - * @param string - * @param int - * @param string the end character. Usually an ellipsis - * @return string - */ if ( ! function_exists('character_limiter')) { + /** + * Character Limiter + * + * Limits the string based on the character count. Preserves complete words + * so the character count may not be exactly as specified. + * + * @param string + * @param int + * @param string the end character. Usually an ellipsis + * @return string + */ function character_limiter($str, $n = 500, $end_char = '…') { if (strlen($str) < $n) @@ -112,16 +112,16 @@ if ( ! function_exists('character_limiter')) // ------------------------------------------------------------------------ -/** - * High ASCII to Entities - * - * Converts High ascii text and MS Word special characters to character entities - * - * @param string - * @return string - */ if ( ! function_exists('ascii_to_entities')) { + /** + * High ASCII to Entities + * + * Converts High ascii text and MS Word special characters to character entities + * + * @param string + * @return string + */ function ascii_to_entities($str) { $count = 1; @@ -172,17 +172,17 @@ if ( ! function_exists('ascii_to_entities')) // ------------------------------------------------------------------------ -/** - * Entities to ASCII - * - * Converts character entities back to ASCII - * - * @param string - * @param bool - * @return string - */ if ( ! function_exists('entities_to_ascii')) { + /** + * Entities to ASCII + * + * Converts character entities back to ASCII + * + * @param string + * @param bool + * @return string + */ function entities_to_ascii($str, $all = TRUE) { if (preg_match_all('/\&#(\d+)\;/', $str, $matches)) @@ -227,20 +227,20 @@ if ( ! function_exists('entities_to_ascii')) // ------------------------------------------------------------------------ -/** - * Word Censoring Function - * - * Supply a string and an array of disallowed words and any - * matched words will be converted to #### or to the replacement - * word you've submitted. - * - * @param string the text string - * @param string the array of censoered words - * @param string the optional replacement value - * @return string - */ if ( ! function_exists('word_censor')) { + /** + * Word Censoring Function + * + * Supply a string and an array of disallowed words and any + * matched words will be converted to #### or to the replacement + * word you've submitted. + * + * @param string the text string + * @param string the array of censoered words + * @param string the optional replacement value + * @return string + */ function word_censor($str, $censored, $replacement = '') { if ( ! is_array($censored)) @@ -274,16 +274,16 @@ if ( ! function_exists('word_censor')) // ------------------------------------------------------------------------ -/** - * Code Highlighter - * - * Colorizes code strings - * - * @param string the text string - * @return string - */ if ( ! function_exists('highlight_code')) { + /** + * Code Highlighter + * + * Colorizes code strings + * + * @param string the text string + * @return string + */ function highlight_code($str) { // The highlight string function encodes and highlights @@ -317,19 +317,19 @@ if ( ! function_exists('highlight_code')) // ------------------------------------------------------------------------ -/** - * Phrase Highlighter - * - * Highlights a phrase within a text string - * - * @param string the text string - * @param string the phrase you'd like to highlight - * @param string the openging tag to precede the phrase with - * @param string the closing tag to end the phrase with - * @return string - */ if ( ! function_exists('highlight_phrase')) { + /** + * Phrase Highlighter + * + * Highlights a phrase within a text string + * + * @param string the text string + * @param string the phrase you'd like to highlight + * @param string the openging tag to precede the phrase with + * @param string the closing tag to end the phrase with + * @return string + */ function highlight_phrase($str, $phrase, $tag_open = '', $tag_close = '') { if ($str == '') @@ -348,14 +348,14 @@ if ( ! function_exists('highlight_phrase')) // ------------------------------------------------------------------------ -/** - * Convert Accented Foreign Characters to ASCII - * - * @param string the text string - * @return string - */ if ( ! function_exists('convert_accented_characters')) { + /** + * Convert Accented Foreign Characters to ASCII + * + * @param string the text string + * @return string + */ function convert_accented_characters($str) { if (defined('ENVIRONMENT') && is_file(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars.php')) @@ -378,19 +378,19 @@ if ( ! function_exists('convert_accented_characters')) // ------------------------------------------------------------------------ -/** - * Word Wrap - * - * Wraps text at the specified character. Maintains the integrity of words. - * Anything placed between {unwrap}{/unwrap} will not be word wrapped, nor - * will URLs. - * - * @param string the text string - * @param int the number of characters to wrap at - * @return string - */ if ( ! function_exists('word_wrap')) { + /** + * Word Wrap + * + * Wraps text at the specified character. Maintains the integrity of words. + * Anything placed between {unwrap}{/unwrap} will not be word wrapped, nor + * will URLs. + * + * @param string the text string + * @param int the number of characters to wrap at + * @return string + */ function word_wrap($str, $charlim = '76') { // Se the character limit @@ -481,19 +481,19 @@ if ( ! function_exists('word_wrap')) // ------------------------------------------------------------------------ -/** - * Ellipsize String - * - * This function will strip tags from a string, split it at its max_length and ellipsize - * - * @param string string to ellipsize - * @param int max length of string - * @param mixed int (1|0) or float, .5, .2, etc for position to split - * @param string ellipsis ; Default '...' - * @return string ellipsized string - */ if ( ! function_exists('ellipsize')) { + /** + * Ellipsize String + * + * This function will strip tags from a string, split it at its max_length and ellipsize + * + * @param string string to ellipsize + * @param int max length of string + * @param mixed int (1|0) or float, .5, .2, etc for position to split + * @param string ellipsis ; Default '...' + * @return string ellipsized string + */ function ellipsize($str, $max_length, $position = 1, $ellipsis = '…') { // Strip tags diff --git a/system/helpers/typography_helper.php b/system/helpers/typography_helper.php index 7a3db5d6b..af9d16a89 100644 --- a/system/helpers/typography_helper.php +++ b/system/helpers/typography_helper.php @@ -37,14 +37,14 @@ // ------------------------------------------------------------------------ -/** - * Convert newlines to HTML line breaks except within PRE tags - * - * @param string - * @return string - */ if ( ! function_exists('nl2br_except_pre')) { + /** + * Convert newlines to HTML line breaks except within PRE tags + * + * @param string + * @return string + */ function nl2br_except_pre($str) { $CI =& get_instance(); @@ -55,16 +55,16 @@ if ( ! function_exists('nl2br_except_pre')) // ------------------------------------------------------------------------ -/** - * Auto Typography Wrapper Function - * - * @param string - * @param bool whether to allow javascript event handlers - * @param bool whether to reduce multiple instances of double newlines to two - * @return string - */ if ( ! function_exists('auto_typography')) { + /** + * Auto Typography Wrapper Function + * + * @param string + * @param bool whether to allow javascript event handlers + * @param bool whether to reduce multiple instances of double newlines to two + * @return string + */ function auto_typography($str, $strip_js_event_handlers = TRUE, $reduce_linebreaks = FALSE) { $CI =& get_instance(); @@ -73,20 +73,19 @@ if ( ! function_exists('auto_typography')) } } - // -------------------------------------------------------------------- -/** - * HTML Entities Decode - * - * This function is a replacement for html_entity_decode() - * - * @param string - * @param string - * @return string - */ if ( ! function_exists('entity_decode')) { + /** + * HTML Entities Decode + * + * This function is a replacement for html_entity_decode() + * + * @param string + * @param string + * @return string + */ function entity_decode($str, $charset = NULL) { global $SEC; diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 5576c2748..fa685645a 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -37,17 +37,17 @@ // ------------------------------------------------------------------------ -/** - * Site URL - * - * Create a local URL based on your basepath. Segments can be passed via the - * first parameter either as a string or an array. - * - * @param string - * @return string - */ if ( ! function_exists('site_url')) { + /** + * Site URL + * + * Create a local URL based on your basepath. Segments can be passed via the + * first parameter either as a string or an array. + * + * @param string + * @return string + */ function site_url($uri = '') { $CI =& get_instance(); @@ -57,18 +57,18 @@ if ( ! function_exists('site_url')) // ------------------------------------------------------------------------ -/** - * Base URL - * - * Create a local URL based on your basepath. - * Segments can be passed in as a string or an array, same as site_url - * or a URL to a file can be passed in, e.g. to an image file. - * - * @param string - * @return string - */ if ( ! function_exists('base_url')) { + /** + * Base URL + * + * Create a local URL based on your basepath. + * Segments can be passed in as a string or an array, same as site_url + * or a URL to a file can be passed in, e.g. to an image file. + * + * @param string + * @return string + */ function base_url($uri = '') { $CI =& get_instance(); @@ -78,16 +78,16 @@ if ( ! function_exists('base_url')) // ------------------------------------------------------------------------ -/** - * Current URL - * - * Returns the full URL (including segments) of the page where this - * function is placed - * - * @return string - */ if ( ! function_exists('current_url')) { + /** + * Current URL + * + * Returns the full URL (including segments) of the page where this + * function is placed + * + * @return string + */ function current_url() { $CI =& get_instance(); @@ -96,15 +96,16 @@ if ( ! function_exists('current_url')) } // ------------------------------------------------------------------------ -/** - * URL String - * - * Returns the URI segments. - * - * @return string - */ + if ( ! function_exists('uri_string')) { + /** + * URL String + * + * Returns the URI segments. + * + * @return string + */ function uri_string() { $CI =& get_instance(); @@ -114,15 +115,15 @@ if ( ! function_exists('uri_string')) // ------------------------------------------------------------------------ -/** - * Index page - * - * Returns the "index_page" from your config file - * - * @return string - */ if ( ! function_exists('index_page')) { + /** + * Index page + * + * Returns the "index_page" from your config file + * + * @return string + */ function index_page() { $CI =& get_instance(); @@ -132,18 +133,18 @@ if ( ! function_exists('index_page')) // ------------------------------------------------------------------------ -/** - * Anchor Link - * - * Creates an anchor based on the local URL. - * - * @param string the URL - * @param string the link title - * @param mixed any attributes - * @return string - */ if ( ! function_exists('anchor')) { + /** + * Anchor Link + * + * Creates an anchor based on the local URL. + * + * @param string the URL + * @param string the link title + * @param mixed any attributes + * @return string + */ function anchor($uri = '', $title = '', $attributes = '') { $title = (string) $title; @@ -173,19 +174,19 @@ if ( ! function_exists('anchor')) // ------------------------------------------------------------------------ -/** - * Anchor Link - Pop-up version - * - * Creates an anchor based on the local URL. The link - * opens a new window based on the attributes specified. - * - * @param string the URL - * @param string the link title - * @param mixed any attributes - * @return string - */ if ( ! function_exists('anchor_popup')) { + /** + * Anchor Link - Pop-up version + * + * Creates an anchor based on the local URL. The link + * opens a new window based on the attributes specified. + * + * @param string the URL + * @param string the link title + * @param mixed any attributes + * @return string + */ function anchor_popup($uri = '', $title = '', $attributes = FALSE) { $title = (string) $title; @@ -223,16 +224,16 @@ if ( ! function_exists('anchor_popup')) // ------------------------------------------------------------------------ -/** - * Mailto Link - * - * @param string the email address - * @param string the link title - * @param mixed any attributes - * @return string - */ if ( ! function_exists('mailto')) { + /** + * Mailto Link + * + * @param string the email address + * @param string the link title + * @param mixed any attributes + * @return string + */ function mailto($email, $title = '', $attributes = '') { $title = (string) $title; @@ -248,18 +249,18 @@ if ( ! function_exists('mailto')) // ------------------------------------------------------------------------ -/** - * Encoded Mailto Link - * - * Create a spam-protected mailto link written in Javascript - * - * @param string the email address - * @param string the link title - * @param mixed any attributes - * @return string - */ if ( ! function_exists('safe_mailto')) { + /** + * Encoded Mailto Link + * + * Create a spam-protected mailto link written in Javascript + * + * @param string the email address + * @param string the link title + * @param mixed any attributes + * @return string + */ function safe_mailto($email, $title = '', $attributes = '') { $title = (string) $title; @@ -357,21 +358,21 @@ if ( ! function_exists('safe_mailto')) // ------------------------------------------------------------------------ -/** - * Auto-linker - * - * Automatically links URL and Email addresses. - * Note: There's a bit of extra code here to deal with - * URLs or emails that end in a period. We'll strip these - * off and add them after the link. - * - * @param string the string - * @param string the type: email, url, or both - * @param bool whether to create pop-up links - * @return string - */ if ( ! function_exists('auto_link')) { + /** + * Auto-linker + * + * Automatically links URL and Email addresses. + * Note: There's a bit of extra code here to deal with + * URLs or emails that end in a period. We'll strip these + * off and add them after the link. + * + * @param string the string + * @param string the type: email, url, or both + * @param bool whether to create pop-up links + * @return string + */ function auto_link($str, $type = 'both', $popup = FALSE) { if ($type !== 'email' && preg_match_all('#(^|\s|\(|\b)((http(s?)://)|(www\.))(\w+[^\s\)\<]+)#i', $str, $matches)) @@ -423,16 +424,16 @@ if ( ! function_exists('auto_link')) // ------------------------------------------------------------------------ -/** - * Prep URL - * - * Simply adds the http:// part if no scheme is included - * - * @param string the URL - * @return string - */ if ( ! function_exists('prep_url')) { + /** + * Prep URL + * + * Simply adds the http:// part if no scheme is included + * + * @param string the URL + * @return string + */ function prep_url($str = '') { if ($str === 'http://' OR $str == '') @@ -453,20 +454,20 @@ if ( ! function_exists('prep_url')) // ------------------------------------------------------------------------ -/** - * Create URL Title - * - * Takes a "title" string as input and creates a - * human-friendly URL string with a "separator" string - * as the word separator. - * - * @param string the string - * @param string the separator - * @param bool - * @return string - */ if ( ! function_exists('url_title')) { + /** + * Create URL Title + * + * Takes a "title" string as input and creates a + * human-friendly URL string with a "separator" string + * as the word separator. + * + * @param string the string + * @param string the separator + * @param bool + * @return string + */ function url_title($str, $separator = '-', $lowercase = FALSE) { if ($separator === 'dash') @@ -504,19 +505,20 @@ if ( ! function_exists('url_title')) // ------------------------------------------------------------------------ -/** - * Header Redirect - * - * Header redirect in two flavors - * For very fine grained control over headers, you could use the Output - * Library's set_header() function. - * - * @param string the URL - * @param string the method: location or refresh - * @return string - */ if ( ! function_exists('redirect')) { + /** + * Header Redirect + * + * Header redirect in two flavors + * For very fine grained control over headers, you could use the Output + * Library's set_header() function. + * + * @param string the URL + * @param string the method: location or refresh + * @param int + * @return string + */ function redirect($uri = '', $method = 'auto', $http_response_code = 302) { if ( ! preg_match('#^https?://#i', $uri)) @@ -545,17 +547,17 @@ if ( ! function_exists('redirect')) // ------------------------------------------------------------------------ -/** - * Parse out the attributes - * - * Some of the functions use this - * - * @param array - * @param bool - * @return string - */ if ( ! function_exists('_parse_attributes')) { + /** + * Parse out the attributes + * + * Some of the functions use this + * + * @param array + * @param bool + * @return string + */ function _parse_attributes($attributes, $javascript = FALSE) { if (is_string($attributes)) diff --git a/system/helpers/xml_helper.php b/system/helpers/xml_helper.php index 67fd34b97..958c633dd 100644 --- a/system/helpers/xml_helper.php +++ b/system/helpers/xml_helper.php @@ -37,15 +37,15 @@ // ------------------------------------------------------------------------ -/** - * Convert Reserved XML characters to Entities - * - * @param string - * @param bool - * @return string - */ if ( ! function_exists('xml_convert')) { + /** + * Convert Reserved XML characters to Entities + * + * @param string + * @param bool + * @return string + */ function xml_convert($str, $protect_all = FALSE) { $temp = '__TEMP_AMPERSANDS__'; -- cgit v1.2.3-24-g4f1b From 3110a0a3cc6b25985acc251799ca9cc97f92ce03 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Wed, 2 May 2012 11:37:31 +0100 Subject: Added a phpDocumenter config file Allows API documentation to be built very easily. Wether or not CodeIgniter will support property docblocks or not is currently in question, but at least everything else will show up. --- phpdoc.dist.xml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 phpdoc.dist.xml diff --git a/phpdoc.dist.xml b/phpdoc.dist.xml new file mode 100644 index 000000000..f1fcc6225 --- /dev/null +++ b/phpdoc.dist.xml @@ -0,0 +1,25 @@ + + + CodeIgniter v3.0.0 API + + ./api/ + + + ./api/ + + + . + ./application/* + ./tests/* + ./user_guide_src/* + ./views/* + + + + warn + + ./api/log/{DATE}.log + ./api/{DATE}.errors.log + + + \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 81aa94bbb533737c19a705d5b8864bd47fbab85c Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Wed, 2 May 2012 11:40:46 +0100 Subject: Reverted rui_string change. This had knock-on effects as can be seen in #1306. Issue #122 has been reopend until it is fixed properly. --- system/core/Router.php | 5 +---- system/core/URI.php | 4 ++-- user_guide_src/source/changelog.rst | 2 ++ 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/system/core/Router.php b/system/core/Router.php index fe9909b06..9314052fe 100755 --- a/system/core/Router.php +++ b/system/core/Router.php @@ -242,12 +242,9 @@ class CI_Router { $segments[1] = 'index'; } - // This is being routed to a file in a sub directory - $this->directory and array_unshift($segments, trim($this->directory, '/')); - // Update our "routed" segment array to contain the segments. // Note: If there is no custom routing, this array will be - // identical to $this->uri->segments + // identical to $this->uri->segments $this->uri->rsegments = $segments; } diff --git a/system/core/URI.php b/system/core/URI.php index 705575a0c..cf82c5838 100755 --- a/system/core/URI.php +++ b/system/core/URI.php @@ -645,10 +645,10 @@ class CI_URI { */ public function ruri_string() { - return implode('/', $this->rsegment_array()); + return '/'.implode('/', $this->rsegment_array()); } } /* End of file URI.php */ -/* Location: ./system/core/URI.php */ \ No newline at end of file +/* Location: ./system/core/URI.php */ diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index bdb418f86..95e32f793 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -204,6 +204,7 @@ Bug fixes for 3.0 - Fixed a bug (#23, #1238) - delete_all() in the `Database Caching Library ` used to delete .htaccess and index.html files, which is a potential security risk. - Fixed a bug in :doc:`Trackback Library ` method validate_url() where it didn't actually do anything, due to input not being passed by reference. - Fixed a bug (#11, #183, #863) - CI_Form_validation::_execute() silently continued to the next rule, if a rule method/function is not found. +<<<<<<< HEAD - Fixed a bug (#122) Where routed uri string was being reported incorrectly in sub-directories - Fixed a bug (#1242) - read_dir() in the :doc:`Zip Library ` wasn't compatible with Windows. - Fixed a bug (#306) - ODBC driver didn't have an _insert_batch() method, which resulted in fatal error being triggered when insert_batch() is used with it. @@ -214,6 +215,7 @@ Bug fixes for 3.0 - Fixed a bug in SQLSRV's delete() method where like() and limit() conditions were ignored. - Fixed a bug (#1265) - Database connections were always closed, regardless of the 'pconnect' option value. - Fixed a bug (#128) - :doc:`Language Library ` did not correctly keep track of loaded language files. +- Fixed a bug (#1242) Added Windows path compatibility to function read_dir of ZIP library Version 2.1.1 ============= -- cgit v1.2.3-24-g4f1b From ee04a913dfd78d394a0e09f01655df0870369512 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 2 May 2012 13:41:23 +0300 Subject: Changelog fix --- user_guide_src/source/changelog.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 95e32f793..bbbe6f718 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -204,7 +204,6 @@ Bug fixes for 3.0 - Fixed a bug (#23, #1238) - delete_all() in the `Database Caching Library ` used to delete .htaccess and index.html files, which is a potential security risk. - Fixed a bug in :doc:`Trackback Library ` method validate_url() where it didn't actually do anything, due to input not being passed by reference. - Fixed a bug (#11, #183, #863) - CI_Form_validation::_execute() silently continued to the next rule, if a rule method/function is not found. -<<<<<<< HEAD - Fixed a bug (#122) Where routed uri string was being reported incorrectly in sub-directories - Fixed a bug (#1242) - read_dir() in the :doc:`Zip Library ` wasn't compatible with Windows. - Fixed a bug (#306) - ODBC driver didn't have an _insert_batch() method, which resulted in fatal error being triggered when insert_batch() is used with it. -- cgit v1.2.3-24-g4f1b From c821a587dce2da70bab3f5955f2b40c6a3c194f5 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Wed, 2 May 2012 10:37:01 -0400 Subject: Fix phpdoc config file --- phpdoc.dist.xml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/phpdoc.dist.xml b/phpdoc.dist.xml index f1fcc6225..6dc58c259 100644 --- a/phpdoc.dist.xml +++ b/phpdoc.dist.xml @@ -8,11 +8,7 @@ ./api/ - . - ./application/* - ./tests/* - ./user_guide_src/* - ./views/* + ./system -- cgit v1.2.3-24-g4f1b From 2d51c08027382cc10692188ccb68789daf2f2083 Mon Sep 17 00:00:00 2001 From: George Petsagourakis Date: Wed, 2 May 2012 20:29:04 +0300 Subject: Fixing some typos. --- system/libraries/Form_validation.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index a52cad5ff..5547c6a69 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -1005,7 +1005,7 @@ class CI_Form_validation { return (MB_ENABLED === TRUE) ? ($val <= mb_strlen($str)) - : ($val <= strlen(str)); + : ($val <= strlen($str)); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 306b378525a13d9c5d1a7f0d6d50c2f263f22a04 Mon Sep 17 00:00:00 2001 From: George Petsagourakis Date: Wed, 2 May 2012 20:31:08 +0300 Subject: Fixing some typos in the xmlrpc class. Also, fputs is an alias for fwrite. --- system/libraries/Xmlrpc.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php index 7009deacc..0d2533855 100644 --- a/system/libraries/Xmlrpc.php +++ b/system/libraries/Xmlrpc.php @@ -436,7 +436,7 @@ class XML_RPC_Client extends CI_Xmlrpc */ public function sendPayload($msg) { - $fp = @fsockopen($this->server, $this->port,$this->errno, $this->errstr, $this->timeout); + $fp = @fsockopen($this->server, $this->port,$this->errno, $this->errstring, $this->timeout); if ( ! is_resource($fp)) { @@ -458,7 +458,7 @@ class XML_RPC_Client extends CI_Xmlrpc .'Content-Length: '.strlen($msg->payload).$r.$r .$msg->payload; - if ( ! fputs($fp, $op, strlen($op))) + if ( ! fwrite($fp, $op, strlen($op))) { error_log($this->xmlrpcstr['http_error']); return new XML_RPC_Response(0, $this->xmlrpcerr['http_error'], $this->xmlrpcstr['http_error']); @@ -1076,7 +1076,7 @@ class XML_RPC_Message extends CI_Xmlrpc // we have an I4/INT // we must check that only 0123456789- are characters here $this->xh[$the_parser]['value'] = preg_match('/^[+-]?[0-9\t ]+$/', $this->xh[$the_parser]['ac']) - ? (int) $this->xh[$the_parset]['ac'] + ? (int) $this->xh[$the_parser]['ac'] : 'ERROR_NON_NUMERIC_FOUND'; } $this->xh[$the_parser]['ac'] = ''; -- cgit v1.2.3-24-g4f1b From 190c6bb125447f83793d9437f1bea28feada910a Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Thu, 3 May 2012 12:13:39 +0700 Subject: Cleaning up --- tests/codeigniter/database/query_builder/insert_test.php | 5 ++--- tests/codeigniter/database/query_builder/select_test.php | 16 ++++++++-------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/tests/codeigniter/database/query_builder/insert_test.php b/tests/codeigniter/database/query_builder/insert_test.php index 53ce23c19..8ba60e242 100644 --- a/tests/codeigniter/database/query_builder/insert_test.php +++ b/tests/codeigniter/database/query_builder/insert_test.php @@ -30,11 +30,10 @@ class Insert_test extends CI_TestCase { // Do normal insert $this->assertTrue($this->db->insert('job', $job_data)); - $jobs = $this->db->get('job')->result_array(); - $job1 = $jobs[0]; + $job1 = $this->db->get('job')->row(); // Check the result - $this->assertEquals('Grocery Sales', $job1['name']); + $this->assertEquals('Grocery Sales', $job1->name); } diff --git a/tests/codeigniter/database/query_builder/select_test.php b/tests/codeigniter/database/query_builder/select_test.php index dbf432a7c..0d299ed16 100644 --- a/tests/codeigniter/database/query_builder/select_test.php +++ b/tests/codeigniter/database/query_builder/select_test.php @@ -41,10 +41,10 @@ class Select_test extends CI_TestCase { { $job_min = $this->db->select_min('id') ->get('job') - ->result_array(); + ->row(); // Minimum id was 1 - $this->assertEquals('1', $job_min[0]['id']); + $this->assertEquals('1', $job_min->id); } // ------------------------------------------------------------------------ @@ -56,10 +56,10 @@ class Select_test extends CI_TestCase { { $job_max = $this->db->select_max('id') ->get('job') - ->result_array(); + ->row(); // Maximum id was 4 - $this->assertEquals('4', $job_max[0]['id']); + $this->assertEquals('4', $job_max->id); } // ------------------------------------------------------------------------ @@ -71,10 +71,10 @@ class Select_test extends CI_TestCase { { $job_avg = $this->db->select_avg('id') ->get('job') - ->result_array(); + ->row(); // Average should be 2.5 - $this->assertEquals('2.5', $job_avg[0]['id']); + $this->assertEquals('2.5', $job_avg->id); } // ------------------------------------------------------------------------ @@ -86,10 +86,10 @@ class Select_test extends CI_TestCase { { $job_sum = $this->db->select_sum('id') ->get('job') - ->result_array(); + ->row(); // Sum of ids should be 10 - $this->assertEquals('10', $job_sum[0]['id']); + $this->assertEquals('10', $job_sum->id); } } \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 6e131cbd0a5243f29a5ad9f56c80715e534e4267 Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Thu, 3 May 2012 12:14:19 +0700 Subject: FROM clause API code-coverage --- .../database/query_builder/from_test.php | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 tests/codeigniter/database/query_builder/from_test.php diff --git a/tests/codeigniter/database/query_builder/from_test.php b/tests/codeigniter/database/query_builder/from_test.php new file mode 100644 index 000000000..95ae4dfdb --- /dev/null +++ b/tests/codeigniter/database/query_builder/from_test.php @@ -0,0 +1,51 @@ +db = Mock_Database_Schema_Skeleton::init(DB_DRIVER); + + Mock_Database_Schema_Skeleton::create_tables(); + Mock_Database_Schema_Skeleton::create_data(); + } + + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_from_simple() + { + $jobs = $this->db->from('job') + ->get() + ->result_array(); + + // Check items + $this->assertEquals(4, count($jobs)); + } + + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_from_with_where() + { + $job1 = $this->db->from('job') + ->where('id', 1) + ->get() + ->row(); + + // Check the result + $this->assertEquals('1', $job1->id); + $this->assertEquals('Developer', $job1->name); + $this->assertEquals('Awesome job, but sometimes makes you bored', $job1->description); + } + +} \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 17f799e1017d1688a2890a1ba78e4f53d80af77e Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Thu, 3 May 2012 15:15:40 +0700 Subject: Add user entity into schema skeleton --- tests/mocks/database/schema/skeleton.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/mocks/database/schema/skeleton.php b/tests/mocks/database/schema/skeleton.php index a3d5bac65..fbd533bfb 100644 --- a/tests/mocks/database/schema/skeleton.php +++ b/tests/mocks/database/schema/skeleton.php @@ -50,6 +50,24 @@ class Mock_Database_Schema_Skeleton { */ public static function create_tables() { + // User Table + static::$forge->add_field(array( + 'id' => array( + 'type' => 'INTEGER', + 'constraint' => 3, + ), + 'name' => array( + 'type' => 'VARCHAR', + 'constraint' => 40, + ), + 'email' => array( + 'type' => 'VARCHAR', + 'constraint' => 100, + ), + )); + static::$forge->add_key('id', TRUE); + static::$forge->create_table('user', (strpos(static::$driver, 'pgsql') === FALSE)); + // Job Table static::$forge->add_field(array( 'id' => array( @@ -77,6 +95,12 @@ class Mock_Database_Schema_Skeleton { { // Job Data $data = array( + 'user' => array( + array('id' => 1, 'name' => 'Derek Jones', 'email' => 'derek@world.com'), + array('id' => 2, 'name' => 'Ahmadinejad', 'email' => 'ahmadinejad@world.com'), + array('id' => 3, 'name' => 'Richard A Causey', 'email' => 'richard@world.com'), + array('id' => 4, 'name' => 'Chris Martin', 'email' => 'chris@world.com'), + ) 'job' => array( array('id' => 1, 'name' => 'Developer', 'description' => 'Awesome job, but sometimes makes you bored'), array('id' => 2, 'name' => 'Politician', 'description' => 'This is not really a job'), -- cgit v1.2.3-24-g4f1b From f074dff71f136860102a6042dccd3ff6db02d9f4 Mon Sep 17 00:00:00 2001 From: ThallisPHP Date: Thu, 3 May 2012 16:01:46 -0300 Subject: Update system/libraries/Cart.php - To enable integrity when using associative arrays --- system/libraries/Cart.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php index eee123584..9f258beb3 100644 --- a/system/libraries/Cart.php +++ b/system/libraries/Cart.php @@ -244,7 +244,7 @@ class CI_Cart { // This becomes the unique "row ID" if (isset($items['options']) && count($items['options']) > 0) { - $rowid = md5($items['id'].implode('', $items['options'])); + $rowid = md5($items['id'].serialize($items['options'])); } else { -- cgit v1.2.3-24-g4f1b From d6b41bb2659f959da01aee0ddb38bb4bce6cd4b6 Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Fri, 4 May 2012 15:05:22 +0700 Subject: JOIN clause API code-coverage --- .../database/query_builder/join_test.php | 38 ++++++++++++++++++++++ tests/mocks/database/schema/skeleton.php | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 tests/codeigniter/database/query_builder/join_test.php diff --git a/tests/codeigniter/database/query_builder/join_test.php b/tests/codeigniter/database/query_builder/join_test.php new file mode 100644 index 000000000..e05329d67 --- /dev/null +++ b/tests/codeigniter/database/query_builder/join_test.php @@ -0,0 +1,38 @@ +db = Mock_Database_Schema_Skeleton::init(DB_DRIVER); + + Mock_Database_Schema_Skeleton::create_tables(); + Mock_Database_Schema_Skeleton::create_data(); + } + + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_join_simple() + { + $job_user = $this->db->select('job.id as job_id, job.name as job_name, user.id as user_id, user.name as user_name') + ->from('job') + ->join('user', 'user.id = job.id') + ->get() + ->result_array(); + + // Check the result + $this->assertEquals('1', $job_user[0]['job_id']); + $this->assertEquals('1', $job_user[0]['user_id']); + $this->assertEquals('Derek Jones', $job_user[0]['user_name']); + $this->assertEquals('Developer', $job_user[0]['job_name']); + } + +} \ No newline at end of file diff --git a/tests/mocks/database/schema/skeleton.php b/tests/mocks/database/schema/skeleton.php index fbd533bfb..9ebd6e85f 100644 --- a/tests/mocks/database/schema/skeleton.php +++ b/tests/mocks/database/schema/skeleton.php @@ -100,7 +100,7 @@ class Mock_Database_Schema_Skeleton { array('id' => 2, 'name' => 'Ahmadinejad', 'email' => 'ahmadinejad@world.com'), array('id' => 3, 'name' => 'Richard A Causey', 'email' => 'richard@world.com'), array('id' => 4, 'name' => 'Chris Martin', 'email' => 'chris@world.com'), - ) + ), 'job' => array( array('id' => 1, 'name' => 'Developer', 'description' => 'Awesome job, but sometimes makes you bored'), array('id' => 2, 'name' => 'Politician', 'description' => 'This is not really a job'), -- cgit v1.2.3-24-g4f1b From 12f5475e2b279d1c2361ad5fc85bc2ba0d0f9033 Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Fri, 4 May 2012 15:46:39 +0700 Subject: WHERE clause API code-coverage --- .../database/query_builder/where_test.php | 144 +++++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 tests/codeigniter/database/query_builder/where_test.php diff --git a/tests/codeigniter/database/query_builder/where_test.php b/tests/codeigniter/database/query_builder/where_test.php new file mode 100644 index 000000000..607eaa076 --- /dev/null +++ b/tests/codeigniter/database/query_builder/where_test.php @@ -0,0 +1,144 @@ +db = Mock_Database_Schema_Skeleton::init(DB_DRIVER); + + Mock_Database_Schema_Skeleton::create_tables(); + Mock_Database_Schema_Skeleton::create_data(); + } + + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_where_simple_key_value() + { + $job1 = $this->db->where('id', 1) + ->get('job') + ->row(); + + // Check the result + $this->assertEquals('1', $job1->id); + $this->assertEquals('Developer', $job1->name); + } + + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_where_custom_key_value() + { + $jobs = $this->db->where('id !=', 1) + ->get('job') + ->result_array(); + + // Check the result + $this->assertEquals(3, count($jobs)); + } + + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_where_associative_array() + { + $where = array('id >' => 2, 'name !=' => 'Accountant'); + $jobs = $this->db->where($where) + ->get('job') + ->result_array(); + + // Check the result + $this->assertEquals(1, count($jobs)); + + // Should be Musician + $job = current($jobs); + + $this->assertEquals('Musician', $job['name']); + } + + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_where_custom_string() + { + $where = "id > 2 AND name != 'Accountant'"; + $jobs = $this->db->where($where) + ->get('job') + ->result_array(); + + // Check the result + $this->assertEquals(1, count($jobs)); + + // Should be Musician + $job = current($jobs); + + $this->assertEquals('Musician', $job['name']); + } + + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_where_or() + { + $jobs = $this->db->where('name !=', 'Accountant') + ->or_where('id >', 3) + ->get('job') + ->result_array(); + + // Check the result + $this->assertEquals(3, count($jobs)); + $this->assertEquals('Developer', $jobs[0]['name']); + $this->assertEquals('Politician', $jobs[1]['name']); + $this->assertEquals('Musician', $jobs[2]['name']); + } + + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_where_in() + { + $jobs = $this->db->where_in('name', array('Politician', 'Accountant')) + ->get('job') + ->result_array(); + + // Check the result + $this->assertEquals(2, count($jobs)); + $this->assertEquals('Politician', $jobs[0]['name']); + $this->assertEquals('Accountant', $jobs[1]['name']); + } + + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_where_not_in() + { + $jobs = $this->db->where_not_in('name', array('Politician', 'Accountant')) + ->get('job') + ->result_array(); + + // Check the result + $this->assertEquals(2, count($jobs)); + $this->assertEquals('Developer', $jobs[0]['name']); + $this->assertEquals('Musician', $jobs[1]['name']); + } + +} \ No newline at end of file -- cgit v1.2.3-24-g4f1b From f78018ec6b081518e4be24934448862a31bda9f8 Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Fri, 4 May 2012 15:53:55 +0700 Subject: LIKE clause API code-coverage --- .../database/query_builder/like_test.php | 90 ++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 tests/codeigniter/database/query_builder/like_test.php diff --git a/tests/codeigniter/database/query_builder/like_test.php b/tests/codeigniter/database/query_builder/like_test.php new file mode 100644 index 000000000..df98c713f --- /dev/null +++ b/tests/codeigniter/database/query_builder/like_test.php @@ -0,0 +1,90 @@ +db = Mock_Database_Schema_Skeleton::init(DB_DRIVER); + + Mock_Database_Schema_Skeleton::create_tables(); + Mock_Database_Schema_Skeleton::create_data(); + } + + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_like() + { + $job1 = $this->db->like('name', 'veloper') + ->get('job') + ->row(); + + // Check the result + $this->assertEquals('1', $job1->id); + $this->assertEquals('Developer', $job1->name); + } + + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_or_like() + { + $jobs = $this->db->like('name', 'ian') + ->or_like('name', 'veloper') + ->get('job') + ->result_array(); + + // Check the result + $this->assertEquals(3, count($jobs)); + $this->assertEquals('Developer', $jobs[0]['name']); + $this->assertEquals('Politician', $jobs[1]['name']); + $this->assertEquals('Musician', $jobs[2]['name']); + } + + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_not_like() + { + $jobs = $this->db->not_like('name', 'veloper') + ->get('job') + ->result_array(); + + // Check the result + $this->assertEquals(3, count($jobs)); + $this->assertEquals('Politician', $jobs[0]['name']); + $this->assertEquals('Accountant', $jobs[1]['name']); + $this->assertEquals('Musician', $jobs[2]['name']); + } + + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_or_not_like() + { + $jobs = $this->db->like('name', 'an') + ->or_not_like('name', 'veloper') + ->get('job') + ->result_array(); + + // Check the result + $this->assertEquals(3, count($jobs)); + $this->assertEquals('Politician', $jobs[0]['name']); + $this->assertEquals('Accountant', $jobs[1]['name']); + $this->assertEquals('Musician', $jobs[2]['name']); + } + +} \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 4c316b6bdfa970e98127ea280fcc77ff1288190f Mon Sep 17 00:00:00 2001 From: Michiel Vugteveen Date: Fri, 4 May 2012 11:32:48 +0200 Subject: unset userdata --- system/libraries/Session.php | 45 +++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/system/libraries/Session.php b/system/libraries/Session.php index 3fa446d84..3195f0a91 100644 --- a/system/libraries/Session.php +++ b/system/libraries/Session.php @@ -36,146 +36,146 @@ */ class CI_Session { - /** + /** * Whether to encrypt the session cookie * * @var bool */ public $sess_encrypt_cookie = FALSE; - + /** * Whether to use to the database for session storage * * @var bool */ public $sess_use_database = FALSE; - + /** * Name of the database table in which to store sessions * * @var string */ public $sess_table_name = ''; - + /** * Length of time (in seconds) for sessions to expire * * @var int */ public $sess_expiration = 7200; - + /** * Whether to kill session on close of browser window * * @var bool */ public $sess_expire_on_close = FALSE; - + /** * Whether to match session on ip address * * @var bool */ public $sess_match_ip = FALSE; - + /** * Whether to match session on user-agent * * @var bool */ public $sess_match_useragent = TRUE; - + /** * Name of session cookie * * @var string */ public $sess_cookie_name = 'ci_session'; - + /** * Session cookie prefix * * @var string */ public $cookie_prefix = ''; - + /** * Session cookie path * * @var string */ public $cookie_path = ''; - + /** * Session cookie domain * * @var string */ public $cookie_domain = ''; - + /** * Whether to set the cookie only on HTTPS connections * * @var bool */ public $cookie_secure = FALSE; - + /** * Whether cookie should be allowed only to be sent by the server * * @var bool */ public $cookie_httponly = FALSE; - + /** * Interval at which to update session * * @var int */ public $sess_time_to_update = 300; - + /** * Key with which to encrypt the session cookie * * @var string */ public $encryption_key = ''; - + /** * String to indicate flash data cookies * * @var string */ public $flashdata_key = 'flash'; - + /** * Function to use to get the current time * * @var string */ public $time_reference = 'time'; - + /** * Probablity level of garbage collection of old sessions * * @var int */ public $gc_probability = 5; - + /** * Session data * * @var array */ public $userdata = array(); - + /** * Reference to CodeIgniter instance * * @var object */ public $CI; - + /** * Current time * @@ -570,6 +570,9 @@ class CI_Session { $this->cookie_domain, 0 ); + + // Kill session data + $this->userdata = array(); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 0e18f625e10a8d8ba57c58c8597875c342cfa3e6 Mon Sep 17 00:00:00 2001 From: Michiel Vugteveen Date: Fri, 4 May 2012 11:41:32 +0200 Subject: changelog entry --- user_guide_src/source/changelog.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index bbbe6f718..a70531901 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -55,7 +55,7 @@ Release Date: Not Released - Database - - Renamed the Active Record class to Query Builder to remove confusion with + - Renamed the Active Record class to Query Builder to remove confusion with the Active Record design pattern - Added new :doc:`Query Builder ` methods that return - Added the ability to insert objects with insert_batch() in :doc:`Query Builder `. @@ -215,6 +215,7 @@ Bug fixes for 3.0 - Fixed a bug (#1265) - Database connections were always closed, regardless of the 'pconnect' option value. - Fixed a bug (#128) - :doc:`Language Library ` did not correctly keep track of loaded language files. - Fixed a bug (#1242) Added Windows path compatibility to function read_dir of ZIP library +- Fixed a bug (#1314) sess_destroy() did not destroy userdata. Version 2.1.1 ============= -- cgit v1.2.3-24-g4f1b From 4e607b00b2c56b7fdcc5f1d1a290be2363c74a46 Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Fri, 4 May 2012 19:22:48 +0700 Subject: GROUP BY clause API code-coverage --- .travis.yml | 3 +- .../database/query_builder/group_test.php | 37 ++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 tests/codeigniter/database/query_builder/group_test.php diff --git a/.travis.yml b/.travis.yml index 97ea0422d..971f62f38 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,4 +25,5 @@ script: phpunit --configuration tests/travis/$DB.phpunit.xml branches: only: - develop - - master \ No newline at end of file + - master + - db-tests \ No newline at end of file diff --git a/tests/codeigniter/database/query_builder/group_test.php b/tests/codeigniter/database/query_builder/group_test.php new file mode 100644 index 000000000..ddb2d0d6a --- /dev/null +++ b/tests/codeigniter/database/query_builder/group_test.php @@ -0,0 +1,37 @@ +db = Mock_Database_Schema_Skeleton::init(DB_DRIVER); + + Mock_Database_Schema_Skeleton::create_tables(); + Mock_Database_Schema_Skeleton::create_data(); + } + + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_group_by() + { + $jobs = $this->db->select('name') + ->from('job') + ->group_by('name HAVING SUM(id) > 2') + ->get() + ->result_array(); + + // Check the result + $this->assertEquals(2, count($jobs)); + $this->assertEquals('Accountant', $jobs[0]['name']); + $this->assertEquals('Musician', $jobs[1]['name']); + } + +} \ No newline at end of file -- cgit v1.2.3-24-g4f1b From f7377abee2ef1e165a362edc9a1c650373a002ca Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Fri, 4 May 2012 19:42:24 +0700 Subject: Trace error --- .../database/query_builder/group_test.php | 8 ++++---- tests/mocks/database/ci_test.sqlite | Bin 17408 -> 19456 bytes 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/codeigniter/database/query_builder/group_test.php b/tests/codeigniter/database/query_builder/group_test.php index ddb2d0d6a..dd248ae9a 100644 --- a/tests/codeigniter/database/query_builder/group_test.php +++ b/tests/codeigniter/database/query_builder/group_test.php @@ -22,16 +22,16 @@ class Group_test extends CI_TestCase { */ public function test_group_by() { - $jobs = $this->db->select('name') + $jobs = $this->db->select('job.name as job_name, job.id as job_id') ->from('job') - ->group_by('name HAVING SUM(id) > 2') + ->group_by('job_name HAVING SUM(job_id) > 2') ->get() ->result_array(); // Check the result $this->assertEquals(2, count($jobs)); - $this->assertEquals('Accountant', $jobs[0]['name']); - $this->assertEquals('Musician', $jobs[1]['name']); + $this->assertEquals('Accountant', $jobs[0]['job_name']); + $this->assertEquals('Musician', $jobs[1]['job_name']); } } \ No newline at end of file diff --git a/tests/mocks/database/ci_test.sqlite b/tests/mocks/database/ci_test.sqlite index 86d868af2..e4128b23f 100755 Binary files a/tests/mocks/database/ci_test.sqlite and b/tests/mocks/database/ci_test.sqlite differ -- cgit v1.2.3-24-g4f1b From 1afd479059c3d6f7c46aa0c36aa56cfba7f94226 Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Fri, 4 May 2012 20:34:30 +0700 Subject: HAVING clause API code-coverage --- .../database/query_builder/group_test.php | 24 +++++++++++++++++---- tests/mocks/database/ci_test.sqlite | Bin 19456 -> 19456 bytes tests/mocks/database/schema/skeleton.php | 12 +++++++---- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/tests/codeigniter/database/query_builder/group_test.php b/tests/codeigniter/database/query_builder/group_test.php index dd248ae9a..7d8abc33f 100644 --- a/tests/codeigniter/database/query_builder/group_test.php +++ b/tests/codeigniter/database/query_builder/group_test.php @@ -22,16 +22,32 @@ class Group_test extends CI_TestCase { */ public function test_group_by() { - $jobs = $this->db->select('job.name as job_name, job.id as job_id') + $jobs = $this->db->select('name') ->from('job') - ->group_by('job_name HAVING SUM(job_id) > 2') + ->group_by('name') + ->get() + ->result_array(); + + // Check the result + $this->assertEquals(4, count($jobs)); + } + + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_having_by() + { + $jobs = $this->db->select('name') + ->from('job') + ->group_by('name') + ->having('SUM(id) > 2') ->get() ->result_array(); // Check the result $this->assertEquals(2, count($jobs)); - $this->assertEquals('Accountant', $jobs[0]['job_name']); - $this->assertEquals('Musician', $jobs[1]['job_name']); } } \ No newline at end of file diff --git a/tests/mocks/database/ci_test.sqlite b/tests/mocks/database/ci_test.sqlite index e4128b23f..d48e3317f 100755 Binary files a/tests/mocks/database/ci_test.sqlite and b/tests/mocks/database/ci_test.sqlite differ diff --git a/tests/mocks/database/schema/skeleton.php b/tests/mocks/database/schema/skeleton.php index 9ebd6e85f..671336cc4 100644 --- a/tests/mocks/database/schema/skeleton.php +++ b/tests/mocks/database/schema/skeleton.php @@ -64,6 +64,10 @@ class Mock_Database_Schema_Skeleton { 'type' => 'VARCHAR', 'constraint' => 100, ), + 'country' => array( + 'type' => 'VARCHAR', + 'constraint' => 40, + ), )); static::$forge->add_key('id', TRUE); static::$forge->create_table('user', (strpos(static::$driver, 'pgsql') === FALSE)); @@ -96,10 +100,10 @@ class Mock_Database_Schema_Skeleton { // Job Data $data = array( 'user' => array( - array('id' => 1, 'name' => 'Derek Jones', 'email' => 'derek@world.com'), - array('id' => 2, 'name' => 'Ahmadinejad', 'email' => 'ahmadinejad@world.com'), - array('id' => 3, 'name' => 'Richard A Causey', 'email' => 'richard@world.com'), - array('id' => 4, 'name' => 'Chris Martin', 'email' => 'chris@world.com'), + array('id' => 1, 'name' => 'Derek Jones', 'email' => 'derek@world.com', 'country' => 'US'), + array('id' => 2, 'name' => 'Ahmadinejad', 'email' => 'ahmadinejad@world.com', 'country' => 'Iran'), + array('id' => 3, 'name' => 'Richard A Causey', 'email' => 'richard@world.com', 'country' => 'US'), + array('id' => 4, 'name' => 'Chris Martin', 'email' => 'chris@world.com', 'country' => 'UK'), ), 'job' => array( array('id' => 1, 'name' => 'Developer', 'description' => 'Awesome job, but sometimes makes you bored'), -- cgit v1.2.3-24-g4f1b From 44d8d881b401238661d81fc9db10482604b4cf43 Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Fri, 4 May 2012 20:43:45 +0700 Subject: DISTINCT clause API code-coverage --- .../database/query_builder/distinct_test.php | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tests/codeigniter/database/query_builder/distinct_test.php diff --git a/tests/codeigniter/database/query_builder/distinct_test.php b/tests/codeigniter/database/query_builder/distinct_test.php new file mode 100644 index 000000000..925eadb19 --- /dev/null +++ b/tests/codeigniter/database/query_builder/distinct_test.php @@ -0,0 +1,34 @@ +db = Mock_Database_Schema_Skeleton::init(DB_DRIVER); + + Mock_Database_Schema_Skeleton::create_tables(); + Mock_Database_Schema_Skeleton::create_data(); + } + + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_distinct() + { + $users = $this->db->select('country') + ->distinct() + ->get('user') + ->result_array(); + + // Check the result + $this->assertEquals(3, count($users)); + } + +} \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 8ca31f34c855c783689198f0d352e6efec352b4d Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Fri, 4 May 2012 23:57:46 +0700 Subject: PDO SQLite bug fixed, for result_object --- system/database/drivers/pdo/pdo_result.php | 19 +++++++------------ tests/mocks/database/ci_test.sqlite | Bin 19456 -> 19456 bytes 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/system/database/drivers/pdo/pdo_result.php b/system/database/drivers/pdo/pdo_result.php index 19aee1dfc..0b8937cc5 100644 --- a/system/database/drivers/pdo/pdo_result.php +++ b/system/database/drivers/pdo/pdo_result.php @@ -84,19 +84,14 @@ class CI_DB_pdo_result extends CI_DB_result { // Define the output $output = array('assoc', 'object'); + // Initial value + $this->result_assoc = array() and $this->result_object = array(); + // Fetch the result - foreach ($output as $type) + while ($row = $this->_fetch_assoc()) { - // Define the method and handler - $res_method = '_fetch_'.$type; - $res_handler = 'result_'.$type; - - $this->$res_handler = array(); - - while ($row = $this->$res_method()) - { - $this->{$res_handler}[] = $row; - } + $this->result_assoc[] = $row; + $this->result_object[] = (object) $row; } // Save this as buffer and marked the fetch flag @@ -249,7 +244,7 @@ class CI_DB_pdo_result extends CI_DB_result { */ protected function _fetch_object() { - return $this->result_id->fetchObject(); + return $this->result_id->fetch(PDO::FETCH_OBJ); } } diff --git a/tests/mocks/database/ci_test.sqlite b/tests/mocks/database/ci_test.sqlite index d48e3317f..23a3de2a4 100755 Binary files a/tests/mocks/database/ci_test.sqlite and b/tests/mocks/database/ci_test.sqlite differ -- cgit v1.2.3-24-g4f1b From d2d329a99f60bebc36eebc1c7b3c1a94b9789b49 Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Sat, 5 May 2012 00:33:04 +0700 Subject: ORDER BY clause API code-coverage --- .../database/query_builder/order_test.php | 55 ++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 tests/codeigniter/database/query_builder/order_test.php diff --git a/tests/codeigniter/database/query_builder/order_test.php b/tests/codeigniter/database/query_builder/order_test.php new file mode 100644 index 000000000..01aa1c2b4 --- /dev/null +++ b/tests/codeigniter/database/query_builder/order_test.php @@ -0,0 +1,55 @@ +db = Mock_Database_Schema_Skeleton::init(DB_DRIVER); + + Mock_Database_Schema_Skeleton::create_tables(); + Mock_Database_Schema_Skeleton::create_data(); + } + + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_order_ascending() + { + $jobs = $this->db->order_by('name', 'asc') + ->get('job') + ->result_array(); + + // Check the result + $this->assertEquals(4, count($jobs)); + $this->assertEquals('Accountant', $jobs[0]['name']); + $this->assertEquals('Developer', $jobs[1]['name']); + $this->assertEquals('Musician', $jobs[2]['name']); + $this->assertEquals('Politician', $jobs[3]['name']); + } + + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_order_descending() + { + $jobs = $this->db->order_by('name', 'desc') + ->get('job') + ->result_array(); + + // Check the result + $this->assertEquals(4, count($jobs)); + $this->assertEquals('Politician', $jobs[0]['name']); + $this->assertEquals('Musician', $jobs[1]['name']); + $this->assertEquals('Developer', $jobs[2]['name']); + $this->assertEquals('Accountant', $jobs[3]['name']); + } +} \ No newline at end of file -- cgit v1.2.3-24-g4f1b From be6fb4271ce723376930507dbe534f91344f26c7 Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Sat, 5 May 2012 00:35:41 +0700 Subject: LIMIT clause API code-coverage --- .../database/query_builder/limit_test.php | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 tests/codeigniter/database/query_builder/limit_test.php diff --git a/tests/codeigniter/database/query_builder/limit_test.php b/tests/codeigniter/database/query_builder/limit_test.php new file mode 100644 index 000000000..704f3b651 --- /dev/null +++ b/tests/codeigniter/database/query_builder/limit_test.php @@ -0,0 +1,49 @@ +db = Mock_Database_Schema_Skeleton::init(DB_DRIVER); + + Mock_Database_Schema_Skeleton::create_tables(); + Mock_Database_Schema_Skeleton::create_data(); + } + + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_limit() + { + $jobs = $this->db->limit(2) + ->get('job') + ->result_array(); + + // Check the result + $this->assertEquals(2, count($jobs)); + } + + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_limit_and_offset() + { + $jobs = $this->db->limit(2, 2) + ->get('job') + ->result_array(); + + // Check the result + $this->assertEquals(2, count($jobs)); + $this->assertEquals('Accountant', $jobs[0]['name']); + $this->assertEquals('Musician', $jobs[1]['name']); + } +} \ No newline at end of file -- cgit v1.2.3-24-g4f1b From c386b2a363c289afcfa07eea081050e35c1e86d8 Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Sat, 5 May 2012 00:42:02 +0700 Subject: count code-coverage --- .../database/query_builder/count_test.php | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 tests/codeigniter/database/query_builder/count_test.php diff --git a/tests/codeigniter/database/query_builder/count_test.php b/tests/codeigniter/database/query_builder/count_test.php new file mode 100644 index 000000000..5e691692d --- /dev/null +++ b/tests/codeigniter/database/query_builder/count_test.php @@ -0,0 +1,44 @@ +db = Mock_Database_Schema_Skeleton::init(DB_DRIVER); + + Mock_Database_Schema_Skeleton::create_tables(); + Mock_Database_Schema_Skeleton::create_data(); + } + + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_count_all() + { + $job_count = $this->db->count_all('job'); + + // Check the result + $this->assertEquals(4, $job_count); + } + + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_count_all_results() + { + $job_count = $this->db->like('name', 'ian') + ->count_all_results('job'); + + // Check the result + $this->assertEquals(2, $job_count); + } +} \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 9ec507badf60952750e76b5d83da54874dd19119 Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Sat, 5 May 2012 00:55:39 +0700 Subject: UPDATE and SET clause code-coverage --- .../database/query_builder/update_test.php | 71 ++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 tests/codeigniter/database/query_builder/update_test.php diff --git a/tests/codeigniter/database/query_builder/update_test.php b/tests/codeigniter/database/query_builder/update_test.php new file mode 100644 index 000000000..f5bbffd4f --- /dev/null +++ b/tests/codeigniter/database/query_builder/update_test.php @@ -0,0 +1,71 @@ +db = Mock_Database_Schema_Skeleton::init(DB_DRIVER); + + Mock_Database_Schema_Skeleton::create_tables(); + Mock_Database_Schema_Skeleton::create_data(); + } + + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_update() + { + // Check initial record + $job1 = $this->db->where('id', 1) + ->get('job') + ->row(); + + $this->assertEquals('Developer', $job1->name); + + // Do the update + $job_data = array('name' => 'Programmer'); + + $this->db->where('id', 1) + ->update('job', $job_data); + + // Check updated record + $job1 = $this->db->where('id', 1) + ->get('job') + ->row(); + + $this->assertEquals('Programmer', $job1->name); + } + + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_update_with_set() + { + // Check initial record + $job1 = $this->db->where('id', 4) + ->get('job') + ->row(); + + $this->assertEquals('Musician', $job1->name); + + // Do the update + $this->db->set('name', 'Vocalist'); + $this->db->update('job', NULL, 'id = 4'); + + // Check updated record + $job1 = $this->db->where('id', 4) + ->get('job') + ->row(); + + $this->assertEquals('Vocalist', $job1->name); + } +} \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 6657cc1672f3f466655b1e476028b9d46a16bd1c Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Sat, 5 May 2012 01:06:41 +0700 Subject: DELETE code-coverage --- .../database/query_builder/delete_test.php | 72 ++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 tests/codeigniter/database/query_builder/delete_test.php diff --git a/tests/codeigniter/database/query_builder/delete_test.php b/tests/codeigniter/database/query_builder/delete_test.php new file mode 100644 index 000000000..84ea7616f --- /dev/null +++ b/tests/codeigniter/database/query_builder/delete_test.php @@ -0,0 +1,72 @@ +db = Mock_Database_Schema_Skeleton::init(DB_DRIVER); + + Mock_Database_Schema_Skeleton::create_tables(); + Mock_Database_Schema_Skeleton::create_data(); + } + + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_delete() + { + // Check initial record + $job1 = $this->db->where('id', 1) + ->get('job') + ->row(); + + $this->assertEquals('Developer', $job1->name); + + // Do the delete + $this->db->delete('job', array('id' => 1)); + + // Check the record + $job1 = $this->db->where('id', 1) + ->get('job'); + + $this->assertEmpty($job1->result_array()); + } + + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_delete_several_tables() + { + // Check initial record + $user4 = $this->db->where('id', 4) + ->get('user') + ->row(); + + $job4 = $this->db->where('id', 4) + ->get('job') + ->row(); + + $this->assertEquals('Musician', $job4->name); + $this->assertEquals('Chris Martin', $user4->name); + + // Do the delete + $this->db->delete(array('job', 'user'), array('id' => 4)); + + // Check the record + $job4 = $this->db->where('id', 4)->get('job'); + $user4 = $this->db->where('id', 4)->get('user'); + + $this->assertEmpty($job4->result_array()); + $this->assertEmpty($user4->result_array()); + } + +} \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 85859b212e480e2e1a59aae50c759367d6794ecd Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Sat, 5 May 2012 01:26:51 +0700 Subject: empty table API code-coverage --- .../database/query_builder/empty_test.php | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 tests/codeigniter/database/query_builder/empty_test.php diff --git a/tests/codeigniter/database/query_builder/empty_test.php b/tests/codeigniter/database/query_builder/empty_test.php new file mode 100644 index 000000000..d1f56285f --- /dev/null +++ b/tests/codeigniter/database/query_builder/empty_test.php @@ -0,0 +1,39 @@ +db = Mock_Database_Schema_Skeleton::init(DB_DRIVER); + + Mock_Database_Schema_Skeleton::create_tables(); + Mock_Database_Schema_Skeleton::create_data(); + } + + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_empty_table() + { + // Check initial record + $jobs = $this->db->get('job')->result_array(); + + $this->assertEquals(4, count($jobs)); + + // Do the empty + $this->db->empty_table('job'); + + // Check the record + $jobs = $this->db->get('job'); + + $this->assertEmpty($jobs->result_array()); + } + +} \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 39f35fde6d023433e98904105f55f305483b6b5e Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Sat, 5 May 2012 01:29:13 +0700 Subject: TRUNCATE code-coverage --- .../database/query_builder/truncate_test.php | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 tests/codeigniter/database/query_builder/truncate_test.php diff --git a/tests/codeigniter/database/query_builder/truncate_test.php b/tests/codeigniter/database/query_builder/truncate_test.php new file mode 100644 index 000000000..2a9c8a91e --- /dev/null +++ b/tests/codeigniter/database/query_builder/truncate_test.php @@ -0,0 +1,61 @@ +db = Mock_Database_Schema_Skeleton::init(DB_DRIVER); + + Mock_Database_Schema_Skeleton::create_tables(); + Mock_Database_Schema_Skeleton::create_data(); + } + + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_truncate() + { + // Check initial record + $jobs = $this->db->get('job')->result_array(); + + $this->assertEquals(4, count($jobs)); + + // Do the empty + $this->db->truncate('job'); + + // Check the record + $jobs = $this->db->get('job'); + + $this->assertEmpty($jobs->result_array()); + } + + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_truncate_with_from() + { + // Check initial record + $users = $this->db->get('user')->result_array(); + + $this->assertEquals(4, count($users)); + + // Do the empty + $this->db->from('user') + ->truncate(); + + // Check the record + $users = $this->db->get('user'); + + $this->assertEmpty($users->result_array()); + } + +} \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 51a7c0b98df29205d39bb404c2bcd12bfb4ed4cb Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Sat, 5 May 2012 01:43:08 +0700 Subject: Clean up --- tests/README.md | 6 ------ tests/codeigniter/Setup_test.php | 10 +++++----- tests/travis/mysql.phpunit.xml | 6 +----- tests/travis/pdo/mysql.phpunit.xml | 4 ---- tests/travis/pdo/pgsql.phpunit.xml | 6 +----- tests/travis/pdo/sqlite.phpunit.xml | 6 +----- tests/travis/pgsql.phpunit.xml | 6 +----- tests/travis/sqlite.phpunit.xml | 6 +----- 8 files changed, 10 insertions(+), 40 deletions(-) diff --git a/tests/README.md b/tests/README.md index 6d83c34d8..b46f344cb 100644 --- a/tests/README.md +++ b/tests/README.md @@ -2,12 +2,6 @@ Status : [![Build Status](https://secure.travis-ci.org/EllisLab/CodeIgniter.png?branch=feature/unit-tests)](http://travis-ci.org/EllisLab/CodeIgniter) -*Do not merge to default until these issues have been addressed* - -- Clean up naming conventions -- Figure out config stuff -- Figure out database testing - ### Introduction: This is the preliminary CodeIgniter testing documentation. It diff --git a/tests/codeigniter/Setup_test.php b/tests/codeigniter/Setup_test.php index 550245f2f..b48e32bfb 100644 --- a/tests/codeigniter/Setup_test.php +++ b/tests/codeigniter/Setup_test.php @@ -2,12 +2,12 @@ class Setup_test extends PHPUnit_Framework_TestCase { - function test_nonsense() + function test_bootstrap_constants() { - $this->markTestIncomplete('not implemented'); - // ensure that our bootstrapped test environment - // is a good representation of an isolated CI install - //die('here'); + $this->assertTrue(defined('PROJECT_BASE')); + $this->assertTrue(defined('BASEPATH')); + $this->assertTrue(defined('APPPATH')); + $this->assertTrue(defined('VIEWPATH')); } } \ No newline at end of file diff --git a/tests/travis/mysql.phpunit.xml b/tests/travis/mysql.phpunit.xml index e9556f758..c5fcf1335 100644 --- a/tests/travis/mysql.phpunit.xml +++ b/tests/travis/mysql.phpunit.xml @@ -14,11 +14,7 @@ - ../codeigniter/Setup_test.php - ../codeigniter/core - ../codeigniter/helpers - ../codeigniter/libraries - ../codeigniter/database + ../codeigniter diff --git a/tests/travis/pdo/mysql.phpunit.xml b/tests/travis/pdo/mysql.phpunit.xml index 69eece24f..f6fcc1c39 100644 --- a/tests/travis/pdo/mysql.phpunit.xml +++ b/tests/travis/pdo/mysql.phpunit.xml @@ -14,10 +14,6 @@ - ../../codeigniter/Setup_test.php - ../../codeigniter/core - ../../codeigniter/helpers - ../../codeigniter/libraries ../../codeigniter/database diff --git a/tests/travis/pdo/pgsql.phpunit.xml b/tests/travis/pdo/pgsql.phpunit.xml index e68c3e028..6a23227db 100644 --- a/tests/travis/pdo/pgsql.phpunit.xml +++ b/tests/travis/pdo/pgsql.phpunit.xml @@ -14,11 +14,7 @@ - ../../codeigniter/Setup_test.php - ../../codeigniter/core - ../../codeigniter/helpers - ../../codeigniter/libraries - ../../codeigniter/database + ../../codeigniter diff --git a/tests/travis/pdo/sqlite.phpunit.xml b/tests/travis/pdo/sqlite.phpunit.xml index 1871f6221..b85b7308a 100644 --- a/tests/travis/pdo/sqlite.phpunit.xml +++ b/tests/travis/pdo/sqlite.phpunit.xml @@ -14,11 +14,7 @@ - ../../codeigniter/Setup_test.php - ../../codeigniter/core - ../../codeigniter/helpers - ../../codeigniter/libraries - ../../codeigniter/database + ../../codeigniter diff --git a/tests/travis/pgsql.phpunit.xml b/tests/travis/pgsql.phpunit.xml index ad8aeded2..78b6046cf 100644 --- a/tests/travis/pgsql.phpunit.xml +++ b/tests/travis/pgsql.phpunit.xml @@ -14,11 +14,7 @@ - ../codeigniter/Setup_test.php - ../codeigniter/core - ../codeigniter/helpers - ../codeigniter/libraries - ../codeigniter/database + ../codeigniter diff --git a/tests/travis/sqlite.phpunit.xml b/tests/travis/sqlite.phpunit.xml index 628370e93..46e3d5073 100644 --- a/tests/travis/sqlite.phpunit.xml +++ b/tests/travis/sqlite.phpunit.xml @@ -14,11 +14,7 @@ - ../codeigniter/Setup_test.php - ../codeigniter/core - ../codeigniter/helpers - ../codeigniter/libraries - ../codeigniter/database + ../codeigniter -- cgit v1.2.3-24-g4f1b From 82196b945e291c65fdb66b35e3205f786ce8e921 Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Sat, 5 May 2012 01:52:47 +0700 Subject: Remove temporary branch from travis whitelist --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 971f62f38..97ea0422d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,5 +25,4 @@ script: phpunit --configuration tests/travis/$DB.phpunit.xml branches: only: - develop - - master - - db-tests \ No newline at end of file + - master \ No newline at end of file -- cgit v1.2.3-24-g4f1b From d4fb95ff19666f178b9f84850d122ff07fe193b9 Mon Sep 17 00:00:00 2001 From: Cusco Date: Sat, 5 May 2012 03:22:24 +0800 Subject: Update system/database/drivers/interbase/interbase_utility.php --- system/database/drivers/interbase/interbase_utility.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/database/drivers/interbase/interbase_utility.php b/system/database/drivers/interbase/interbase_utility.php index 1b92af9b6..164211836 100644 --- a/system/database/drivers/interbase/interbase_utility.php +++ b/system/database/drivers/interbase/interbase_utility.php @@ -42,7 +42,7 @@ class CI_DB_interbase_utility extends CI_DB_utility { * @param string $filename * @return mixed */ - protected function backup($filename) + protected function _backup($filename) { if ($service = ibase_service_attach($this->db->hostname, $this->db->username, $this->db->password)) { -- cgit v1.2.3-24-g4f1b From bb2c83bddbf51c42815be3de60eab24fd87ae392 Mon Sep 17 00:00:00 2001 From: Wes Baker Date: Fri, 4 May 2012 18:44:24 -0400 Subject: Added a return false if an image doesn't pass XSS cleaning to prevent file_get_contents from returning a NULL and passing through unscathed. --- system/libraries/Upload.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php index 8ad67050d..4a4a66f73 100644 --- a/system/libraries/Upload.php +++ b/system/libraries/Upload.php @@ -850,6 +850,10 @@ class CI_Upload { { return TRUE; // its an image, no "triggers" detected in the first 256 bytes, we're good } + else + { + return FALSE; + } } if (($data = @file_get_contents($file)) === FALSE) @@ -1099,4 +1103,4 @@ class CI_Upload { } /* End of file Upload.php */ -/* Location: ./system/libraries/Upload.php */ \ No newline at end of file +/* Location: ./system/libraries/Upload.php */ -- cgit v1.2.3-24-g4f1b From 43ef706d3684af7efa02c21db02ca150c9b424a9 Mon Sep 17 00:00:00 2001 From: dixy Date: Sat, 5 May 2012 18:26:54 +0200 Subject: Remove -webkit prefix for box-shadow --- application/errors/error_404.php | 2 +- application/errors/error_db.php | 2 +- application/errors/error_general.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/application/errors/error_404.php b/application/errors/error_404.php index 746032956..c19bedfcd 100644 --- a/application/errors/error_404.php +++ b/application/errors/error_404.php @@ -72,7 +72,7 @@ code { #container { margin: 10px; border: 1px solid #D0D0D0; - -webkit-box-shadow: 0 0 8px #D0D0D0; + box-shadow: 0 0 8px #D0D0D0; } p { diff --git a/application/errors/error_db.php b/application/errors/error_db.php index eb3a75260..3b244e094 100644 --- a/application/errors/error_db.php +++ b/application/errors/error_db.php @@ -72,7 +72,7 @@ code { #container { margin: 10px; border: 1px solid #D0D0D0; - -webkit-box-shadow: 0 0 8px #D0D0D0; + box-shadow: 0 0 8px #D0D0D0; } p { diff --git a/application/errors/error_general.php b/application/errors/error_general.php index 59896e1ea..c88afe168 100644 --- a/application/errors/error_general.php +++ b/application/errors/error_general.php @@ -72,7 +72,7 @@ code { #container { margin: 10px; border: 1px solid #D0D0D0; - -webkit-box-shadow: 0 0 8px #D0D0D0; + box-shadow: 0 0 8px #D0D0D0; } p { -- cgit v1.2.3-24-g4f1b From e463c4d71c2fdcc224e70f7576582220ae64e3d7 Mon Sep 17 00:00:00 2001 From: Wes Baker Date: Fri, 4 May 2012 18:44:24 -0400 Subject: Added a return false if an image doesn't pass XSS cleaning to prevent file_get_contents from returning a NULL and passing through unscathed. --- system/libraries/Upload.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php index b0490de30..0e5d73b19 100644 --- a/system/libraries/Upload.php +++ b/system/libraries/Upload.php @@ -868,6 +868,10 @@ class CI_Upload { { return TRUE; // its an image, no "triggers" detected in the first 256 bytes, we're good } + else + { + return FALSE; + } } if (($data = @file_get_contents($file)) === FALSE) -- cgit v1.2.3-24-g4f1b From cdcceecba73dd9f54665f531d15c12f5c9679738 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 9 May 2012 11:23:30 +0300 Subject: Fix issue #1342 --- system/libraries/Form_validation.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index 5547c6a69..73f607be8 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -448,7 +448,7 @@ class CI_Form_validation { { $this->_field_data[$field]['postdata'] = $this->_reduce_array($validation_array, $row['keys']); } - elseif ( ! empty($validation_array[$field])) + elseif (isset($validation_array[$field])) { $this->_field_data[$field]['postdata'] = $validation_array[$field]; } -- cgit v1.2.3-24-g4f1b From d41f423528b21d97ff0eb268e10947b257f5a90e Mon Sep 17 00:00:00 2001 From: Soesapto Joeni Hantoro Date: Fri, 11 May 2012 11:00:42 +0700 Subject: Generate better conditions statement on boolean field type. Actually boolean field type need TRUE or FALSE value. Common DBMS (e.g., MySQL) can substite this value with 1 or 0, but it can't be implemented on PostgreSQL. So, its better to use TRUE or FALSE value for boolean field type. --- system/database/DB_query_builder.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php index d0af66de1..969a25acb 100644 --- a/system/database/DB_query_builder.php +++ b/system/database/DB_query_builder.php @@ -432,7 +432,21 @@ abstract class CI_DB_query_builder extends CI_DB_driver { $k .= ' IS NULL'; } - if ( ! is_null($v)) + if ( is_bool($v)) + { + if ($escape === TRUE) + { + $k = $this->protect_identifiers($k, FALSE, $escape); + + $v = ' '.($v ? 'TRUE' : 'FALSE'); + } + + if ( ! $this->_has_operator($k)) + { + $k .= ' ='; + } + } + else if ( ! is_null($v)) { if ($escape === TRUE) { -- cgit v1.2.3-24-g4f1b From b01d96f65a78528323b3917eec31c4ed8b58eb7b Mon Sep 17 00:00:00 2001 From: Soesapto Joeni Hantoro Date: Fri, 11 May 2012 11:18:38 +0700 Subject: simpler script, add boolean handling on DB_driver/escape --- system/database/DB_query_builder.php | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php index 969a25acb..8fa67ea06 100644 --- a/system/database/DB_query_builder.php +++ b/system/database/DB_query_builder.php @@ -432,26 +432,16 @@ abstract class CI_DB_query_builder extends CI_DB_driver { $k .= ' IS NULL'; } - if ( is_bool($v)) + if ( ! is_null($v)) { if ($escape === TRUE) { $k = $this->protect_identifiers($k, FALSE, $escape); - - $v = ' '.($v ? 'TRUE' : 'FALSE'); + $v = ' '.$this->escape($v); } - - if ( ! $this->_has_operator($k)) + else if (is_bool($v)) { - $k .= ' ='; - } - } - else if ( ! is_null($v)) - { - if ($escape === TRUE) - { - $k = $this->protect_identifiers($k, FALSE, $escape); - $v = ' '.$this->escape($v); + $v = ' '.($v ? 'TRUE' : 'FALSE'); } if ( ! $this->_has_operator($k)) -- cgit v1.2.3-24-g4f1b From 938c7ef59991ed12b8634b292e2f8fc9fa385264 Mon Sep 17 00:00:00 2001 From: Soesapto Joeni Hantoro Date: Fri, 11 May 2012 11:21:43 +0700 Subject: Escaping boolean data type, some DBMS (e.g., postgre) need it --- system/database/DB_driver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index ef77b594e..09513e267 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -696,7 +696,7 @@ abstract class CI_DB_driver { } elseif (is_bool($str)) { - return ($str === FALSE) ? 0 : 1; + return ($str === FALSE) ? "FALSE" : "TRUE"; } elseif (is_null($str)) { -- cgit v1.2.3-24-g4f1b From ca7d822f224033196e0e327944a01f319c90f37f Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 11 May 2012 10:59:09 +0300 Subject: User_agent library improvements --- application/config/user_agents.php | 147 +++++++++++++++++++----------------- system/libraries/User_agent.php | 24 +++--- user_guide_src/source/changelog.rst | 2 +- 3 files changed, 89 insertions(+), 84 deletions(-) diff --git a/application/config/user_agents.php b/application/config/user_agents.php index 60f256e01..72d74dbc7 100644 --- a/application/config/user_agents.php +++ b/application/config/user_agents.php @@ -36,7 +36,7 @@ | */ -$platforms = array ( +$platforms = array( 'windows nt 6.1' => 'Windows 7', 'windows nt 6.0' => 'Windows Vista', 'windows nt 5.2' => 'Windows 2003', @@ -51,6 +51,11 @@ $platforms = array ( 'windows 95' => 'Windows 95', 'win95' => 'Windows 95', 'windows' => 'Unknown Windows OS', + 'android' => 'Android', + 'blackberry' => 'BlackBerry', + 'iphone' => 'iOS', + 'ipad' => 'iOS', + 'ipod' => 'iOS', 'os x' => 'Mac OS X', 'ppc mac' => 'Power PC Mac', 'freebsd' => 'FreeBSD', @@ -117,84 +122,84 @@ $mobiles = array( // 'motorola' => 'Motorola' // Phones and Manufacturers - 'motorola' => "Motorola", - 'nokia' => "Nokia", - 'palm' => "Palm", - 'iphone' => "Apple iPhone", - 'ipad' => "iPad", - 'ipod' => "Apple iPod Touch", - 'sony' => "Sony Ericsson", - 'ericsson' => "Sony Ericsson", - 'blackberry' => "BlackBerry", - 'cocoon' => "O2 Cocoon", - 'blazer' => "Treo", - 'lg' => "LG", - 'amoi' => "Amoi", - 'xda' => "XDA", - 'mda' => "MDA", - 'vario' => "Vario", - 'htc' => "HTC", - 'samsung' => "Samsung", - 'sharp' => "Sharp", - 'sie-' => "Siemens", - 'alcatel' => "Alcatel", - 'benq' => "BenQ", - 'ipaq' => "HP iPaq", - 'mot-' => "Motorola", - 'playstation portable' => "PlayStation Portable", - 'hiptop' => "Danger Hiptop", - 'nec-' => "NEC", - 'panasonic' => "Panasonic", - 'philips' => "Philips", - 'sagem' => "Sagem", - 'sanyo' => "Sanyo", - 'spv' => "SPV", - 'zte' => "ZTE", - 'sendo' => "Sendo", - 'dsi' => "Nintendo DSi", - 'ds' => "Nintendo DS", - 'wii' => "Nintendo Wii", - '3ds' => "Nintendo 3DS", - 'open web' => "Open Web", - 'openweb' => "OpenWeb", + 'motorola' => 'Motorola', + 'nokia' => 'Nokia', + 'palm' => 'Palm', + 'iphone' => 'Apple iPhone', + 'ipad' => 'iPad', + 'ipod' => 'Apple iPod Touch', + 'sony' => 'Sony Ericsson', + 'ericsson' => 'Sony Ericsson', + 'blackberry' => 'BlackBerry', + 'cocoon' => 'O2 Cocoon', + 'blazer' => 'Treo', + 'lg' => 'LG', + 'amoi' => 'Amoi', + 'xda' => 'XDA', + 'mda' => 'MDA', + 'vario' => 'Vario', + 'htc' => 'HTC', + 'samsung' => 'Samsung', + 'sharp' => 'Sharp', + 'sie-' => 'Siemens', + 'alcatel' => 'Alcatel', + 'benq' => 'BenQ', + 'ipaq' => 'HP iPaq', + 'mot-' => 'Motorola', + 'playstation portable' => 'PlayStation Portable', + 'hiptop' => 'Danger Hiptop', + 'nec-' => 'NEC', + 'panasonic' => 'Panasonic', + 'philips' => 'Philips', + 'sagem' => 'Sagem', + 'sanyo' => 'Sanyo', + 'spv' => 'SPV', + 'zte' => 'ZTE', + 'sendo' => 'Sendo', + 'dsi' => 'Nintendo DSi', + 'ds' => 'Nintendo DS', + 'wii' => 'Nintendo Wii', + '3ds' => 'Nintendo 3DS', + 'open web' => 'Open Web', + 'openweb' => 'OpenWeb', // Operating Systems - 'android' => "Android", - 'symbian' => "Symbian", - 'SymbianOS' => "SymbianOS", - 'elaine' => "Palm", - 'palm' => "Palm", - 'series60' => "Symbian S60", - 'windows ce' => "Windows CE", + 'android' => 'Android', + 'symbian' => 'Symbian', + 'SymbianOS' => 'SymbianOS', + 'elaine' => 'Palm', + 'palm' => 'Palm', + 'series60' => 'Symbian S60', + 'windows ce' => 'Windows CE', // Browsers - 'obigo' => "Obigo", - 'netfront' => "Netfront Browser", - 'openwave' => "Openwave Browser", - 'mobilexplorer' => "Mobile Explorer", - 'operamini' => "Opera Mini", - 'opera mini' => "Opera Mini", - 'opera mobi' => "Opera Mobile", + 'obigo' => 'Obigo', + 'netfront' => 'Netfront Browser', + 'openwave' => 'Openwave Browser', + 'mobilexplorer' => 'Mobile Explorer', + 'operamini' => 'Opera Mini', + 'opera mini' => 'Opera Mini', + 'opera mobi' => 'Opera Mobile', // Other - 'digital paths' => "Digital Paths", - 'avantgo' => "AvantGo", - 'xiino' => "Xiino", - 'novarra' => "Novarra Transcoder", - 'vodafone' => "Vodafone", - 'docomo' => "NTT DoCoMo", - 'o2' => "O2", + 'digital paths' => 'Digital Paths', + 'avantgo' => 'AvantGo', + 'xiino' => 'Xiino', + 'novarra' => 'Novarra Transcoder', + 'vodafone' => 'Vodafone', + 'docomo' => 'NTT DoCoMo', + 'o2' => 'O2', // Fallback - 'mobile' => "Generic Mobile", - 'wireless' => "Generic Mobile", - 'j2me' => "Generic Mobile", - 'midp' => "Generic Mobile", - 'cldc' => "Generic Mobile", - 'up.link' => "Generic Mobile", - 'up.browser' => "Generic Mobile", - 'smartphone' => "Generic Mobile", - 'cellphone' => "Generic Mobile" + 'mobile' => 'Generic Mobile', + 'wireless' => 'Generic Mobile', + 'j2me' => 'Generic Mobile', + 'midp' => 'Generic Mobile', + 'cldc' => 'Generic Mobile', + 'up.link' => 'Generic Mobile', + 'up.browser' => 'Generic Mobile', + 'smartphone' => 'Generic Mobile', + 'cellphone' => 'Generic Mobile' ); // There are hundreds of bots but these are the most common. diff --git a/system/libraries/User_agent.php b/system/libraries/User_agent.php index 0ac605fa4..ff596f04b 100644 --- a/system/libraries/User_agent.php +++ b/system/libraries/User_agent.php @@ -51,14 +51,14 @@ class CI_User_agent { * @var bool */ public $is_browser = FALSE; - + /** * Flag for if the user-agent is a robot * * @var bool */ public $is_robot = FALSE; - + /** * Flag for if the user-agent is a mobile browser * @@ -72,7 +72,7 @@ class CI_User_agent { * @var array */ public $languages = array(); - + /** * Character sets accepted by the current user agent * @@ -86,21 +86,21 @@ class CI_User_agent { * @var array */ public $platforms = array(); - + /** * List of browsers to compare against current user agent * * @var array */ public $browsers = array(); - + /** * List of mobile browsers to compare against current user agent * * @var array */ public $mobiles = array(); - + /** * List of robots to compare against current user agent * @@ -114,28 +114,28 @@ class CI_User_agent { * @var string */ public $platform = ''; - + /** * Current user-agent browser * * @var string */ public $browser = ''; - + /** * Current user-agent version * * @var string */ public $version = ''; - + /** * Current user-agent mobile name * * @var string */ public $mobile = ''; - + /** * Current user-agent robot name * @@ -330,7 +330,7 @@ class CI_User_agent { { foreach ($this->mobiles as $key => $val) { - if (FALSE !== (strpos(strtolower($this->agent), $key))) + if (FALSE !== (stripos($this->agent, $key))) { $this->is_mobile = TRUE; $this->mobile = $val; @@ -604,7 +604,7 @@ class CI_User_agent { /** * Test for a particular character set * - * @param string $charset + * @param string $charset * @return bool */ public function accept_charset($charset = 'utf-8') diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index a70531901..4756eb3f5 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -22,7 +22,7 @@ Release Date: Not Released - PHP 5.1.6 is no longer supported. CodeIgniter now requires PHP 5.2.4. - Added an optional backtrace to php-error template. - Added Android to the list of user agents. - - Added Windows 7 to the list of user platforms. + - Added Windows 7, Android, Blackberry and iOS to the list of user platforms. - Ability to log certain error types, not all under a threshold. - Added support for pem, p10, p12, p7a, p7c, p7m, p7r, p7s, crt, crl, der, kdb, rsa, cer, sst, csr Certs to mimes.php. - Added support for pgp and gpg to mimes.php. -- cgit v1.2.3-24-g4f1b From 585cf67a98d8a31f584c13a319310ca7561d572c Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 11 May 2012 11:55:15 +0300 Subject: Remove a duplicate mobile user agent entry --- application/config/user_agents.php | 1 - 1 file changed, 1 deletion(-) diff --git a/application/config/user_agents.php b/application/config/user_agents.php index 72d74dbc7..76114616b 100644 --- a/application/config/user_agents.php +++ b/application/config/user_agents.php @@ -168,7 +168,6 @@ $mobiles = array( 'symbian' => 'Symbian', 'SymbianOS' => 'SymbianOS', 'elaine' => 'Palm', - 'palm' => 'Palm', 'series60' => 'Symbian S60', 'windows ce' => 'Windows CE', -- cgit v1.2.3-24-g4f1b From 46d53fb8799eb2f84798f0e7a5f57b065c2482e2 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 11 May 2012 13:42:24 +0300 Subject: Fix issue #1349 --- system/libraries/Upload.php | 2 +- user_guide_src/source/changelog.rst | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php index 4a4a66f73..24d4bd4d0 100644 --- a/system/libraries/Upload.php +++ b/system/libraries/Upload.php @@ -725,7 +725,7 @@ class CI_Upload { public function get_extension($filename) { $x = explode('.', $filename); - return '.'.end($x); + return (count($x) !== 1) ? '.'.end($x) : ''; } // -------------------------------------------------------------------- diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 4756eb3f5..d457a3fbc 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -214,8 +214,9 @@ Bug fixes for 3.0 - Fixed a bug in SQLSRV's delete() method where like() and limit() conditions were ignored. - Fixed a bug (#1265) - Database connections were always closed, regardless of the 'pconnect' option value. - Fixed a bug (#128) - :doc:`Language Library ` did not correctly keep track of loaded language files. -- Fixed a bug (#1242) Added Windows path compatibility to function read_dir of ZIP library -- Fixed a bug (#1314) sess_destroy() did not destroy userdata. +- Fixed a bug (#1242) - Added Windows path compatibility to function read_dir of ZIP library +- Fixed a bug (#1314) - sess_destroy() did not destroy userdata. +- Fixed a bug (#1349) - get_extension() in the `File Uploading Library ` returned the original filename when it didn't have an actual extension. Version 2.1.1 ============= -- cgit v1.2.3-24-g4f1b From fff6c2a3caa1ce14e58fcb3ee0d937d17985eea1 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sun, 13 May 2012 22:15:23 +0300 Subject: Improve the solution for issue #1342 --- system/libraries/Form_validation.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index 73f607be8..c396580be 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -448,7 +448,7 @@ class CI_Form_validation { { $this->_field_data[$field]['postdata'] = $this->_reduce_array($validation_array, $row['keys']); } - elseif (isset($validation_array[$field])) + elseif (isset($validation_array[$field]) && $validation_array[$field] !== '') { $this->_field_data[$field]['postdata'] = $validation_array[$field]; } -- cgit v1.2.3-24-g4f1b From 66c982e8fa8fb0261394b63b25a3817503263d17 Mon Sep 17 00:00:00 2001 From: Thanasis Polychronakis Date: Mon, 14 May 2012 21:31:04 +0300 Subject: Load base config first, then environment's config --- system/core/Common.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/system/core/Common.php b/system/core/Common.php index 78aa6e874..01b0d8673 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -231,21 +231,21 @@ if ( ! function_exists('get_config')) return $_config[0]; } - // Is the config file in the environment folder? - if ( ! defined('ENVIRONMENT') OR ! file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/config.php')) - { - $file_path = APPPATH.'config/config.php'; + $file_path = APPPATH.'config/config.php'; + $found = false; + if (file_exists($file_path)) { + $found = true; + require($file_path); } - // Fetch the config file - if ( ! file_exists($file_path)) + // Is the config file in the environment folder? + if (defined(ENVIRONMENT) && file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/config.php')) { - set_status_header(503); + require($file_path); + } else if (!$found) { exit('The configuration file does not exist.'); } - require($file_path); - // Does the $config array exist in the file? if ( ! isset($config) OR ! is_array($config)) { -- cgit v1.2.3-24-g4f1b From 09069ddcecde9a0c66e41087e816567d420eb750 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Mon, 14 May 2012 15:21:33 -0400 Subject: Move errors to views folder --- application/errors/error_404.php | 89 ------------------------------ application/errors/error_db.php | 89 ------------------------------ application/errors/error_general.php | 89 ------------------------------ application/errors/error_php.php | 55 ------------------ application/errors/index.html | 10 ---- application/views/errors/error_404.php | 89 ++++++++++++++++++++++++++++++ application/views/errors/error_db.php | 89 ++++++++++++++++++++++++++++++ application/views/errors/error_general.php | 89 ++++++++++++++++++++++++++++++ application/views/errors/error_php.php | 55 ++++++++++++++++++ application/views/errors/index.html | 10 ++++ system/core/Exceptions.php | 4 +- 11 files changed, 334 insertions(+), 334 deletions(-) delete mode 100644 application/errors/error_404.php delete mode 100644 application/errors/error_db.php delete mode 100644 application/errors/error_general.php delete mode 100644 application/errors/error_php.php delete mode 100644 application/errors/index.html create mode 100644 application/views/errors/error_404.php create mode 100644 application/views/errors/error_db.php create mode 100644 application/views/errors/error_general.php create mode 100644 application/views/errors/error_php.php create mode 100644 application/views/errors/index.html diff --git a/application/errors/error_404.php b/application/errors/error_404.php deleted file mode 100644 index c19bedfcd..000000000 --- a/application/errors/error_404.php +++ /dev/null @@ -1,89 +0,0 @@ - - - - -404 Page Not Found - - - -
-

- -
- - \ No newline at end of file diff --git a/application/errors/error_db.php b/application/errors/error_db.php deleted file mode 100644 index 3b244e094..000000000 --- a/application/errors/error_db.php +++ /dev/null @@ -1,89 +0,0 @@ - - - - -Database Error - - - -
-

- -
- - \ No newline at end of file diff --git a/application/errors/error_general.php b/application/errors/error_general.php deleted file mode 100644 index c88afe168..000000000 --- a/application/errors/error_general.php +++ /dev/null @@ -1,89 +0,0 @@ - - - - -Error - - - -
-

- -
- - \ No newline at end of file diff --git a/application/errors/error_php.php b/application/errors/error_php.php deleted file mode 100644 index 3855720de..000000000 --- a/application/errors/error_php.php +++ /dev/null @@ -1,55 +0,0 @@ - - -
- -

A PHP Error was encountered

- -

Severity:

-

Message:

-

Filename:

-

Line Number:

- - - -

Backtrace:

- - - -

- File:
- Line:
- Function: -

- - -

- - - -
\ No newline at end of file diff --git a/application/errors/index.html b/application/errors/index.html deleted file mode 100644 index c942a79ce..000000000 --- a/application/errors/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - 403 Forbidden - - - -

Directory access is forbidden.

- - - \ No newline at end of file diff --git a/application/views/errors/error_404.php b/application/views/errors/error_404.php new file mode 100644 index 000000000..c19bedfcd --- /dev/null +++ b/application/views/errors/error_404.php @@ -0,0 +1,89 @@ + + + + +404 Page Not Found + + + +
+

+ +
+ + \ No newline at end of file diff --git a/application/views/errors/error_db.php b/application/views/errors/error_db.php new file mode 100644 index 000000000..3b244e094 --- /dev/null +++ b/application/views/errors/error_db.php @@ -0,0 +1,89 @@ + + + + +Database Error + + + +
+

+ +
+ + \ No newline at end of file diff --git a/application/views/errors/error_general.php b/application/views/errors/error_general.php new file mode 100644 index 000000000..c88afe168 --- /dev/null +++ b/application/views/errors/error_general.php @@ -0,0 +1,89 @@ + + + + +Error + + + +
+

+ +
+ + \ No newline at end of file diff --git a/application/views/errors/error_php.php b/application/views/errors/error_php.php new file mode 100644 index 000000000..3855720de --- /dev/null +++ b/application/views/errors/error_php.php @@ -0,0 +1,55 @@ + + +
+ +

A PHP Error was encountered

+ +

Severity:

+

Message:

+

Filename:

+

Line Number:

+ + + +

Backtrace:

+ + + +

+ File:
+ Line:
+ Function: +

+ + +

+ + + +
\ No newline at end of file diff --git a/application/views/errors/index.html b/application/views/errors/index.html new file mode 100644 index 000000000..c942a79ce --- /dev/null +++ b/application/views/errors/index.html @@ -0,0 +1,10 @@ + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + \ No newline at end of file diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index 2e9f0c766..f9618044e 100755 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -141,7 +141,7 @@ class CI_Exceptions { ob_end_flush(); } ob_start(); - include(APPPATH.'errors/'.$template.'.php'); + include(APPPATH.'views/errors/'.$template.'.php'); $buffer = ob_get_contents(); ob_end_clean(); return $buffer; @@ -175,7 +175,7 @@ class CI_Exceptions { ob_end_flush(); } ob_start(); - include(APPPATH.'errors/'.'error_php.php'); + include(APPPATH.'views/errors/error_php.php'); $buffer = ob_get_contents(); ob_end_clean(); echo $buffer; -- cgit v1.2.3-24-g4f1b From f25b9295557f9d5fda1e0b2342964f17e26a390e Mon Sep 17 00:00:00 2001 From: Soesapto Joeni Hantoro Date: Tue, 15 May 2012 08:10:31 +0700 Subject: Escaping boolean data type on postgre --- system/database/drivers/postgre/postgre_driver.php | 101 +++++++++++++++++++++ 1 file changed, 101 insertions(+) diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php index 84bf768ee..915763ad7 100644 --- a/system/database/drivers/postgre/postgre_driver.php +++ b/system/database/drivers/postgre/postgre_driver.php @@ -310,6 +310,35 @@ class CI_DB_postgre_driver extends CI_DB { // -------------------------------------------------------------------- + /** + * "Smart" Escape String + * + * Escapes data based on type + * Sets boolean and null types + * + * @param string + * @return mixed + */ + public function escape($str) + { + if (is_string($str) OR method_exists($str, '__toString')) + { + return "'".$this->escape_str($str)."'"; + } + elseif (is_bool($str)) + { + return $str ? "TRUE" : "FALSE"; + } + elseif (is_null($str)) + { + return 'NULL'; + } + + return $str; + } + + // -------------------------------------------------------------------- + /** * Affected Rows * @@ -557,6 +586,78 @@ class CI_DB_postgre_driver extends CI_DB { // -------------------------------------------------------------------- + /** + * Where + * + * Called by where() or or_where() + * + * @param mixed + * @param mixed + * @param string + * @return object + * + */ + protected function _where($key, $value = NULL, $type = 'AND ', $escape = NULL) + { + $type = $this->_group_get_type($type); + + if ( ! is_array($key)) + { + $key = array($key => $value); + } + + // If the escape value was not set will will base it on the global setting + if ( ! is_bool($escape)) + { + $escape = $this->_protect_identifiers; + } + + foreach ($key as $k => $v) + { + $prefix = (count($this->qb_where) === 0 && count($this->qb_cache_where) === 0) ? '' : $type; + + if (is_null($v) && ! $this->_has_operator($k)) + { + // value appears not to have been set, assign the test to IS NULL + $k .= ' IS NULL'; + } + + if ( ! is_null($v)) + { + if ($escape === TRUE) + { + $k = $this->protect_identifiers($k, FALSE, $escape); + $v = ' '.$this->escape($v); + } + else if (is_bool($v)) + { + $v = ' '.($v ? 'TRUE' : 'FALSE'); + } + + if ( ! $this->_has_operator($k)) + { + $k .= ' = '; + } + } + else + { + $k = $this->protect_identifiers($k, FALSE, $escape); + } + + $this->qb_where[] = $prefix.$k.$v; + if ($this->qb_caching === TRUE) + { + $this->qb_cache_where[] = $prefix.$k.$v; + $this->qb_cache_exists[] = 'where'; + } + + } + + return $this; + } + + // -------------------------------------------------------------------- + /** * Close DB Connection * -- cgit v1.2.3-24-g4f1b From 68fe7935a391b20dcf0cbdde9c1b49c697a6443b Mon Sep 17 00:00:00 2001 From: Soesapto Joeni Hantoro Date: Tue, 15 May 2012 08:19:29 +0700 Subject: Rollback changes, move it to postgre_driver --- system/database/DB_driver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index 09513e267..ef77b594e 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -696,7 +696,7 @@ abstract class CI_DB_driver { } elseif (is_bool($str)) { - return ($str === FALSE) ? "FALSE" : "TRUE"; + return ($str === FALSE) ? 0 : 1; } elseif (is_null($str)) { -- cgit v1.2.3-24-g4f1b From f79bdda8d823495b1f6524bd0cafb985860b7331 Mon Sep 17 00:00:00 2001 From: Soesapto Joeni Hantoro Date: Tue, 15 May 2012 08:20:24 +0700 Subject: Rollback changes, move it to postgre_driver --- system/database/DB_query_builder.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php index 8fa67ea06..d0af66de1 100644 --- a/system/database/DB_query_builder.php +++ b/system/database/DB_query_builder.php @@ -439,10 +439,6 @@ abstract class CI_DB_query_builder extends CI_DB_driver { $k = $this->protect_identifiers($k, FALSE, $escape); $v = ' '.$this->escape($v); } - else if (is_bool($v)) - { - $v = ' '.($v ? 'TRUE' : 'FALSE'); - } if ( ! $this->_has_operator($k)) { -- cgit v1.2.3-24-g4f1b From d2574db779d97f2a1ff8351b5a7c31c028601e17 Mon Sep 17 00:00:00 2001 From: Soesapto Joeni Hantoro Date: Tue, 15 May 2012 16:28:16 +0700 Subject: Escaping boolean data type for postgre --- system/database/drivers/postgre/postgre_driver.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php index 915763ad7..4b2fb7a9e 100644 --- a/system/database/drivers/postgre/postgre_driver.php +++ b/system/database/drivers/postgre/postgre_driver.php @@ -327,7 +327,7 @@ class CI_DB_postgre_driver extends CI_DB { } elseif (is_bool($str)) { - return $str ? "TRUE" : "FALSE"; + return ($str) ? 'TRUE' : 'FALSE'; } elseif (is_null($str)) { @@ -629,7 +629,7 @@ class CI_DB_postgre_driver extends CI_DB { $k = $this->protect_identifiers($k, FALSE, $escape); $v = ' '.$this->escape($v); } - else if (is_bool($v)) + elseif (is_bool($v)) { $v = ' '.($v ? 'TRUE' : 'FALSE'); } -- cgit v1.2.3-24-g4f1b From 5963db71348a06c14b38e7ce998df4249d4fd45a Mon Sep 17 00:00:00 2001 From: Soesapto Joeni Hantoro Date: Tue, 15 May 2012 16:31:18 +0700 Subject: escaping boolean data type for postgre change log --- user_guide_src/source/changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index a70531901..77c7e2ca4 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -100,6 +100,7 @@ Release Date: Not Released - Added PDO support for create_database(), drop_database and drop_table() in :doc:`Database Forge `. - Added MSSQL, SQLSRV support for optimize_table() in :doc:`Database Utility `. - Improved CUBRID support for list_databases() in :doc:`Database Utility ` (until now only the currently used database was returned). + - Added escaping boolean data type for PosgreSQL - Libraries -- cgit v1.2.3-24-g4f1b From dabeaa11ca2076935e5091e0f9e90ff9c4593962 Mon Sep 17 00:00:00 2001 From: Soesapto Joeni Hantoro Date: Tue, 15 May 2012 16:37:46 +0700 Subject: Escaping boolean data type for postgre --- system/database/drivers/postgre/postgre_driver.php | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php index 4b2fb7a9e..670eb549d 100644 --- a/system/database/drivers/postgre/postgre_driver.php +++ b/system/database/drivers/postgre/postgre_driver.php @@ -321,20 +321,12 @@ class CI_DB_postgre_driver extends CI_DB { */ public function escape($str) { - if (is_string($str) OR method_exists($str, '__toString')) - { - return "'".$this->escape_str($str)."'"; - } - elseif (is_bool($str)) + if (is_bool($str)) { return ($str) ? 'TRUE' : 'FALSE'; } - elseif (is_null($str)) - { - return 'NULL'; - } - return $str; + return parent::escape($str); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 242925bc084e4d606d5f34bdb49bdf9f5235ec32 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 15 May 2012 13:03:51 +0300 Subject: Minor changes on the pull #1355 additions --- system/database/drivers/postgre/postgre_driver.php | 8 ++++---- user_guide_src/source/changelog.rst | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php index 670eb549d..17bd37b38 100644 --- a/system/database/drivers/postgre/postgre_driver.php +++ b/system/database/drivers/postgre/postgre_driver.php @@ -328,7 +328,7 @@ class CI_DB_postgre_driver extends CI_DB { return parent::escape($str); } - + // -------------------------------------------------------------------- /** @@ -623,7 +623,7 @@ class CI_DB_postgre_driver extends CI_DB { } elseif (is_bool($v)) { - $v = ' '.($v ? 'TRUE' : 'FALSE'); + $v = ($v ? ' TRUE' : ' FALSE'); } if ( ! $this->_has_operator($k)) @@ -647,7 +647,7 @@ class CI_DB_postgre_driver extends CI_DB { return $this; } - + // -------------------------------------------------------------------- /** @@ -664,4 +664,4 @@ class CI_DB_postgre_driver extends CI_DB { } /* End of file postgre_driver.php */ -/* Location: ./system/database/drivers/postgre/postgre_driver.php */ +/* Location: ./system/database/drivers/postgre/postgre_driver.php */ \ No newline at end of file diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 2f2ebce98..d33a6a635 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -77,6 +77,7 @@ Release Date: Not Released - pg_version() is now used to get the database version number, when possible. - Added db_set_charset() support. - Added _optimize_table() support for the :doc:`Database Utility Class ` (rebuilds table indexes). + - Added boolean data type support in escape(). - Added a constructor to the DB_result class and moved all driver-specific properties and logic out of the base DB_driver class to allow better abstraction. - Removed limit() and order_by() support for UPDATE and DELETE queries in PostgreSQL driver. Postgres does not support those features. - Removed protect_identifiers() and renamed internal method _protect_identifiers() to it instead - it was just an alias. @@ -100,7 +101,6 @@ Release Date: Not Released - Added PDO support for create_database(), drop_database and drop_table() in :doc:`Database Forge `. - Added MSSQL, SQLSRV support for optimize_table() in :doc:`Database Utility `. - Improved CUBRID support for list_databases() in :doc:`Database Utility ` (until now only the currently used database was returned). - - Added escaping boolean data type for PosgreSQL - Libraries -- cgit v1.2.3-24-g4f1b From 570e77cd78e0c704b032c3e7702372ca63d5ddaa Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Tue, 15 May 2012 18:47:24 +0700 Subject: Benchmark code-coverage --- tests/codeigniter/core/Benchmark_test.php | 42 +++++++++++++++++++++++++++++++ tests/mocks/core/benchmark.php | 3 +++ 2 files changed, 45 insertions(+) create mode 100644 tests/codeigniter/core/Benchmark_test.php create mode 100644 tests/mocks/core/benchmark.php diff --git a/tests/codeigniter/core/Benchmark_test.php b/tests/codeigniter/core/Benchmark_test.php new file mode 100644 index 000000000..2790b582e --- /dev/null +++ b/tests/codeigniter/core/Benchmark_test.php @@ -0,0 +1,42 @@ +benchmark = new Mock_Core_Benchmark(); + } + + // -------------------------------------------------------------------- + + public function test_mark() + { + $this->assertEmpty($this->benchmark->marker); + + $this->benchmark->mark('code_start'); + + $this->assertEquals(1, count($this->benchmark->marker)); + $this->assertArrayHasKey('code_start', $this->benchmark->marker); + } + + // -------------------------------------------------------------------- + + public function test_elapsed_time() + { + $this->assertEquals('{elapsed_time}', $this->benchmark->elapsed_time()); + $this->assertEmpty($this->benchmark->elapsed_time('undefined_point')); + + $this->benchmark->mark('code_start'); + sleep(1); + $this->benchmark->mark('code_end'); + + $this->assertEquals('1.00', $this->benchmark->elapsed_time('code_start', 'code_end', 3)); + } + + // -------------------------------------------------------------------- + + public function test_memory_usage() + { + $this->assertEquals('{memory_usage}', $this->benchmark->memory_usage()); + } +} \ No newline at end of file diff --git a/tests/mocks/core/benchmark.php b/tests/mocks/core/benchmark.php new file mode 100644 index 000000000..d92be21db --- /dev/null +++ b/tests/mocks/core/benchmark.php @@ -0,0 +1,3 @@ + Date: Tue, 15 May 2012 18:48:45 +0700 Subject: Clean up autoloader annotation --- tests/mocks/autoloader.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/mocks/autoloader.php b/tests/mocks/autoloader.php index f1bdb5d6f..92c9bea59 100644 --- a/tests/mocks/autoloader.php +++ b/tests/mocks/autoloader.php @@ -6,7 +6,6 @@ // // Prototype : // -// include_once('Mock_Core_Loader') // Will load ./mocks/core/loader.php // $mock_table = new Mock_Libraries_Table(); // Will load ./mocks/libraries/table.php // $mock_database_driver = new Mock_Database_Driver(); // Will load ./mocks/database/driver.php // and so on... -- cgit v1.2.3-24-g4f1b From 8af88f3f729b7bcfd2a106f858b5445deafe5ed0 Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Tue, 15 May 2012 21:52:53 +0700 Subject: Security Code coverage --- tests/Bootstrap.php | 3 ++ tests/codeigniter/core/Security_test.php | 79 ++++++++++++++++++++++++++++++++ tests/mocks/core/security.php | 27 +++++++++++ tests/mocks/libraries/table.php | 2 +- 4 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 tests/codeigniter/core/Security_test.php create mode 100644 tests/mocks/core/security.php diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index 9f89d1be8..2bec364ef 100644 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -12,6 +12,9 @@ define('BASEPATH', PROJECT_BASE.'system/'); define('APPPATH', PROJECT_BASE.'application/'); define('VIEWPATH', PROJECT_BASE.''); +// Set cookie for security test +$_COOKIE['ci_csrf_cookie'] = md5(uniqid(rand(), TRUE)); + // Prep our test environment require_once 'vfsStream/vfsStream.php'; include_once $dir.'/mocks/core/common.php'; diff --git a/tests/codeigniter/core/Security_test.php b/tests/codeigniter/core/Security_test.php new file mode 100644 index 000000000..c3b526965 --- /dev/null +++ b/tests/codeigniter/core/Security_test.php @@ -0,0 +1,79 @@ +ci_set_config('csrf_protection', TRUE); + $this->ci_set_config('csrf_token_name', 'ci_csrf_token'); + // @see : ./Bootstrap.php Line 16 + $this->ci_set_config('csrf_cookie_name', 'ci_csrf_cookie'); + $this->ci_set_config('csrf_expire', 7200); + $this->ci_set_config('csrf_regenerate', TRUE); + $this->ci_set_config('csrf_exclude_uris', array()); + + $this->ci_set_config('cookie_prefix', ""); + $this->ci_set_config('cookie_domain', ""); + $this->ci_set_config('cookie_path', "/"); + $this->ci_set_config('cookie_secure', FALSE); + $this->ci_set_config('cookie_httponly', FALSE); + + $this->security = new Mock_Core_Security(); + } + + // -------------------------------------------------------------------- + + public function test_csrf_verify() + { + $_SERVER['REQUEST_METHOD'] = 'GET'; + + $this->assertInstanceOf('CI_Security', $this->security->csrf_verify()); + } + + // -------------------------------------------------------------------- + + public function test_csrf_verify_invalid() + { + // Without issuing $_POST[csrf_token_name], this request will triggering CSRF error + $_SERVER['REQUEST_METHOD'] = 'POST'; + + $this->setExpectedException('RuntimeException', 'CI Error: The action you have requested is not allowed'); + + $this->security->csrf_verify(); + } + + // -------------------------------------------------------------------- + + public function test_csrf_verify_valid() + { + $_SERVER['REQUEST_METHOD'] = 'POST'; + $_POST[$this->security->csrf_token_name] = $this->security->csrf_hash; + + $this->assertInstanceOf('CI_Security', $this->security->csrf_verify()); + } + + // -------------------------------------------------------------------- + + public function test_get_csrf_hash() + { + $this->assertEquals($this->security->csrf_hash, $this->security->get_csrf_hash()); + } + + // -------------------------------------------------------------------- + + public function test_get_csrf_token_name() + { + $this->assertEquals('ci_csrf_token', $this->security->get_csrf_token_name()); + } + + // -------------------------------------------------------------------- + + public function test_xss_clean() + { + $harm_string = "Hello, i try to your site"; + + $harmless_string = $this->security->xss_clean($harm_string); + + $this->assertEquals("Hello, i try to [removed]alert('Hack');[removed] your site", $harmless_string); + } +} \ No newline at end of file diff --git a/tests/mocks/core/security.php b/tests/mocks/core/security.php new file mode 100644 index 000000000..de8e44710 --- /dev/null +++ b/tests/mocks/core/security.php @@ -0,0 +1,27 @@ +{'_'.$property}) ? $this->{'_'.$property} : NULL; + } + + // Overide inaccesible protected method + public function __call($method, $params) + { + if (is_callable(array($this, '_'.$method))) + { + return call_user_func_array(array($this, '_'.$method), $params); + } + + throw new BadMethodCallException('Method '.$method.' was not found'); + } + +} \ No newline at end of file diff --git a/tests/mocks/libraries/table.php b/tests/mocks/libraries/table.php index 1a6ff8d35..97fbb30bd 100644 --- a/tests/mocks/libraries/table.php +++ b/tests/mocks/libraries/table.php @@ -2,7 +2,7 @@ class Mock_Libraries_Table extends CI_Table { - // Overide inaccesible private or protected method + // Overide inaccesible protected method public function __call($method, $params) { if (is_callable(array($this, '_'.$method))) -- cgit v1.2.3-24-g4f1b From d40a545e9e7e4dc222d58fe46fe23f3691f043ee Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Tue, 15 May 2012 22:00:14 +0700 Subject: Comment block for explanation --- tests/mocks/core/security.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/mocks/core/security.php b/tests/mocks/core/security.php index de8e44710..c5269fbc5 100644 --- a/tests/mocks/core/security.php +++ b/tests/mocks/core/security.php @@ -4,6 +4,9 @@ class Mock_Core_Security extends CI_Security { public function csrf_set_cookie() { + // We cannot set cookie in CLI mode, so for csrf test, who rely on $_COOKIE, + // we superseded set_cookie with directly set the cookie variable, + // @see : ./Bootstrap.php, line 16 return $this; } -- cgit v1.2.3-24-g4f1b From 7756af5df0a53930019e9fd7b828504f0c2c5427 Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Tue, 15 May 2012 23:57:05 +0700 Subject: Input class code-coverage --- tests/Bootstrap.php | 3 - tests/codeigniter/core/Input_test.php | 144 +++++++++++++++++++++++++++++++ tests/codeigniter/core/Security_test.php | 14 +-- tests/mocks/core/input.php | 31 +++++++ tests/mocks/core/security.php | 2 +- tests/mocks/core/utf8.php | 27 ++++++ 6 files changed, 207 insertions(+), 14 deletions(-) create mode 100644 tests/codeigniter/core/Input_test.php create mode 100644 tests/mocks/core/input.php create mode 100644 tests/mocks/core/utf8.php diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index 2bec364ef..9f89d1be8 100644 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -12,9 +12,6 @@ define('BASEPATH', PROJECT_BASE.'system/'); define('APPPATH', PROJECT_BASE.'application/'); define('VIEWPATH', PROJECT_BASE.''); -// Set cookie for security test -$_COOKIE['ci_csrf_cookie'] = md5(uniqid(rand(), TRUE)); - // Prep our test environment require_once 'vfsStream/vfsStream.php'; include_once $dir.'/mocks/core/common.php'; diff --git a/tests/codeigniter/core/Input_test.php b/tests/codeigniter/core/Input_test.php new file mode 100644 index 000000000..fd0576e38 --- /dev/null +++ b/tests/codeigniter/core/Input_test.php @@ -0,0 +1,144 @@ +ci_set_config('allow_get_array', TRUE); + $this->ci_set_config('global_xss_filtering', FALSE); + $this->ci_set_config('csrf_protection', FALSE); + + $security = new Mock_Core_Security(); + $utf8 = new Mock_Core_Utf8(); + + $this->input = new Mock_Core_Input($security, $utf8); + } + + // -------------------------------------------------------------------- + + public function test_get_not_exists() + { + $this->assertEmpty($this->input->get()); + $this->assertEmpty($this->input->get('foo')); + + $this->assertTrue( ! $this->input->get()); + $this->assertTrue( ! $this->input->get('foo')); + + $this->assertTrue($this->input->get() == FALSE); + $this->assertTrue($this->input->get('foo') == FALSE); + + $this->assertTrue($this->input->get() === FALSE); + $this->assertTrue($this->input->get('foo') === FALSE); + } + + // -------------------------------------------------------------------- + + public function test_get_exist() + { + $_SERVER['REQUEST_METHOD'] = 'GET'; + $_GET['foo'] = 'bar'; + + $this->assertArrayHasKey('foo', $this->input->get()); + $this->assertEquals('bar', $this->input->get('foo')); + } + + // -------------------------------------------------------------------- + + public function test_get_exist_with_xss_clean() + { + $_SERVER['REQUEST_METHOD'] = 'GET'; + $_GET['harm'] = "Hello, i try to your site"; + + $this->assertArrayHasKey('harm', $this->input->get()); + $this->assertEquals("Hello, i try to your site", $this->input->get('harm')); + $this->assertEquals("Hello, i try to [removed]alert('Hack');[removed] your site", $this->input->get('harm', TRUE)); + } + + // -------------------------------------------------------------------- + + public function test_post_not_exists() + { + $this->assertEmpty($this->input->post()); + $this->assertEmpty($this->input->post('foo')); + + $this->assertTrue( ! $this->input->post()); + $this->assertTrue( ! $this->input->post('foo')); + + $this->assertTrue($this->input->post() == FALSE); + $this->assertTrue($this->input->post('foo') == FALSE); + + $this->assertTrue($this->input->post() === FALSE); + $this->assertTrue($this->input->post('foo') === FALSE); + } + + // -------------------------------------------------------------------- + + public function test_post_exist() + { + $_SERVER['REQUEST_METHOD'] = 'POST'; + $_POST['foo'] = 'bar'; + + $this->assertArrayHasKey('foo', $this->input->post()); + $this->assertEquals('bar', $this->input->post('foo')); + } + + // -------------------------------------------------------------------- + + public function test_post_exist_with_xss_clean() + { + $_SERVER['REQUEST_METHOD'] = 'POST'; + $_POST['harm'] = "Hello, i try to your site"; + + $this->assertArrayHasKey('harm', $this->input->post()); + $this->assertEquals("Hello, i try to your site", $this->input->post('harm')); + $this->assertEquals("Hello, i try to [removed]alert('Hack');[removed] your site", $this->input->post('harm', TRUE)); + } + + // -------------------------------------------------------------------- + + public function test_get_post() + { + $_SERVER['REQUEST_METHOD'] = 'POST'; + $_POST['foo'] = 'bar'; + + $this->assertEquals('bar', $this->input->get_post('foo')); + } + + // -------------------------------------------------------------------- + + public function test_cookie() + { + $_COOKIE['foo'] = 'bar'; + + $this->assertEquals('bar', $this->input->cookie('foo')); + } + + // -------------------------------------------------------------------- + + public function test_server() + { + $this->assertEquals('GET', $this->input->server('REQUEST_METHOD')); + } + + // -------------------------------------------------------------------- + + public function test_fetch_from_array() + { + $data = array( + 'foo' => 'bar', + 'harm' => 'Hello, i try to your site', + ); + + $foo = $this->input->fetch_from_array($data, 'foo'); + $harm = $this->input->fetch_from_array($data, 'harm'); + $harmless = $this->input->fetch_from_array($data, 'harm', TRUE); + + $this->assertEquals('bar', $foo); + $this->assertEquals("Hello, i try to your site", $harm); + $this->assertEquals("Hello, i try to [removed]alert('Hack');[removed] your site", $harmless); + } +} \ No newline at end of file diff --git a/tests/codeigniter/core/Security_test.php b/tests/codeigniter/core/Security_test.php index c3b526965..1796ba74d 100644 --- a/tests/codeigniter/core/Security_test.php +++ b/tests/codeigniter/core/Security_test.php @@ -4,19 +4,13 @@ class Security_test extends CI_TestCase { public function set_up() { + // Set cookie for security test + $_COOKIE['ci_csrf_cookie'] = md5(uniqid(rand(), TRUE)); + + // Set config for Security class $this->ci_set_config('csrf_protection', TRUE); $this->ci_set_config('csrf_token_name', 'ci_csrf_token'); - // @see : ./Bootstrap.php Line 16 $this->ci_set_config('csrf_cookie_name', 'ci_csrf_cookie'); - $this->ci_set_config('csrf_expire', 7200); - $this->ci_set_config('csrf_regenerate', TRUE); - $this->ci_set_config('csrf_exclude_uris', array()); - - $this->ci_set_config('cookie_prefix', ""); - $this->ci_set_config('cookie_domain', ""); - $this->ci_set_config('cookie_path', "/"); - $this->ci_set_config('cookie_secure', FALSE); - $this->ci_set_config('cookie_httponly', FALSE); $this->security = new Mock_Core_Security(); } diff --git a/tests/mocks/core/input.php b/tests/mocks/core/input.php new file mode 100644 index 000000000..8a337d2ef --- /dev/null +++ b/tests/mocks/core/input.php @@ -0,0 +1,31 @@ +_allow_get_array = (config_item('allow_get_array') === TRUE); + $this->_enable_xss = (config_item('global_xss_filtering') === TRUE); + $this->_enable_csrf = (config_item('csrf_protection') === TRUE); + + // Assign Security and Utf8 classes + $this->security = $security; + $this->uni = $utf8; + + // Sanitize global arrays + $this->_sanitize_globals(); + } + + public function fetch_from_array($array, $index = '', $xss_clean = FALSE) + { + return parent::_fetch_from_array($array, $index, $xss_clean); + } + +} \ No newline at end of file diff --git a/tests/mocks/core/security.php b/tests/mocks/core/security.php index c5269fbc5..d7ea0e6bd 100644 --- a/tests/mocks/core/security.php +++ b/tests/mocks/core/security.php @@ -6,7 +6,7 @@ class Mock_Core_Security extends CI_Security { { // We cannot set cookie in CLI mode, so for csrf test, who rely on $_COOKIE, // we superseded set_cookie with directly set the cookie variable, - // @see : ./Bootstrap.php, line 16 + // @see : ./tests/codeigniter/core/Security_test.php, line 8 return $this; } diff --git a/tests/mocks/core/utf8.php b/tests/mocks/core/utf8.php new file mode 100644 index 000000000..b77d717e7 --- /dev/null +++ b/tests/mocks/core/utf8.php @@ -0,0 +1,27 @@ + Date: Wed, 16 May 2012 00:08:05 +0700 Subject: Remove unused hardcoded reference from *phpunit.xml files --- tests/travis/mysql.phpunit.xml | 2 -- tests/travis/pdo/mysql.phpunit.xml | 4 +--- tests/travis/pdo/pgsql.phpunit.xml | 2 -- tests/travis/pdo/sqlite.phpunit.xml | 2 -- tests/travis/pgsql.phpunit.xml | 2 -- tests/travis/sqlite.phpunit.xml | 2 -- 6 files changed, 1 insertion(+), 13 deletions(-) diff --git a/tests/travis/mysql.phpunit.xml b/tests/travis/mysql.phpunit.xml index c5fcf1335..1792ae38d 100644 --- a/tests/travis/mysql.phpunit.xml +++ b/tests/travis/mysql.phpunit.xml @@ -21,8 +21,6 @@ PEAR_INSTALL_DIR PHP_LIBDIR - PROJECT_BASE.'tests' - '../../system/core/CodeIgniter.php'
\ No newline at end of file diff --git a/tests/travis/pdo/mysql.phpunit.xml b/tests/travis/pdo/mysql.phpunit.xml index f6fcc1c39..602030d4e 100644 --- a/tests/travis/pdo/mysql.phpunit.xml +++ b/tests/travis/pdo/mysql.phpunit.xml @@ -14,15 +14,13 @@ - ../../codeigniter/database + ../../codeigniter PEAR_INSTALL_DIR PHP_LIBDIR - PROJECT_BASE.'tests' - '../../../system/core/CodeIgniter.php' \ No newline at end of file diff --git a/tests/travis/pdo/pgsql.phpunit.xml b/tests/travis/pdo/pgsql.phpunit.xml index 6a23227db..77e1493c6 100644 --- a/tests/travis/pdo/pgsql.phpunit.xml +++ b/tests/travis/pdo/pgsql.phpunit.xml @@ -21,8 +21,6 @@ PEAR_INSTALL_DIR PHP_LIBDIR - PROJECT_BASE.'tests' - '../../../system/core/CodeIgniter.php'
\ No newline at end of file diff --git a/tests/travis/pdo/sqlite.phpunit.xml b/tests/travis/pdo/sqlite.phpunit.xml index b85b7308a..cdccef017 100644 --- a/tests/travis/pdo/sqlite.phpunit.xml +++ b/tests/travis/pdo/sqlite.phpunit.xml @@ -21,8 +21,6 @@ PEAR_INSTALL_DIR PHP_LIBDIR - PROJECT_BASE.'tests' - '../../../system/core/CodeIgniter.php'
\ No newline at end of file diff --git a/tests/travis/pgsql.phpunit.xml b/tests/travis/pgsql.phpunit.xml index 78b6046cf..dfc1bff1c 100644 --- a/tests/travis/pgsql.phpunit.xml +++ b/tests/travis/pgsql.phpunit.xml @@ -21,8 +21,6 @@ PEAR_INSTALL_DIR PHP_LIBDIR - PROJECT_BASE.'tests' - '../../system/core/CodeIgniter.php'
\ No newline at end of file diff --git a/tests/travis/sqlite.phpunit.xml b/tests/travis/sqlite.phpunit.xml index 46e3d5073..3223da5e7 100644 --- a/tests/travis/sqlite.phpunit.xml +++ b/tests/travis/sqlite.phpunit.xml @@ -21,8 +21,6 @@ PEAR_INSTALL_DIR PHP_LIBDIR - PROJECT_BASE.'tests' - '../../system/core/CodeIgniter.php'
\ No newline at end of file -- cgit v1.2.3-24-g4f1b From 04d4091dfa551475998c351e09858e5ebdcf4482 Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Mon, 30 Apr 2012 16:04:43 +0100 Subject: fix backtrace filtering The backtrace was filtered to remove CI system files, but the filter was buggy. It would also filter out application files which happened to contain the string "system"... or ALL files, if the application directory is under /system/ (Perhaps the latter comes as a surprise, but it's explicitly mentioned in index.php and ). Instead, we should test whether the file is underneath BASEPATH (using realpath() to make sure we have the same sort of slashes). --- application/errors/error_php.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/application/errors/error_php.php b/application/errors/error_php.php index 3855720de..b76dc8a9e 100644 --- a/application/errors/error_php.php +++ b/application/errors/error_php.php @@ -40,12 +40,15 @@

Backtrace:

- + +

File:
Line:
Function:

+

-- cgit v1.2.3-24-g4f1b From 2ed226bd5ed19754c2fb28d4b98ac5423741f039 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Wed, 16 May 2012 08:37:32 -0400 Subject: Add note in the upgrade guide to move errors folder --- user_guide_src/source/installation/upgrade_300.rst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/user_guide_src/source/installation/upgrade_300.rst b/user_guide_src/source/installation/upgrade_300.rst index e434e8d45..63c4227dc 100644 --- a/user_guide_src/source/installation/upgrade_300.rst +++ b/user_guide_src/source/installation/upgrade_300.rst @@ -40,4 +40,9 @@ need to rename the `$active_record` variable to `$query_builder`. $active_group = 'default'; // $active_record = TRUE; - $query_builder = TRUE; \ No newline at end of file + $query_builder = TRUE; + +Step 5: Move your errors folder +=============================== + +In version 3.0.0, the errors folder has been moved from "application/errors" to "application/views/errors". \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 09a1b5e7fb3c930aa9a50e246236227a499b5d28 Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Wed, 16 May 2012 22:18:00 +0700 Subject: Reduce decimal points, since there is a micro differencess on runtime and update travis status --- tests/README.md | 2 +- tests/codeigniter/core/Benchmark_test.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/README.md b/tests/README.md index b46f344cb..c8fc608e8 100644 --- a/tests/README.md +++ b/tests/README.md @@ -1,6 +1,6 @@ # CodeIgniter Unit Tests # -Status : [![Build Status](https://secure.travis-ci.org/EllisLab/CodeIgniter.png?branch=feature/unit-tests)](http://travis-ci.org/EllisLab/CodeIgniter) +Status : [![Build Status](https://secure.travis-ci.org/EllisLab/CodeIgniter.png?branch=develop)](http://travis-ci.org/EllisLab/CodeIgniter) ### Introduction: diff --git a/tests/codeigniter/core/Benchmark_test.php b/tests/codeigniter/core/Benchmark_test.php index 2790b582e..109b38821 100644 --- a/tests/codeigniter/core/Benchmark_test.php +++ b/tests/codeigniter/core/Benchmark_test.php @@ -29,8 +29,8 @@ class Benchmark_test extends CI_TestCase { $this->benchmark->mark('code_start'); sleep(1); $this->benchmark->mark('code_end'); - - $this->assertEquals('1.00', $this->benchmark->elapsed_time('code_start', 'code_end', 3)); + + $this->assertEquals('1.0', $this->benchmark->elapsed_time('code_start', 'code_end', 1)); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 94e74bf0f8ae82a28c70fe1a3cb76a01f6c50fd8 Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Wed, 16 May 2012 17:20:56 +0100 Subject: If we want E_STRICT, don't suppress it! 15be8fc "Changed the 'development' environment default error reporting to included E_STRICT" Not present in any tagged release, so no need for -stable or a changlelog entry. --- system/core/Common.php | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/system/core/Common.php b/system/core/Common.php index 78aa6e874..ec94c528b 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -487,16 +487,6 @@ if ( ! function_exists('_exception_handler')) */ function _exception_handler($severity, $message, $filepath, $line) { - // We don't bother with "strict" notices since they tend to fill up - // the log file with excess information that isn't normally very helpful. - // For example, if you are running PHP 5 and you use version 4 style - // class functions (without prefixes like "public", "private", etc.) - // you'll get notices telling you that these have been deprecated. - if ($severity == E_STRICT) - { - return; - } - $_error =& load_class('Exceptions', 'core'); // Should we display the error? We'll get the current error_reporting -- cgit v1.2.3-24-g4f1b From e2c374fc474f91cc1c04aaae68e15cef6984f494 Mon Sep 17 00:00:00 2001 From: Alexander Hofstede Date: Thu, 17 May 2012 00:28:08 +0200 Subject: Check cookie against md5 regex. Otherwise, cookie can contain arbitrary injected code that gets sent back directly to the browser. --- system/core/Security.php | 2 +- user_guide/changelog.html | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/system/core/Security.php b/system/core/Security.php index a3e227437..6f5ac1ed8 100755 --- a/system/core/Security.php +++ b/system/core/Security.php @@ -848,7 +848,7 @@ class CI_Security { // each page load since a page could contain embedded // sub-pages causing this feature to fail if (isset($_COOKIE[$this->_csrf_cookie_name]) && - $_COOKIE[$this->_csrf_cookie_name] != '') + preg_match('#^[0-9a-f]{32}$#iS', $_COOKIE[$this->_csrf_cookie_name]) === 1) { return $this->_csrf_hash = $_COOKIE[$this->_csrf_cookie_name]; } diff --git a/user_guide/changelog.html b/user_guide/changelog.html index 613c4e65d..38275955b 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -85,6 +85,7 @@ Change Log
  • Fixed a bug - CI_Upload::_file_mime_type() could've failed if mime_content_type() is used for the detection and returns FALSE.
  • Fixed a bug (#538) - Windows paths were ignored when using the Image Manipulation Class to create a new file.
  • Fixed a bug - When database caching was enabled, $this->db->query() checked the cache before binding variables which resulted in cached queries never being found.
  • +
  • Fixed a bug - CSRF cookie value was allowed to be any (non-empty) string before being written to the output, making code injection a risk.
  • -- cgit v1.2.3-24-g4f1b From c3eb672ed01c57a543dd8cdf1b90eb4001498c19 Mon Sep 17 00:00:00 2001 From: Alexander Hofstede Date: Thu, 17 May 2012 10:48:11 +0200 Subject: Use tab for indent --- .project | 13 +++++++++++++ .settings/com.aptana.formatter.epl.prefs | 2 ++ user_guide/changelog.html | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 .project create mode 100644 .settings/com.aptana.formatter.epl.prefs diff --git a/.project b/.project new file mode 100644 index 000000000..6f00520a1 --- /dev/null +++ b/.project @@ -0,0 +1,13 @@ + + + CodeIgniter + + + + + + + com.aptana.projects.webnature + com.aptana.editor.php.phpNature + + diff --git a/.settings/com.aptana.formatter.epl.prefs b/.settings/com.aptana.formatter.epl.prefs new file mode 100644 index 000000000..ebd4b7aeb --- /dev/null +++ b/.settings/com.aptana.formatter.epl.prefs @@ -0,0 +1,2 @@ +com.aptana.formatter.profiles.active=com.aptana.formatter.profiles.default +eclipse.preferences.version=1 diff --git a/user_guide/changelog.html b/user_guide/changelog.html index 38275955b..55fbceeaf 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -85,7 +85,7 @@ Change Log
  • Fixed a bug - CI_Upload::_file_mime_type() could've failed if mime_content_type() is used for the detection and returns FALSE.
  • Fixed a bug (#538) - Windows paths were ignored when using the Image Manipulation Class to create a new file.
  • Fixed a bug - When database caching was enabled, $this->db->query() checked the cache before binding variables which resulted in cached queries never being found.
  • -
  • Fixed a bug - CSRF cookie value was allowed to be any (non-empty) string before being written to the output, making code injection a risk.
  • +
  • Fixed a bug - CSRF cookie value was allowed to be any (non-empty) string before being written to the output, making code injection a risk.
  • -- cgit v1.2.3-24-g4f1b From be32f2b25c72517c003010eeaae8b46dae19fe3e Mon Sep 17 00:00:00 2001 From: Alexander Hofstede Date: Thu, 17 May 2012 10:51:05 +0200 Subject: Revert "Use tab for indent" This reverts commit c3eb672ed01c57a543dd8cdf1b90eb4001498c19. --- .project | 13 ------------- .settings/com.aptana.formatter.epl.prefs | 2 -- user_guide/changelog.html | 2 +- 3 files changed, 1 insertion(+), 16 deletions(-) delete mode 100644 .project delete mode 100644 .settings/com.aptana.formatter.epl.prefs diff --git a/.project b/.project deleted file mode 100644 index 6f00520a1..000000000 --- a/.project +++ /dev/null @@ -1,13 +0,0 @@ - - - CodeIgniter - - - - - - - com.aptana.projects.webnature - com.aptana.editor.php.phpNature - - diff --git a/.settings/com.aptana.formatter.epl.prefs b/.settings/com.aptana.formatter.epl.prefs deleted file mode 100644 index ebd4b7aeb..000000000 --- a/.settings/com.aptana.formatter.epl.prefs +++ /dev/null @@ -1,2 +0,0 @@ -com.aptana.formatter.profiles.active=com.aptana.formatter.profiles.default -eclipse.preferences.version=1 diff --git a/user_guide/changelog.html b/user_guide/changelog.html index 55fbceeaf..38275955b 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -85,7 +85,7 @@ Change Log
  • Fixed a bug - CI_Upload::_file_mime_type() could've failed if mime_content_type() is used for the detection and returns FALSE.
  • Fixed a bug (#538) - Windows paths were ignored when using the Image Manipulation Class to create a new file.
  • Fixed a bug - When database caching was enabled, $this->db->query() checked the cache before binding variables which resulted in cached queries never being found.
  • -
  • Fixed a bug - CSRF cookie value was allowed to be any (non-empty) string before being written to the output, making code injection a risk.
  • +
  • Fixed a bug - CSRF cookie value was allowed to be any (non-empty) string before being written to the output, making code injection a risk.
  • -- cgit v1.2.3-24-g4f1b From 8f04c69fe65ddc2604425eaee811b50a909d905f Mon Sep 17 00:00:00 2001 From: Alexander Hofstede Date: Thu, 17 May 2012 10:52:44 +0200 Subject: Use tabs for indenting --- user_guide/changelog.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide/changelog.html b/user_guide/changelog.html index 38275955b..55fbceeaf 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -85,7 +85,7 @@ Change Log
  • Fixed a bug - CI_Upload::_file_mime_type() could've failed if mime_content_type() is used for the detection and returns FALSE.
  • Fixed a bug (#538) - Windows paths were ignored when using the Image Manipulation Class to create a new file.
  • Fixed a bug - When database caching was enabled, $this->db->query() checked the cache before binding variables which resulted in cached queries never being found.
  • -
  • Fixed a bug - CSRF cookie value was allowed to be any (non-empty) string before being written to the output, making code injection a risk.
  • +
  • Fixed a bug - CSRF cookie value was allowed to be any (non-empty) string before being written to the output, making code injection a risk.
  • -- cgit v1.2.3-24-g4f1b From 92ebfb65ac044f5c2e6d88fba137253854cf1b94 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 17 May 2012 12:49:24 +0300 Subject: Cleanup the core classes --- system/core/Benchmark.php | 6 ++-- system/core/CodeIgniter.php | 2 +- system/core/Common.php | 6 ++-- system/core/Config.php | 27 +++++++++--------- system/core/Controller.php | 7 +++-- system/core/Exceptions.php | 12 ++++---- system/core/Hooks.php | 6 ++-- system/core/Input.php | 31 ++++++++++----------- system/core/Loader.php | 35 +++++++++++------------ system/core/Model.php | 3 ++ system/core/Output.php | 18 ++++++------ system/core/Router.php | 25 ++++++++--------- system/core/Security.php | 18 ++++++------ system/core/URI.php | 67 ++++++++++++++++++++++----------------------- system/core/Utf8.php | 4 ++- 15 files changed, 135 insertions(+), 132 deletions(-) diff --git a/system/core/Benchmark.php b/system/core/Benchmark.php index c17e95a19..bb630f40b 100755 --- a/system/core/Benchmark.php +++ b/system/core/Benchmark.php @@ -25,13 +25,11 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * CodeIgniter Benchmark Class * * This class enables you to mark points and calculate the time difference - * between them. Memory consumption can also be displayed. + * between them. Memory consumption can also be displayed. * * @package CodeIgniter * @subpackage Libraries @@ -119,4 +117,4 @@ class CI_Benchmark { } /* End of file Benchmark.php */ -/* Location: ./system/core/Benchmark.php */ +/* Location: ./system/core/Benchmark.php */ \ No newline at end of file diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php index 349f9f2d0..00db6e13a 100755 --- a/system/core/CodeIgniter.php +++ b/system/core/CodeIgniter.php @@ -31,7 +31,7 @@ * Loads the base classes and executes the request. * * @package CodeIgniter - * @subpackage codeigniter + * @subpackage CodeIgniter * @category Front-controller * @author EllisLab Dev Team * @link http://codeigniter.com/user_guide/ diff --git a/system/core/Common.php b/system/core/Common.php index 78aa6e874..8b897776f 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -31,7 +31,7 @@ * Loads the base classes and executes the request. * * @package CodeIgniter - * @subpackage codeigniter + * @subpackage CodeIgniter * @category Common Functions * @author EllisLab Dev Team * @link http://codeigniter.com/user_guide/ @@ -57,7 +57,7 @@ if ( ! function_exists('is_php')) if ( ! isset($_is_php[$version])) { - $_is_php[$version] = (version_compare(PHP_VERSION, $version) < 0) ? FALSE : TRUE; + $_is_php[$version] = (version_compare(PHP_VERSION, $version) >= 0); } return $_is_php[$version]; @@ -506,7 +506,7 @@ if ( ! function_exists('_exception_handler')) $_error->show_php_error($severity, $message, $filepath, $line); } - // Should we log the error? No? We're done... + // Should we log the error? No? We're done... if (config_item('log_threshold') == 0) { return; diff --git a/system/core/Config.php b/system/core/Config.php index 9cebe6c86..c07ffa591 100755 --- a/system/core/Config.php +++ b/system/core/Config.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * CodeIgniter Config Class * @@ -46,14 +44,14 @@ class CI_Config { * @var array */ public $config = array(); - + /** * List of all loaded config files * * @var array */ public $is_loaded = array(); - + /** * List of paths to search when trying to load a config file. * This must be public as it's used by the Loader class. @@ -77,9 +75,9 @@ class CI_Config { { if (isset($_SERVER['HTTP_HOST'])) { - $base_url = ! empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off' ? 'https' : 'http'; - $base_url .= '://'. $_SERVER['HTTP_HOST'] - . str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']); + $base_url = ( ! empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') ? 'https' : 'http'; + $base_url .= '://'.$_SERVER['HTTP_HOST'] + .str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']); } else { @@ -96,9 +94,9 @@ class CI_Config { * Load Config File * * @param string the config file name - * @param boolean if configuration values should be loaded into their own section - * @param boolean true if errors should just return false, false if an error message should be displayed - * @return boolean if the file was loaded correctly + * @param bool if configuration values should be loaded into their own section + * @param bool true if errors should just return false, false if an error message should be displayed + * @return bool if the file was loaded correctly */ public function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE) { @@ -254,8 +252,8 @@ class CI_Config { * Base URL * Returns base_url [. uri_string] * - * @param string $uri - * @return string + * @param string $uri + * @return string */ public function base_url($uri = '') { @@ -267,8 +265,8 @@ class CI_Config { /** * Build URI string for use in Config::site_url() and Config::base_url() * - * @param mixed $uri - * @return string + * @param mixed $uri + * @return string */ protected function _uri_string($uri) { @@ -345,6 +343,7 @@ class CI_Config { } } } + } /* End of file Config.php */ diff --git a/system/core/Controller.php b/system/core/Controller.php index 1f69146d0..491414807 100644 --- a/system/core/Controller.php +++ b/system/core/Controller.php @@ -48,6 +48,8 @@ class CI_Controller { /** * Set up controller properties and methods + * + * @return void */ public function __construct() { @@ -67,14 +69,15 @@ class CI_Controller { } /** - * Return the CI object + * Return the CI object * - * @return object + * @return object */ public static function &get_instance() { return self::$instance; } + } /* End of file Controller.php */ diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index 2e9f0c766..965a717ad 100755 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -65,6 +65,8 @@ class CI_Exceptions { /** * Initialize execption class + * + * @return void */ public function __construct() { @@ -87,7 +89,7 @@ class CI_Exceptions { */ public function log_exception($severity, $message, $filepath, $line) { - $severity = ( ! isset($this->levels[$severity])) ? $severity : $this->levels[$severity]; + $severity = isset($this->levels[$severity]) ? $this->levels[$severity] : $severity; log_message('error', 'Severity: '.$severity.' --> '.$message. ' '.$filepath.' '.$line, TRUE); } @@ -127,14 +129,14 @@ class CI_Exceptions { * @param string the heading * @param string the message * @param string the template name - * @param int the status code + * @param int the status code * @return string */ public function show_error($heading, $message, $template = 'error_general', $status_code = 500) { set_status_header($status_code); - $message = '

    '.implode('

    ', ( ! is_array($message)) ? array($message) : $message).'

    '; + $message = '

    '.implode('

    ', is_array($message) ? $message : array($message)).'

    '; if (ob_get_level() > $this->ob_level + 1) { @@ -160,7 +162,7 @@ class CI_Exceptions { */ public function show_php_error($severity, $message, $filepath, $line) { - $severity = ( ! isset($this->levels[$severity])) ? $severity : $this->levels[$severity]; + $severity = isset($this->levels[$severity]) ? $this->levels[$severity] : $severity; $filepath = str_replace('\\', '/', $filepath); // For safety reasons we do not show the full file path @@ -175,7 +177,7 @@ class CI_Exceptions { ob_end_flush(); } ob_start(); - include(APPPATH.'errors/'.'error_php.php'); + include(APPPATH.'errors/error_php.php'); $buffer = ob_get_contents(); ob_end_clean(); echo $buffer; diff --git a/system/core/Hooks.php b/system/core/Hooks.php index b42ecbe20..5bbb0009a 100755 --- a/system/core/Hooks.php +++ b/system/core/Hooks.php @@ -44,14 +44,14 @@ class CI_Hooks { * @var bool */ public $enabled = FALSE; - + /** * List of all hooks set in config/hooks.php * * @var array */ public $hooks = array(); - + /** * Determines wether hook is in progress, used to prevent infinte loops * @@ -152,7 +152,7 @@ class CI_Hooks { // If the script being called happens to have the same // hook call within it a loop can happen - if ($this->in_progress == TRUE) + if ($this->in_progress === TRUE) { return; } diff --git a/system/core/Input.php b/system/core/Input.php index fc2a550bc..e916ac66d 100755 --- a/system/core/Input.php +++ b/system/core/Input.php @@ -44,28 +44,28 @@ class CI_Input { * @var string */ public $ip_address = FALSE; - + /** * user agent (web browser) being used by the current user * * @var string */ public $user_agent = FALSE; - + /** * If FALSE, then $_GET will be set to an empty array * * @var bool */ protected $_allow_get_array = TRUE; - + /** * If TRUE, then newlines are standardized * * @var bool */ protected $_standardize_newlines = TRUE; - + /** * Determines whether the XSS filter is always active when GET, POST or COOKIE data is encountered * Set automatically based on config setting @@ -73,7 +73,7 @@ class CI_Input { * @var bool */ protected $_enable_xss = FALSE; - + /** * Enables a CSRF cookie token to be set. * Set automatically based on config setting @@ -81,7 +81,7 @@ class CI_Input { * @var bool */ protected $_enable_csrf = FALSE; - + /** * List of all HTTP request headers * @@ -94,6 +94,8 @@ class CI_Input { * * Sets whether to globally enable the XSS processing * and whether to allow the $_GET array + * + * @return void */ public function __construct() { @@ -438,15 +440,7 @@ class CI_Input { // This is effectively the same as register_globals = off foreach (array($_GET, $_POST, $_COOKIE) as $global) { - if ( ! is_array($global)) - { - if ( ! in_array($global, $protected)) - { - global $$global; - $$global = NULL; - } - } - else + if (is_array($global)) { foreach ($global as $key => $val) { @@ -457,6 +451,11 @@ class CI_Input { } } } + elseif ( ! in_array($global, $protected)) + { + global $$global; + $$global = NULL; + } } // Is $_GET data allowed? If not we'll set the $_GET to an empty array @@ -605,7 +604,7 @@ class CI_Input { * In Apache, you can simply call apache_request_headers(), however for * people running other webservers the function is undefined. * - * @param bool XSS cleaning + * @param bool XSS cleaning * @return array */ public function request_headers($xss_clean = FALSE) diff --git a/system/core/Loader.php b/system/core/Loader.php index bf7f6cb02..3eb09e6ab 100644 --- a/system/core/Loader.php +++ b/system/core/Loader.php @@ -32,8 +32,8 @@ * * @package CodeIgniter * @subpackage Libraries - * @author EllisLab Dev Team * @category Loader + * @author EllisLab Dev Team * @link http://codeigniter.com/user_guide/libraries/loader.html */ class CI_Loader { @@ -45,77 +45,77 @@ class CI_Loader { * @var int */ protected $_ci_ob_level; - + /** * List of paths to load views from * * @var array */ protected $_ci_view_paths = array(); - + /** * List of paths to load libraries from * * @var array */ protected $_ci_library_paths = array(); - + /** * List of paths to load models from * * @var array */ protected $_ci_model_paths = array(); - + /** * List of paths to load helpers from * * @var array */ protected $_ci_helper_paths = array(); - + /** * List of loaded base classes * * @var array */ protected $_base_classes = array(); // Set by the controller class - + /** * List of cached variables * * @var array */ protected $_ci_cached_vars = array(); - + /** * List of loaded classes * * @var array */ protected $_ci_classes = array(); - + /** * List of loaded files * * @var array */ protected $_ci_loaded_files = array(); - + /** * List of loaded models * * @var array */ protected $_ci_models = array(); - + /** * List of loaded helpers * * @var array */ protected $_ci_helpers = array(); - + /** * List of class name mappings * @@ -130,6 +130,8 @@ class CI_Loader { * Constructor * * Sets the path to the view files and gets the initial output buffering level + * + * @return void */ public function __construct() { @@ -178,12 +180,7 @@ class CI_Loader { */ public function is_loaded($class) { - if (isset($this->_ci_classes[$class])) - { - return $this->_ci_classes[$class]; - } - - return FALSE; + return isset($this->_ci_classes[$class]) ? $this->_ci_classes[$class] : FALSE; } // -------------------------------------------------------------------- @@ -1263,4 +1260,4 @@ class CI_Loader { } /* End of file Loader.php */ -/* Location: ./system/core/Loader.php */ +/* Location: ./system/core/Loader.php */ \ No newline at end of file diff --git a/system/core/Model.php b/system/core/Model.php index 7c9971970..9bc9f879f 100755 --- a/system/core/Model.php +++ b/system/core/Model.php @@ -38,6 +38,8 @@ class CI_Model { /** * Initialize CI_Model Class + * + * @return void */ public function __construct() { @@ -57,6 +59,7 @@ class CI_Model { $CI =& get_instance(); return $CI->$key; } + } /* End of file Model.php */ diff --git a/system/core/Output.php b/system/core/Output.php index 513c657a6..c8feb4e67 100755 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -44,49 +44,49 @@ class CI_Output { * @var string */ public $final_output; - + /** * Cache expiration time * * @var int */ public $cache_expiration = 0; - + /** * List of server headers * * @var array */ public $headers = array(); - + /** * List of mime types * * @var array */ public $mime_types = array(); - + /** * Determines wether profiler is enabled * * @var book */ public $enable_profiler = FALSE; - + /** * Determines if output compression is enabled * * @var bool */ protected $_zlib_oc = FALSE; - + /** * List of profiler sections * * @var array */ protected $_profiler_sections = array(); - + /** * Whether or not to parse variables like {elapsed_time} and {memory_usage} * @@ -96,6 +96,8 @@ class CI_Output { /** * Set up Output class + * + * @return void */ public function __construct() { @@ -177,7 +179,7 @@ class CI_Output { * * Lets you set a server header which will be outputted with the final display. * - * Note: If a file is cached, headers will not be sent. We need to figure out + * Note: If a file is cached, headers will not be sent. We need to figure out * how to permit header data to be saved with the cache data... * * @param string diff --git a/system/core/Router.php b/system/core/Router.php index 9314052fe..5ea13797b 100755 --- a/system/core/Router.php +++ b/system/core/Router.php @@ -32,8 +32,8 @@ * * @package CodeIgniter * @subpackage Libraries - * @author EllisLab Dev Team * @category Libraries + * @author EllisLab Dev Team * @link http://codeigniter.com/user_guide/general/routing.html */ class CI_Router { @@ -44,42 +44,42 @@ class CI_Router { * @var object */ public $config; - + /** * List of routes * * @var array */ public $routes = array(); - + /** * List of error routes * * @var array */ public $error_routes = array(); - + /** * Current class name * * @var string */ - public $class = ''; - + public $class = ''; + /** * Current method name * * @var string */ public $method = 'index'; - + /** * Sub-directory that contains the requested controller class * * @var string */ public $directory = ''; - + /** * Default controller (and method if specific) * @@ -91,6 +91,8 @@ class CI_Router { * Constructor * * Runs the route mapping function. + * + * @return void */ public function __construct() { @@ -433,12 +435,7 @@ class CI_Router { */ public function fetch_method() { - if ($this->method == $this->fetch_class()) - { - return 'index'; - } - - return $this->method; + return ($this->method == $this->fetch_class()) ? 'index' : $this->method; } // -------------------------------------------------------------------- diff --git a/system/core/Security.php b/system/core/Security.php index c82b69ff9..81b6602ae 100755 --- a/system/core/Security.php +++ b/system/core/Security.php @@ -102,9 +102,11 @@ class CI_Security { 'Redirect\s+302', "([\"'])?data\s*:[^\\1]*?base64[^\\1]*?,[^\\1]*?\\1?" ); - + /** * Initialize security class + * + * @return void */ public function __construct() { @@ -201,11 +203,11 @@ class CI_Security { } setcookie( - $this->_csrf_cookie_name, - $this->_csrf_hash, - $expire, - config_item('cookie_path'), - config_item('cookie_domain'), + $this->_csrf_cookie_name, + $this->_csrf_hash, + $expire, + config_item('cookie_path'), + config_item('cookie_domain'), $secure_cookie, config_item('cookie_httponly') ); @@ -626,7 +628,7 @@ class CI_Security { // replace illegal attribute strings that are inside an html tag if (count($attribs) > 0) { - $str = preg_replace("/<(\/?[^><]+?)([^A-Za-z<>\-])(.*?)(".implode('|', $attribs).")(.*?)([\s><])([><]*)/i", '<$1 $3$5$6$7', $str, -1, $count); + $str = preg_replace('/<(\/?[^><]+?)([^A-Za-z<>\-])(.*?)('.implode('|', $attribs).')(.*?)([\s><])([><]*)/i', '<$1 $3$5$6$7', $str, -1, $count); } } while ($count); @@ -844,4 +846,4 @@ class CI_Security { } /* End of file Security.php */ -/* Location: ./system/core/Security.php */ +/* Location: ./system/core/Security.php */ \ No newline at end of file diff --git a/system/core/URI.php b/system/core/URI.php index cf82c5838..e66cb6dc5 100755 --- a/system/core/URI.php +++ b/system/core/URI.php @@ -22,6 +22,7 @@ * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * @link http://codeigniter.com * @since Version 1.0 + * @filesource */ /** @@ -43,21 +44,21 @@ class CI_URI { * @var array */ public $keyval = array(); - + /** * Current uri string * * @var string */ public $uri_string; - + /** * List of uri segments * * @var array */ public $segments = array(); - + /** * Re-indexed list of uri segments * Starts at 1 instead of 0 @@ -72,6 +73,8 @@ class CI_URI { * Simply globalizes the $RTR object. The front * loads the Router class early on so it's not available * normally as other classes are. + * + * @return void */ public function __construct() { @@ -148,7 +151,7 @@ class CI_URI { return; } - $path = (isset($_SERVER[$uri])) ? $_SERVER[$uri] : @getenv($uri); + $path = isset($_SERVER[$uri]) ? $_SERVER[$uri] : @getenv($uri); $this->_set_uri_string($path); } @@ -181,7 +184,7 @@ class CI_URI { */ protected function _detect_uri() { - if ( ! isset($_SERVER['REQUEST_URI']) OR ! isset($_SERVER['SCRIPT_NAME'])) + if ( ! isset($_SERVER['REQUEST_URI'], $_SERVER['SCRIPT_NAME'])) { return ''; } @@ -227,20 +230,19 @@ class CI_URI { } // -------------------------------------------------------------------- - + /** * Is cli Request? * * Duplicate of function from the Input class to test to see if a request was made from the command line * - * @return boolean + * @return bool */ protected function _is_cli_request() { - return (php_sapi_name() == 'cli') OR defined('STDIN'); + return (php_sapi_name() === 'cli') OR defined('STDIN'); } - // -------------------------------------------------------------------- /** @@ -253,7 +255,7 @@ class CI_URI { protected function _parse_cli_args() { $args = array_slice($_SERVER['argv'], 1); - return $args ? '/' . implode('/', $args) : ''; + return $args ? '/'.implode('/', $args) : ''; } // -------------------------------------------------------------------- @@ -327,7 +329,7 @@ class CI_URI { } // -------------------------------------------------------------------- - + /** * Re-index Segments * @@ -355,13 +357,13 @@ class CI_URI { * * This function returns the URI segment based on the number provided. * - * @param integer + * @param int * @param bool * @return string */ public function segment($n, $no_result = FALSE) { - return ( ! isset($this->segments[$n])) ? $no_result : $this->segments[$n]; + return isset($this->segments[$n]) ? $this->segments[$n] : $no_result; } // -------------------------------------------------------------------- @@ -370,16 +372,16 @@ class CI_URI { * Fetch a URI "routed" Segment * * This function returns the re-routed URI segment (assuming routing rules are used) - * based on the number provided. If there is no routing this function returns the + * based on the number provided. If there is no routing this function returns the * same result as $this->segment() * - * @param integer + * @param int * @param bool * @return string */ public function rsegment($n, $no_result = FALSE) { - return ( ! isset($this->rsegments[$n])) ? $no_result : $this->rsegments[$n]; + return isset($this->rsegments[$n]) ? $this->rsegments[$n] : $no_result; } // -------------------------------------------------------------------- @@ -400,7 +402,7 @@ class CI_URI { * gender => male * ) * - * @param integer the starting segment number + * @param int the starting segment number * @param array an array of default values * @return array */ @@ -408,13 +410,13 @@ class CI_URI { { return $this->_uri_to_assoc($n, $default, 'segment'); } - + // -------------------------------------------------------------------- - + /** * Identical to above only it uses the re-routed segment array * - * @param integer the starting segment number + * @param int the starting segment number * @param array an array of default values * @return array */ @@ -428,7 +430,7 @@ class CI_URI { /** * Generate a key value pair from the URI string or Re-routed URI string * - * @param integer the starting segment number + * @param int the starting segment number * @param array an array of default values * @param string which array we should use * @return array @@ -458,12 +460,9 @@ class CI_URI { if ($this->$total_segments() < $n) { - if (count($default) === 0) - { - return array(); - } - - return array_fill_keys($default, FALSE); + return (count($default) === 0) + ? array() + : array_fill_keys($default, FALSE); } $segments = array_slice($this->$segment_array(), ($n - 1)); @@ -512,7 +511,7 @@ class CI_URI { public function assoc_to_uri($array) { $temp = array(); - foreach ((array)$array as $key => $val) + foreach ( (array) $array as $key => $val) { $temp[] = $key; $temp[] = $val; @@ -526,7 +525,7 @@ class CI_URI { /** * Fetch a URI Segment and add a trailing slash * - * @param integer + * @param int * @param string * @return string */ @@ -540,7 +539,7 @@ class CI_URI { /** * Fetch a URI Segment and add a trailing slash * - * @param integer + * @param int * @param string * @return string */ @@ -554,7 +553,7 @@ class CI_URI { /** * Fetch a URI Segment and add a trailing slash - helper function * - * @param integer + * @param int * @param string * @param string * @return string @@ -604,7 +603,7 @@ class CI_URI { /** * Total number of segments * - * @return integer + * @return int */ public function total_segments() { @@ -616,7 +615,7 @@ class CI_URI { /** * Total number of routed segments * - * @return integer + * @return int */ public function total_rsegments() { @@ -651,4 +650,4 @@ class CI_URI { } /* End of file URI.php */ -/* Location: ./system/core/URI.php */ +/* Location: ./system/core/URI.php */ \ No newline at end of file diff --git a/system/core/Utf8.php b/system/core/Utf8.php index 122020aea..a6faa84ec 100644 --- a/system/core/Utf8.php +++ b/system/core/Utf8.php @@ -42,6 +42,8 @@ class CI_Utf8 { * Constructor * * Determines if UTF-8 support is to be enabled + * + * @return void */ public function __construct() { @@ -124,7 +126,7 @@ class CI_Utf8 { * Attempts to convert a string to UTF-8 * * @param string - * @param string - input encoding + * @param string input encoding * @return string */ public function convert_to_utf8($str, $encoding) -- cgit v1.2.3-24-g4f1b From 5645479c622eb36cf9869797896dc0921568c4a9 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 17 May 2012 14:32:19 +0300 Subject: Clean up the libraries --- system/libraries/Cache/Cache.php | 4 +- system/libraries/Cache/drivers/Cache_file.php | 2 + system/libraries/Cache/drivers/Cache_memcached.php | 4 +- system/libraries/Calendar.php | 41 ++-- system/libraries/Cart.php | 31 +-- system/libraries/Driver.php | 8 +- system/libraries/Email.php | 206 ++++++++--------- system/libraries/Encrypt.php | 12 +- system/libraries/Form_validation.php | 60 +++-- system/libraries/Ftp.php | 2 - system/libraries/Image_lib.php | 252 +++++++++++---------- system/libraries/Log.php | 18 +- system/libraries/Migration.php | 13 +- system/libraries/Pagination.php | 1 + system/libraries/Parser.php | 26 +-- system/libraries/Profiler.php | 1 + system/libraries/Session.php | 1 + system/libraries/Table.php | 16 +- system/libraries/Typography.php | 4 +- system/libraries/Unit_test.php | 4 +- system/libraries/Upload.php | 4 +- system/libraries/Xmlrpcs.php | 9 +- system/libraries/Zip.php | 12 +- system/libraries/javascript/Jquery.php | 66 +++--- 24 files changed, 383 insertions(+), 414 deletions(-) diff --git a/system/libraries/Cache/Cache.php b/system/libraries/Cache/Cache.php index 0493d5a6e..ba732ee8e 100644 --- a/system/libraries/Cache/Cache.php +++ b/system/libraries/Cache/Cache.php @@ -55,14 +55,14 @@ class CI_Cache extends CI_Driver_Library { * @var string */ protected $_cache_path = NULL; - + /** * Reference to the driver * * @var mixed */ protected $_adapter = 'dummy'; - + /** * Fallback driver * diff --git a/system/libraries/Cache/drivers/Cache_file.php b/system/libraries/Cache/drivers/Cache_file.php index ec4195278..f0eb8bdf7 100644 --- a/system/libraries/Cache/drivers/Cache_file.php +++ b/system/libraries/Cache/drivers/Cache_file.php @@ -45,6 +45,8 @@ class CI_Cache_file extends CI_Driver { /** * Initialize file-based cache + * + * @return void */ public function __construct() { diff --git a/system/libraries/Cache/drivers/Cache_memcached.php b/system/libraries/Cache/drivers/Cache_memcached.php index 813df4b1c..1df149c2d 100644 --- a/system/libraries/Cache/drivers/Cache_memcached.php +++ b/system/libraries/Cache/drivers/Cache_memcached.php @@ -77,7 +77,7 @@ class CI_Cache_memcached extends CI_Driver { * @param string unique identifier * @param mixed data being cached * @param int time to live - * @return bool true on success, false on failure + * @return bool true on success, false on failure */ public function save($id, $data, $ttl = 60) { @@ -99,7 +99,7 @@ class CI_Cache_memcached extends CI_Driver { * Delete from Cache * * @param mixed key to be deleted. - * @return bool true on success, false on failure + * @return bool true on success, false on failure */ public function delete($id) { diff --git a/system/libraries/Calendar.php b/system/libraries/Calendar.php index 4db754f5e..92f372b20 100644 --- a/system/libraries/Calendar.php +++ b/system/libraries/Calendar.php @@ -44,55 +44,55 @@ class CI_Calendar { * @var object */ protected $CI; - + /** * Current local time * * @var int */ public $local_time; - + /** * Calendar layout template * * @var string */ public $template = ''; - + /** * Day of the week to start the calendar on * * @var string */ public $start_day = 'sunday'; - + /** * How to display months * * @var string */ public $month_type = 'long'; - + /** * How to display names of days * * @var string */ public $day_type = 'abr'; - + /** * Whether to show next/prev month links * * @var bool */ - public $show_next_prev = FALSE; - + public $show_next_prev = FALSE; + /** * Url base to use for next/prev month links * * @var bool */ - public $next_prev_url = ''; + public $next_prev_url = ''; /** * Constructor @@ -187,7 +187,7 @@ class CI_Calendar { // Set the starting day of the week $start_days = array('sunday' => 0, 'monday' => 1, 'tuesday' => 2, 'wednesday' => 3, 'thursday' => 4, 'friday' => 5, 'saturday' => 6); - $start_day = ( ! isset($start_days[$this->start_day])) ? 0 : $start_days[$this->start_day]; + $start_day = isset($start_days[$this->start_day]) ? $start_days[$this->start_day] : 0; // Set the starting day number $local_date = mktime(12, 0, 0, $month, 1, $year); @@ -290,9 +290,7 @@ class CI_Calendar { $out .= "\n".$this->temp['cal_row_end']."\n"; } - $out .= "\n".$this->temp['table_close']; - - return $out; + return $out .= "\n".$this->temp['table_close']; } // -------------------------------------------------------------------- @@ -317,14 +315,9 @@ class CI_Calendar { $month_names = array('01' => 'cal_january', '02' => 'cal_february', '03' => 'cal_march', '04' => 'cal_april', '05' => 'cal_mayl', '06' => 'cal_june', '07' => 'cal_july', '08' => 'cal_august', '09' => 'cal_september', '10' => 'cal_october', '11' => 'cal_november', '12' => 'cal_december'); } - $month = $month_names[$month]; - - if ($this->CI->lang->line($month) === FALSE) - { - return ucfirst(substr($month, 4)); - } - - return $this->CI->lang->line($month); + return ($this->CI->lang->line($month_names[$month]) === FALSE) + ? ucfirst(substr($month_names[$month], 4)) + : $this->CI->lang->line($month_names[$month]); } // -------------------------------------------------------------------- @@ -345,11 +338,11 @@ class CI_Calendar { $this->day_type = $day_type; } - if ($this->day_type == 'long') + if ($this->day_type === 'long') { $day_names = array('sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'); } - elseif ($this->day_type == 'short') + elseif ($this->day_type === 'short') { $day_names = array('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'); } @@ -448,7 +441,7 @@ class CI_Calendar { */ public function default_template() { - return array ( + return array( 'table_open' => '', 'heading_row_start' => '', 'heading_previous_cell' => '', diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php index eee123584..b73ed5128 100644 --- a/system/libraries/Cart.php +++ b/system/libraries/Cart.php @@ -39,11 +39,11 @@ class CI_Cart { /** * These are the regular expression rules that we use to validate the product ID and product name * alpha-numeric, dashes, underscores, or periods - * + * * @var string */ public $product_id_rules = '\.a-z0-9_-'; - + /** * These are the regular expression rules that we use to validate the product ID and product name * alpha-numeric, dashes, underscores, colons or periods @@ -51,7 +51,7 @@ class CI_Cart { * @var string */ public $product_name_rules = '\.\:\-_ a-z0-9'; - + /** * only allow safe product names * @@ -62,14 +62,14 @@ class CI_Cart { // -------------------------------------------------------------------------- // Protected variables. Do not change! // -------------------------------------------------------------------------- - + /** * Reference to CodeIgniter instance * * @var object */ protected $CI; - + /** * Contents of the cart * @@ -83,6 +83,7 @@ class CI_Cart { * The constructor loads the Session class, used to store the shopping cart contents. * * @param array + * @return void */ public function __construct($params = array()) { @@ -180,7 +181,7 @@ class CI_Cart { // -------------------------------------------------------------------- // Does the $items array contain an id, quantity, price, and name? These are required - if ( ! isset($items['id']) OR ! isset($items['qty']) OR ! isset($items['price']) OR ! isset($items['name'])) + if ( ! isset($items['id'], $items['qty'], $items['price'], $items['name'])) { log_message('error', 'The cart array must contain a product ID, quantity, price, and name.'); return FALSE; @@ -341,7 +342,7 @@ class CI_Cart { protected function _update($items = array()) { // Without these array indexes there is nothing we can do - if ( ! isset($items['qty']) OR ! isset($items['rowid']) OR ! isset($this->_cart_contents[$items['rowid']])) + if ( ! isset($items['qty'], $items['rowid'], $this->_cart_contents[$items['rowid']])) { return FALSE; } @@ -383,7 +384,7 @@ class CI_Cart { foreach ($this->_cart_contents as $key => $val) { // We make sure the array contains the proper indexes - if ( ! is_array($val) OR ! isset($val['price']) OR ! isset($val['qty'])) + if ( ! is_array($val) OR ! isset($val['price'], $val['qty'])) { continue; } @@ -393,7 +394,7 @@ class CI_Cart { $this->_cart_contents[$key]['subtotal'] = ($this->_cart_contents[$key]['price'] * $this->_cart_contents[$key]['qty']); } - // Is our cart empty? If so we delete it from the session + // Is our cart empty? If so we delete it from the session if (count($this->_cart_contents) <= 2) { $this->CI->session->unset_userdata('cart_contents'); @@ -489,7 +490,7 @@ class CI_Cart { */ public function has_options($rowid = '') { - return (isset($this->_cart_contents[$rowid]['options']) && count($this->_cart_contents[$rowid]['options']) !== 0) ? TRUE : FALSE; + return (isset($this->_cart_contents[$rowid]['options']) && count($this->_cart_contents[$rowid]['options']) !== 0); } // -------------------------------------------------------------------- @@ -519,15 +520,7 @@ class CI_Cart { */ public function format_number($n = '') { - if ($n == '') - { - return ''; - } - - // Remove anything that isn't a number or decimal point. - $n = (float) $n; - - return number_format($n, 2, '.', ','); + return ($n == '') ? '' : number_format( (float) $n, 2, '.', ','); } // -------------------------------------------------------------------- diff --git a/system/libraries/Driver.php b/system/libraries/Driver.php index b1fff154d..c79698c7b 100644 --- a/system/libraries/Driver.php +++ b/system/libraries/Driver.php @@ -45,7 +45,7 @@ class CI_Driver_Library { * @var array */ protected $valid_drivers = array(); - + /** * Name of the current class - usually the driver class * @@ -57,8 +57,8 @@ class CI_Driver_Library { * The first time a child is used it won't exist, so we instantiate it * subsequents calls will go straight to the proper child. * - * @param mixed $child - * @return mixed + * @param mixed $child + * @return mixed */ public function __get($child) { @@ -145,7 +145,7 @@ class CI_Driver { * @var array */ protected $_methods = array(); - + /** * List of properties in the parent class * diff --git a/system/libraries/Email.php b/system/libraries/Email.php index 103c3cb25..56d60c802 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -93,6 +93,8 @@ class CI_Email { * Constructor - Sets Email Preferences * * The constructor can be passed an array of config values + * + * @return void */ public function __construct($config = array()) { @@ -303,8 +305,7 @@ class CI_Email { */ public function cc($cc) { - $cc = $this->_str_to_array($cc); - $cc = $this->clean_email($cc); + $cc = $this->clean_email($this->_str_to_array($cc)); if ($this->validate) { @@ -338,8 +339,7 @@ class CI_Email { $this->bcc_batch_size = $limit; } - $bcc = $this->_str_to_array($bcc); - $bcc = $this->clean_email($bcc); + $bcc = $this->clean_email($this->_str_to_array($bcc)); if ($this->validate) { @@ -441,15 +441,11 @@ class CI_Email { { if ( ! is_array($email)) { - if (strpos($email, ',') !== FALSE) - { - $email = preg_split('/[\s,]/', $email, -1, PREG_SPLIT_NO_EMPTY); - } - else - { - $email = (array) trim($email); - } + return (strpos($email, ',') !== FALSE) + ? preg_split('/[\s,]/', $email, -1, PREG_SPLIT_NO_EMPTY) + : (array) trim($email); } + return $email; } @@ -477,7 +473,7 @@ class CI_Email { */ public function set_mailtype($type = 'text') { - $this->mailtype = ($type == 'html') ? 'html' : 'text'; + $this->mailtype = ($type === 'html') ? 'html' : 'text'; return $this; } @@ -574,7 +570,7 @@ class CI_Email { protected function _get_message_id() { $from = str_replace(array('>', '<'), '', $this->_headers['Return-Path']); - return '<'.uniqid('').strstr($from, '@').'>'; + return '<'.uniqid('').strstr($from, '@').'>'; } // -------------------------------------------------------------------- @@ -631,13 +627,9 @@ class CI_Email { */ protected function _get_content_type() { - if ($this->mailtype === 'html' && count($this->_attach_name) === 0) - { - return 'html'; - } - elseif ($this->mailtype === 'html' && count($this->_attach_name) > 0) + if ($this->mailtype === 'html') { - return 'html-attach'; + return (count($this->_attach_name) == 0) ? 'html' : 'html-attach'; } elseif ($this->mailtype === 'text' && count($this->_attach_name) > 0) { @@ -731,7 +723,7 @@ class CI_Email { { if ( ! is_array($email)) { - return (preg_match('/\<(.*)\>/', $email, $match)) ? $match[1] : $email; + return preg_match('/\<(.*)\>/', $email, $match) ? $match[1] : $email; } $clean_email = array(); @@ -763,7 +755,7 @@ class CI_Email { return $this->word_wrap($this->alt_message, '76'); } - $body = (preg_match('/\(.*)\<\/body\>/si', $this->_body, $match)) ? $match[1] : $this->_body; + $body = preg_match('/\(.*)\<\/body\>/si', $this->_body, $match) ? $match[1] : $this->_body; $body = str_replace("\t", '', preg_replace('# '.$msg."\n"; + $message .= $level.' '.($level === 'INFO' ? ' -' : '-').' '.date($this->_date_fmt).' --> '.$msg."\n"; flock($fp, LOCK_EX); fwrite($fp, $message); diff --git a/system/libraries/Migration.php b/system/libraries/Migration.php index ce4683fc1..0a88e6926 100644 --- a/system/libraries/Migration.php +++ b/system/libraries/Migration.php @@ -45,28 +45,28 @@ class CI_Migration { * @var bool */ protected $_migration_enabled = FALSE; - + /** * Path to migration classes * * @var string */ protected $_migration_path = NULL; - + /** * Current migration version * * @var mixed */ protected $_migration_version = 0; - + /** * Database table with migration info * * @var string */ protected $_migration_table = 'migrations'; - + /** * Whether to automatically run migrations * @@ -85,6 +85,7 @@ class CI_Migration { * Initialize Migration Class * * @param array + * @return void */ public function __construct($config = array()) { @@ -96,7 +97,7 @@ class CI_Migration { foreach ($config as $key => $val) { - $this->{'_' . $key} = $val; + $this->{'_'.$key} = $val; } log_message('debug', 'Migrations class initialized'); @@ -340,7 +341,6 @@ class CI_Migration { } sort($files); - return $files; } @@ -384,6 +384,7 @@ class CI_Migration { { return get_instance()->$var; } + } /* End of file Migration.php */ diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php index 3d2911813..58f86fa17 100644 --- a/system/libraries/Pagination.php +++ b/system/libraries/Pagination.php @@ -73,6 +73,7 @@ class CI_Pagination { * Constructor * * @param array initialization parameters + * @return void */ public function __construct($params = array()) { diff --git a/system/libraries/Parser.php b/system/libraries/Parser.php index c40f339b4..a0b60ed97 100644 --- a/system/libraries/Parser.php +++ b/system/libraries/Parser.php @@ -42,14 +42,14 @@ class CI_Parser { * @var string */ public $l_delim = '{'; - + /** * Right delimeter character for psuedo vars * * @var string */ public $r_delim = '}'; - + /** * Reference to CodeIgniter instance * @@ -116,14 +116,9 @@ class CI_Parser { foreach ($data as $key => $val) { - if (is_array($val)) - { - $template = $this->_parse_pair($key, $val, $template); - } - else - { - $template = $this->_parse_single($key, (string)$val, $template); - } + $template = is_array($val) + ? $this->_parse_pair($key, $val, $template) + : $template = $this->_parse_single($key, (string) $val, $template); } if ($return == FALSE) @@ -189,14 +184,9 @@ class CI_Parser { $temp = $match[1]; foreach ($row as $key => $val) { - if ( ! is_array($val)) - { - $temp = $this->_parse_single($key, $val, $temp); - } - else - { - $temp = $this->_parse_pair($key, $val, $temp); - } + $temp = is_array($val) + ? $this->_parse_pair($key, $val, $temp) + : $this->_parse_single($key, $val, $temp); } $str .= $temp; diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php index 1e86f3c61..e219d20f2 100644 --- a/system/libraries/Profiler.php +++ b/system/libraries/Profiler.php @@ -527,6 +527,7 @@ class CI_Profiler { return $output.''; } + } /* End of file Profiler.php */ diff --git a/system/libraries/Session.php b/system/libraries/Session.php index 3195f0a91..783109a60 100644 --- a/system/libraries/Session.php +++ b/system/libraries/Session.php @@ -190,6 +190,7 @@ class CI_Session { * whenever the class is instantiated. * * @param array + * @return void */ public function __construct($params = array()) { diff --git a/system/libraries/Table.php b/system/libraries/Table.php index 236129531..f844d6435 100644 --- a/system/libraries/Table.php +++ b/system/libraries/Table.php @@ -44,49 +44,49 @@ class CI_Table { * @var array */ public $rows = array(); - + /** * Data for table heading * * @var array */ public $heading = array(); - + /** * Whether or not to automatically create the table header * * @var bool */ public $auto_heading = TRUE; - + /** * Table caption * * @var string */ public $caption = NULL; - + /** - * Table layout template + * Table layout template * * @var array */ public $template = NULL; - + /** * Newline setting * * @var string */ public $newline = "\n"; - + /** * Contents of empty cells * * @var string */ public $empty_cells = ''; - + /** * Callback for custom table layout * diff --git a/system/libraries/Typography.php b/system/libraries/Typography.php index 50bd12486..6aaa993ae 100644 --- a/system/libraries/Typography.php +++ b/system/libraries/Typography.php @@ -38,7 +38,7 @@ class CI_Typography { /** * Block level elements that should not be wrapped inside

    tags - * + * * @var string */ public $block_elements = 'address|blockquote|div|dl|fieldset|form|h\d|hr|noscript|object|ol|p|pre|script|table|ul'; @@ -52,7 +52,7 @@ class CI_Typography { /** * Tags we want the parser to completely ignore when splitting the string. - * + * * @var string */ public $inline_elements = 'a|abbr|acronym|b|bdo|big|br|button|cite|code|del|dfn|em|i|img|ins|input|label|map|kbd|q|samp|select|small|span|strong|sub|sup|textarea|tt|var'; diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index 0f6e2dfdd..6ec2dcd5d 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -350,11 +350,11 @@ class CI_Unit_test { */ function is_true($test) { - return (is_bool($test) && $test === TRUE); + return ($test === TRUE); } function is_false($test) { - return (is_bool($test) && $test === FALSE); + return ($test === FALSE); } /* End of file Unit_test.php */ diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php index 24d4bd4d0..271c6d21f 100644 --- a/system/libraries/Upload.php +++ b/system/libraries/Upload.php @@ -1036,7 +1036,7 @@ class CI_Upload { */ if (DIRECTORY_SEPARATOR !== '\\') { - $cmd = 'file --brief --mime ' . escapeshellarg($file['tmp_name']) . ' 2>&1'; + $cmd = 'file --brief --mime '.escapeshellarg($file['tmp_name']).' 2>&1'; if (function_exists('exec')) { @@ -1103,4 +1103,4 @@ class CI_Upload { } /* End of file Upload.php */ -/* Location: ./system/libraries/Upload.php */ +/* Location: ./system/libraries/Upload.php */ \ No newline at end of file diff --git a/system/libraries/Xmlrpcs.php b/system/libraries/Xmlrpcs.php index f0c5b48e7..1853906ea 100644 --- a/system/libraries/Xmlrpcs.php +++ b/system/libraries/Xmlrpcs.php @@ -54,21 +54,21 @@ class CI_Xmlrpcs extends CI_Xmlrpc * @var array */ public $methods = array(); - + /** * Debug Message * * @var string */ public $debug_msg = ''; - + /** * XML RPC Server methods * * @var array */ public $system_methods = array(); - + /** * Configuration object * @@ -79,7 +79,8 @@ class CI_Xmlrpcs extends CI_Xmlrpc /** * Initialize XMLRPC class * - * @param array $config + * @param array $config + * @return void */ public function __construct($config = array()) { diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php index 86d0787b2..e0dc637ad 100644 --- a/system/libraries/Zip.php +++ b/system/libraries/Zip.php @@ -48,35 +48,35 @@ class CI_Zip { * @var string */ public $zipdata = ''; - + /** * Zip data for a directory in string form * * @var string */ public $directory = ''; - + /** * Number of files/folder in zip file * * @var int */ public $entries = 0; - + /** * Number of files in zip * * @var int */ public $file_num = 0; - + /** * relative offset of local header * * @var int */ public $offset = 0; - + /** * Reference to time at init * @@ -87,7 +87,7 @@ class CI_Zip { /** * Initialize zip compression class * - * @return void + * @return void */ public function __construct() { diff --git a/system/libraries/javascript/Jquery.php b/system/libraries/javascript/Jquery.php index f30d7c639..3c9ae1867 100644 --- a/system/libraries/javascript/Jquery.php +++ b/system/libraries/javascript/Jquery.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * Jquery Class * @@ -57,7 +55,7 @@ class CI_Jquery extends CI_Javascript { $this->script(); } - log_message('debug', "Jquery Class Initialized"); + log_message('debug', 'Jquery Class Initialized'); } // -------------------------------------------------------------------- @@ -115,7 +113,7 @@ class CI_Jquery extends CI_Javascript { if ($ret_false) { - $js[] = "return false;"; + $js[] = 'return false;'; } return $this->_add_event($element, $js, 'click'); @@ -183,7 +181,7 @@ class CI_Jquery extends CI_Javascript { */ protected function _hover($element = 'this', $over, $out) { - $event = "\n\t$(" . $this->_prep_element($element) . ").hover(\n\t\tfunction()\n\t\t{\n\t\t\t{$over}\n\t\t}, \n\t\tfunction()\n\t\t{\n\t\t\t{$out}\n\t\t});\n"; + $event = "\n\t$(".$this->_prep_element($element).").hover(\n\t\tfunction()\n\t\t{\n\t\t\t{$over}\n\t\t}, \n\t\tfunction()\n\t\t{\n\t\t\t{$out}\n\t\t});\n"; $this->jquery_code_for_compile[] = $event; @@ -322,7 +320,7 @@ class CI_Jquery extends CI_Javascript { foreach ($array_js as $js) { - $this->jquery_code_for_compile[] = "\t$js\n"; + $this->jquery_code_for_compile[] = "\t".$js."\n"; } } @@ -389,7 +387,7 @@ class CI_Jquery extends CI_Javascript { protected function _addClass($element = 'this', $class='') { $element = $this->_prep_element($element); - return "$({$element}).addClass(\"$class\");"; + return '$('.$element.').addClass("'.$class.'");'; } // -------------------------------------------------------------------- @@ -411,9 +409,9 @@ class CI_Jquery extends CI_Javascript { $animations = "\t\t\t"; - foreach ($params as $param=>$value) + foreach ($params as $param => $value) { - $animations .= $param.': \''.$value.'\', '; + $animations .= $param.": '".$value."', "; } $animations = substr($animations, 0, -2); // remove the last ", " @@ -428,7 +426,7 @@ class CI_Jquery extends CI_Javascript { $extra = ', '.$extra; } - return "$({$element}).animate({\n$animations\n\t\t}".$speed.$extra.");"; + return "$({$element}).animate({\n$animations\n\t\t}".$speed.$extra.');'; } // -------------------------------------------------------------------- @@ -478,7 +476,7 @@ class CI_Jquery extends CI_Javascript { $callback = ", function(){\n{$callback}\n}"; } - return "$({$element}).fadeOut({$speed}{$callback});"; + return '$('.$element.').fadeOut('.$speed.$callback.');'; } // -------------------------------------------------------------------- @@ -519,7 +517,7 @@ class CI_Jquery extends CI_Javascript { protected function _removeClass($element = 'this', $class='') { $element = $this->_prep_element($element); - return "$({$element}).removeClass(\"$class\");"; + return '$('.$element.').removeClass("'.$class.'");'; } // -------------------------------------------------------------------- @@ -544,7 +542,7 @@ class CI_Jquery extends CI_Javascript { $callback = ", function(){\n{$callback}\n}"; } - return "$({$element}).slideUp({$speed}{$callback});"; + return '$('.$element.').slideUp('.$speed.$callback.');'; } // -------------------------------------------------------------------- @@ -569,7 +567,7 @@ class CI_Jquery extends CI_Javascript { $callback = ", function(){\n{$callback}\n}"; } - return "$({$element}).slideDown({$speed}{$callback});"; + return '$('.$element.').slideDown('.$speed.$callback.');'; } // -------------------------------------------------------------------- @@ -594,7 +592,7 @@ class CI_Jquery extends CI_Javascript { $callback = ", function(){\n{$callback}\n}"; } - return "$({$element}).slideToggle({$speed}{$callback});"; + return '$('.$element.').slideToggle('.$speed.$callback.');'; } // -------------------------------------------------------------------- @@ -610,7 +608,7 @@ class CI_Jquery extends CI_Javascript { protected function _toggle($element = 'this') { $element = $this->_prep_element($element); - return "$({$element}).toggle();"; + return '$('.$element.').toggle();'; } // -------------------------------------------------------------------- @@ -626,7 +624,7 @@ class CI_Jquery extends CI_Javascript { protected function _toggleClass($element = 'this', $class='') { $element = $this->_prep_element($element); - return "$({$element}).toggleClass(\"$class\");"; + return '$('.$element.').toggleClass("'.$class.'");'; } // -------------------------------------------------------------------- @@ -651,7 +649,7 @@ class CI_Jquery extends CI_Javascript { $callback = ", function(){\n{$callback}\n}"; } - return "$({$element}).show({$speed}{$callback});"; + return '$('.$element.').show('.$speed.$callback.');'; } // -------------------------------------------------------------------- @@ -676,22 +674,22 @@ class CI_Jquery extends CI_Javascript { // ajaxStart and ajaxStop are better choices here... but this is a stop gap if ($this->CI->config->item('javascript_ajax_img') == '') { - $loading_notifier = "Loading..."; + $loading_notifier = 'Loading...'; } else { - $loading_notifier = 'CI->config->slash_item('base_url').$this->CI->config->item('javascript_ajax_img').'\' alt=\'Loading\' />'; + $loading_notifier = 'Loading'; } - $updater = "$($container).empty();\n" // anything that was in... get it out - . "\t\t$($container).prepend(\"$loading_notifier\");\n"; // to replace with an image + $updater = '$('.$container.").empty();\n" // anything that was in... get it out + ."\t\t$(".$container.').prepend("'.$loading_notifier."\");\n"; // to replace with an image $request_options = ''; if ($options != '') { $request_options .= ', {' - . (is_array($options) ? "'".implode("', '", $options)."'" : "'".str_replace(":", "':'", $options)."'") - . '}'; + .(is_array($options) ? "'".implode("', '", $options)."'" : "'".str_replace(':', "':'", $options)."'") + .'}'; } return $updater."\t\t$($container).load('$controller'$request_options);"; @@ -746,7 +744,7 @@ class CI_Jquery extends CI_Javascript { $corner_style = '"'.$corner_style.'"'; } - return "$(" . $this->_prep_element($element) . ").corner(".$corner_style.");"; + return '$('.$this->_prep_element($element).').corner('.$corner_style.');'; } // -------------------------------------------------------------------- @@ -821,16 +819,16 @@ class CI_Jquery extends CI_Javascript { $sort_options = array(); foreach ($options as $k=>$v) { - $sort_options[] = "\n\t\t".$k.': '.$v.""; + $sort_options[] = "\n\t\t".$k.': '.$v; } - $sort_options = implode(",", $sort_options); + $sort_options = implode(',', $sort_options); } else { $sort_options = ''; } - return "$(" . $this->_prep_element($element) . ").sortable({".$sort_options."\n\t});"; + return '$('.$this->_prep_element($element).').sortable({'.$sort_options."\n\t});"; } // -------------------------------------------------------------------- @@ -844,7 +842,7 @@ class CI_Jquery extends CI_Javascript { */ public function tablesorter($table = '', $options = '') { - $this->jquery_code_for_compile[] = "\t$(" . $this->_prep_element($table) . ").tablesorter($options);\n"; + $this->jquery_code_for_compile[] = "\t$(".$this->_prep_element($table).').tablesorter('.$options.");\n"; } // -------------------------------------------------------------------- @@ -869,7 +867,7 @@ class CI_Jquery extends CI_Javascript { } - $event = "\n\t$(" . $this->_prep_element($element) . ").{$event}(function(){\n\t\t{$js}\n\t});\n"; + $event = "\n\t$(".$this->_prep_element($element).').'.$event."(function(){\n\t\t{$js}\n\t});\n"; $this->jquery_code_for_compile[] = $event; return $event; } @@ -898,8 +896,8 @@ class CI_Jquery extends CI_Javascript { // Inline references $script = '$(document).ready(function() {'."\n" - . implode('', $this->jquery_code_for_compile) - . '});'; + .implode('', $this->jquery_code_for_compile) + .'});'; $output = ($script_tags === FALSE) ? $script : $this->inline($script); @@ -998,7 +996,7 @@ class CI_Jquery extends CI_Javascript { { return '"'.$speed.'"'; } - elseif (preg_match("/[^0-9]/", $speed)) + elseif (preg_match('/[^0-9]/', $speed)) { return ''; } @@ -1009,4 +1007,4 @@ class CI_Jquery extends CI_Javascript { } /* End of file Jquery.php */ -/* Location: ./system/libraries/Jquery.php */ +/* Location: ./system/libraries/Jquery.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From ae31eb5e75d914fc3ab622a7ac5c23eb1e6d9f9a Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 17 May 2012 14:54:15 +0300 Subject: Clean up the helpers --- system/helpers/date_helper.php | 65 ++++++++++++++++++------------------- system/helpers/download_helper.php | 2 +- system/helpers/form_helper.php | 1 - system/helpers/html_helper.php | 8 ++--- system/helpers/inflector_helper.php | 2 +- system/helpers/url_helper.php | 4 +-- 6 files changed, 39 insertions(+), 43 deletions(-) diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php index 531d1d32f..5f0427f7d 100644 --- a/system/helpers/date_helper.php +++ b/system/helpers/date_helper.php @@ -100,7 +100,7 @@ if ( ! function_exists('mdate')) $datestr = str_replace( '%\\', '', - preg_replace("/([a-z]+?){1}/i", "\\\\\\1", $datestr) + preg_replace('/([a-z]+?){1}/i', '\\\\\\1', $datestr) ); return date($datestr, $time); @@ -316,12 +316,12 @@ if ( ! function_exists('local_to_gmt')) } return mktime( - gmdate("H", $time), - gmdate("i", $time), - gmdate("s", $time), - gmdate("m", $time), - gmdate("d", $time), - gmdate("Y", $time) + gmdate('H', $time), + gmdate('i', $time), + gmdate('s', $time), + gmdate('m', $time), + gmdate('d', $time), + gmdate('Y', $time) ); } } @@ -452,8 +452,7 @@ if ( ! function_exists('human_to_unix')) return FALSE; } - $datestr = trim($datestr); - $datestr = preg_replace("/\040+/", ' ', $datestr); + $datestr = preg_replace('/\040+/', ' ', trim($datestr)); if ( ! preg_match('/^[0-9]{2,4}\-[0-9]{1,2}\-[0-9]{1,2}\s[0-9]{1,2}:[0-9]{1,2}(?::[0-9]{1,2})?(?:\s[AP]M)?$/i', $datestr)) { @@ -462,20 +461,20 @@ if ( ! function_exists('human_to_unix')) $split = explode(' ', $datestr); - $ex = explode("-", $split['0']); + $ex = explode('-', $split['0']); - $year = (strlen($ex['0']) == 2) ? '20'.$ex['0'] : $ex['0']; - $month = (strlen($ex['1']) == 1) ? '0'.$ex['1'] : $ex['1']; - $day = (strlen($ex['2']) == 1) ? '0'.$ex['2'] : $ex['2']; + $year = (strlen($ex[0]) === 2) ? '20'.$ex[0] : $ex[0]; + $month = (strlen($ex[1]) === 1) ? '0'.$ex[1] : $ex[1]; + $day = (strlen($ex[2]) === 1) ? '0'.$ex[2] : $ex[2]; - $ex = explode(":", $split['1']); + $ex = explode(':', $split['1']); - $hour = (strlen($ex['0']) == 1) ? '0'.$ex['0'] : $ex['0']; - $min = (strlen($ex['1']) == 1) ? '0'.$ex['1'] : $ex['1']; + $hour = (strlen($ex[0]) === 1) ? '0'.$ex[0] : $ex[0]; + $min = (strlen($ex[1]) === 1) ? '0'.$ex[1] : $ex[1]; - if (isset($ex['2']) && preg_match('/[0-9]{1,2}/', $ex['2'])) + if (isset($ex['2']) && preg_match('/[0-9]{1,2}/', $ex[2])) { - $sec = (strlen($ex['2']) == 1) ? '0'.$ex['2'] : $ex['2']; + $sec = (strlen($ex[2]) === 1) ? '0'.$ex[2] : $ex[2]; } else { @@ -485,11 +484,11 @@ if ( ! function_exists('human_to_unix')) if (isset($split['2'])) { - $ampm = strtolower($split['2']); + $ampm = strtolower($split[2]); if (substr($ampm, 0, 1) === 'p' && $hour < 12) { - $hour = $hour + 12; + $hour += 12; } if (substr($ampm, 0, 1) === 'a' && $hour == 12) @@ -497,7 +496,7 @@ if ( ! function_exists('human_to_unix')) $hour = '00'; } - if (strlen($hour) == 1) + if (strlen($hour) === 1) { $hour = '0'.$hour; } @@ -529,7 +528,7 @@ if ( ! function_exists('nice_date')) // Date like: YYYYMM if (preg_match('/^\d{6}$/', $bad_date)) { - if (in_array(substr($bad_date, 0, 2),array('19', '20'))) + if (in_array(substr($bad_date, 0, 2), array('19', '20'))) { $year = substr($bad_date, 0, 4); $month = substr($bad_date, 4, 2); @@ -540,24 +539,24 @@ if ( ! function_exists('nice_date')) $year = substr($bad_date, 2, 4); } - return date($format, strtotime($year . '-' . $month . '-01')); + return date($format, strtotime($year.'-'.$month.'-01')); } // Date Like: YYYYMMDD - if (preg_match('/^\d{8}$/',$bad_date)) + if (preg_match('/^\d{8}$/', $bad_date)) { $month = substr($bad_date, 0, 2); $day = substr($bad_date, 2, 2); $year = substr($bad_date, 4, 4); - return date($format, strtotime($month . '/01/' . $year)); + return date($format, strtotime($month.'/01/'.$year)); } // Date Like: MM-DD-YYYY __or__ M-D-YYYY (or anything in between) - if (preg_match('/^\d{1,2}-\d{1,2}-\d{4}$/',$bad_date)) + if (preg_match('/^\d{1,2}-\d{1,2}-\d{4}$/', $bad_date)) { list($m, $d, $y) = explode('-', $bad_date); - return date($format, strtotime("{$y}-{$m}-{$d}")); + return date($format, strtotime($y.'-'.$m.'-'.$d)); } // Any other kind of string, when converted into UNIX time, @@ -565,7 +564,7 @@ if ( ! function_exists('nice_date')) // return "Invalid Date". if (date('U', strtotime($bad_date)) == '0') { - return "Invalid Date"; + return 'Invalid Date'; } // It's probably a valid-ish date format already @@ -587,7 +586,7 @@ if ( ! function_exists('timezone_menu')) * @param string menu name * @return string */ - function timezone_menu($default = 'UTC', $class = "", $name = 'timezones') + function timezone_menu($default = 'UTC', $class = '', $name = 'timezones') { $CI =& get_instance(); $CI->lang->load('date'); @@ -605,13 +604,11 @@ if ( ! function_exists('timezone_menu')) foreach (timezones() as $key => $val) { - $selected = ($default == $key) ? " selected='selected'" : ''; - $menu .= "\n"; + $selected = ($default == $key) ? ' selected="selected"' : ''; + $menu .= '\n"; } - $menu .= ""; - - return $menu; + return $menu.''; } } diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index 97e6986b0..470b61ede 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -100,7 +100,7 @@ if ( ! function_exists('force_download')) $x[count($x) - 1] = strtoupper($extension); $filename = implode('.', $x); } - + // Clean output buffer ob_clean(); diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php index b246d72f3..eca6c5f1e 100644 --- a/system/helpers/form_helper.php +++ b/system/helpers/form_helper.php @@ -184,7 +184,6 @@ if ( ! function_exists('form_input')) // ------------------------------------------------------------------------ - if ( ! function_exists('form_password')) { /** diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index 124f58009..92a6db477 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -379,10 +379,10 @@ if ( ! function_exists('meta')) $str = ''; foreach ($name as $meta) { - $type = ( ! isset($meta['type']) OR $meta['type'] == 'name') ? 'name' : 'http-equiv'; - $name = ( ! isset($meta['name'])) ? '' : $meta['name']; - $content = ( ! isset($meta['content'])) ? '' : $meta['content']; - $newline = ( ! isset($meta['newline'])) ? "\n" : $meta['newline']; + $type = ( ! isset($meta['type']) OR $meta['type'] === 'name') ? 'name' : 'http-equiv'; + $name = isset($meta['name']) ? $meta['name'] : ''; + $content = isset($meta['content']) ? $meta['content'] : ''; + $newline = isset($meta['newline']) ? $meta['newline'] : "\n"; $str .= ''.$newline; } diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php index feeaf57d7..2a9466305 100644 --- a/system/helpers/inflector_helper.php +++ b/system/helpers/inflector_helper.php @@ -201,7 +201,7 @@ if ( ! function_exists('underscore')) * * @param string $str * @param string $separator - * @return str + * @return string */ if ( ! function_exists('humanize')) { diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 5576c2748..cf6df4ef5 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -198,7 +198,7 @@ if ( ! function_exists('anchor_popup')) if ($attributes === FALSE) { - return "".$title.''; + return '".$title.''; } if ( ! is_array($attributes)) @@ -217,7 +217,7 @@ if ( ! function_exists('anchor_popup')) $attributes = _parse_attributes($attributes); } - return "'.$title.''; + return ''.$title.''; } } -- cgit v1.2.3-24-g4f1b From 16642c71403f4463dfe6e83c13a0e3120474cd1d Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Thu, 17 May 2012 08:20:16 -0400 Subject: Update inflector docblocks, add changelog entry --- system/helpers/inflector_helper.php | 10 +++++----- user_guide_src/source/changelog.rst | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php index 72615671c..647d840e4 100644 --- a/system/helpers/inflector_helper.php +++ b/system/helpers/inflector_helper.php @@ -45,7 +45,7 @@ if ( ! function_exists('singular')) * Takes a plural word and makes it singular * * @param string - * @return str + * @return string */ function singular($str) { @@ -110,7 +110,7 @@ if ( ! function_exists('plural')) * * @param string * @param bool - * @return str + * @return string */ function plural($str, $force = FALSE) { @@ -166,7 +166,7 @@ if ( ! function_exists('camelize')) * Takes multiple words separated by spaces or underscores and camelizes them * * @param string - * @return str + * @return string */ function camelize($str) { @@ -184,7 +184,7 @@ if ( ! function_exists('underscore')) * Takes multiple words separated by spaces and underscores them * * @param string - * @return str + * @return string */ function underscore($str) { @@ -203,7 +203,7 @@ if ( ! function_exists('humanize')) * * @param string $str * @param string $separator - * @return str + * @return string */ function humanize($str, $separator = '_') { diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index d33a6a635..0066af9ad 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -52,6 +52,7 @@ Release Date: Not Released - set_realpath() can now also handle file paths as opposed to just directories. - do_hash() now uses PHP's native hash() function, supporting more algorithms. - Added an optional paramater to ``delete_files()`` to enable it to skip deleting files such as .htaccess and index.html. + - Removed deprecated helper function ``js_insert_smiley`` from smiley helper. - Database -- cgit v1.2.3-24-g4f1b From f0eb2f133bf43be7ffa1bf71babf4ed28852e71b Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Thu, 17 May 2012 08:32:11 -0400 Subject: Suggested changes --- system/helpers/number_helper.php | 2 +- system/helpers/smiley_helper.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/system/helpers/number_helper.php b/system/helpers/number_helper.php index 2a906ba1b..e49f2f7a0 100644 --- a/system/helpers/number_helper.php +++ b/system/helpers/number_helper.php @@ -42,7 +42,7 @@ if ( ! function_exists('byte_format')) /** * Formats a numbers as bytes, based on size, and adds the appropriate suffix * - * @param mixed // will be cast as int + * @param mixed will be cast as int * @param int * @return string */ diff --git a/system/helpers/smiley_helper.php b/system/helpers/smiley_helper.php index 4320dd392..5e6de08af 100644 --- a/system/helpers/smiley_helper.php +++ b/system/helpers/smiley_helper.php @@ -130,7 +130,7 @@ if ( ! function_exists('get_clickable_smileys')) * * @param string the URL to the folder containing the smiley images * @param array - * @param array + * @param array * @return array */ function get_clickable_smileys($image_url, $alias = '', $smileys = NULL) -- cgit v1.2.3-24-g4f1b From 98fde46fb938694feb1f36e590c4cfa5c97c3261 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Thu, 17 May 2012 08:33:05 -0400 Subject: Add parens to changelog entry --- user_guide_src/source/changelog.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 0066af9ad..7fc5ee5a0 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -52,7 +52,7 @@ Release Date: Not Released - set_realpath() can now also handle file paths as opposed to just directories. - do_hash() now uses PHP's native hash() function, supporting more algorithms. - Added an optional paramater to ``delete_files()`` to enable it to skip deleting files such as .htaccess and index.html. - - Removed deprecated helper function ``js_insert_smiley`` from smiley helper. + - Removed deprecated helper function ``js_insert_smiley()`` from smiley helper. - Database -- cgit v1.2.3-24-g4f1b From 97aefa5cd41475d5b404ced56052008beebf8f40 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Thu, 17 May 2012 08:55:55 -0400 Subject: Added changelog entry --- user_guide_src/source/changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 7fc5ee5a0..933743c38 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -38,6 +38,7 @@ Release Date: Not Released Only entries in ``$autoload['libraries']`` are auto-loaded now. - Added some more doctypes. - Updated all classes to be written in PHP 5 style, with visibility declarations and no ``var`` usage for properties. + - Moved error templates to "application/views/errors" - Helpers -- cgit v1.2.3-24-g4f1b From 7d22f0adbe5df5c93ae1ee367acad7568d555f0a Mon Sep 17 00:00:00 2001 From: Pawel Decowski Date: Thu, 17 May 2012 15:06:25 +0200 Subject: Remove set_time_limit() call. CodeIgniter should respect php.ini setting. --- system/core/CodeIgniter.php | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php index 00db6e13a..e1892ee7e 100755 --- a/system/core/CodeIgniter.php +++ b/system/core/CodeIgniter.php @@ -99,17 +99,6 @@ get_config(array('subclass_prefix' => $assign_to_config['subclass_prefix'])); } -/* - * ------------------------------------------------------ - * Set a liberal script execution time limit - * ------------------------------------------------------ - */ - if (function_exists('set_time_limit') && @ini_get('safe_mode') == 0 - && php_sapi_name() !== 'cli') // Do not override the Time Limit value if running from Command Line - { - @set_time_limit(300); - } - /* * ------------------------------------------------------ * Start the timer... tick tock tick tock... -- cgit v1.2.3-24-g4f1b From 324ef078dda5a3596444152ba49dd591a61adba6 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Thu, 17 May 2012 14:45:25 +0100 Subject: Added upgrade for 2.1.1 and updated version. --- system/core/CodeIgniter.php | 2 +- system/database/drivers/pdo/pdo_driver.php | 2 +- system/database/drivers/pdo/pdo_forge.php | 2 +- system/database/drivers/pdo/pdo_result.php | 2 +- system/database/drivers/pdo/pdo_utility.php | 2 +- system/libraries/Cache/Cache.php | 2 +- system/libraries/Cache/drivers/Cache_apc.php | 2 +- system/libraries/Cache/drivers/Cache_dummy.php | 2 +- system/libraries/Cache/drivers/Cache_file.php | 2 +- system/libraries/Cache/drivers/Cache_memcached.php | 2 +- system/libraries/Cart.php | 2 +- system/libraries/Driver.php | 2 +- system/libraries/Migration.php | 2 +- user_guide/changelog.html | 4 +- user_guide/database/active_record.html | 4 +- user_guide/database/caching.html | 4 +- user_guide/database/call_function.html | 4 +- user_guide/database/configuration.html | 4 +- user_guide/database/connecting.html | 4 +- user_guide/database/examples.html | 4 +- user_guide/database/fields.html | 4 +- user_guide/database/forge.html | 4 +- user_guide/database/helpers.html | 4 +- user_guide/database/index.html | 4 +- user_guide/database/queries.html | 4 +- user_guide/database/results.html | 4 +- user_guide/database/table_data.html | 4 +- user_guide/database/transactions.html | 4 +- user_guide/database/utilities.html | 4 +- user_guide/doc_style/index.html | 4 +- user_guide/doc_style/template.html | 2 +- user_guide/general/alternative_php.html | 4 +- user_guide/general/ancillary_classes.html | 4 +- user_guide/general/autoloader.html | 4 +- user_guide/general/caching.html | 4 +- user_guide/general/cli.html | 4 +- user_guide/general/common_functions.html | 4 +- user_guide/general/controllers.html | 4 +- user_guide/general/core_classes.html | 4 +- user_guide/general/creating_drivers.html | 4 +- user_guide/general/creating_libraries.html | 4 +- user_guide/general/credits.html | 4 +- user_guide/general/drivers.html | 4 +- user_guide/general/environments.html | 4 +- user_guide/general/errors.html | 4 +- user_guide/general/helpers.html | 4 +- user_guide/general/hooks.html | 4 +- user_guide/general/libraries.html | 4 +- user_guide/general/managing_apps.html | 4 +- user_guide/general/models.html | 4 +- user_guide/general/profiling.html | 4 +- user_guide/general/quick_reference.html | 4 +- user_guide/general/requirements.html | 4 +- user_guide/general/reserved_names.html | 4 +- user_guide/general/routing.html | 4 +- user_guide/general/security.html | 4 +- user_guide/general/styleguide.html | 4 +- user_guide/general/urls.html | 4 +- user_guide/general/views.html | 4 +- user_guide/helpers/array_helper.html | 4 +- user_guide/helpers/captcha_helper.html | 4 +- user_guide/helpers/cookie_helper.html | 4 +- user_guide/helpers/date_helper.html | 4 +- user_guide/helpers/directory_helper.html | 4 +- user_guide/helpers/download_helper.html | 4 +- user_guide/helpers/email_helper.html | 4 +- user_guide/helpers/file_helper.html | 4 +- user_guide/helpers/form_helper.html | 4 +- user_guide/helpers/html_helper.html | 4 +- user_guide/helpers/inflector_helper.html | 4 +- user_guide/helpers/language_helper.html | 4 +- user_guide/helpers/number_helper.html | 4 +- user_guide/helpers/path_helper.html | 4 +- user_guide/helpers/security_helper.html | 4 +- user_guide/helpers/smiley_helper.html | 4 +- user_guide/helpers/string_helper.html | 4 +- user_guide/helpers/text_helper.html | 4 +- user_guide/helpers/typography_helper.html | 4 +- user_guide/helpers/url_helper.html | 4 +- user_guide/helpers/xml_helper.html | 4 +- user_guide/index.html | 4 +- user_guide/installation/downloads.html | 16 ++-- user_guide/installation/index.html | 4 +- user_guide/installation/troubleshooting.html | 4 +- user_guide/installation/upgrade_120.html | 4 +- user_guide/installation/upgrade_130.html | 4 +- user_guide/installation/upgrade_131.html | 4 +- user_guide/installation/upgrade_132.html | 4 +- user_guide/installation/upgrade_133.html | 4 +- user_guide/installation/upgrade_140.html | 4 +- user_guide/installation/upgrade_141.html | 4 +- user_guide/installation/upgrade_150.html | 4 +- user_guide/installation/upgrade_152.html | 4 +- user_guide/installation/upgrade_153.html | 4 +- user_guide/installation/upgrade_154.html | 4 +- user_guide/installation/upgrade_160.html | 4 +- user_guide/installation/upgrade_161.html | 4 +- user_guide/installation/upgrade_162.html | 4 +- user_guide/installation/upgrade_163.html | 4 +- user_guide/installation/upgrade_170.html | 4 +- user_guide/installation/upgrade_171.html | 4 +- user_guide/installation/upgrade_172.html | 4 +- user_guide/installation/upgrade_200.html | 4 +- user_guide/installation/upgrade_201.html | 4 +- user_guide/installation/upgrade_202.html | 4 +- user_guide/installation/upgrade_203.html | 4 +- user_guide/installation/upgrade_210.html | 4 +- user_guide/installation/upgrade_211.html | 89 ++++++++++++++++++++++ user_guide/installation/upgrade_b11.html | 4 +- user_guide/installation/upgrading.html | 5 +- user_guide/libraries/benchmark.html | 4 +- user_guide/libraries/caching.html | 4 +- user_guide/libraries/calendar.html | 4 +- user_guide/libraries/cart.html | 4 +- user_guide/libraries/config.html | 4 +- user_guide/libraries/email.html | 4 +- user_guide/libraries/encryption.html | 4 +- user_guide/libraries/file_uploading.html | 4 +- user_guide/libraries/form_validation.html | 4 +- user_guide/libraries/ftp.html | 4 +- user_guide/libraries/image_lib.html | 4 +- user_guide/libraries/input.html | 4 +- user_guide/libraries/javascript.html | 4 +- user_guide/libraries/language.html | 4 +- user_guide/libraries/loader.html | 4 +- user_guide/libraries/migration.html | 4 +- user_guide/libraries/output.html | 4 +- user_guide/libraries/pagination.html | 4 +- user_guide/libraries/parser.html | 4 +- user_guide/libraries/security.html | 4 +- user_guide/libraries/sessions.html | 4 +- user_guide/libraries/table.html | 4 +- user_guide/libraries/trackback.html | 4 +- user_guide/libraries/typography.html | 4 +- user_guide/libraries/unit_testing.html | 4 +- user_guide/libraries/uri.html | 4 +- user_guide/libraries/user_agent.html | 4 +- user_guide/libraries/xmlrpc.html | 4 +- user_guide/libraries/zip.html | 4 +- user_guide/license.html | 4 +- user_guide/overview/appflow.html | 4 +- user_guide/overview/at_a_glance.html | 4 +- user_guide/overview/cheatsheets.html | 4 +- user_guide/overview/features.html | 4 +- user_guide/overview/getting_started.html | 4 +- user_guide/overview/goals.html | 4 +- user_guide/overview/index.html | 4 +- user_guide/overview/mvc.html | 4 +- user_guide/toc.html | 4 +- user_guide/tutorial/conclusion.html | 4 +- user_guide/tutorial/create_news_items.html | 4 +- user_guide/tutorial/hard_coded_pages.html | 4 +- user_guide/tutorial/index.html | 4 +- user_guide/tutorial/news_section.html | 4 +- user_guide/tutorial/static_pages.html | 4 +- 155 files changed, 391 insertions(+), 299 deletions(-) create mode 100644 user_guide/installation/upgrade_211.html diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php index db1aee574..ec7294102 100755 --- a/system/core/CodeIgniter.php +++ b/system/core/CodeIgniter.php @@ -33,7 +33,7 @@ * @var string * */ - define('CI_VERSION', '2.1.0'); + define('CI_VERSION', '2.1.1'); /** * CodeIgniter Branch (Core = TRUE, Reactor = FALSE) diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php index 5de2079bb..4fc65aeb4 100644 --- a/system/database/drivers/pdo/pdo_driver.php +++ b/system/database/drivers/pdo/pdo_driver.php @@ -9,7 +9,7 @@ * @license http://codeigniter.com/user_guide/license.html * @author EllisLab Dev Team * @link http://codeigniter.com - * @since Version 2.1.0 + * @since Version 2.1.1 * @filesource */ diff --git a/system/database/drivers/pdo/pdo_forge.php b/system/database/drivers/pdo/pdo_forge.php index 1462e8c21..1a076d4a2 100644 --- a/system/database/drivers/pdo/pdo_forge.php +++ b/system/database/drivers/pdo/pdo_forge.php @@ -9,7 +9,7 @@ * @license http://codeigniter.com/user_guide/license.html * @author EllisLab Dev Team * @link http://codeigniter.com - * @since Version 2.1.0 + * @since Version 2.1.1 * @filesource */ diff --git a/system/database/drivers/pdo/pdo_result.php b/system/database/drivers/pdo/pdo_result.php index 7f3058ff0..7c4a2f977 100644 --- a/system/database/drivers/pdo/pdo_result.php +++ b/system/database/drivers/pdo/pdo_result.php @@ -9,7 +9,7 @@ * @license http://codeigniter.com/user_guide/license.html * @author EllisLab Dev Team * @link http://codeigniter.com - * @since Version 2.1.0 + * @since Version 2.1.1 * @filesource */ diff --git a/system/database/drivers/pdo/pdo_utility.php b/system/database/drivers/pdo/pdo_utility.php index 29aefca80..fec276458 100644 --- a/system/database/drivers/pdo/pdo_utility.php +++ b/system/database/drivers/pdo/pdo_utility.php @@ -9,7 +9,7 @@ * @license http://codeigniter.com/user_guide/license.html * @author EllisLab Dev Team * @link http://codeigniter.com - * @since Version 2.1.0 + * @since Version 2.1.1 * @filesource */ diff --git a/system/libraries/Cache/Cache.php b/system/libraries/Cache/Cache.php index 61e7aa761..261fc367b 100644 --- a/system/libraries/Cache/Cache.php +++ b/system/libraries/Cache/Cache.php @@ -6,7 +6,7 @@ * * @package CodeIgniter * @author ExpressionEngine Dev Team - * @copyright Copyright (c) 2006 - 2011 EllisLab, Inc. + * @copyright Copyright (c) 2006 - 2012 EllisLab, Inc. * @license http://codeigniter.com/user_guide/license.html * @link http://codeigniter.com * @since Version 2.0 diff --git a/system/libraries/Cache/drivers/Cache_apc.php b/system/libraries/Cache/drivers/Cache_apc.php index 79d91b320..f750e6cb7 100644 --- a/system/libraries/Cache/drivers/Cache_apc.php +++ b/system/libraries/Cache/drivers/Cache_apc.php @@ -6,7 +6,7 @@ * * @package CodeIgniter * @author ExpressionEngine Dev Team - * @copyright Copyright (c) 2006 - 2011 EllisLab, Inc. + * @copyright Copyright (c) 2006 - 2012 EllisLab, Inc. * @license http://codeigniter.com/user_guide/license.html * @link http://codeigniter.com * @since Version 2.0 diff --git a/system/libraries/Cache/drivers/Cache_dummy.php b/system/libraries/Cache/drivers/Cache_dummy.php index f96a68e27..b11b5b8fc 100644 --- a/system/libraries/Cache/drivers/Cache_dummy.php +++ b/system/libraries/Cache/drivers/Cache_dummy.php @@ -6,7 +6,7 @@ * * @package CodeIgniter * @author ExpressionEngine Dev Team - * @copyright Copyright (c) 2006 - 2011 EllisLab, Inc. + * @copyright Copyright (c) 2006 - 2012 EllisLab, Inc. * @license http://codeigniter.com/user_guide/license.html * @link http://codeigniter.com * @since Version 2.0 diff --git a/system/libraries/Cache/drivers/Cache_file.php b/system/libraries/Cache/drivers/Cache_file.php index 13e2d1af6..c50043660 100644 --- a/system/libraries/Cache/drivers/Cache_file.php +++ b/system/libraries/Cache/drivers/Cache_file.php @@ -6,7 +6,7 @@ * * @package CodeIgniter * @author ExpressionEngine Dev Team - * @copyright Copyright (c) 2006 - 2011 EllisLab, Inc. + * @copyright Copyright (c) 2006 - 2012 EllisLab, Inc. * @license http://codeigniter.com/user_guide/license.html * @link http://codeigniter.com * @since Version 2.0 diff --git a/system/libraries/Cache/drivers/Cache_memcached.php b/system/libraries/Cache/drivers/Cache_memcached.php index fc586e025..747842091 100644 --- a/system/libraries/Cache/drivers/Cache_memcached.php +++ b/system/libraries/Cache/drivers/Cache_memcached.php @@ -6,7 +6,7 @@ * * @package CodeIgniter * @author ExpressionEngine Dev Team - * @copyright Copyright (c) 2006 - 2011 EllisLab, Inc. + * @copyright Copyright (c) 2006 - 2012 EllisLab, Inc. * @license http://codeigniter.com/user_guide/license.html * @link http://codeigniter.com * @since Version 2.0 diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php index ab5a70c98..da47b5a19 100644 --- a/system/libraries/Cart.php +++ b/system/libraries/Cart.php @@ -6,7 +6,7 @@ * * @package CodeIgniter * @author ExpressionEngine Dev Team - * @copyright Copyright (c) 2006 - 2011, EllisLab, Inc. + * @copyright Copyright (c) 2006 - 2012, EllisLab, Inc. * @license http://codeigniter.com/user_guide/license.html * @link http://codeigniter.com * @since Version 1.0 diff --git a/system/libraries/Driver.php b/system/libraries/Driver.php index 9881c1eec..f9959ff81 100644 --- a/system/libraries/Driver.php +++ b/system/libraries/Driver.php @@ -6,7 +6,7 @@ * * @package CodeIgniter * @author EllisLab Dev Team - * @copyright Copyright (c) 2006 - 2011, EllisLab, Inc. + * @copyright Copyright (c) 2006 - 2012, EllisLab, Inc. * @license http://codeigniter.com/user_guide/license.html * @link http://codeigniter.com * @since Version 1.0 diff --git a/system/libraries/Migration.php b/system/libraries/Migration.php index 3943ec130..5a41377ea 100644 --- a/system/libraries/Migration.php +++ b/system/libraries/Migration.php @@ -6,7 +6,7 @@ * * @package CodeIgniter * @author EllisLab Dev Team - * @copyright Copyright (c) 2006 - 2011, EllisLab, Inc. + * @copyright Copyright (c) 2006 - 2012, EllisLab, Inc. * @license http://codeigniter.com/user_guide/license.html * @link http://codeigniter.com * @since Version 1.0 diff --git a/user_guide/changelog.html b/user_guide/changelog.html index 55fbceeaf..d8fa374cb 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -58,7 +58,7 @@ Change Log

    Change Log

    Version 2.1.1

    -

    Release Date: not yet released

    +

    Release Date: May 18, 2012

    • General Changes @@ -1465,7 +1465,7 @@ Previous Topic:  License Agreement User Guide Home   ·   Next Topic:  Credits

      -

      CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

      +

      CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

      diff --git a/user_guide/database/active_record.html b/user_guide/database/active_record.html index 17c58c9f1..734b28411 100644 --- a/user_guide/database/active_record.html +++ b/user_guide/database/active_record.html @@ -27,7 +27,7 @@
    <<
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -817,7 +817,7 @@ Previous Topic:  Query Helper Functions User Guide Home   ·   Next Topic:  Transactions

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/database/caching.html b/user_guide/database/caching.html index e6e72f269..6cf6ebd98 100644 --- a/user_guide/database/caching.html +++ b/user_guide/database/caching.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -213,7 +213,7 @@ Previous Topic:  Custom Function CallsUser Guide Home   ·   Next Topic:  Database manipulation with Database Forge

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/database/call_function.html b/user_guide/database/call_function.html index 4fc894743..b28a05050 100644 --- a/user_guide/database/call_function.html +++ b/user_guide/database/call_function.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -111,7 +111,7 @@ Previous Topic:  Field MetaData User Guide Home   ·   Next Topic:  Query Caching

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/database/configuration.html b/user_guide/database/configuration.html index 17a291ac2..01a28c0b5 100644 --- a/user_guide/database/configuration.html +++ b/user_guide/database/configuration.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -157,7 +157,7 @@ Previous Topic:  Quick Start: Usage ExamplesUser Guide Home   ·   Next Topic:  Connecting to your Database

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/database/connecting.html b/user_guide/database/connecting.html index f86602269..531f6a104 100644 --- a/user_guide/database/connecting.html +++ b/user_guide/database/connecting.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -181,7 +181,7 @@ Previous Topic:  Database ConfigurationUser Guide Home   ·   Next Topic:  Queries

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/database/examples.html b/user_guide/database/examples.html index 58035557d..1a1d71be6 100644 --- a/user_guide/database/examples.html +++ b/user_guide/database/examples.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -210,7 +210,7 @@ Previous Topic:  Database Class User Guide Home   ·   Next Topic:  Database Configuration

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/database/fields.html b/user_guide/database/fields.html index 56c9d9fdf..546a4ca1f 100644 --- a/user_guide/database/fields.html +++ b/user_guide/database/fields.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -156,7 +156,7 @@ Previous Topic:   Table Data User Guide Home   ·   Next Topic:  Custom Function Calls

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/database/forge.html b/user_guide/database/forge.html index 2289e148e..e6153721d 100644 --- a/user_guide/database/forge.html +++ b/user_guide/database/forge.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -227,7 +227,7 @@ Previous Topic:  DB Caching Class Top of Page   ·   User Guide Home   ·   Next Topic:  Database Utilities Class

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/database/helpers.html b/user_guide/database/helpers.html index 82f5c1d21..db03de1e9 100644 --- a/user_guide/database/helpers.html +++ b/user_guide/database/helpers.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -144,7 +144,7 @@ Previous Topic:  Query Results User Guide Home   ·   Next Topic:  Active Record Pattern

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/database/index.html b/user_guide/database/index.html index 8a957ecef..2a08f0a69 100644 --- a/user_guide/database/index.html +++ b/user_guide/database/index.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -92,7 +92,7 @@ Previous Topic:  Caching Class User Guide Home   ·   Next Topic:  Quick Start: Usage Examples

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/database/queries.html b/user_guide/database/queries.html index 3152997ca..263752f52 100644 --- a/user_guide/database/queries.html +++ b/user_guide/database/queries.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -151,7 +151,7 @@ Previous Topic:  Connecting to your Database User Guide Home   ·   Next Topic:  Query Results

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/database/results.html b/user_guide/database/results.html index 0baf992fb..395714073 100644 --- a/user_guide/database/results.html +++ b/user_guide/database/results.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -252,7 +252,7 @@ Previous Topic:  Queries User Guide Home   ·   Next Topic:  Query Helper Functions

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/database/table_data.html b/user_guide/database/table_data.html index dc5b54198..5ebe368d8 100644 --- a/user_guide/database/table_data.html +++ b/user_guide/database/table_data.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -106,7 +106,7 @@ Previous Topic:   Transactions User Guide Home   ·   Next Topic:   Field Metadata

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/database/transactions.html b/user_guide/database/transactions.html index dd5f73ed1..53e667046 100644 --- a/user_guide/database/transactions.html +++ b/user_guide/database/transactions.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -193,7 +193,7 @@ Previous Topic:   Field MetaData   User Guide Home   ·   Next Topic:  Table Metadata

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/database/utilities.html b/user_guide/database/utilities.html index 7c30070f6..4a3005f9f 100644 --- a/user_guide/database/utilities.html +++ b/user_guide/database/utilities.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -307,7 +307,7 @@ Previous Topic:  DB Forge Class Top of Page   ·   User Guide Home   ·   Next Topic:  Javascript Class

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/doc_style/index.html b/user_guide/doc_style/index.html index aa7fff43d..ad5c65a5b 100644 --- a/user_guide/doc_style/index.html +++ b/user_guide/doc_style/index.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -80,7 +80,7 @@ Previous Topic:  PHP Style Guide< User Guide Home   ·   Next Topic:  Benchmarking Class

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/doc_style/template.html b/user_guide/doc_style/template.html index d59d5e4ed..3fde59c9e 100644 --- a/user_guide/doc_style/template.html +++ b/user_guide/doc_style/template.html @@ -121,7 +121,7 @@ Previous Topic:  Previous Class User Guide Home   ·   Next Topic:  Next Class

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/general/alternative_php.html b/user_guide/general/alternative_php.html index 6e601af44..6d2165fda 100644 --- a/user_guide/general/alternative_php.html +++ b/user_guide/general/alternative_php.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -140,7 +140,7 @@ Previous Topic:  Managing ApplicationsUser Guide Home   ·   Next Topic:  Security

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/general/ancillary_classes.html b/user_guide/general/ancillary_classes.html index 0e3d54deb..9c209c0b7 100644 --- a/user_guide/general/ancillary_classes.html +++ b/user_guide/general/ancillary_classes.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -110,7 +110,7 @@ Previous Topic:  Creating Core Libra User Guide Home   ·   Next Topic:  Auto-loading Resources

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/general/autoloader.html b/user_guide/general/autoloader.html index 699751202..fdc02e906 100644 --- a/user_guide/general/autoloader.html +++ b/user_guide/general/autoloader.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -93,7 +93,7 @@ Previous Topic:  Hooks - Extending the Core Top of Page   ·   User Guide Home   ·   Next Topic:  Common Functions

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/general/caching.html b/user_guide/general/caching.html index a0d7596ed..5ccc79190 100644 --- a/user_guide/general/caching.html +++ b/user_guide/general/caching.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -108,7 +108,7 @@ Previous Topic:  Error Handling User Guide Home   ·   Next Topic:  Profiling Your Application

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/general/cli.html b/user_guide/general/cli.html index 5dda24b56..e21d1de51 100644 --- a/user_guide/general/cli.html +++ b/user_guide/general/cli.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -143,7 +143,7 @@ Previous Topic:  CodeIgniter URLs Top of Page   ·   User Guide Home   ·   Next Topic:  Reserved Names

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/general/common_functions.html b/user_guide/general/common_functions.html index f290521a9..ac2ff529b 100644 --- a/user_guide/general/common_functions.html +++ b/user_guide/general/common_functions.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -120,7 +120,7 @@ Previous Topic:  Auto-loading Resources< Top of Page   ·   User Guide Home   ·   Next Topic:  URI Routing

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/general/controllers.html b/user_guide/general/controllers.html index 91dd95a00..ee482e512 100644 --- a/user_guide/general/controllers.html +++ b/user_guide/general/controllers.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -381,7 +381,7 @@ Previous Topic:  CodeIgniter URLs Top of Page   ·   User Guide Home   ·   Next Topic:  Reserved Names

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/general/core_classes.html b/user_guide/general/core_classes.html index be711903c..ae43eef27 100644 --- a/user_guide/general/core_classes.html +++ b/user_guide/general/core_classes.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -179,7 +179,7 @@ Previous Topic:  Creating Your Own L User Guide Home   ·   Next Topic:  Hooks - Extending the Core

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/general/creating_drivers.html b/user_guide/general/creating_drivers.html index 77cccd03c..eaa626566 100644 --- a/user_guide/general/creating_drivers.html +++ b/user_guide/general/creating_drivers.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -93,7 +93,7 @@ Previous Topic:  Using CodeIgniter Drivers User Guide Home   ·   Next Topic:  Creating Core System Classes

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/general/creating_libraries.html b/user_guide/general/creating_libraries.html index f905bb7c3..977cfae4d 100644 --- a/user_guide/general/creating_libraries.html +++ b/user_guide/general/creating_libraries.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -286,7 +286,7 @@ Previous Topic:  Using CodeIgniter Libraries< User Guide Home   ·   Next Topic:  Using CodeIgniter Drivers

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/general/credits.html b/user_guide/general/credits.html index 00c577871..90e7d0306 100644 --- a/user_guide/general/credits.html +++ b/user_guide/general/credits.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -80,7 +80,7 @@ Previous Topic:  Change Log User Guide Home   ·   Next Topic:  Downloading CodeIgniter

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/general/drivers.html b/user_guide/general/drivers.html index f463adb10..9ea7df6b6 100644 --- a/user_guide/general/drivers.html +++ b/user_guide/general/drivers.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -97,7 +97,7 @@ Previous Topic:  Creating Libraries< User Guide Home   ·   Next Topic:  Creating Drivers

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/general/environments.html b/user_guide/general/environments.html index 0245b085d..38285a662 100644 --- a/user_guide/general/environments.html +++ b/user_guide/general/environments.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -119,7 +119,7 @@ Previous Topic:  Managing ApplicationsUser Guide Home   ·   Next Topic:  Alternative PHP Syntax

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/general/errors.html b/user_guide/general/errors.html index d6bed9ea1..3f0830419 100644 --- a/user_guide/general/errors.html +++ b/user_guide/general/errors.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -133,7 +133,7 @@ Previous Topic:  URI Routing User Guide Home   ·   Next Topic:  Page Caching

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/general/helpers.html b/user_guide/general/helpers.html index 619e9ff78..099430bea 100644 --- a/user_guide/general/helpers.html +++ b/user_guide/general/helpers.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -178,7 +178,7 @@ Previous Topic:  Models User Guide Home   ·   Next Topic:  Using Libraries

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/general/hooks.html b/user_guide/general/hooks.html index 07d302a7d..70fb9648e 100644 --- a/user_guide/general/hooks.html +++ b/user_guide/general/hooks.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -158,7 +158,7 @@ Previous Topic:  Creating Core Classes User Guide Home   ·   Next Topic:  Auto-loading Resources

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/general/libraries.html b/user_guide/general/libraries.html index 73b642bef..648b6cba9 100644 --- a/user_guide/general/libraries.html +++ b/user_guide/general/libraries.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -91,7 +91,7 @@ Previous Topic:  Helpers User Guide Home   ·   Next Topic:  Creating Libraries

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/general/managing_apps.html b/user_guide/general/managing_apps.html index 388519796..97312a01e 100644 --- a/user_guide/general/managing_apps.html +++ b/user_guide/general/managing_apps.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -126,7 +126,7 @@ Previous Topic:  Profiling Your ApplicationUser Guide Home   ·   Next Topic:  Alternative PHP Syntax

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/general/models.html b/user_guide/general/models.html index 7bda4d9a9..a416a80d9 100644 --- a/user_guide/general/models.html +++ b/user_guide/general/models.html @@ -27,7 +27,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -244,7 +244,7 @@ Previous Topic:  Views User Guide Home   ·   Next Topic:  Helpers

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/general/profiling.html b/user_guide/general/profiling.html index 451b6f9e6..b6d5721fd 100644 --- a/user_guide/general/profiling.html +++ b/user_guide/general/profiling.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -174,7 +174,7 @@ Previous Topic:  Caching User Guide Home   ·   Next Topic:  Managing Applications

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/general/quick_reference.html b/user_guide/general/quick_reference.html index 6c07b335c..1eb78992b 100644 --- a/user_guide/general/quick_reference.html +++ b/user_guide/general/quick_reference.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -70,7 +70,7 @@ Quick Reference Chart Top of Page   ·   User Guide Home

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/general/requirements.html b/user_guide/general/requirements.html index 1393b40e0..230ab7809 100644 --- a/user_guide/general/requirements.html +++ b/user_guide/general/requirements.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -75,7 +75,7 @@ Server Requirements User Guide Home   ·   Next Topic:  License Agreement

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/general/reserved_names.html b/user_guide/general/reserved_names.html index 450c0f667..80df6fd11 100644 --- a/user_guide/general/reserved_names.html +++ b/user_guide/general/reserved_names.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -121,7 +121,7 @@ Previous Topic:  Controllers Top of Page   ·   User Guide Home   ·   Next Topic:  Views

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/general/routing.html b/user_guide/general/routing.html index d5c90a1b8..e2252e028 100644 --- a/user_guide/general/routing.html +++ b/user_guide/general/routing.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -164,7 +164,7 @@ Previous Topic:  Common Functions User Guide Home   ·   Next Topic:  Error Handling

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/general/security.html b/user_guide/general/security.html index 9e78d4c68..b91266f92 100644 --- a/user_guide/general/security.html +++ b/user_guide/general/security.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -157,7 +157,7 @@ Previous Topic:  Alternative PHP User Guide Home   ·   Next Topic:  PHP Style Guide

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/general/styleguide.html b/user_guide/general/styleguide.html index c94313365..3ca16496b 100644 --- a/user_guide/general/styleguide.html +++ b/user_guide/general/styleguide.html @@ -34,7 +34,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -672,7 +672,7 @@ Previous Topic:  Security User Guide Home   ·   Next Topic:  Writing Documentation

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/general/urls.html b/user_guide/general/urls.html index edf03309b..d5d85df8a 100644 --- a/user_guide/general/urls.html +++ b/user_guide/general/urls.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -144,7 +144,7 @@ segment based URLs.

    Top of Page   ·   User Guide Home   ·   Next Topic:  Controllers

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/general/views.html b/user_guide/general/views.html index 5dc1d3250..68686e1e6 100644 --- a/user_guide/general/views.html +++ b/user_guide/general/views.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -267,7 +267,7 @@ Previous Topic:  Reserved Names User Guide Home   ·   Next Topic:  Models

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/helpers/array_helper.html b/user_guide/helpers/array_helper.html index 92a11ed69..9b7a90b85 100644 --- a/user_guide/helpers/array_helper.html +++ b/user_guide/helpers/array_helper.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -163,7 +163,7 @@ Previous Topic:   Javascript Cl Top of Page   ·   User Guide Home   ·   Next Topic:  CAPTCHA Helper

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/helpers/captcha_helper.html b/user_guide/helpers/captcha_helper.html index 6c2671ad0..d6b46fdc0 100644 --- a/user_guide/helpers/captcha_helper.html +++ b/user_guide/helpers/captcha_helper.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -188,7 +188,7 @@ Previous Topic:  Array Helper Top of Page   ·   User Guide Home   ·   Next Topic:  Cookie Helper

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/helpers/cookie_helper.html b/user_guide/helpers/cookie_helper.html index 2fde7f841..beba67a96 100644 --- a/user_guide/helpers/cookie_helper.html +++ b/user_guide/helpers/cookie_helper.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -100,7 +100,7 @@ Previous Topic:  CAPTCHA Helper Top of Page   ·   User Guide Home   ·   Next Topic:  Date Helper

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/helpers/date_helper.html b/user_guide/helpers/date_helper.html index e705593b0..f39971a0c 100644 --- a/user_guide/helpers/date_helper.html +++ b/user_guide/helpers/date_helper.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -401,7 +401,7 @@ Previous Topic:  Cookie Helper User Guide Home   ·   Next Topic:  Directory Helper

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/helpers/directory_helper.html b/user_guide/helpers/directory_helper.html index 7fd7797af..c5ac082cd 100644 --- a/user_guide/helpers/directory_helper.html +++ b/user_guide/helpers/directory_helper.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -136,7 +136,7 @@ Previous Topic:  Date Helper User Guide Home   ·   Next Topic:  Download Helper

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/helpers/download_helper.html b/user_guide/helpers/download_helper.html index ccfe9ac72..b669202ad 100644 --- a/user_guide/helpers/download_helper.html +++ b/user_guide/helpers/download_helper.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -105,7 +105,7 @@ Previous Topic:  Directory Helper Top of Page   ·   User Guide Home   ·   Next Topic:  Email Helper

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/helpers/email_helper.html b/user_guide/helpers/email_helper.html index 13ae220fe..ae8d2da0e 100644 --- a/user_guide/helpers/email_helper.html +++ b/user_guide/helpers/email_helper.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -95,7 +95,7 @@ Previous Topic:  Download Helper Top of Page   ·   User Guide Home   ·   Next Topic:  File Helper

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/helpers/file_helper.html b/user_guide/helpers/file_helper.html index 0296191ff..3302cd048 100644 --- a/user_guide/helpers/file_helper.html +++ b/user_guide/helpers/file_helper.html @@ -27,7 +27,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -172,7 +172,7 @@ Previous Topic:  Email Helper Top of Page   ·   User Guide Home   ·   Next Topic:  Form Helper

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/helpers/form_helper.html b/user_guide/helpers/form_helper.html index ce809e946..02952b679 100644 --- a/user_guide/helpers/form_helper.html +++ b/user_guide/helpers/form_helper.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -477,7 +477,7 @@ Previous Topic:  File Helper User Guide Home   ·   Next Topic:  HTML Helper

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/helpers/html_helper.html b/user_guide/helpers/html_helper.html index a8277febe..6ade2d137 100644 --- a/user_guide/helpers/html_helper.html +++ b/user_guide/helpers/html_helper.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -383,7 +383,7 @@ Previous Topic:  Form Helper Top of Page   ·   User Guide Home   ·   Next Topic:   Path Helper

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/helpers/inflector_helper.html b/user_guide/helpers/inflector_helper.html index 66982e8b3..d441ca1eb 100644 --- a/user_guide/helpers/inflector_helper.html +++ b/user_guide/helpers/inflector_helper.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -144,7 +144,7 @@ Previous Topic:   HTML Helper User Guide Home   ·   Next Topic:  Number Helper

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/helpers/language_helper.html b/user_guide/helpers/language_helper.html index 073c368d8..9761b96b7 100644 --- a/user_guide/helpers/language_helper.html +++ b/user_guide/helpers/language_helper.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -91,7 +91,7 @@ Previous Topic:  Date Helper User Guide Home   ·   Next Topic:  Download Helper

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/helpers/number_helper.html b/user_guide/helpers/number_helper.html index c48987e6c..8dd9287a8 100644 --- a/user_guide/helpers/number_helper.html +++ b/user_guide/helpers/number_helper.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -106,7 +106,7 @@ Previous Topic:  Inflector Helper User Guide Home   ·   Next Topic:  Path Helper

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/helpers/path_helper.html b/user_guide/helpers/path_helper.html index 00f4aa2ec..04826bb19 100644 --- a/user_guide/helpers/path_helper.html +++ b/user_guide/helpers/path_helper.html @@ -27,7 +27,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -99,7 +99,7 @@ Previous Topic:  Number Helper User Guide Home   ·   Next Topic:  Security Helper

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/helpers/security_helper.html b/user_guide/helpers/security_helper.html index 16d5c51f2..b05d8e076 100644 --- a/user_guide/helpers/security_helper.html +++ b/user_guide/helpers/security_helper.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -125,7 +125,7 @@ Previous Topic:   Path Helper Top of Page   ·   User Guide Home   ·   Next Topic:  Smiley Helper

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/helpers/smiley_helper.html b/user_guide/helpers/smiley_helper.html index 8bdd1df2c..3441cd8a3 100644 --- a/user_guide/helpers/smiley_helper.html +++ b/user_guide/helpers/smiley_helper.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -208,7 +208,7 @@ Previous Topic:  Security Helper User Guide Home   ·   Next Topic:  String Helper

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/helpers/string_helper.html b/user_guide/helpers/string_helper.html index 3d7ba1c51..d4023841d 100644 --- a/user_guide/helpers/string_helper.html +++ b/user_guide/helpers/string_helper.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -182,7 +182,7 @@ Previous Topic:  Smiley Helper User Guide Home   ·   Next Topic:  Text Helper

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/helpers/text_helper.html b/user_guide/helpers/text_helper.html index 9f0d22ffc..775ded677 100644 --- a/user_guide/helpers/text_helper.html +++ b/user_guide/helpers/text_helper.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -204,7 +204,7 @@ Previous Topic:  String Helper User Guide Home   ·   Next Topic:  Typography Helper

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/helpers/typography_helper.html b/user_guide/helpers/typography_helper.html index a6bd809a5..16e3ca989 100644 --- a/user_guide/helpers/typography_helper.html +++ b/user_guide/helpers/typography_helper.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -105,7 +105,7 @@ Previous Topic:  Text Helper User Guide Home   ·   Next Topic:  URL Helper

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/helpers/url_helper.html b/user_guide/helpers/url_helper.html index c23c5ac92..488078c39 100644 --- a/user_guide/helpers/url_helper.html +++ b/user_guide/helpers/url_helper.html @@ -27,7 +27,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -295,7 +295,7 @@ Previous Topic:  Typography HelperUser Guide Home   ·   Next Topic:  XML Helper

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/helpers/xml_helper.html b/user_guide/helpers/xml_helper.html index f410b2114..ce037c251 100644 --- a/user_guide/helpers/xml_helper.html +++ b/user_guide/helpers/xml_helper.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -98,7 +98,7 @@ Previous Topic:  URL Helper Top of Page   ·   User Guide Home

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/index.html b/user_guide/index.html index fa90983e1..b7ae61887 100644 --- a/user_guide/index.html +++ b/user_guide/index.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -89,7 +89,7 @@ minimizing the amount of code needed for a given task.

    diff --git a/user_guide/installation/downloads.html b/user_guide/installation/downloads.html index 14c65edd0..12252ad47 100644 --- a/user_guide/installation/downloads.html +++ b/user_guide/installation/downloads.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -58,7 +58,8 @@ Downloading CodeIgniter

    Downloading CodeIgniter

      -
    • CodeIgniter V 2.1.0 (Current version)
    • +
    • CodeIgniter V 2.1.1 (Current version)
    • +
    • CodeIgniter V 2.1.0
    • CodeIgniter V 2.0.3
    • CodeIgniter V 2.0.2
    • CodeIgniter V 2.0.1
    • @@ -91,11 +92,12 @@ Downloading CodeIgniter

      Git Server

      Git is a distributed version control system.

      -

      Public Git access is available at GitHub. - Please note that while every effort is made to keep this code base functional, we cannot guarantee the functionality of code taken - from the tip.

      +

      Public Git access is available at GitHub. + Please note that while every effort is made to keep this code base functional, we cannot guarantee the functionality of code taken + from the tip.

      + +

      Beginning with version 2.0.3, stable tags are also available via GitHub, simply select the version from the Tags dropdown.

      -

      Beginning with version 2.0.3, stable tags are also available via GitHub, simply select the version from the Tags dropdown.

    @@ -108,7 +110,7 @@ Previous Topic:  Credits User Guide Home   ·   Next Topic:  Installation Instructions

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/installation/index.html b/user_guide/installation/index.html index f01c8b8d5..aca760ca4 100644 --- a/user_guide/installation/index.html +++ b/user_guide/installation/index.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -101,7 +101,7 @@ Previous Topic:  Credits Next Topic:  Upgrading from a Previous Version

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/installation/troubleshooting.html b/user_guide/installation/troubleshooting.html index e79eb6a9f..bb7cadeba 100644 --- a/user_guide/installation/troubleshooting.html +++ b/user_guide/installation/troubleshooting.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -83,7 +83,7 @@ Previous Topic:  Upgrading from a Previous Ve User Guide Home   ·   Next Topic:  CodeIgniter at a Glance

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/installation/upgrade_120.html b/user_guide/installation/upgrade_120.html index 2b3d066cd..b80c02ad9 100644 --- a/user_guide/installation/upgrade_120.html +++ b/user_guide/installation/upgrade_120.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -85,7 +85,7 @@ Previous Topic:  Installation Instructions User Guide Home   ·   Next Topic:  Troubleshooting

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/installation/upgrade_130.html b/user_guide/installation/upgrade_130.html index dd1465617..3a335738e 100644 --- a/user_guide/installation/upgrade_130.html +++ b/user_guide/installation/upgrade_130.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -196,7 +196,7 @@ Previous Topic:  Installation Instructions User Guide Home   ·   Next Topic:  Troubleshooting

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/installation/upgrade_131.html b/user_guide/installation/upgrade_131.html index 202468dac..4a91c6ceb 100644 --- a/user_guide/installation/upgrade_131.html +++ b/user_guide/installation/upgrade_131.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -95,7 +95,7 @@ Previous Topic:  Installation Instructions User Guide Home   ·   Next Topic:  Troubleshooting

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/installation/upgrade_132.html b/user_guide/installation/upgrade_132.html index 99f8fd3ab..1763f2b9c 100644 --- a/user_guide/installation/upgrade_132.html +++ b/user_guide/installation/upgrade_132.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -93,7 +93,7 @@ Previous Topic:  Installation Instructions User Guide Home   ·   Next Topic:  Troubleshooting

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/installation/upgrade_133.html b/user_guide/installation/upgrade_133.html index b9b7a7fd3..fd1887d0e 100644 --- a/user_guide/installation/upgrade_133.html +++ b/user_guide/installation/upgrade_133.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -105,7 +105,7 @@ Previous Topic:  Installation Instructions User Guide Home   ·   Next Topic:  Troubleshooting

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/installation/upgrade_140.html b/user_guide/installation/upgrade_140.html index 50891b912..d82472551 100644 --- a/user_guide/installation/upgrade_140.html +++ b/user_guide/installation/upgrade_140.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -138,7 +138,7 @@ Previous Topic:  Installation Instructions User Guide Home   ·   Next Topic:  Troubleshooting

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/installation/upgrade_141.html b/user_guide/installation/upgrade_141.html index afa8018b8..3ed11e7b5 100644 --- a/user_guide/installation/upgrade_141.html +++ b/user_guide/installation/upgrade_141.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -141,7 +141,7 @@ Previous Topic:  Installation Instructions User Guide Home   ·   Next Topic:  Troubleshooting

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/installation/upgrade_150.html b/user_guide/installation/upgrade_150.html index f910aa039..5909a463a 100644 --- a/user_guide/installation/upgrade_150.html +++ b/user_guide/installation/upgrade_150.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -171,7 +171,7 @@ Previous Topic:  Installation Instructions User Guide Home   ·   Next Topic:  Troubleshooting

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/installation/upgrade_152.html b/user_guide/installation/upgrade_152.html index 55e43f728..f46aee967 100644 --- a/user_guide/installation/upgrade_152.html +++ b/user_guide/installation/upgrade_152.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -104,7 +104,7 @@ Previous Topic:  Installation Instructions User Guide Home   ·   Next Topic:  Troubleshooting

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/installation/upgrade_153.html b/user_guide/installation/upgrade_153.html index 3e6af7a38..3d28c6c77 100644 --- a/user_guide/installation/upgrade_153.html +++ b/user_guide/installation/upgrade_153.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -93,7 +93,7 @@ Previous Topic:  Installation Instructions User Guide Home   ·   Next Topic:  Troubleshooting

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/installation/upgrade_154.html b/user_guide/installation/upgrade_154.html index 627fa0896..d8dffc99d 100644 --- a/user_guide/installation/upgrade_154.html +++ b/user_guide/installation/upgrade_154.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -109,7 +109,7 @@ Previous Topic:  Installation Instructions User Guide Home   ·   Next Topic:  Troubleshooting

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/installation/upgrade_160.html b/user_guide/installation/upgrade_160.html index 70e589ccf..b90a2e370 100644 --- a/user_guide/installation/upgrade_160.html +++ b/user_guide/installation/upgrade_160.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -118,7 +118,7 @@ Previous Topic:  Installation Instructions User Guide Home   ·   Next Topic:  Troubleshooting

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/installation/upgrade_161.html b/user_guide/installation/upgrade_161.html index 40877369d..69bf84893 100644 --- a/user_guide/installation/upgrade_161.html +++ b/user_guide/installation/upgrade_161.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -91,7 +91,7 @@ Previous Topic:  Installation Instructions User Guide Home   ·   Next Topic:  Troubleshooting

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/installation/upgrade_162.html b/user_guide/installation/upgrade_162.html index d67190842..270507c59 100644 --- a/user_guide/installation/upgrade_162.html +++ b/user_guide/installation/upgrade_162.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -99,7 +99,7 @@ Previous Topic:  Installation Instructions User Guide Home   ·   Next Topic:  Troubleshooting

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/installation/upgrade_163.html b/user_guide/installation/upgrade_163.html index cdf6bdf6f..35e7f5c52 100644 --- a/user_guide/installation/upgrade_163.html +++ b/user_guide/installation/upgrade_163.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -92,7 +92,7 @@ Previous Topic:  Installation Instructions User Guide Home   ·   Next Topic:  Troubleshooting

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/installation/upgrade_170.html b/user_guide/installation/upgrade_170.html index 7c67f9125..3a7943905 100644 --- a/user_guide/installation/upgrade_170.html +++ b/user_guide/installation/upgrade_170.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -114,7 +114,7 @@ Previous Topic:  Installation Instructions User Guide Home   ·   Next Topic:  Troubleshooting

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/installation/upgrade_171.html b/user_guide/installation/upgrade_171.html index 014b2c589..43710d444 100644 --- a/user_guide/installation/upgrade_171.html +++ b/user_guide/installation/upgrade_171.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -91,7 +91,7 @@ Previous Topic:  Installation Instructions User Guide Home   ·   Next Topic:  Troubleshooting

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/installation/upgrade_172.html b/user_guide/installation/upgrade_172.html index 961f3cae1..1882da712 100644 --- a/user_guide/installation/upgrade_172.html +++ b/user_guide/installation/upgrade_172.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -102,7 +102,7 @@ Previous Topic:  Installation Instructions User Guide Home   ·   Next Topic:  Troubleshooting

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/installation/upgrade_200.html b/user_guide/installation/upgrade_200.html index b5d6e75ec..fb4fdaf71 100644 --- a/user_guide/installation/upgrade_200.html +++ b/user_guide/installation/upgrade_200.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -124,7 +124,7 @@ Previous Topic:  Installation Instructions User Guide Home   ·   Next Topic:  Troubleshooting

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/installation/upgrade_201.html b/user_guide/installation/upgrade_201.html index 7edd0ba6a..16177e940 100644 --- a/user_guide/installation/upgrade_201.html +++ b/user_guide/installation/upgrade_201.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -98,7 +98,7 @@ Previous Topic:  Installation Instructions User Guide Home   ·   Next Topic:  Troubleshooting

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/installation/upgrade_202.html b/user_guide/installation/upgrade_202.html index 9aaa561eb..a0d787115 100644 --- a/user_guide/installation/upgrade_202.html +++ b/user_guide/installation/upgrade_202.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -90,7 +90,7 @@ Previous Topic:  Installation Instructions User Guide Home   ·   Next Topic:  Troubleshooting

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/installation/upgrade_203.html b/user_guide/installation/upgrade_203.html index d4b703af0..0969164df 100644 --- a/user_guide/installation/upgrade_203.html +++ b/user_guide/installation/upgrade_203.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -114,7 +114,7 @@ Previous Topic:  Installation Instructions User Guide Home   ·   Next Topic:  Troubleshooting

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/installation/upgrade_210.html b/user_guide/installation/upgrade_210.html index d9a7213a9..7c34806e7 100644 --- a/user_guide/installation/upgrade_210.html +++ b/user_guide/installation/upgrade_210.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -82,7 +82,7 @@ Previous Topic:  Installation Instructions User Guide Home   ·   Next Topic:  Troubleshooting

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/installation/upgrade_211.html b/user_guide/installation/upgrade_211.html new file mode 100644 index 000000000..a2afdee2b --- /dev/null +++ b/user_guide/installation/upgrade_211.html @@ -0,0 +1,89 @@ + + + + + +Upgrading from 2.0.3 to 2.1.0 : CodeIgniter User Guide + + + + + + + + + + + + + + + + + + + + + +
    + + + + + +

    CodeIgniter User Guide Version 2.1.1

    +
    + + + + + + + + + +
    + + +
    + + + +
    + +

    Upgrading from 2.1.0 to 2.1.1

    + +

    Before performing an update you should take your site offline by replacing the index.php file with a static one.

    + +

    Step 1: Update your CodeIgniter files

    + +

    Replace all files and directories in your "system" folder and replace your index.php file. If any modifications were made to your index.php they will need to be made fresh in this new one.

    + +

    Note: If you have any custom developed files in these folders please make copies of them first.

    + +

    Step 2: Replace config/mimes.php

    + +

    This config file has been updated to contain more user mime-types, please copy it to application/config/mimes.php.

    + + +
    + + + + + + + \ No newline at end of file diff --git a/user_guide/installation/upgrade_b11.html b/user_guide/installation/upgrade_b11.html index dc3c1f07c..0e52aa601 100644 --- a/user_guide/installation/upgrade_b11.html +++ b/user_guide/installation/upgrade_b11.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -137,7 +137,7 @@ Previous Topic:  Installation Instructions User Guide Home   ·   Next Topic:  Troubleshooting

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/installation/upgrading.html b/user_guide/installation/upgrading.html index c3f5ae6dd..1c8be9025 100644 --- a/user_guide/installation/upgrading.html +++ b/user_guide/installation/upgrading.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -60,6 +60,7 @@ Upgrading from a Previous Version

    Please read the upgrade notes corresponding to the version you are upgrading from.

    diff --git a/user_guide/libraries/benchmark.html b/user_guide/libraries/benchmark.html index 602e6fac0..55592857a 100644 --- a/user_guide/libraries/benchmark.html +++ b/user_guide/libraries/benchmark.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -191,7 +191,7 @@ Previous Topic:  Writing Documentaio User Guide Home   ·   Next Topic:  Calendar Class

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/libraries/caching.html b/user_guide/libraries/caching.html index 9808aaa51..a818fe807 100644 --- a/user_guide/libraries/caching.html +++ b/user_guide/libraries/caching.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -186,7 +186,7 @@ Previous Topic:  Zip Encoding Class User Guide Home   ·   Next Topic:  Database Class

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/libraries/calendar.html b/user_guide/libraries/calendar.html index 2abc43975..ac0c8252a 100644 --- a/user_guide/libraries/calendar.html +++ b/user_guide/libraries/calendar.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -242,7 +242,7 @@ Previous Topic:  Benchmark Class User Guide Home   ·   Next Topic:  Cart Class

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/libraries/cart.html b/user_guide/libraries/cart.html index b867b709c..c10ab4488 100644 --- a/user_guide/libraries/cart.html +++ b/user_guide/libraries/cart.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -339,7 +339,7 @@ Previous Topic:  Calendar Class User Guide Home   ·   Next Topic:  Config Class

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/libraries/config.html b/user_guide/libraries/config.html index 08b612e77..a689bd5cf 100644 --- a/user_guide/libraries/config.html +++ b/user_guide/libraries/config.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -215,7 +215,7 @@ Previous Topic:  Calendaring Class User Guide Home   ·   Next Topic:  Database Class

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/libraries/email.html b/user_guide/libraries/email.html index 7fc56d55b..e418d528d 100644 --- a/user_guide/libraries/email.html +++ b/user_guide/libraries/email.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -300,7 +300,7 @@ Previous Topic:  Database Class User Guide Home   ·   Next Topic:  Encryption Class

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/libraries/encryption.html b/user_guide/libraries/encryption.html index 6ec629f96..935e0bfa0 100644 --- a/user_guide/libraries/encryption.html +++ b/user_guide/libraries/encryption.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -217,7 +217,7 @@ Previous Topic:  Email Class User Guide Home   ·   Next Topic:  File Uploading Class

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/libraries/file_uploading.html b/user_guide/libraries/file_uploading.html index 2cb1ef5ea..2ada111ab 100644 --- a/user_guide/libraries/file_uploading.html +++ b/user_guide/libraries/file_uploading.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -444,7 +444,7 @@ Previous Topic:  Encryption Helper User Guide Home   ·   Next Topic:  Form Validation Class

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  Ellislab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  Ellislab, Inc.

    diff --git a/user_guide/libraries/form_validation.html b/user_guide/libraries/form_validation.html index 2028bcd2c..81f2b9582 100644 --- a/user_guide/libraries/form_validation.html +++ b/user_guide/libraries/form_validation.html @@ -27,7 +27,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -1243,7 +1243,7 @@ Previous Topic:  File Uploading ClassUser Guide Home   ·   Next Topic:  FTP Class

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/libraries/ftp.html b/user_guide/libraries/ftp.html index 175efe19b..8cf60893e 100644 --- a/user_guide/libraries/ftp.html +++ b/user_guide/libraries/ftp.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -308,7 +308,7 @@ Previous Topic:  Form Validation Class< User Guide Home   ·   Next Topic:  HTML Table Class

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/libraries/image_lib.html b/user_guide/libraries/image_lib.html index 1caf791d8..8df6976e1 100644 --- a/user_guide/libraries/image_lib.html +++ b/user_guide/libraries/image_lib.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -660,7 +660,7 @@ Previous Topic:  HTML Table Class User Guide Home   ·   Next Topic:  Input Class

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/libraries/input.html b/user_guide/libraries/input.html index 10c84a9ea..2f2d1830b 100644 --- a/user_guide/libraries/input.html +++ b/user_guide/libraries/input.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -288,7 +288,7 @@ Previous Topic:  Image Manipulation Class User Guide Home   ·   Next Topic:  Loader Class

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/libraries/javascript.html b/user_guide/libraries/javascript.html index 3dda1fd69..6b72ed6c2 100644 --- a/user_guide/libraries/javascript.html +++ b/user_guide/libraries/javascript.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -240,7 +240,7 @@ Previous Topic:  Database Class Top of Page   ·   User Guide Home   ·   Next Topic:  Array Helper

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/libraries/language.html b/user_guide/libraries/language.html index a9afcef90..44a4cb654 100644 --- a/user_guide/libraries/language.html +++ b/user_guide/libraries/language.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -130,7 +130,7 @@ Previous Topic:  Loader Class User Guide Home   ·   Next Topic:  Output Class

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/libraries/loader.html b/user_guide/libraries/loader.html index 53440c53c..862430b9f 100644 --- a/user_guide/libraries/loader.html +++ b/user_guide/libraries/loader.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -266,7 +266,7 @@ Previous Topic:  Input Class User Guide Home   ·   Next Topic:  Language Class

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/libraries/migration.html b/user_guide/libraries/migration.html index ed99044d1..646772198 100644 --- a/user_guide/libraries/migration.html +++ b/user_guide/libraries/migration.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -169,7 +169,7 @@ Previous Topic:  Form Validation Class< User Guide Home   ·   Next Topic:  HTML Table Class

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/libraries/output.html b/user_guide/libraries/output.html index 77fe464ce..cf2324bd8 100644 --- a/user_guide/libraries/output.html +++ b/user_guide/libraries/output.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -170,7 +170,7 @@ Previous Topic:  Language Class User Guide Home   ·   Next Topic:  Pagination Class

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/libraries/pagination.html b/user_guide/libraries/pagination.html index 6478694d0..54c7efcc2 100644 --- a/user_guide/libraries/pagination.html +++ b/user_guide/libraries/pagination.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -226,7 +226,7 @@ Previous Topic:  Output Class User Guide Home   ·   Next Topic:  Session Class

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/libraries/parser.html b/user_guide/libraries/parser.html index f449145ac..4d909223c 100644 --- a/user_guide/libraries/parser.html +++ b/user_guide/libraries/parser.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -205,7 +205,7 @@ Previous Topic:  Trackback Class User Guide Home   ·   Next Topic:  Typography

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/libraries/security.html b/user_guide/libraries/security.html index ad1d9ae86..25f1fe879 100644 --- a/user_guide/libraries/security.html +++ b/user_guide/libraries/security.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -128,7 +128,7 @@ Previous Topic:  Pagination Class User Guide Home   ·   Next Topic:  Session Class

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/libraries/sessions.html b/user_guide/libraries/sessions.html index dfb732491..ba9085f59 100644 --- a/user_guide/libraries/sessions.html +++ b/user_guide/libraries/sessions.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -334,7 +334,7 @@ Previous Topic:  Security Class User Guide Home   ·   Next Topic:  Trackback Class

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/libraries/table.html b/user_guide/libraries/table.html index 003916ef3..1c46b5fac 100644 --- a/user_guide/libraries/table.html +++ b/user_guide/libraries/table.html @@ -27,7 +27,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -308,7 +308,7 @@ Previous Topic:  FTP Class   &mi User Guide Home   ·   Next Topic:  Image Manipulation Class

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/libraries/trackback.html b/user_guide/libraries/trackback.html index 035158463..f77937a9b 100644 --- a/user_guide/libraries/trackback.html +++ b/user_guide/libraries/trackback.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -239,7 +239,7 @@ Previous Topic:  Session Class User Guide Home   ·   Next Topic:  Template Parser Class

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/libraries/typography.html b/user_guide/libraries/typography.html index 12be119cc..81c244790 100644 --- a/user_guide/libraries/typography.html +++ b/user_guide/libraries/typography.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -153,7 +153,7 @@ Previous Topic:  Template Parser User Guide Home   ·   Next Topic:  Unit Testing Class

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/libraries/unit_testing.html b/user_guide/libraries/unit_testing.html index 7d27ff1dd..df1748e5c 100644 --- a/user_guide/libraries/unit_testing.html +++ b/user_guide/libraries/unit_testing.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -219,7 +219,7 @@ Previous Topic:  Typography Class User Guide Home   ·   Next Topic:  URI Class

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/libraries/uri.html b/user_guide/libraries/uri.html index f04bb9f10..9b9b5d889 100644 --- a/user_guide/libraries/uri.html +++ b/user_guide/libraries/uri.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -245,7 +245,7 @@ Previous Topic:  Unit Testing Class User Guide Home   ·   Next Topic:  User Agent Class

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/libraries/user_agent.html b/user_guide/libraries/user_agent.html index 8b3dcee62..829fdba03 100644 --- a/user_guide/libraries/user_agent.html +++ b/user_guide/libraries/user_agent.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -219,7 +219,7 @@ Previous Topic:  URI Class User Guide Home   ·   Next Topic:  XML-RPC Class

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/libraries/xmlrpc.html b/user_guide/libraries/xmlrpc.html index bb939dff4..ad714efbf 100644 --- a/user_guide/libraries/xmlrpc.html +++ b/user_guide/libraries/xmlrpc.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -512,7 +512,7 @@ Previous Topic:  User Agent Class User Guide Home   ·   Next Topic:  Zip Encoding Class

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/libraries/zip.html b/user_guide/libraries/zip.html index 53fc71ef3..3324bd16c 100644 --- a/user_guide/libraries/zip.html +++ b/user_guide/libraries/zip.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -281,7 +281,7 @@ Previous Topic:   XML-RPC Class User Guide Home   ·   Next Topic:  Caching Class

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/license.html b/user_guide/license.html index f9769a417..bc25c30b4 100644 --- a/user_guide/license.html +++ b/user_guide/license.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -100,7 +100,7 @@ Previous Topic:  Server Requiremen User Guide Home   ·   Next Topic:  Change Log

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/overview/appflow.html b/user_guide/overview/appflow.html index 61bf907a6..a59758f0b 100644 --- a/user_guide/overview/appflow.html +++ b/user_guide/overview/appflow.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -88,7 +88,7 @@ Previous Topic:  CodeIgniter Features User Guide Home   ·   Next Topic:  Model-View-Controller

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/overview/at_a_glance.html b/user_guide/overview/at_a_glance.html index 7e93bd2a6..18688d34f 100644 --- a/user_guide/overview/at_a_glance.html +++ b/user_guide/overview/at_a_glance.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -155,7 +155,7 @@ Previous Topic:  Getting Started User Guide Home   ·   Next Topic:  CodeIgniter Cheatsheets

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/overview/cheatsheets.html b/user_guide/overview/cheatsheets.html index 60e655229..005890a55 100644 --- a/user_guide/overview/cheatsheets.html +++ b/user_guide/overview/cheatsheets.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -76,7 +76,7 @@ Previous Topic:  CodeIgniter at a GlanceUser Guide Home   ·   Next Topic:  CodeIgniter Features

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/overview/features.html b/user_guide/overview/features.html index d1d5c8c25..c97044414 100644 --- a/user_guide/overview/features.html +++ b/user_guide/overview/features.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -111,7 +111,7 @@ Previous Topic:  CodeIgniter CheatsheetsUser Guide Home   ·   Next Topic:  Application Flow Chart

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/overview/getting_started.html b/user_guide/overview/getting_started.html index ad6fa01ed..8d8a8af35 100644 --- a/user_guide/overview/getting_started.html +++ b/user_guide/overview/getting_started.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -85,7 +85,7 @@ our Wiki to see code examples posted User Guide Home   ·   Next Topic:  CodeIgniter At a Glance

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/overview/goals.html b/user_guide/overview/goals.html index f2263c7ae..0d2eeb5c9 100644 --- a/user_guide/overview/goals.html +++ b/user_guide/overview/goals.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -91,7 +91,7 @@ Previous Topic:  Model-View-Controller User Guide Home   ·   Next Topic:  Getting Started

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/overview/index.html b/user_guide/overview/index.html index f295d4e81..732a245ff 100644 --- a/user_guide/overview/index.html +++ b/user_guide/overview/index.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -77,7 +77,7 @@ Introduction diff --git a/user_guide/overview/mvc.html b/user_guide/overview/mvc.html index 4aebb1095..989ad7afb 100644 --- a/user_guide/overview/mvc.html +++ b/user_guide/overview/mvc.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -93,7 +93,7 @@ Previous Topic:  Application Flow Chart User Guide Home   ·   Next Topic:  Architectural Goals

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/toc.html b/user_guide/toc.html index 01b5a7b92..07bfbd234 100644 --- a/user_guide/toc.html +++ b/user_guide/toc.html @@ -29,7 +29,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -221,7 +221,7 @@ Table of Contents diff --git a/user_guide/tutorial/conclusion.html b/user_guide/tutorial/conclusion.html index 9cf146746..b4a1e0005 100644 --- a/user_guide/tutorial/conclusion.html +++ b/user_guide/tutorial/conclusion.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -84,7 +84,7 @@ Previous Topic:  Create news itemsUser Guide Home   ·   Next Topic:  CodeIgniter URLs

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/tutorial/create_news_items.html b/user_guide/tutorial/create_news_items.html index 26b1ed10f..9afeed9ec 100644 --- a/user_guide/tutorial/create_news_items.html +++ b/user_guide/tutorial/create_news_items.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -172,7 +172,7 @@ Previous Topic:  News section User Guide Home   ·   Next Topic:  Conclusion

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/tutorial/hard_coded_pages.html b/user_guide/tutorial/hard_coded_pages.html index b34e9f1be..354dcb0e6 100644 --- a/user_guide/tutorial/hard_coded_pages.html +++ b/user_guide/tutorial/hard_coded_pages.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -151,7 +151,7 @@ Previous Topic:  CodeIgniter CheatsheetsUser Guide Home   ·   Next Topic:  Application Flow Chart

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/tutorial/index.html b/user_guide/tutorial/index.html index 65075fb2a..d3392669e 100644 --- a/user_guide/tutorial/index.html +++ b/user_guide/tutorial/index.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -94,7 +94,7 @@ Previous Topic:  Goals User Guide Home   ·   Next Topic:  Static pages

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/tutorial/news_section.html b/user_guide/tutorial/news_section.html index cf3377ff9..1cb67c66e 100644 --- a/user_guide/tutorial/news_section.html +++ b/user_guide/tutorial/news_section.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -223,7 +223,7 @@ Previous Topic:  Static pages User Guide Home   ·   Next Topic:  Create news items

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    diff --git a/user_guide/tutorial/static_pages.html b/user_guide/tutorial/static_pages.html index da2c58cda..a7112f362 100644 --- a/user_guide/tutorial/static_pages.html +++ b/user_guide/tutorial/static_pages.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.1.0

    CodeIgniter User Guide Version 2.1.1

    @@ -199,7 +199,7 @@ Previous Topic:  Introduction User Guide Home   ·   Next Topic:  News section

    -

    CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

    +

    CodeIgniter  ·  Copyright © 2006 - 2012  ·  EllisLab, Inc.

    -- cgit v1.2.3-24-g4f1b From 1ef19196e32d081bd5db1a7f87599acea0ecac6e Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Thu, 17 May 2012 20:41:12 +0100 Subject: Changed the default controller route to use single quotes instead of double quotes --- application/config/routes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/config/routes.php b/application/config/routes.php index 474bda969..001198615 100644 --- a/application/config/routes.php +++ b/application/config/routes.php @@ -64,7 +64,7 @@ | */ -$route['default_controller'] = "welcome"; +$route['default_controller'] = 'welcome'; $route['404_override'] = ''; /* End of file routes.php */ -- cgit v1.2.3-24-g4f1b From 3020b24545381a72add33d67a488a7e39674ec7e Mon Sep 17 00:00:00 2001 From: Juan Ignacio Borda Date: Fri, 18 May 2012 18:27:50 -0300 Subject: added unbuffered_row() to DB_result.php to avoid memory exhausting when dealing with large results. --- system/database/DB_result.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/system/database/DB_result.php b/system/database/DB_result.php index 196febe2c..574cd9858 100644 --- a/system/database/DB_result.php +++ b/system/database/DB_result.php @@ -370,6 +370,24 @@ class CI_DB_result { // -------------------------------------------------------------------- + /** + * Returns an unbuffered row and move pointer to next row + * + * @return object + */ + public function unbuffered_row($type = 'object') + { + if ($type == 'object') + { + return $this->_fetch_object(); + } else + { + return $this->_fetch_assoc(); + } + } + + // -------------------------------------------------------------------- + /** * The following functions are normally overloaded by the identically named * methods in the platform-specific driver -- except when query caching -- cgit v1.2.3-24-g4f1b From d981e2915cbd37f866e6f74c3a86a41e8a43e02e Mon Sep 17 00:00:00 2001 From: Juan Ignacio Borda Date: Fri, 18 May 2012 18:29:24 -0300 Subject: Added doc notes for unbuffered_row() function --- user_guide_src/source/database/results.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/user_guide_src/source/database/results.rst b/user_guide_src/source/database/results.rst index 865345762..6a0dbf92a 100644 --- a/user_guide_src/source/database/results.rst +++ b/user_guide_src/source/database/results.rst @@ -136,6 +136,26 @@ parameter: | **$row = $query->next_row('array')** | **$row = $query->previous_row('array')** +.. note:: all the functions above will load the whole result into memory (prefetching) use unbuffered_row() for processing large result sets. + +unbuffered_row($type) +===== + +This function returns a single result row without prefetching the whole result in memory as row() does. +If your query has more than one row, it returns the current row and moves the internal data pointer ahead. +The result is returned as $type could be 'object' (default) or 'array' that will return an associative array. + + + + $query = $this->db->query("YOUR QUERY"); + + while ($row=$query->unbuffered_rows()) + { + echo $row->title; + echo $row->name; + echo $row->body; + } + *********************** Result Helper Functions *********************** -- cgit v1.2.3-24-g4f1b From fbd31c8d98bd7e5eac5c8e8c2f102b05350db93e Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 19 May 2012 13:19:43 +0300 Subject: Fix issue #726 --- system/database/drivers/pdo/pdo_driver.php | 16 ++++++++-------- user_guide/changelog.html | 1 + 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php index 5de2079bb..c38b79c5a 100644 --- a/system/database/drivers/pdo/pdo_driver.php +++ b/system/database/drivers/pdo/pdo_driver.php @@ -51,23 +51,23 @@ class CI_DB_pdo_driver extends CI_DB { function __construct($params) { parent::__construct($params); - + // clause and character used for LIKE escape sequences if (strpos($this->hostname, 'mysql') !== FALSE) { $this->_like_escape_str = ''; $this->_like_escape_chr = ''; - + //Prior to this version, the charset can't be set in the dsn if(is_php('5.3.6')) { $this->hostname .= ";charset={$this->char_set}"; } - + //Set the charset with the connection options $this->options['PDO::MYSQL_ATTR_INIT_COMMAND'] = "SET NAMES {$this->char_set}"; } - else if (strpos($this->hostname, 'odbc') !== FALSE) + elseif (strpos($this->hostname, 'odbc') !== FALSE) { $this->_like_escape_str = " {escape '%s'} "; $this->_like_escape_chr = '!'; @@ -77,9 +77,9 @@ class CI_DB_pdo_driver extends CI_DB { $this->_like_escape_str = " ESCAPE '%s' "; $this->_like_escape_chr = '!'; } - - $this->hostname .= ";dbname=".$this->database; - + + empty($this->database) OR $this->hostname .= ';dbname='.$this->database; + $this->trans_enabled = FALSE; $this->_random_keyword = ' RND('.time().')'; // database specific random keyword @@ -94,7 +94,7 @@ class CI_DB_pdo_driver extends CI_DB { function db_connect() { $this->options['PDO::ATTR_ERRMODE'] = PDO::ERRMODE_SILENT; - + return new PDO($this->hostname, $this->username, $this->password, $this->options); } diff --git a/user_guide/changelog.html b/user_guide/changelog.html index 55fbceeaf..4e332a013 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -86,6 +86,7 @@ Change Log
  • Fixed a bug (#538) - Windows paths were ignored when using the Image Manipulation Class to create a new file.
  • Fixed a bug - When database caching was enabled, $this->db->query() checked the cache before binding variables which resulted in cached queries never being found.
  • Fixed a bug - CSRF cookie value was allowed to be any (non-empty) string before being written to the output, making code injection a risk.
  • +
  • Fixed a bug (#726) - PDO put a 'dbname' argument in it's connection string regardless of the database platform in use, which made it impossible to use SQLite.
  • -- cgit v1.2.3-24-g4f1b From 67a08ed578350d3a25c77855dc3467320be9e6f6 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 19 May 2012 13:35:40 +0300 Subject: Add missing changelog entries from 2.1-stable --- user_guide_src/source/changelog.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 7fc5ee5a0..6192fecfd 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -241,7 +241,9 @@ Bug fixes for 2.1.1 - Fixed a bug - form_open() compared $action against site_url() instead of base_url(). - Fixed a bug - CI_Upload::_file_mime_type() could've failed if mime_content_type() is used for the detection and returns FALSE. - Fixed a bug (#538) - Windows paths were ignored when using the :doc:`Image Manipulation Library ` to create a new file. -- Fixed a bug - When database caching was enabled, $this->db->query() checked the cache before binding variables which resulted in cached queries never being found +- Fixed a bug - When database caching was enabled, $this->db->query() checked the cache before binding variables which resulted in cached queries never being found. +- Fixed a bug - CSRF cookie value was allowed to be any (non-empty) string before being written to the output, making code injection a risk. +- Fixed a bug (#726) - PDO put a 'dbname' argument in it's connection string regardless of the database platform in use, which made it impossible to use SQLite. Version 2.1.0 ============= -- cgit v1.2.3-24-g4f1b From fece884ea610485425208c648ba207fa43593e8b Mon Sep 17 00:00:00 2001 From: Juan Ignacio Borda Date: Sat, 19 May 2012 09:33:07 -0300 Subject: Fixed return line and comments --- system/database/DB_result.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/system/database/DB_result.php b/system/database/DB_result.php index 574cd9858..25b4fb911 100644 --- a/system/database/DB_result.php +++ b/system/database/DB_result.php @@ -373,17 +373,12 @@ class CI_DB_result { /** * Returns an unbuffered row and move pointer to next row * - * @return object + * @return mixed either a result object or array */ public function unbuffered_row($type = 'object') { - if ($type == 'object') - { - return $this->_fetch_object(); - } else - { - return $this->_fetch_assoc(); - } + return ($type !== 'array') ? $this->_fetch_object() : $this->_fetch_assoc(); + } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 49cbec5870612c30b6e5bd0582616d519d1ea515 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Borda Date: Sat, 19 May 2012 09:34:53 -0300 Subject: Fixed some spaces --- user_guide_src/source/database/results.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/database/results.rst b/user_guide_src/source/database/results.rst index 6a0dbf92a..2158c6df6 100644 --- a/user_guide_src/source/database/results.rst +++ b/user_guide_src/source/database/results.rst @@ -149,7 +149,7 @@ The result is returned as $type could be 'object' (default) or 'array' that will $query = $this->db->query("YOUR QUERY"); - while ($row=$query->unbuffered_rows()) + while ($row = $query->unbuffered_rows()) { echo $row->title; echo $row->name; -- cgit v1.2.3-24-g4f1b From da7c9e033bd33ba27b549dface68e17177115963 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Borda Date: Sat, 19 May 2012 09:42:40 -0300 Subject: Fixed typo --- user_guide_src/source/database/results.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/database/results.rst b/user_guide_src/source/database/results.rst index 2158c6df6..ac4fc3733 100644 --- a/user_guide_src/source/database/results.rst +++ b/user_guide_src/source/database/results.rst @@ -149,7 +149,7 @@ The result is returned as $type could be 'object' (default) or 'array' that will $query = $this->db->query("YOUR QUERY"); - while ($row = $query->unbuffered_rows()) + while ($row = $query->unbuffered_row()) { echo $row->title; echo $row->name; -- cgit v1.2.3-24-g4f1b From 9fa8d404790833a098a8bbd855f1452897d6ff88 Mon Sep 17 00:00:00 2001 From: Rogerio Prado de Jesus Date: Sat, 19 May 2012 13:38:26 -0300 Subject: Fix a issue with affect_rows in CI_DB_pdo_driver::_execute() In case of SELECT queries PDOStatement::rowCount doesn't work as expected. This commit makes affect_rows be initialized properly. Signed-off-by: Rogerio Prado de Jesus --- system/database/drivers/pdo/pdo_driver.php | 13 +++++++++++-- user_guide/changelog.html | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php index c38b79c5a..952016848 100644 --- a/system/database/drivers/pdo/pdo_driver.php +++ b/system/database/drivers/pdo/pdo_driver.php @@ -189,11 +189,20 @@ class CI_DB_pdo_driver extends CI_DB { function _execute($sql) { $sql = $this->_prep_query($sql); - $result_id = $this->conn_id->query($sql); + $result_id = $this->conn_id->prepare($sql); + $result_id->execute(); if (is_object($result_id)) { - $this->affect_rows = $result_id->rowCount(); + if (is_numeric(stripos($sql, 'SELECT'))) + { + $this->affect_rows = count($result_id->fetchAll()); + $result_id->execute(); + } + else + { + $this->affect_rows = $result_id->rowCount(); + } } else { diff --git a/user_guide/changelog.html b/user_guide/changelog.html index 4e332a013..e1a87d963 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -87,6 +87,7 @@ Change Log
  • Fixed a bug - When database caching was enabled, $this->db->query() checked the cache before binding variables which resulted in cached queries never being found.
  • Fixed a bug - CSRF cookie value was allowed to be any (non-empty) string before being written to the output, making code injection a risk.
  • Fixed a bug (#726) - PDO put a 'dbname' argument in it's connection string regardless of the database platform in use, which made it impossible to use SQLite.
  • +
  • Fixed a bug - CI_DB_pdo_driver::affect_row was not being initialized properly with SELECT queries, cause it was relying on PDOStatement::rowCount().
  • -- cgit v1.2.3-24-g4f1b From 27738491fc11d0b9ce5670b2f6a7957fc421ee4b Mon Sep 17 00:00:00 2001 From: Rogerio Prado de Jesus Date: Sat, 19 May 2012 13:45:44 -0300 Subject: Fix a issue with CI_DB_pdo_result::num_rows() In case of SELECT queries PDOStatement::rowCount doesn't work as expected. This commit makes it returns the expected value. --- system/database/drivers/pdo/pdo_result.php | 13 ++++++++++++- user_guide/changelog.html | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/system/database/drivers/pdo/pdo_result.php b/system/database/drivers/pdo/pdo_result.php index 7f3058ff0..c05fbc908 100644 --- a/system/database/drivers/pdo/pdo_result.php +++ b/system/database/drivers/pdo/pdo_result.php @@ -34,7 +34,18 @@ class CI_DB_pdo_result extends CI_DB_result { */ function num_rows() { - return $this->result_id->rowCount(); + if (is_numeric(stripos($this->result_id->queryString, 'SELECT'))) + { + $dbh = $this->conn_id; + $query = $dbh->query($this->result_id->queryString); + $result = $query->fetchAll(); + unset($dbh, $query); + return count($result); + } + else + { + return $this->result_id->rowCount(); + } } // -------------------------------------------------------------------- diff --git a/user_guide/changelog.html b/user_guide/changelog.html index e1a87d963..ca1a55bac 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -88,6 +88,7 @@ Change Log
  • Fixed a bug - CSRF cookie value was allowed to be any (non-empty) string before being written to the output, making code injection a risk.
  • Fixed a bug (#726) - PDO put a 'dbname' argument in it's connection string regardless of the database platform in use, which made it impossible to use SQLite.
  • Fixed a bug - CI_DB_pdo_driver::affect_row was not being initialized properly with SELECT queries, cause it was relying on PDOStatement::rowCount().
  • +
  • Fixed a bug - CI_DB_pdo_result::num_rows() was not returning properly value with SELECT queries, cause it was relying on PDOStatement::rowCount().
  • -- cgit v1.2.3-24-g4f1b From f1aff707128865741a70d732283c0702183c52b3 Mon Sep 17 00:00:00 2001 From: Thanasis Polychronakis Date: Sun, 20 May 2012 18:44:21 +0300 Subject: Indended code to meet CI standards --- system/core/Common.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/system/core/Common.php b/system/core/Common.php index 01b0d8673..eb080aa2b 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -233,7 +233,8 @@ if ( ! function_exists('get_config')) $file_path = APPPATH.'config/config.php'; $found = false; - if (file_exists($file_path)) { + if (file_exists($file_path)) + { $found = true; require($file_path); } @@ -242,7 +243,10 @@ if ( ! function_exists('get_config')) if (defined(ENVIRONMENT) && file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/config.php')) { require($file_path); - } else if (!$found) { + } + else if (!$found) + { + set_status_header(503); exit('The configuration file does not exist.'); } -- cgit v1.2.3-24-g4f1b From 441dfc3a17f48c741a930cfc8a6d667bf0c352ba Mon Sep 17 00:00:00 2001 From: Juan Ignacio Borda Date: Sun, 20 May 2012 21:46:32 -0300 Subject: added a comment for unbuffered_row --- user_guide_src/source/changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 7fc5ee5a0..defac54a2 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -102,6 +102,7 @@ Release Date: Not Released - Added PDO support for create_database(), drop_database and drop_table() in :doc:`Database Forge `. - Added MSSQL, SQLSRV support for optimize_table() in :doc:`Database Utility `. - Improved CUBRID support for list_databases() in :doc:`Database Utility ` (until now only the currently used database was returned). + - Added unbuffered_row() function for getting a row without prefetching whole result (consume less memory) - Libraries -- cgit v1.2.3-24-g4f1b From ccbd827076b83a7ff903fb8264192d2beea1260e Mon Sep 17 00:00:00 2001 From: Thanasis Polychronakis Date: Mon, 21 May 2012 14:38:22 +0300 Subject: Edit to meet CI coding standards --- system/core/Common.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/system/core/Common.php b/system/core/Common.php index eb080aa2b..15082a101 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -232,10 +232,10 @@ if ( ! function_exists('get_config')) } $file_path = APPPATH.'config/config.php'; - $found = false; + $found = FALSE; if (file_exists($file_path)) { - $found = true; + $found = TRUE; require($file_path); } @@ -244,7 +244,7 @@ if ( ! function_exists('get_config')) { require($file_path); } - else if (!$found) + elseif ( ! $found) { set_status_header(503); exit('The configuration file does not exist.'); -- cgit v1.2.3-24-g4f1b From 36237d8305260282b46f52f9fec91b5b7176088f Mon Sep 17 00:00:00 2001 From: Root Date: Mon, 21 May 2012 18:30:00 -0400 Subject: Move closing of database connection to CI_DB_driver->__destruct - #1376 --- system/core/CodeIgniter.php | 10 ---------- system/database/DB_driver.php | 7 +++++++ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php index 00db6e13a..585bb7b31 100755 --- a/system/core/CodeIgniter.php +++ b/system/core/CodeIgniter.php @@ -393,15 +393,5 @@ */ $EXT->call_hook('post_system'); -/* - * ------------------------------------------------------ - * Close the DB connection if one exists - * ------------------------------------------------------ - */ - if (class_exists('CI_DB') && isset($CI->db) && ! $CI->db->pconnect) - { - $CI->db->close(); - } - /* End of file CodeIgniter.php */ /* Location: ./system/core/CodeIgniter.php */ \ No newline at end of file diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index ef77b594e..c757277ce 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -92,6 +92,13 @@ abstract class CI_DB_driver { // -------------------------------------------------------------------- + public function __destruct() + { + $this->close(); + } + + // -------------------------------------------------------------------- + /** * Initialize Database Settings * -- cgit v1.2.3-24-g4f1b From 4337771961de19f7cffb444aa2bd2866e9dad18a Mon Sep 17 00:00:00 2001 From: Brent Ashley Date: Tue, 22 May 2012 12:45:10 -0300 Subject: Add step to move existing core extensions to new folder --- user_guide_src/source/installation/upgrade_200.rst | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/user_guide_src/source/installation/upgrade_200.rst b/user_guide_src/source/installation/upgrade_200.rst index b39f4fd23..74b7443d8 100644 --- a/user_guide_src/source/installation/upgrade_200.rst +++ b/user_guide_src/source/installation/upgrade_200.rst @@ -87,7 +87,14 @@ All native CodeIgniter classes now use the PHP 5 \__construct() convention. Please update extended libraries to call parent::\__construct(). -Step 8: Update your user guide +Step 8: Move any core extensions to application/core +==================================================== + +Any extensions to core classes (e.g. MY_Controller.php) in your +application/liblraries folder must be moved to the new +application/core folder. + +Step 9: Update your user guide ============================== Please replace your local copy of the user guide with the new version, -- cgit v1.2.3-24-g4f1b From 0b427951859e393b5c6b31699fe0f1c1ae89b403 Mon Sep 17 00:00:00 2001 From: Brent Ashley Date: Tue, 22 May 2012 16:24:04 -0300 Subject: fix typo in step 8 --- user_guide_src/source/installation/upgrade_200.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/installation/upgrade_200.rst b/user_guide_src/source/installation/upgrade_200.rst index 74b7443d8..29f44bd9e 100644 --- a/user_guide_src/source/installation/upgrade_200.rst +++ b/user_guide_src/source/installation/upgrade_200.rst @@ -91,7 +91,7 @@ Step 8: Move any core extensions to application/core ==================================================== Any extensions to core classes (e.g. MY_Controller.php) in your -application/liblraries folder must be moved to the new +application/libraries folder must be moved to the new application/core folder. Step 9: Update your user guide -- cgit v1.2.3-24-g4f1b From ab396b4a56d3eaa91c559ccc4df2817c53897aef Mon Sep 17 00:00:00 2001 From: Gints Murans Date: Wed, 23 May 2012 00:21:39 +0300 Subject: Moved destruct to the end of file --- system/database/DB_driver.php | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index c757277ce..44c864e64 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -90,13 +90,6 @@ abstract class CI_DB_driver { log_message('debug', 'Database Driver Class Initialized'); } - // -------------------------------------------------------------------- - - public function __destruct() - { - $this->close(); - } - // -------------------------------------------------------------------- /** @@ -1397,6 +1390,23 @@ abstract class CI_DB_driver { { } + // -------------------------------------------------------------------- + + /** + * Destructor + * + * Closes the database connection, if needed. + * + * @return void + */ + public function __destruct() + { + if ($this->conn_id && ! $this->pconnect) + { + $this->close(); + } + } + } /* End of file DB_driver.php */ -- cgit v1.2.3-24-g4f1b From 89f77eedf9118dfccd52a7bc3e559d6bac5aa07c Mon Sep 17 00:00:00 2001 From: Gints Murans Date: Wed, 23 May 2012 00:23:50 +0300 Subject: Removed a space after comment line --- system/database/DB_driver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index 44c864e64..a955f45d2 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -90,7 +90,7 @@ abstract class CI_DB_driver { log_message('debug', 'Database Driver Class Initialized'); } - // -------------------------------------------------------------------- + // -------------------------------------------------------------------- /** * Initialize Database Settings -- cgit v1.2.3-24-g4f1b From 79922c0d963de9728315db02deaf4d2516c94d5b Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 23 May 2012 12:27:17 +0300 Subject: Removed the parameter use in database drivers' _close() and added a default _close() method in CI_DB_driver + some changelog fixes --- system/database/DB_driver.php | 20 ++++++-- system/database/DB_result.php | 3 +- system/database/drivers/cubrid/cubrid_driver.php | 9 ++-- .../drivers/interbase/interbase_driver.php | 5 +- system/database/drivers/mssql/mssql_driver.php | 7 ++- system/database/drivers/mysql/mysql_driver.php | 7 ++- system/database/drivers/mysqli/mysqli_driver.php | 6 +-- system/database/drivers/oci8/oci8_driver.php | 7 ++- system/database/drivers/odbc/odbc_driver.php | 7 ++- system/database/drivers/pdo/pdo_driver.php | 15 +----- system/database/drivers/postgre/postgre_driver.php | 5 +- system/database/drivers/sqlite/sqlite_driver.php | 7 ++- system/database/drivers/sqlite3/sqlite3_driver.php | 3 +- system/database/drivers/sqlsrv/sqlsrv_driver.php | 7 ++- user_guide_src/source/changelog.rst | 53 ++++++++++------------ 15 files changed, 71 insertions(+), 90 deletions(-) diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index a955f45d2..a0812d4c7 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -1152,13 +1152,27 @@ abstract class CI_DB_driver { { if ($this->conn_id) { - $this->_close($this->conn_id); + $this->_close(); $this->conn_id = FALSE; } } // -------------------------------------------------------------------- + /** + * Close DB Connection + * + * This method would be overriden by most of the drivers. + * + * @return void + */ + protected function _close() + { + $this->conn_id = FALSE; + } + + // -------------------------------------------------------------------- + /** * Display an error message * @@ -1401,7 +1415,7 @@ abstract class CI_DB_driver { */ public function __destruct() { - if ($this->conn_id && ! $this->pconnect) + if ( ! $this->pconnect) { $this->close(); } @@ -1410,4 +1424,4 @@ abstract class CI_DB_driver { } /* End of file DB_driver.php */ -/* Location: ./system/database/DB_driver.php */ +/* Location: ./system/database/DB_driver.php */ \ No newline at end of file diff --git a/system/database/DB_result.php b/system/database/DB_result.php index 25b4fb911..690734b08 100644 --- a/system/database/DB_result.php +++ b/system/database/DB_result.php @@ -378,11 +378,10 @@ class CI_DB_result { public function unbuffered_row($type = 'object') { return ($type !== 'array') ? $this->_fetch_object() : $this->_fetch_assoc(); - } // -------------------------------------------------------------------- - + /** * The following functions are normally overloaded by the identically named * methods in the platform-specific driver -- except when query caching diff --git a/system/database/drivers/cubrid/cubrid_driver.php b/system/database/drivers/cubrid/cubrid_driver.php index 1373faa88..944df99b5 100644 --- a/system/database/drivers/cubrid/cubrid_driver.php +++ b/system/database/drivers/cubrid/cubrid_driver.php @@ -485,7 +485,7 @@ class CI_DB_cubrid_driver extends CI_DB { } // -------------------------------------------------------------------- - + /** * Limit string * @@ -506,15 +506,14 @@ class CI_DB_cubrid_driver extends CI_DB { /** * Close DB Connection * - * @param resource * @return void */ - protected function _close($conn_id) + protected function _close() { - @cubrid_close($conn_id); + @cubrid_close($this->conn_id); } } /* End of file cubrid_driver.php */ -/* Location: ./system/database/drivers/cubrid/cubrid_driver.php */ +/* Location: ./system/database/drivers/cubrid/cubrid_driver.php */ \ No newline at end of file diff --git a/system/database/drivers/interbase/interbase_driver.php b/system/database/drivers/interbase/interbase_driver.php index 1b18de803..c457f6340 100644 --- a/system/database/drivers/interbase/interbase_driver.php +++ b/system/database/drivers/interbase/interbase_driver.php @@ -472,12 +472,11 @@ class CI_DB_interbase_driver extends CI_DB { /** * Close DB Connection * - * @param resource * @return void */ - protected function _close($conn_id) + protected function _close() { - @ibase_close($conn_id); + @ibase_close($this->conn_id); } } diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php index f60ec8168..914de499f 100644 --- a/system/database/drivers/mssql/mssql_driver.php +++ b/system/database/drivers/mssql/mssql_driver.php @@ -523,15 +523,14 @@ class CI_DB_mssql_driver extends CI_DB { /** * Close DB Connection * - * @param resource * @return void */ - protected function _close($conn_id) + protected function _close() { - @mssql_close($conn_id); + @mssql_close($this->conn_id); } } /* End of file mssql_driver.php */ -/* Location: ./system/database/drivers/mssql/mssql_driver.php */ +/* Location: ./system/database/drivers/mssql/mssql_driver.php */ \ No newline at end of file diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php index 32c51865d..161f99541 100644 --- a/system/database/drivers/mysql/mysql_driver.php +++ b/system/database/drivers/mysql/mysql_driver.php @@ -520,15 +520,14 @@ class CI_DB_mysql_driver extends CI_DB { /** * Close DB Connection * - * @param resource * @return void */ - protected function _close($conn_id) + protected function _close() { - @mysql_close($conn_id); + @mysql_close($this->conn_id); } } /* End of file mysql_driver.php */ -/* Location: ./system/database/drivers/mysql/mysql_driver.php */ +/* Location: ./system/database/drivers/mysql/mysql_driver.php */ \ No newline at end of file diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php index e2684e4f2..9261883f5 100644 --- a/system/database/drivers/mysqli/mysqli_driver.php +++ b/system/database/drivers/mysqli/mysqli_driver.php @@ -523,16 +523,14 @@ class CI_DB_mysqli_driver extends CI_DB { /** * Close DB Connection * - * @param object * @return void */ - protected function _close($conn_id) + protected function _close() { $this->conn_id->close(); - $this->conn_id = FALSE; } } /* End of file mysqli_driver.php */ -/* Location: ./system/database/drivers/mysqli/mysqli_driver.php */ +/* Location: ./system/database/drivers/mysqli/mysqli_driver.php */ \ No newline at end of file diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php index 33a89df94..e2fa51349 100644 --- a/system/database/drivers/oci8/oci8_driver.php +++ b/system/database/drivers/oci8/oci8_driver.php @@ -671,15 +671,14 @@ class CI_DB_oci8_driver extends CI_DB { /** * Close DB Connection * - * @param resource * @return void */ - protected function _close($conn_id) + protected function _close() { - @oci_close($conn_id); + @oci_close($this->conn_id); } } /* End of file oci8_driver.php */ -/* Location: ./system/database/drivers/oci8/oci8_driver.php */ +/* Location: ./system/database/drivers/oci8/oci8_driver.php */ \ No newline at end of file diff --git a/system/database/drivers/odbc/odbc_driver.php b/system/database/drivers/odbc/odbc_driver.php index e36f2d233..e3172117a 100644 --- a/system/database/drivers/odbc/odbc_driver.php +++ b/system/database/drivers/odbc/odbc_driver.php @@ -402,15 +402,14 @@ class CI_DB_odbc_driver extends CI_DB { /** * Close DB Connection * - * @param resource * @return void */ - protected function _close($conn_id) + protected function _close() { - @odbc_close($conn_id); + @odbc_close($this->conn_id); } } /* End of file odbc_driver.php */ -/* Location: ./system/database/drivers/odbc/odbc_driver.php */ +/* Location: ./system/database/drivers/odbc/odbc_driver.php */ \ No newline at end of file diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php index 89e69676d..e38c1145c 100644 --- a/system/database/drivers/pdo/pdo_driver.php +++ b/system/database/drivers/pdo/pdo_driver.php @@ -667,20 +667,7 @@ class CI_DB_pdo_driver extends CI_DB { } } - // -------------------------------------------------------------------- - - /** - * Close DB Connection - * - * @param object - * @return void - */ - protected function _close($conn_id) - { - $this->conn_id = NULL; - } - } /* End of file pdo_driver.php */ -/* Location: ./system/database/drivers/pdo/pdo_driver.php */ +/* Location: ./system/database/drivers/pdo/pdo_driver.php */ \ No newline at end of file diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php index 17bd37b38..0ddfd0abe 100644 --- a/system/database/drivers/postgre/postgre_driver.php +++ b/system/database/drivers/postgre/postgre_driver.php @@ -653,12 +653,11 @@ class CI_DB_postgre_driver extends CI_DB { /** * Close DB Connection * - * @param resource * @return void */ - protected function _close($conn_id) + protected function _close() { - @pg_close($conn_id); + @pg_close($this->conn_id); } } diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php index 551704f83..d710b945d 100644 --- a/system/database/drivers/sqlite/sqlite_driver.php +++ b/system/database/drivers/sqlite/sqlite_driver.php @@ -450,15 +450,14 @@ class CI_DB_sqlite_driver extends CI_DB { /** * Close DB Connection * - * @param resource * @return void */ - protected function _close($conn_id) + protected function _close() { - @sqlite_close($conn_id); + @sqlite_close($this->conn_id); } } /* End of file sqlite_driver.php */ -/* Location: ./system/database/drivers/sqlite/sqlite_driver.php */ +/* Location: ./system/database/drivers/sqlite/sqlite_driver.php */ \ No newline at end of file diff --git a/system/database/drivers/sqlite3/sqlite3_driver.php b/system/database/drivers/sqlite3/sqlite3_driver.php index d22f6a442..ad2848ed8 100644 --- a/system/database/drivers/sqlite3/sqlite3_driver.php +++ b/system/database/drivers/sqlite3/sqlite3_driver.php @@ -417,10 +417,9 @@ class CI_DB_sqlite3_driver extends CI_DB { /** * Close DB Connection * - * @param object (ignored) * @return void */ - protected function _close($conn_id) + protected function _close() { $this->conn_id->close(); } diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php index 8cc500f55..3e9fa7b1a 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_driver.php +++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php @@ -510,15 +510,14 @@ class CI_DB_sqlsrv_driver extends CI_DB { /** * Close DB Connection * - * @param resource * @return void */ - protected function _close($conn_id) + protected function _close() { - @sqlsrv_close($conn_id); + @sqlsrv_close($this->conn_id); } } /* End of file sqlsrv_driver.php */ -/* Location: ./system/database/drivers/sqlsrv/sqlsrv_driver.php */ +/* Location: ./system/database/drivers/sqlsrv/sqlsrv_driver.php */ \ No newline at end of file diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 45e6ebc07..a65a658ed 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -9,8 +9,7 @@ Release Date: Not Released - License - - CodeIgniter has been relicensed with the Open Software License (3.0), - eliminating its old proprietary licensing. + - CodeIgniter has been relicensed with the Open Software License (3.0), eliminating its old proprietary licensing. - All system files are licensed with OSL 3.0. - Config, error, and sample files shipped in the application folder are @@ -43,7 +42,7 @@ Release Date: Not Released - url_title() will now trim extra dashes from beginning and end. - Added XHTML Basic 1.1 doctype to :doc:`HTML Helper `. - - Changed humanize to include a second param for the separator. + - Changed humanize() to include a second param for the separator. - Refactored ``plural()`` and ``singular()`` to avoid double pluralization and support more words. - Added an optional third parameter to ``force_download()`` that enables/disables sending the actual file MIME type in the Content-Type header (disabled by default). - Added an optional third parameter to ``timespan()`` that constrains the number of time units displayed. @@ -56,21 +55,17 @@ Release Date: Not Released - Database - - Renamed the Active Record class to Query Builder to remove confusion with - the Active Record design pattern - - Added new :doc:`Query Builder ` methods that return + - Renamed the Active Record class to Query Builder to remove confusion with the Active Record design pattern. - Added the ability to insert objects with insert_batch() in :doc:`Query Builder `. - - Added new :doc:`Query Builder ` methods that return - the SQL string of queries without executing them: get_compiled_select(), - get_compiled_insert(), get_compiled_update(), get_compiled_delete(). - - Adding $escape parameter to the order_by function, this enables ordering by custom fields. + - Added new :doc:`Query Builder ` methods that return the SQL string of queries without executing them: get_compiled_select(), get_compiled_insert(), get_compiled_update(), get_compiled_delete(). + - Adding $escape parameter to the order_by() method, this enables ordering by custom fields. - Improved support for the MySQLi driver, including: - OOP style of the PHP extension is now used, instead of the procedural aliases. - Server version checking is now done via ``mysqli::$server_info`` instead of running an SQL query. - Added persistent connections support for PHP >= 5.3. - Added 'dsn' configuration setting for drivers that support DSN strings (PDO, PostgreSQL, Oracle, ODBC, CUBRID). - Improved PDO database support. - - Added Interbase/Firebird database support via the "interbase" driver + - Added Interbase/Firebird database support via the "interbase" driver. - Added an optional database name parameter to db_select(). - Replaced the _error_message() and _error_number() methods with error(), that returns an array containing the last database error code and message. - Improved version() implementation so that drivers that have a native function to get the version number don't have to be defined in the core DB_driver class. @@ -102,7 +97,7 @@ Release Date: Not Released - Added PDO support for create_database(), drop_database and drop_table() in :doc:`Database Forge `. - Added MSSQL, SQLSRV support for optimize_table() in :doc:`Database Utility `. - Improved CUBRID support for list_databases() in :doc:`Database Utility ` (until now only the currently used database was returned). - - Added unbuffered_row() function for getting a row without prefetching whole result (consume less memory) + - Added unbuffered_row() method for getting a row without prefetching whole result (consume less memory). - Libraries @@ -110,17 +105,15 @@ Release Date: Not Released - CI_Loader::_ci_autoloader() is now a protected method. - Added custom filename to Email::attach() as $this->email->attach($filename, $disposition, $newname). - Added possibility to send attachment as buffer string in Email::attach() as $this->email->attach($buffer, $disposition, $newname, $mime). - - Cart library changes include: + - :doc:`Cart library ` changes include: - It now auto-increments quantity's instead of just resetting it, this is the default behaviour of large e-commerce sites. - - Product Name strictness can be disabled via the Cart Library by switching "$product_name_safe" - - Added function remove() to remove a cart item, updating with quantity of 0 seemed like a hack but has remained to retain compatability + - Product Name strictness can be disabled via the Cart Library by switching "$product_name_safe". + - Added function remove() to remove a cart item, updating with quantity of 0 seemed like a hack but has remained to retain compatability. - :doc:`Image Manipulation library ` changes include: - The initialize() method now only sets existing class properties. - Added support for 3-length hex color values for wm_font_color and wm_shadow_color properties, as well as validation for them. - - Class properties wm_font_color, wm_shadow_color and wm_use_drop_shadow are now protected, to avoid breaking the text_watermark() method - if they are set manually after initialization. + - Class properties wm_font_color, wm_shadow_color and wm_use_drop_shadow are now protected, to avoid breaking the text_watermark() method if they are set manually after initialization. - If property maintain_ratio is set to TRUE, image_reproportion() now doesn't need both width and height to be specified. - - Minor speed optimizations and method & property visibility declarations in the Calendar Library. - Removed SHA1 function in the :doc:`Encryption Library `. - Added $config['csrf_regeneration'] to the CSRF protection in the :doc:`Security library `, which makes token regeneration optional. - :doc:`Form Validation library ` changes include: @@ -153,26 +146,26 @@ Release Date: Not Released Bug fixes for 3.0 ------------------ -- Unlink raised an error if cache file did not exist when you try to delete it. +- Fixed a bug where ``unlink()`` raised an error if cache file did not exist when you try to delete it. - Fixed a bug (#181) where a mis-spelling was in the form validation language file. - Fixed a bug (#159, #163) that mishandled Active Record nested transactions because _trans_depth was not getting incremented. - Fixed a bug (#737, #75) where pagination anchor class was not set properly when using initialize method. - Fixed a bug (#419) - auto_link() now recognizes URLs that come after a word boundary. - Fixed a bug (#724) - is_unique in form validation now checks that you are connected to a database. -- Fixed a bug (#647) - _get_mod_time() in Zip library no longer generates stat failed errors -- Fixed a bug (#608) - Fixes an issue with the Image_lib class not clearing properties completely -- Fixed bugs (#157 and #174) - the Image_lib clear() function now resets all variables to their default values. +- Fixed a bug (#647) - _get_mod_time() in Zip library no longer generates stat failed errors. +- Fixed a bug (#608) - Fixes an issue with the Image_lib class not clearing properties completely. +- Fixed a bug (#157, #174) - the Image_lib clear() function now resets all variables to their default values. - Fixed a bug where using $this->dbforge->create_table() with PostgreSQL database could lead to fetching whole table. - Fixed a bug (#795) - Fixed form method and accept-charset when passing an empty array. -- Fixed a bug (#797) - timespan was using incorrect seconds for year and month. +- Fixed a bug (#797) - timespan() was using incorrect seconds for year and month. - Fixed a bug in CI_Cart::contents() where if called without a TRUE (or equal) parameter, it would fail due to a typo. -- Fixed a bug (#696) - make oci_execute calls inside num_rows non-committing, since they are only there to reset which row is next in line for oci_fetch calls and thus don't need to be committed. -- Fixed a bug (#406) - sqlsrv DB driver not reuturning resource on db_pconnect(). +- Fixed a bug (#696) - make oci_execute() calls inside num_rows() non-committing, since they are only there to reset which row is next in line for oci_fetch calls and thus don't need to be committed. +- Fixed a bug (#406) - sqlsrv DB driver not reuturning resource on ``db_pconnect()``. - Fixed a bug in CI_Image_lib::gd_loaded() where it was possible for the script execution to end or a PHP E_WARNING message to be emitted. -- In Pagination library, when use_page_numbers=TRUE previous link and page 1 link do not have the same url +- Fixed a bug in the :doc:`Pagination library ` where when use_page_numbers=TRUE previous link and page 1 link did not have the same url. - Fixed a bug (#561) - Errors in :doc:`XML-RPC Library ` were not properly escaped. - Fixed a bug (#904) - ``CI_Loader::initialize()`` caused a PHP Fatal error to be triggered if error level E_STRICT is used. -- Fixed a hosting edge case where an empty $_SERVER['HTTPS'] variable would evaluate to 'on' +- Fixed a hosting edge case where an empty $_SERVER['HTTPS'] variable would evaluate to 'on'. - Fixed a bug (#154) - ``CI_Session::sess_update()`` caused the session to be destroyed on pages where multiple AJAX requests were executed at once. - Fixed a possible bug in ``CI_Input::is_ajax_request()`` where some clients might not send the X-Requested-With HTTP header value exactly as 'XmlHttpRequest'. - Fixed a bug (#1039) - MySQL's _backup() method failed due to a table name not being escaped. @@ -183,7 +176,7 @@ Bug fixes for 3.0 - Fixed a bug (#129) - ODBC's num_rows() returned -1 in some cases, due to not all subdrivers supporting the odbc_num_rows() function. - Fixed a bug (#153) - E_NOTICE being generated by getimagesize() in the :doc:`File Uploading Library `. - Fixed a bug (#611) - SQLSRV's error handling methods used to issue warnings when there's no actual error. -- Fixed a bug (#1036) - is_write_type() method in the :doc:`Database Library ` didn't return TRUE for RENAME and OPTIMIZE queries. +- Fixed a bug (#1036) - is_write_type() method in the :doc:`Database Library ` didn't return TRUE for RENAME queries. - Fixed a bug in PDO's _version() method where it used to return the client version as opposed to the server one. - Fixed a bug in PDO's insert_id() method where it could've failed if it's used with Postgre versions prior to 8.1. - Fixed a bug in CUBRID's affected_rows() method where a connection resource was passed to cubrid_affected_rows() instead of a result. @@ -207,7 +200,7 @@ Bug fixes for 3.0 - Fixed a bug (#23, #1238) - delete_all() in the `Database Caching Library ` used to delete .htaccess and index.html files, which is a potential security risk. - Fixed a bug in :doc:`Trackback Library ` method validate_url() where it didn't actually do anything, due to input not being passed by reference. - Fixed a bug (#11, #183, #863) - CI_Form_validation::_execute() silently continued to the next rule, if a rule method/function is not found. -- Fixed a bug (#122) Where routed uri string was being reported incorrectly in sub-directories +- Fixed a bug (#122) Where routed uri string was being reported incorrectly in sub-directories. - Fixed a bug (#1242) - read_dir() in the :doc:`Zip Library ` wasn't compatible with Windows. - Fixed a bug (#306) - ODBC driver didn't have an _insert_batch() method, which resulted in fatal error being triggered when insert_batch() is used with it. - Fixed a bug in MSSQL and SQLSrv's _truncate() where the TABLE keyword was missing. @@ -217,7 +210,7 @@ Bug fixes for 3.0 - Fixed a bug in SQLSRV's delete() method where like() and limit() conditions were ignored. - Fixed a bug (#1265) - Database connections were always closed, regardless of the 'pconnect' option value. - Fixed a bug (#128) - :doc:`Language Library ` did not correctly keep track of loaded language files. -- Fixed a bug (#1242) - Added Windows path compatibility to function read_dir of ZIP library +- Fixed a bug (#1242) - Added Windows path compatibility to function read_dir of ZIP library. - Fixed a bug (#1314) - sess_destroy() did not destroy userdata. - Fixed a bug (#1349) - get_extension() in the `File Uploading Library ` returned the original filename when it didn't have an actual extension. -- cgit v1.2.3-24-g4f1b From f46e726cfb726da2ec2095011ffe8625b6f9c816 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 23 May 2012 13:16:00 +0300 Subject: Fix a typo in the changelog --- user_guide_src/source/changelog.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index a65a658ed..2b15c3f55 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -160,7 +160,7 @@ Bug fixes for 3.0 - Fixed a bug (#797) - timespan() was using incorrect seconds for year and month. - Fixed a bug in CI_Cart::contents() where if called without a TRUE (or equal) parameter, it would fail due to a typo. - Fixed a bug (#696) - make oci_execute() calls inside num_rows() non-committing, since they are only there to reset which row is next in line for oci_fetch calls and thus don't need to be committed. -- Fixed a bug (#406) - sqlsrv DB driver not reuturning resource on ``db_pconnect()``. +- Fixed a bug (#406) - sqlsrv DB driver not returning resource on ``db_pconnect()``. - Fixed a bug in CI_Image_lib::gd_loaded() where it was possible for the script execution to end or a PHP E_WARNING message to be emitted. - Fixed a bug in the :doc:`Pagination library ` where when use_page_numbers=TRUE previous link and page 1 link did not have the same url. - Fixed a bug (#561) - Errors in :doc:`XML-RPC Library ` were not properly escaped. -- cgit v1.2.3-24-g4f1b From 74b648c2da3ee5d92920cea2355ccf36d5e0519e Mon Sep 17 00:00:00 2001 From: Nithin Date: Sun, 21 Aug 2011 01:23:47 -0300 Subject: Added ability to _like paramater side to use 'none', in case one wants to query like instead of where without case being sensitive --- system/database/DB_active_rec.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php index 7bab729f5..841ede28e 100644 --- a/system/database/DB_active_rec.php +++ b/system/database/DB_active_rec.php @@ -660,8 +660,12 @@ class CI_DB_active_record extends CI_DB_driver { $prefix = (count($this->ar_like) == 0) ? '' : $type; $v = $this->escape_like_str($v); - - if ($side == 'before') + + if ($side == 'none') + { + $like_statement = $prefix." $k $not LIKE '{$v}'"; + } + elseif ($side == 'before') { $like_statement = $prefix." $k $not LIKE '%{$v}'"; } -- cgit v1.2.3-24-g4f1b From e65f4893c9b3e7c2b34e0fef7c7de04112329063 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Wed, 23 May 2012 19:27:54 +0200 Subject: Removed the starting slash from uri_string() documentation. --- user_guide/libraries/uri.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide/libraries/uri.html b/user_guide/libraries/uri.html index f04bb9f10..663fca5bc 100644 --- a/user_guide/libraries/uri.html +++ b/user_guide/libraries/uri.html @@ -191,7 +191,7 @@ $str = $this->uri->assoc_to_uri($array);

    The function would return this:

    -/news/local/345 +news/local/345

    $this->uri->ruri_string()

    -- cgit v1.2.3-24-g4f1b From 55a6ddb0c7bab1149bb1ddfa3a1aff46612c91d4 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Wed, 23 May 2012 18:37:24 +0100 Subject: Input, Session and Cookie get's will return NULL. Read more about this change here: http://codeigniter.com/forums/viewthread/215833 --- system/core/Input.php | 4 ++-- system/core/URI.php | 18 +++++++++--------- system/libraries/Session.php | 6 +++--- tests/codeigniter/core/Input_test.php | 18 ++++++++++-------- user_guide_src/source/libraries/input.rst | 17 +++++------------ user_guide_src/source/libraries/uri.rst | 2 +- 6 files changed, 30 insertions(+), 35 deletions(-) diff --git a/system/core/Input.php b/system/core/Input.php index e916ac66d..97be9e690 100755 --- a/system/core/Input.php +++ b/system/core/Input.php @@ -135,7 +135,7 @@ class CI_Input { { if ( ! isset($array[$index])) { - return FALSE; + return NULL; } if ($xss_clean === TRUE) @@ -659,7 +659,7 @@ class CI_Input { if ( ! isset($this->headers[$index])) { - return FALSE; + return NULL; } return ($xss_clean === TRUE) diff --git a/system/core/URI.php b/system/core/URI.php index e66cb6dc5..a9432e05d 100755 --- a/system/core/URI.php +++ b/system/core/URI.php @@ -358,10 +358,10 @@ class CI_URI { * This function returns the URI segment based on the number provided. * * @param int - * @param bool + * @param mixed * @return string */ - public function segment($n, $no_result = FALSE) + public function segment($n, $no_result = NULL) { return isset($this->segments[$n]) ? $this->segments[$n] : $no_result; } @@ -376,10 +376,10 @@ class CI_URI { * same result as $this->segment() * * @param int - * @param bool + * @param mixed * @return string */ - public function rsegment($n, $no_result = FALSE) + public function rsegment($n, $no_result = NULL) { return isset($this->rsegments[$n]) ? $this->rsegments[$n] : $no_result; } @@ -462,7 +462,7 @@ class CI_URI { { return (count($default) === 0) ? array() - : array_fill_keys($default, FALSE); + : array_fill_keys($default, NULL); } $segments = array_slice($this->$segment_array(), ($n - 1)); @@ -477,7 +477,7 @@ class CI_URI { } else { - $retval[$seg] = FALSE; + $retval[$seg] = NULL; $lastval = $seg; } @@ -490,7 +490,7 @@ class CI_URI { { if ( ! array_key_exists($val, $retval)) { - $retval[$val] = FALSE; + $retval[$val] = NULL; } } } @@ -511,7 +511,7 @@ class CI_URI { public function assoc_to_uri($array) { $temp = array(); - foreach ( (array) $array as $key => $val) + foreach ((array) $array as $key => $val) { $temp[] = $key; $temp[] = $val; @@ -644,7 +644,7 @@ class CI_URI { */ public function ruri_string() { - return '/'.implode('/', $this->rsegment_array()); + return implode('/', $this->rsegment_array()); } } diff --git a/system/libraries/Session.php b/system/libraries/Session.php index 783109a60..4d6aa0ce8 100644 --- a/system/libraries/Session.php +++ b/system/libraries/Session.php @@ -276,7 +276,7 @@ class CI_Session { $session = $this->CI->input->cookie($this->sess_cookie_name); // No cookie? Goodbye cruel world!... - if ($session === FALSE) + if ($session === NULL) { log_message('debug', 'A session cookie was not found.'); return FALSE; @@ -586,7 +586,7 @@ class CI_Session { */ public function userdata($item) { - return isset($this->userdata[$item]) ? $this->userdata[$item] : FALSE; + return isset($this->userdata[$item]) ? $this->userdata[$item] : NULL; } // -------------------------------------------------------------------- @@ -715,7 +715,7 @@ class CI_Session { { // 'old' flashdata gets removed. Here we mark all // flashdata as 'new' to preserve it from _flashdata_sweep() - // Note the function will return FALSE if the $key + // Note the function will return NULL if the $key // provided cannot be found $value = $this->userdata($this->flashdata_key.':old:'.$key); diff --git a/tests/codeigniter/core/Input_test.php b/tests/codeigniter/core/Input_test.php index fd0576e38..a066d9960 100644 --- a/tests/codeigniter/core/Input_test.php +++ b/tests/codeigniter/core/Input_test.php @@ -28,11 +28,13 @@ class Input_test extends CI_TestCase { $this->assertTrue( ! $this->input->get()); $this->assertTrue( ! $this->input->get('foo')); - $this->assertTrue($this->input->get() == FALSE); - $this->assertTrue($this->input->get('foo') == FALSE); + // Test we're getting empty results + $this->assertTrue($this->input->get() == NULL); + $this->assertTrue($this->input->get('foo') == NULL); - $this->assertTrue($this->input->get() === FALSE); - $this->assertTrue($this->input->get('foo') === FALSE); + // Test new 3.0 behaviour for non existant results (used to be FALSE) + $this->assertTrue($this->input->get() === NULL); + $this->assertTrue($this->input->get('foo') === NULL); } // -------------------------------------------------------------------- @@ -68,11 +70,11 @@ class Input_test extends CI_TestCase { $this->assertTrue( ! $this->input->post()); $this->assertTrue( ! $this->input->post('foo')); - $this->assertTrue($this->input->post() == FALSE); - $this->assertTrue($this->input->post('foo') == FALSE); + $this->assertTrue($this->input->post() == NULL); + $this->assertTrue($this->input->post('foo') == NULL); - $this->assertTrue($this->input->post() === FALSE); - $this->assertTrue($this->input->post('foo') === FALSE); + $this->assertTrue($this->input->post() === NULL); + $this->assertTrue($this->input->post('foo') === NULL); } // -------------------------------------------------------------------- diff --git a/user_guide_src/source/libraries/input.rst b/user_guide_src/source/libraries/input.rst index 1f2ea650a..432bac3c7 100644 --- a/user_guide_src/source/libraries/input.rst +++ b/user_guide_src/source/libraries/input.rst @@ -18,7 +18,7 @@ The security filtering function is called automatically when a new :doc:`controller <../general/controllers>` is invoked. It does the following: -- If $config['allow_get_array'] is FALSE(default is TRUE), destroys +- If $config['allow_get_array'] is FALSE (default is TRUE), destroys the global GET array. - Destroys all global variables in the event register_globals is turned on. @@ -53,14 +53,7 @@ false (boolean) if not. This lets you conveniently use data without having to test whether an item exists first. In other words, normally you might do something like this:: - if ( ! isset($_POST['something'])) - { - $something = FALSE; - } - else - { - $something = $_POST['something']; - } + $something = isset($_POST['something']) ? $_POST['something'] : NULL; With CodeIgniter's built in functions you can simply do this:: @@ -95,7 +88,7 @@ To return an array of all POST items call without any parameters. To return all POST items and pass them through the XSS filter set the first parameter NULL while setting the second parameter to boolean; -The function returns FALSE (boolean) if there are no items in the POST. +The function returns NULL if there are no items in the POST. :: @@ -115,7 +108,7 @@ To return an array of all GET items call without any parameters. To return all GET items and pass them through the XSS filter set the first parameter NULL while setting the second parameter to boolean; -The function returns FALSE (boolean) if there are no items in the GET. +The function returns NULL if there are no items in the GET. :: @@ -210,7 +203,7 @@ the cookie you are looking for (including any prefixes):: cookie('some_cookie'); -The function returns FALSE (boolean) if the item you are attempting to +The function returns NULL if the item you are attempting to retrieve does not exist. The second optional parameter lets you run the data through the XSS diff --git a/user_guide_src/source/libraries/uri.rst b/user_guide_src/source/libraries/uri.rst index ee60b77d7..cdd76e322 100644 --- a/user_guide_src/source/libraries/uri.rst +++ b/user_guide_src/source/libraries/uri.rst @@ -25,7 +25,7 @@ The segment numbers would be this: #. metro #. crime_is_up -By default the function returns FALSE (boolean) if the segment does not +By default the function returns NULL if the segment does not exist. There is an optional second parameter that permits you to set your own default value if the segment is missing. For example, this would tell the function to return the number zero in the event of -- cgit v1.2.3-24-g4f1b From f49c407d587d35fc12ad27c045fbcb51f89f59f8 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 24 May 2012 14:57:33 +0300 Subject: Fix issue #1388 --- system/core/Lang.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/core/Lang.php b/system/core/Lang.php index 5cb0cad71..73c9127ac 100755 --- a/system/core/Lang.php +++ b/system/core/Lang.php @@ -65,14 +65,14 @@ class CI_Lang { /** * Load a language file * - * @param mixed the name of the language file to be loaded. Can be an array + * @param mixed the name of the language file to be loaded * @param string the language (english, etc.) * @param bool return loaded array of translations * @param bool add suffix to $langfile * @param string alternative path to look for language file * @return mixed */ - public function load($langfile = '', $idiom = '', $return = FALSE, $add_suffix = TRUE, $alt_path = '') + public function load($langfile, $idiom = '', $return = FALSE, $add_suffix = TRUE, $alt_path = '') { $langfile = str_replace('.php', '', $langfile); -- cgit v1.2.3-24-g4f1b From 7f57a016358a5ae19470d6c45b09d647246e3462 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 24 May 2012 18:40:50 +0300 Subject: Remove the DB destructor (db->close()) --- system/database/DB.php | 2 +- system/database/DB_driver.php | 17 ----------------- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/system/database/DB.php b/system/database/DB.php index b28439b29..9b96c7fcd 100755 --- a/system/database/DB.php +++ b/system/database/DB.php @@ -159,4 +159,4 @@ function &DB($params = '', $query_builder_override = NULL) } /* End of file DB.php */ -/* Location: ./system/database/DB.php */ +/* Location: ./system/database/DB.php */ \ No newline at end of file diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index a0812d4c7..d8a1c13f0 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -1404,23 +1404,6 @@ abstract class CI_DB_driver { { } - // -------------------------------------------------------------------- - - /** - * Destructor - * - * Closes the database connection, if needed. - * - * @return void - */ - public function __destruct() - { - if ( ! $this->pconnect) - { - $this->close(); - } - } - } /* End of file DB_driver.php */ -- cgit v1.2.3-24-g4f1b From d45f9503a45e099ed35df3e83aaa12bd91217dea Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 24 May 2012 19:31:39 +0300 Subject: Add backwards compatibility work-around for the configuration setting --- system/database/DB.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/system/database/DB.php b/system/database/DB.php index 9b96c7fcd..1fe44c0e5 100755 --- a/system/database/DB.php +++ b/system/database/DB.php @@ -118,6 +118,13 @@ function &DB($params = '', $query_builder_override = NULL) { $query_builder = $query_builder_override; } + // Backwards compatibility work-around for keeping the + // $active_record config variable working. Should be + // removed in v3.1 + elseif ( ! isset($query_builder) && isset($active_record)) + { + $query_builder = $active_record; + } require_once(BASEPATH.'database/DB_driver.php'); -- cgit v1.2.3-24-g4f1b From 7b5eb7310e5980ffb23fde8a11261e4a40c3b90e Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 24 May 2012 20:52:41 +0300 Subject: Fix issue #1273 and some cleanup in Query Builder --- system/database/DB_query_builder.php | 43 +++++++++++++++--------------------- user_guide_src/source/changelog.rst | 7 +++--- 2 files changed, 22 insertions(+), 28 deletions(-) diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php index d0af66de1..cee4354e9 100644 --- a/system/database/DB_query_builder.php +++ b/system/database/DB_query_builder.php @@ -211,8 +211,8 @@ abstract class CI_DB_query_builder extends CI_DB_driver { $alias = $this->_create_alias_from_table(trim($select)); } - $sql = $this->protect_identifiers($type.'('.trim($select).')').' AS '.$this->protect_identifiers(trim($alias)); - + $sql = $this->protect_identifiers($type.'('.trim($select).')').' AS '.$this->escape_identifiers(trim($alias)); + $this->qb_select[] = $sql; $this->qb_no_escape[] = NULL; @@ -256,7 +256,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { */ public function distinct($val = TRUE) { - $this->qb_distinct = (is_bool($val)) ? $val : TRUE; + $this->qb_distinct = is_bool($val) ? $val : TRUE; return $this; } @@ -272,7 +272,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { */ public function from($from) { - foreach ((array)$from as $val) + foreach ((array) $from as $val) { if (strpos($val, ',') !== FALSE) { @@ -1111,6 +1111,8 @@ abstract class CI_DB_query_builder extends CI_DB_driver { return $result; } + // -------------------------------------------------------------------- + /** * "Count All Results" query * @@ -1139,6 +1141,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { $row = $result->row(); return (int) $row->numrows; } + // -------------------------------------------------------------------- /** @@ -1401,16 +1404,13 @@ abstract class CI_DB_query_builder extends CI_DB_driver { return ($this->db_debug) ? $this->display_error('db_must_use_set') : FALSE; } - if ($table == '') + if ($table != '') { - if ( ! isset($this->qb_from[0])) - { - return ($this->db_debug) ? $this->display_error('db_must_set_table') : FALSE; - } + $this->qb_from[0] = $table; } - else + elseif ( ! isset($this->qb_from[0])) { - $this->qb_from[0] = $table; + return ($this->db_debug) ? $this->display_error('db_must_set_table') : FALSE; } return TRUE; @@ -1600,16 +1600,13 @@ abstract class CI_DB_query_builder extends CI_DB_driver { return ($this->db_debug) ? $this->display_error('db_must_use_set') : FALSE; } - if ($table == '') + if ($table != '') { - if ( ! isset($this->qb_from[0])) - { - return ($this->db_debug) ? $this->display_error('db_must_set_table') : FALSE; - } + $this->qb_from[0] = $table; } - else + elseif ( ! isset($this->qb_from[0])) { - $this->qb_from[0] = $table; + return ($this->db_debug) ? $this->display_error('db_must_set_table') : FALSE; } return TRUE; @@ -1696,15 +1693,11 @@ abstract class CI_DB_query_builder extends CI_DB_driver { { $index_set = TRUE; } - else - { - $not[] = $k.'-'.$v; - } $clean[$this->protect_identifiers($k2)] = ($escape === FALSE) ? $v2 : $this->escape($v2); } - if ($index_set == FALSE) + if ($index_set === FALSE) { return $this->display_error('db_batch_missing_index'); } @@ -2102,7 +2095,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { * @param object * @return array */ - public function _object_to_array($object) + protected function _object_to_array($object) { if ( ! is_object($object)) { @@ -2132,7 +2125,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { * @param object * @return array */ - public function _object_to_array_batch($object) + protected function _object_to_array_batch($object) { if ( ! is_object($object)) { diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index e0d745fd8..8ddeb0eac 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -149,7 +149,7 @@ Bug fixes for 3.0 - Fixed a bug where ``unlink()`` raised an error if cache file did not exist when you try to delete it. - Fixed a bug (#181) where a mis-spelling was in the form validation language file. -- Fixed a bug (#159, #163) that mishandled Active Record nested transactions because _trans_depth was not getting incremented. +- Fixed a bug (#159, #163) that mishandled Query Builder nested transactions because _trans_depth was not getting incremented. - Fixed a bug (#737, #75) where pagination anchor class was not set properly when using initialize method. - Fixed a bug (#419) - auto_link() now recognizes URLs that come after a word boundary. - Fixed a bug (#724) - is_unique in form validation now checks that you are connected to a database. @@ -190,7 +190,7 @@ Bug fixes for 3.0 - Fixed a bug (#499) - a CSRF cookie was created even with CSRF protection being disabled. - Fixed a bug (#306) - ODBC's insert_id() method was calling non-existent function odbc_insert_id(), which resulted in a fatal error. - Fixed a bug in Oracle's DB_result class where the cursor id passed to it was always NULL. -- Fixed a bug (#64) - Regular expression in DB_active_rec.php failed to handle queries containing SQL bracket delimiters in the join condition. +- Fixed a bug (#64) - Regular expression in DB_query_builder.php failed to handle queries containing SQL bracket delimiters in the join condition. - Fixed a bug in the :doc:`Session Library ` where a PHP E_NOTICE error was triggered by _unserialize() due to results from databases such as MSSQL and Oracle being space-padded on the right. - Fixed a bug (#501) - set_rules() to check if the request method is not 'POST' before aborting, instead of depending on count($_POST) in the :doc:`Form Validation Library `. - Fixed a bug (#940) - csrf_verify() used to set the CSRF cookie while processing a POST request with no actual POST data, which resulted in validating a request that should be considered invalid. @@ -213,7 +213,8 @@ Bug fixes for 3.0 - Fixed a bug (#128) - :doc:`Language Library ` did not correctly keep track of loaded language files. - Fixed a bug (#1242) - Added Windows path compatibility to function read_dir of ZIP library. - Fixed a bug (#1314) - sess_destroy() did not destroy userdata. -- Fixed a bug (#1349) - get_extension() in the `File Uploading Library ` returned the original filename when it didn't have an actual extension. +- Fixed a bug (#1349) - get_extension() in the :doc:`File Uploading Library ` returned the original filename when it didn't have an actual extension. +- Fixed a bug (#1273) - E_NOTICE being generated by :doc:`Query Builder `'s set_update_batch() method. Version 2.1.1 ============= -- cgit v1.2.3-24-g4f1b From 389d3cafa7cda7cdf5f891d1a9cd2e00c2711c39 Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Fri, 25 May 2012 01:05:23 +0700 Subject: Update vfsStream reference, run the test --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 97ea0422d..d82be5888 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,8 +13,8 @@ env: - DB=pdo/sqlite before_script: - - pyrus channel-discover pear.php-tools.net - - pyrus install http://pear.php-tools.net/get/vfsStream-0.11.2.tgz + - pyrus channel-discover pear.bovigo.org + - pyrus install bovigo/vfsStream-beta - phpenv rehash - sh -c "if [ '$DB' = 'pgsql' ] || [ '$DB' = 'pdo/pgsql' ]; then psql -c 'DROP DATABASE IF EXISTS ci_test;' -U postgres; fi" - sh -c "if [ '$DB' = 'pgsql' ] || [ '$DB' = 'pdo/pgsql' ]; then psql -c 'create database ci_test;' -U postgres; fi" @@ -25,4 +25,4 @@ script: phpunit --configuration tests/travis/$DB.phpunit.xml branches: only: - develop - - master \ No newline at end of file + - travis-ci -- cgit v1.2.3-24-g4f1b From 337c35406e9f9588317f8ebedfc5cf89d9ffa236 Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Fri, 25 May 2012 01:12:34 +0700 Subject: Update vfsStream repo --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d82be5888..1d9f350fc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,7 @@ env: before_script: - pyrus channel-discover pear.bovigo.org - - pyrus install bovigo/vfsStream-beta + - pyrus install http://pear.bovigo.org/get/vfsStream-0.12.0.tgz - phpenv rehash - sh -c "if [ '$DB' = 'pgsql' ] || [ '$DB' = 'pdo/pgsql' ]; then psql -c 'DROP DATABASE IF EXISTS ci_test;' -U postgres; fi" - sh -c "if [ '$DB' = 'pgsql' ] || [ '$DB' = 'pdo/pgsql' ]; then psql -c 'create database ci_test;' -U postgres; fi" -- cgit v1.2.3-24-g4f1b From de883e3bdb112ad721926f4274f89f61079a1c81 Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Fri, 25 May 2012 01:27:17 +0700 Subject: Force install --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1d9f350fc..bfaf4036a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,7 @@ env: before_script: - pyrus channel-discover pear.bovigo.org - - pyrus install http://pear.bovigo.org/get/vfsStream-0.12.0.tgz + - pyrus install -f bovigo/vfsStream-beta - phpenv rehash - sh -c "if [ '$DB' = 'pgsql' ] || [ '$DB' = 'pdo/pgsql' ]; then psql -c 'DROP DATABASE IF EXISTS ci_test;' -U postgres; fi" - sh -c "if [ '$DB' = 'pgsql' ] || [ '$DB' = 'pdo/pgsql' ]; then psql -c 'create database ci_test;' -U postgres; fi" -- cgit v1.2.3-24-g4f1b From f61d9f3758cbc6848d6df2cc83cc262fc36fa156 Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Fri, 25 May 2012 01:38:58 +0700 Subject: Write permission --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index bfaf4036a..4076e2bdc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,8 +13,8 @@ env: - DB=pdo/sqlite before_script: - - pyrus channel-discover pear.bovigo.org - - pyrus install -f bovigo/vfsStream-beta + - sudo pyrus channel-discover pear.bovigo.org + - sudo pyrus install -f bovigo/vfsStream-beta - phpenv rehash - sh -c "if [ '$DB' = 'pgsql' ] || [ '$DB' = 'pdo/pgsql' ]; then psql -c 'DROP DATABASE IF EXISTS ci_test;' -U postgres; fi" - sh -c "if [ '$DB' = 'pgsql' ] || [ '$DB' = 'pdo/pgsql' ]; then psql -c 'create database ci_test;' -U postgres; fi" -- cgit v1.2.3-24-g4f1b From 6bca9f836836f4bea2112cd6635a384e862b4db2 Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Fri, 25 May 2012 01:55:36 +0700 Subject: get vfsStream via composer if its PEAR package not exists --- .travis.yml | 5 ++--- composer.json | 5 +++++ tests/Bootstrap.php | 11 ++++++++++- 3 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 composer.json diff --git a/.travis.yml b/.travis.yml index 4076e2bdc..5eff68d18 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,9 +13,8 @@ env: - DB=pdo/sqlite before_script: - - sudo pyrus channel-discover pear.bovigo.org - - sudo pyrus install -f bovigo/vfsStream-beta - - phpenv rehash + - curl -s http://getcomposer.org/installer | php + - php composer.phar install - sh -c "if [ '$DB' = 'pgsql' ] || [ '$DB' = 'pdo/pgsql' ]; then psql -c 'DROP DATABASE IF EXISTS ci_test;' -U postgres; fi" - sh -c "if [ '$DB' = 'pgsql' ] || [ '$DB' = 'pdo/pgsql' ]; then psql -c 'create database ci_test;' -U postgres; fi" - sh -c "if [ '$DB' = 'mysql' ] || [ '$DB' = 'pdo/mysql' ]; then mysql -e 'create database IF NOT EXISTS ci_test;'; fi" diff --git a/composer.json b/composer.json new file mode 100644 index 000000000..fa6dc02e4 --- /dev/null +++ b/composer.json @@ -0,0 +1,5 @@ +{ + "require": { + "mikey179/vfsStream": "*" + } +} \ No newline at end of file diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index 9f89d1be8..c14a4dee2 100644 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -12,8 +12,17 @@ define('BASEPATH', PROJECT_BASE.'system/'); define('APPPATH', PROJECT_BASE.'application/'); define('VIEWPATH', PROJECT_BASE.''); +// Get vfsStream either via pear or composer +if (file_exists('vfsStream/vfsStream.php')) +{ + require_once 'vfsStream/vfsStream.php'; +} +else +{ + include_once '../vendor/autoload.php'; +} + // Prep our test environment -require_once 'vfsStream/vfsStream.php'; include_once $dir.'/mocks/core/common.php'; include_once $dir.'/mocks/autoloader.php'; spl_autoload_register('autoload'); -- cgit v1.2.3-24-g4f1b From 470805b12a8a25faddc9caafe573c15dbd89f8ed Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 24 May 2012 21:57:21 +0300 Subject: Fix issues #44 & #110 --- system/libraries/Upload.php | 2 ++ user_guide_src/source/changelog.rst | 1 + 2 files changed, 3 insertions(+) diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php index 271c6d21f..7456e922a 100644 --- a/system/libraries/Upload.php +++ b/system/libraries/Upload.php @@ -747,6 +747,8 @@ class CI_Upload { ';', '?', '/', + '!', + '#', '%20', '%22', '%3c', // < diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 8ddeb0eac..8ee224fc6 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -215,6 +215,7 @@ Bug fixes for 3.0 - Fixed a bug (#1314) - sess_destroy() did not destroy userdata. - Fixed a bug (#1349) - get_extension() in the :doc:`File Uploading Library ` returned the original filename when it didn't have an actual extension. - Fixed a bug (#1273) - E_NOTICE being generated by :doc:`Query Builder `'s set_update_batch() method. +- Fixed a bug (#44, #110) - :doc:`Upload library `'s clean_file_name() method didn't clear '!' and '#' characters. Version 2.1.1 ============= -- cgit v1.2.3-24-g4f1b From 55d3ad4faf2727b900832884e7c219076a255b66 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 24 May 2012 22:13:06 +0300 Subject: Fix issue #121 --- system/database/DB_result.php | 16 +++++++++------- system/database/drivers/oci8/oci8_result.php | 16 ++++++++-------- system/database/drivers/sqlite3/sqlite3_result.php | 16 ++++++++-------- user_guide_src/source/changelog.rst | 1 + 4 files changed, 26 insertions(+), 23 deletions(-) diff --git a/system/database/DB_result.php b/system/database/DB_result.php index 690734b08..334e08c72 100644 --- a/system/database/DB_result.php +++ b/system/database/DB_result.php @@ -242,7 +242,7 @@ class CI_DB_result { $result = $this->custom_result_object($type); if (count($result) === 0) { - return $result; + return NULL; } if ($n != $this->current_row && isset($result[$n])) @@ -253,6 +253,8 @@ class CI_DB_result { return $result[$this->current_row]; } + // -------------------------------------------------------------------- + /** * Returns a single result row - object version * @@ -263,7 +265,7 @@ class CI_DB_result { $result = $this->result_object(); if (count($result) === 0) { - return $result; + return NULL; } if ($n != $this->current_row && isset($result[$n])) @@ -286,7 +288,7 @@ class CI_DB_result { $result = $this->result_array(); if (count($result) === 0) { - return $result; + return NULL; } if ($n != $this->current_row && isset($result[$n])) @@ -307,7 +309,7 @@ class CI_DB_result { public function first_row($type = 'object') { $result = $this->result($type); - return (count($result) === 0) ? $result : $result[0]; + return (count($result) === 0) ? NULL : $result[0]; } // -------------------------------------------------------------------- @@ -320,7 +322,7 @@ class CI_DB_result { public function last_row($type = 'object') { $result = $this->result($type); - return (count($result) === 0) ? $result : $result[count($result) - 1]; + return (count($result) === 0) ? NULL : $result[count($result) - 1]; } // -------------------------------------------------------------------- @@ -335,7 +337,7 @@ class CI_DB_result { $result = $this->result($type); if (count($result) === 0) { - return $result; + return NULL; } if (isset($result[$this->current_row + 1])) @@ -358,7 +360,7 @@ class CI_DB_result { $result = $this->result($type); if (count($result) === 0) { - return $result; + return NULL; } if (isset($result[$this->current_row - 1])) diff --git a/system/database/drivers/oci8/oci8_result.php b/system/database/drivers/oci8/oci8_result.php index 7b05e0a43..6fb6c81f1 100644 --- a/system/database/drivers/oci8/oci8_result.php +++ b/system/database/drivers/oci8/oci8_result.php @@ -419,7 +419,7 @@ class CI_DB_oci8_result extends CI_DB_result { OR $n < $this->current_row) { // No such row exists - return array(); + return NULL; } // Get the next row index that would actually need to be fetched @@ -460,7 +460,7 @@ class CI_DB_oci8_result extends CI_DB_result { $this->num_rows = 0; } - return array(); + return NULL; } $this->current_row = $n; @@ -507,7 +507,7 @@ class CI_DB_oci8_result extends CI_DB_result { return (object) $row; } - return array(); + return NULL; } // -------------------------------------------------------------------- @@ -539,19 +539,19 @@ class CI_DB_oci8_result extends CI_DB_result { } else { - return array(); + return NULL; } } elseif ( ! class_exists($class_name)) // No such class exists { - return array(); + return NULL; } $row = $this->row_array($n); - // An array would mean that the row doesn't exist - if (is_array($row)) + // A non-array would mean that the row doesn't exist + if ( ! is_array($row)) { - return $row; + return NULL; } // Convert to the desired class and return diff --git a/system/database/drivers/sqlite3/sqlite3_result.php b/system/database/drivers/sqlite3/sqlite3_result.php index d83d6b2cd..946b36557 100644 --- a/system/database/drivers/sqlite3/sqlite3_result.php +++ b/system/database/drivers/sqlite3/sqlite3_result.php @@ -386,7 +386,7 @@ class CI_DB_sqlite3_result extends CI_DB_result { OR count($this->result_array) > 0 OR $n < $this->current_row) { // No such row exists - return array(); + return NULL; } // Get the next row index that would actually need to be fetched @@ -427,7 +427,7 @@ class CI_DB_sqlite3_result extends CI_DB_result { $this->num_rows = 0; } - return array(); + return NULL; } $this->current_row = $n; @@ -469,7 +469,7 @@ class CI_DB_sqlite3_result extends CI_DB_result { return (object) $row; } - return array(); + return NULL; } // -------------------------------------------------------------------- @@ -501,19 +501,19 @@ class CI_DB_sqlite3_result extends CI_DB_result { } else { - return array(); + return NULL; } } elseif ( ! class_exists($class_name)) // No such class exists { - return array(); + return NULL; } $row = $this->row_array($n); - // An array would mean that the row doesn't exist - if (is_array($row)) + // A non-array would mean that the row doesn't exist + if ( ! is_array($row)) { - return $row; + return NULL; } // Convert to the desired class and return diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 8ee224fc6..67f1271f1 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -216,6 +216,7 @@ Bug fixes for 3.0 - Fixed a bug (#1349) - get_extension() in the :doc:`File Uploading Library ` returned the original filename when it didn't have an actual extension. - Fixed a bug (#1273) - E_NOTICE being generated by :doc:`Query Builder `'s set_update_batch() method. - Fixed a bug (#44, #110) - :doc:`Upload library `'s clean_file_name() method didn't clear '!' and '#' characters. +- Fixed a bug (#121) - ``CI_DB_result::row()`` returned an array when there's no actual result to be returned. Version 2.1.1 ============= -- cgit v1.2.3-24-g4f1b From e13511a1368adb9914a4252d98cb2d0165138e0d Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Fri, 25 May 2012 02:15:42 +0700 Subject: Global class aliasing, at least until namespace introduced into further release --- tests/Bootstrap.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index c14a4dee2..71394720a 100644 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -12,14 +12,17 @@ define('BASEPATH', PROJECT_BASE.'system/'); define('APPPATH', PROJECT_BASE.'application/'); define('VIEWPATH', PROJECT_BASE.''); -// Get vfsStream either via pear or composer +// Get vfsStream either via PEAR or composer if (file_exists('vfsStream/vfsStream.php')) { require_once 'vfsStream/vfsStream.php'; } else { - include_once '../vendor/autoload.php'; + include_once PROJECT_BASE.'vendor/autoload.php'; + class_alias('org\bovigo\vfs\vfsStream', 'vfsStream'); + class_alias('org\bovigo\vfs\vfsStreamDirectory', 'vfsStreamDirectory'); + class_alias('org\bovigo\vfs\vfsStreamWrapper', 'vfsStreamWrapper'); } // Prep our test environment -- cgit v1.2.3-24-g4f1b From 76e2f034f55b7e0f678f22043eb841b428377fa6 Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Fri, 25 May 2012 02:18:59 +0700 Subject: Remove temporary branch from whitelist --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5eff68d18..6a7d37812 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,5 +23,4 @@ script: phpunit --configuration tests/travis/$DB.phpunit.xml branches: only: - - develop - - travis-ci + - develop \ No newline at end of file -- cgit v1.2.3-24-g4f1b From eeca6d265c4e104e3a6b34b8581180d2926b3dba Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Fri, 25 May 2012 03:15:19 +0700 Subject: Backward compatibility, in case someone already has vfsStream in their PEAR or other include_path --- tests/Bootstrap.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index 71394720a..1dbd178ca 100644 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -13,11 +13,16 @@ define('APPPATH', PROJECT_BASE.'application/'); define('VIEWPATH', PROJECT_BASE.''); // Get vfsStream either via PEAR or composer -if (file_exists('vfsStream/vfsStream.php')) +foreach (explode(PATH_SEPARATOR, get_include_path()) as $path) { - require_once 'vfsStream/vfsStream.php'; + if (file_exists($path.DIRECTORY_SEPARATOR.'vfsStream/vfsStream.phps')) + { + require_once 'vfsStream/vfsStream.php'; + break; + } } -else + +if ( ! class_exists('vfsStream') && file_exists(PROJECT_BASE.'vendor/autoload.php')) { include_once PROJECT_BASE.'vendor/autoload.php'; class_alias('org\bovigo\vfs\vfsStream', 'vfsStream'); -- cgit v1.2.3-24-g4f1b From 846acc7926ccb991d39135353d5047e7de5bcb60 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 24 May 2012 23:27:46 +0300 Subject: Fix issue #319 --- system/database/drivers/sqlsrv/sqlsrv_driver.php | 10 ++++------ user_guide_src/source/changelog.rst | 1 + 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php index 3e9fa7b1a..5a24f5532 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_driver.php +++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php @@ -132,11 +132,9 @@ class CI_DB_sqlsrv_driver extends CI_DB { */ protected function _execute($sql) { - return sqlsrv_query($this->conn_id, - $sql, - NULL, - array('Scrollable'=> SQLSRV_CURSOR_STATIC, 'SendStreamParamsAtExec' => TRUE) - ); + return (is_write_type($sql) && stripos($sql, 'INSERT') === FALSE) + ? sqlsrv_query($this->conn_id, $sql) + : sqlsrv_query($this->conn_id, $sql, NULL, array('Scrollable' => SQLSRV_CURSOR_STATIC)); } // -------------------------------------------------------------------- @@ -237,7 +235,7 @@ class CI_DB_sqlsrv_driver extends CI_DB { */ public function affected_rows() { - return @sqlrv_rows_affected($this->conn_id); + return sqlrv_rows_affected($this->result_id); } // -------------------------------------------------------------------- diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 67f1271f1..f21f1266d 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -217,6 +217,7 @@ Bug fixes for 3.0 - Fixed a bug (#1273) - E_NOTICE being generated by :doc:`Query Builder `'s set_update_batch() method. - Fixed a bug (#44, #110) - :doc:`Upload library `'s clean_file_name() method didn't clear '!' and '#' characters. - Fixed a bug (#121) - ``CI_DB_result::row()`` returned an array when there's no actual result to be returned. +- Fixed a bug (#319) - SQLSRV's affected_rows() method failed due to a scrollable cursor being created for write-type queries. Version 2.1.1 ============= -- cgit v1.2.3-24-g4f1b From 2d57445ba66f8b6e5fef526b932d691b0e5690db Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Fri, 25 May 2012 04:03:56 +0700 Subject: Escape like tests, #136 verification --- tests/Bootstrap.php | 2 +- .../database/query_builder/escape_test.php | 47 ++++++++++++++++++++++ tests/mocks/database/schema/skeleton.php | 21 ++++++++++ 3 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 tests/codeigniter/database/query_builder/escape_test.php diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index 1dbd178ca..38615dd89 100644 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -15,7 +15,7 @@ define('VIEWPATH', PROJECT_BASE.''); // Get vfsStream either via PEAR or composer foreach (explode(PATH_SEPARATOR, get_include_path()) as $path) { - if (file_exists($path.DIRECTORY_SEPARATOR.'vfsStream/vfsStream.phps')) + if (file_exists($path.DIRECTORY_SEPARATOR.'vfsStream/vfsStream.php')) { require_once 'vfsStream/vfsStream.php'; break; diff --git a/tests/codeigniter/database/query_builder/escape_test.php b/tests/codeigniter/database/query_builder/escape_test.php new file mode 100644 index 000000000..6d220d65d --- /dev/null +++ b/tests/codeigniter/database/query_builder/escape_test.php @@ -0,0 +1,47 @@ +db = Mock_Database_Schema_Skeleton::init(DB_DRIVER); + + Mock_Database_Schema_Skeleton::create_tables(); + Mock_Database_Schema_Skeleton::create_data(); + } + + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_escape_like_percent_sign() + { + $string = $this->db->escape_like_str('\%foo'); + $sql = "SELECT `value` FROM `misc` WHERE `key` LIKE '$string%';"; + $res = $this->db->query($sql)->result_array(); + + // Check the result + $this->assertEquals(1, count($res)); + } + + // ------------------------------------------------------------------------ + + /** + * @see ./mocks/schema/skeleton.php + */ + public function test_escape_like_backslash_sign() + { + $string = $this->db->escape_like_str('\\'); + $sql = "SELECT `value` FROM `misc` WHERE `key` LIKE '$string%';"; + $res = $this->db->query($sql)->result_array(); + + // Check the result + $this->assertEquals(2, count($res)); + } +} \ No newline at end of file diff --git a/tests/mocks/database/schema/skeleton.php b/tests/mocks/database/schema/skeleton.php index 671336cc4..05499f82f 100644 --- a/tests/mocks/database/schema/skeleton.php +++ b/tests/mocks/database/schema/skeleton.php @@ -88,6 +88,23 @@ class Mock_Database_Schema_Skeleton { )); static::$forge->add_key('id', TRUE); static::$forge->create_table('job', (strpos(static::$driver, 'pgsql') === FALSE)); + + // Misc Table + static::$forge->add_field(array( + 'id' => array( + 'type' => 'INTEGER', + 'constraint' => 3, + ), + 'key' => array( + 'type' => 'VARCHAR', + 'constraint' => 40, + ), + 'value' => array( + 'type' => 'TEXT', + ), + )); + static::$forge->add_key('id', TRUE); + static::$forge->create_table('misc', (strpos(static::$driver, 'pgsql') === FALSE)); } /** @@ -111,6 +128,10 @@ class Mock_Database_Schema_Skeleton { array('id' => 3, 'name' => 'Accountant', 'description' => 'Boring job, but you will get free snack at lunch'), array('id' => 4, 'name' => 'Musician', 'description' => 'Only Coldplay can actually called Musician'), ), + 'misc' => array( + array('id' => 1, 'key' => '\\xxxfoo456', 'value' => 'Entry with \\xxx'), + array('id' => 2, 'key' => '\\%foo456', 'value' => 'Entry with \\%'), + ), ); foreach ($data as $table => $dummy_data) -- cgit v1.2.3-24-g4f1b From 6a43244e1d739db17db266456221099232d120d6 Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Fri, 25 May 2012 04:09:38 +0700 Subject: replace space with tab --- tests/codeigniter/database/query_builder/escape_test.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/codeigniter/database/query_builder/escape_test.php b/tests/codeigniter/database/query_builder/escape_test.php index 6d220d65d..f2d1b84ca 100644 --- a/tests/codeigniter/database/query_builder/escape_test.php +++ b/tests/codeigniter/database/query_builder/escape_test.php @@ -23,8 +23,8 @@ class Escape_test extends CI_TestCase { public function test_escape_like_percent_sign() { $string = $this->db->escape_like_str('\%foo'); - $sql = "SELECT `value` FROM `misc` WHERE `key` LIKE '$string%';"; - $res = $this->db->query($sql)->result_array(); + $sql = "SELECT `value` FROM `misc` WHERE `key` LIKE '$string%';"; + $res = $this->db->query($sql)->result_array(); // Check the result $this->assertEquals(1, count($res)); @@ -38,8 +38,8 @@ class Escape_test extends CI_TestCase { public function test_escape_like_backslash_sign() { $string = $this->db->escape_like_str('\\'); - $sql = "SELECT `value` FROM `misc` WHERE `key` LIKE '$string%';"; - $res = $this->db->query($sql)->result_array(); + $sql = "SELECT `value` FROM `misc` WHERE `key` LIKE '$string%';"; + $res = $this->db->query($sql)->result_array(); // Check the result $this->assertEquals(2, count($res)); -- cgit v1.2.3-24-g4f1b From d06acd85cdfff5411474b46afee36fb77baa1200 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 25 May 2012 00:29:09 +0300 Subject: Added update_batch() support for PostgreSQL (issue #356) --- system/database/DB_utility.php | 4 +-- system/database/drivers/postgre/postgre_driver.php | 41 ++++++++++++++++++++++ user_guide_src/source/changelog.rst | 2 ++ 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php index 587dfdc01..cb97ff448 100644 --- a/system/database/DB_utility.php +++ b/system/database/DB_utility.php @@ -212,7 +212,7 @@ abstract class CI_DB_utility extends CI_DB_forge { $out = rtrim($out).$newline; // Next blast through the result array and build out the rows - foreach ($query->result_array() as $row) + while ($row = $query->unbuffered_row('array')) { foreach ($row as $item) { @@ -258,7 +258,7 @@ abstract class CI_DB_utility extends CI_DB_forge { // Generate the result $xml = '<'.$root.'>'.$newline; - foreach ($query->result_array() as $row) + while ($row = $query->unbuffered_row()) { $xml .= $tab.'<'.$element.'>'.$newline; foreach ($row as $key => $val) diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php index 0ddfd0abe..30689cc70 100644 --- a/system/database/drivers/postgre/postgre_driver.php +++ b/system/database/drivers/postgre/postgre_driver.php @@ -538,6 +538,47 @@ class CI_DB_postgre_driver extends CI_DB { // -------------------------------------------------------------------- + /** + * Update_Batch statement + * + * Generates a platform-specific batch update string from the supplied data + * + * @param string the table name + * @param array the update data + * @param array the where clause + * @return string + */ + protected function _update_batch($table, $values, $index, $where = NULL) + { + $ids = array(); + foreach ($values as $key => $val) + { + $ids[] = $val[$index]; + + foreach (array_keys($val) as $field) + { + if ($field != $index) + { + $final[$field][] = 'WHEN '.$val[$index].' THEN '.$val[$field]; + } + } + } + + $cases = ''; + foreach ($final as $k => $v) + { + $cases .= $k.' = (CASE '.$k."\n" + .implode("\n", $v)."\n" + .'ELSE '.$k.' END), '; + } + + return 'UPDATE '.$table.' SET '.substr($cases, 0, -2) + .' WHERE '.(($where != '' && count($where) > 0) ? implode(' ', $where).' AND ' : '') + .$index.' IN('.implode(',', $ids).')'; + } + + // -------------------------------------------------------------------- + /** * Delete statement * diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index f21f1266d..5407fb05e 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -75,6 +75,7 @@ Release Date: Not Released - Added db_set_charset() support. - Added _optimize_table() support for the :doc:`Database Utility Class ` (rebuilds table indexes). - Added boolean data type support in escape(). + - Added update_batch() support. - Added a constructor to the DB_result class and moved all driver-specific properties and logic out of the base DB_driver class to allow better abstraction. - Removed limit() and order_by() support for UPDATE and DELETE queries in PostgreSQL driver. Postgres does not support those features. - Removed protect_identifiers() and renamed internal method _protect_identifiers() to it instead - it was just an alias. @@ -218,6 +219,7 @@ Bug fixes for 3.0 - Fixed a bug (#44, #110) - :doc:`Upload library `'s clean_file_name() method didn't clear '!' and '#' characters. - Fixed a bug (#121) - ``CI_DB_result::row()`` returned an array when there's no actual result to be returned. - Fixed a bug (#319) - SQLSRV's affected_rows() method failed due to a scrollable cursor being created for write-type queries. +- Fixed a bug (#356) - PostgreSQL driver didn't have an _update_batch() method, which resulted in fatal error being triggered when update_batch() is used with it. Version 2.1.1 ============= -- cgit v1.2.3-24-g4f1b From 21cb2d32edd595a38189cdba137e694c3a22e1f0 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 25 May 2012 01:01:06 +0300 Subject: Fix issue #136 (MySQL escape_like_str()) --- system/database/drivers/mysql/mysql_driver.php | 6 ++++-- system/database/drivers/mysqli/mysqli_driver.php | 6 ++++-- user_guide_src/source/changelog.rst | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php index 161f99541..d801a9aaf 100644 --- a/system/database/drivers/mysql/mysql_driver.php +++ b/system/database/drivers/mysql/mysql_driver.php @@ -47,7 +47,7 @@ class CI_DB_mysql_driver extends CI_DB { // clause and character used for LIKE escape sequences - not used in MySQL protected $_like_escape_str = ''; - protected $_like_escape_chr = ''; + protected $_like_escape_chr = '\\'; /** * The syntax to count rows is slightly different across different @@ -291,7 +291,9 @@ class CI_DB_mysql_driver extends CI_DB { // escape LIKE condition wildcards if ($like === TRUE) { - return str_replace(array('%', '_'), array('\\%', '\\_'), $str); + return str_replace(array($this->_like_escape_chr, '%', '_'), + array($this->_like_escape_chr.$this->_like_escape_chr, $this->_like_escape_chr.'%', $this->_like_escape_chr.'_'), + $str); } return $str; diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php index 9261883f5..61761e0c6 100644 --- a/system/database/drivers/mysqli/mysqli_driver.php +++ b/system/database/drivers/mysqli/mysqli_driver.php @@ -47,7 +47,7 @@ class CI_DB_mysqli_driver extends CI_DB { // clause and character used for LIKE escape sequences - not used in MySQL protected $_like_escape_str = ''; - protected $_like_escape_chr = ''; + protected $_like_escape_chr = '\\'; /** * The syntax to count rows is slightly different across different @@ -291,7 +291,9 @@ class CI_DB_mysqli_driver extends CI_DB { // escape LIKE condition wildcards if ($like === TRUE) { - return str_replace(array('%', '_'), array('\\%', '\\_'), $str); + return str_replace(array($this->_like_escape_chr, '%', '_'), + array($this->_like_escape_chr.$this->_like_escape_chr, $this->_like_escape_chr.'%', $this->_like_escape_chr.'_'), + $str); } return $str; diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 5407fb05e..4b8a0f2d3 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -195,7 +195,7 @@ Bug fixes for 3.0 - Fixed a bug in the :doc:`Session Library ` where a PHP E_NOTICE error was triggered by _unserialize() due to results from databases such as MSSQL and Oracle being space-padded on the right. - Fixed a bug (#501) - set_rules() to check if the request method is not 'POST' before aborting, instead of depending on count($_POST) in the :doc:`Form Validation Library `. - Fixed a bug (#940) - csrf_verify() used to set the CSRF cookie while processing a POST request with no actual POST data, which resulted in validating a request that should be considered invalid. -- Fixed a bug in PostgreSQL's escape_str() where it didn't properly escape LIKE wild characters. +- Fixed a bug (#136) - PostgreSQL, MySQL and MySQLi's escape_str() method didn't properly escape LIKE wild characters. - Fixed a bug in the library loader where some PHP versions wouldn't execute the class constructor. - Fixed a bug (#88) - An unexisting property was used for configuration of the Memcache cache driver. - Fixed a bug (#14) - create_database() method in the :doc:`Database Forge Library ` didn't utilize the configured database character set. -- cgit v1.2.3-24-g4f1b From def568fcc8586db7685c4a1c2efd14c3cd75c8ad Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 25 May 2012 01:06:54 +0300 Subject: Apply fix for issue #136 on PDO+MySQL as well --- system/database/drivers/pdo/pdo_driver.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php index e38c1145c..4784fc65b 100644 --- a/system/database/drivers/pdo/pdo_driver.php +++ b/system/database/drivers/pdo/pdo_driver.php @@ -79,13 +79,13 @@ class CI_DB_pdo_driver extends CI_DB { // clause and character used for LIKE escape sequences // this one depends on the driver being used - if ($this->pdodriver == 'mysql') + if ($this->pdodriver === 'mysql') { $this->_escape_char = '`'; $this->_like_escape_str = ''; - $this->_like_escape_chr = ''; + $this->_like_escape_chr = '\\'; } - elseif ($this->pdodriver == 'odbc') + elseif ($this->pdodriver === 'odbc') { $this->_like_escape_str = " {escape '%s'} "; } -- cgit v1.2.3-24-g4f1b From 98dcac7ea5f82cc1d5cecedd030c5f242f1dc652 Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Fri, 25 May 2012 05:07:51 +0700 Subject: Alter the escape like test, since it use raw SQL via query(), the sql statement would need to add ESCAPE clause for database(s) other than mysql --- .../database/query_builder/escape_test.php | 7 +++++-- tests/mocks/database/ci_test.sqlite | Bin 19456 -> 19456 bytes 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/codeigniter/database/query_builder/escape_test.php b/tests/codeigniter/database/query_builder/escape_test.php index f2d1b84ca..5dd2da058 100644 --- a/tests/codeigniter/database/query_builder/escape_test.php +++ b/tests/codeigniter/database/query_builder/escape_test.php @@ -23,7 +23,9 @@ class Escape_test extends CI_TestCase { public function test_escape_like_percent_sign() { $string = $this->db->escape_like_str('\%foo'); - $sql = "SELECT `value` FROM `misc` WHERE `key` LIKE '$string%';"; + $sql = "SELECT `value` FROM `misc` WHERE `key` LIKE '$string%'"; + $sql .= (strpos(DB_DRIVER, 'mysql') !== FALSE) ? ";" : "ESCAPE '!';"; + $res = $this->db->query($sql)->result_array(); // Check the result @@ -38,7 +40,8 @@ class Escape_test extends CI_TestCase { public function test_escape_like_backslash_sign() { $string = $this->db->escape_like_str('\\'); - $sql = "SELECT `value` FROM `misc` WHERE `key` LIKE '$string%';"; + $sql = "SELECT `value` FROM `misc` WHERE `key` LIKE '$string%'"; + $sql .= (strpos(DB_DRIVER, 'mysql') !== FALSE) ? ";" : "ESCAPE '!';"; $res = $this->db->query($sql)->result_array(); // Check the result diff --git a/tests/mocks/database/ci_test.sqlite b/tests/mocks/database/ci_test.sqlite index 23a3de2a4..44dcef9ec 100755 Binary files a/tests/mocks/database/ci_test.sqlite and b/tests/mocks/database/ci_test.sqlite differ -- cgit v1.2.3-24-g4f1b From 59d6b4fc4f4d7d5265b59cfd8c0f68f885083f69 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 25 May 2012 02:08:00 +0300 Subject: Alter LIKE escaping tests again --- tests/codeigniter/database/DB_driver_test.php | 4 +--- tests/codeigniter/database/DB_test.php | 4 +--- tests/codeigniter/database/query_builder/escape_test.php | 16 ++++++---------- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/tests/codeigniter/database/DB_driver_test.php b/tests/codeigniter/database/DB_driver_test.php index fb40f0608..9e16e29b4 100644 --- a/tests/codeigniter/database/DB_driver_test.php +++ b/tests/codeigniter/database/DB_driver_test.php @@ -2,8 +2,6 @@ class DB_driver_test extends CI_TestCase { - // ------------------------------------------------------------------------ - public function test_initialize() { $config = Mock_Database_DB::config(DB_DRIVER); @@ -32,5 +30,5 @@ class DB_driver_test extends CI_TestCase { { return new Mock_Database_Drivers_Postgre($config); } - + } \ No newline at end of file diff --git a/tests/codeigniter/database/DB_test.php b/tests/codeigniter/database/DB_test.php index 9b93e223d..d5c0dea08 100644 --- a/tests/codeigniter/database/DB_test.php +++ b/tests/codeigniter/database/DB_test.php @@ -2,8 +2,6 @@ class DB_test extends CI_TestCase { - // ------------------------------------------------------------------------ - public function test_db_invalid() { $connection = new Mock_Database_DB(array( @@ -45,5 +43,5 @@ class DB_test extends CI_TestCase { $this->assertTrue($db instanceof CI_DB); $this->assertTrue($db instanceof CI_DB_Driver); } - + } \ No newline at end of file diff --git a/tests/codeigniter/database/query_builder/escape_test.php b/tests/codeigniter/database/query_builder/escape_test.php index 5dd2da058..96fbd078b 100644 --- a/tests/codeigniter/database/query_builder/escape_test.php +++ b/tests/codeigniter/database/query_builder/escape_test.php @@ -23,13 +23,10 @@ class Escape_test extends CI_TestCase { public function test_escape_like_percent_sign() { $string = $this->db->escape_like_str('\%foo'); - $sql = "SELECT `value` FROM `misc` WHERE `key` LIKE '$string%'"; - $sql .= (strpos(DB_DRIVER, 'mysql') !== FALSE) ? ";" : "ESCAPE '!';"; + $res = $this->db->select('value')->from('misc')->like('key', $string, 'after')->get(); - $res = $this->db->query($sql)->result_array(); - // Check the result - $this->assertEquals(1, count($res)); + $this->assertEquals(1, count($res->result_array())); } // ------------------------------------------------------------------------ @@ -40,11 +37,10 @@ class Escape_test extends CI_TestCase { public function test_escape_like_backslash_sign() { $string = $this->db->escape_like_str('\\'); - $sql = "SELECT `value` FROM `misc` WHERE `key` LIKE '$string%'"; - $sql .= (strpos(DB_DRIVER, 'mysql') !== FALSE) ? ";" : "ESCAPE '!';"; - $res = $this->db->query($sql)->result_array(); - + $res = $this->db->select('value')->from('misc')->like('key', $string, 'after')->get(); + // Check the result - $this->assertEquals(2, count($res)); + $this->assertEquals(2, count($res->result_array())); } + } \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 0174d84401b5c5996115a4a6193161f1dab96de2 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 25 May 2012 02:17:49 +0300 Subject: Alter LIKE escaping tests again --- tests/codeigniter/database/query_builder/escape_test.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/codeigniter/database/query_builder/escape_test.php b/tests/codeigniter/database/query_builder/escape_test.php index 96fbd078b..9df82c2d0 100644 --- a/tests/codeigniter/database/query_builder/escape_test.php +++ b/tests/codeigniter/database/query_builder/escape_test.php @@ -23,7 +23,10 @@ class Escape_test extends CI_TestCase { public function test_escape_like_percent_sign() { $string = $this->db->escape_like_str('\%foo'); - $res = $this->db->select('value')->from('misc')->like('key', $string, 'after')->get(); + $this->db->select('value'); + $this->db->from('misc'); + $this->db->like('key', $string, 'after'); + $res = $this->db->get(); // Check the result $this->assertEquals(1, count($res->result_array())); @@ -38,6 +41,10 @@ class Escape_test extends CI_TestCase { { $string = $this->db->escape_like_str('\\'); $res = $this->db->select('value')->from('misc')->like('key', $string, 'after')->get(); + $this->db->select('value'); + $this->db->from('misc'); + $this->db->like('key', $string, 'after'); + $res = $this->db->get(); // Check the result $this->assertEquals(2, count($res->result_array())); -- cgit v1.2.3-24-g4f1b From f33e2ff30b0a9c54d6e8adbe88662838b9bd525e Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 25 May 2012 02:24:17 +0300 Subject: Again ... escape_like_str() tests --- tests/codeigniter/database/query_builder/escape_test.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/codeigniter/database/query_builder/escape_test.php b/tests/codeigniter/database/query_builder/escape_test.php index 9df82c2d0..50685922a 100644 --- a/tests/codeigniter/database/query_builder/escape_test.php +++ b/tests/codeigniter/database/query_builder/escape_test.php @@ -22,7 +22,8 @@ class Escape_test extends CI_TestCase { */ public function test_escape_like_percent_sign() { - $string = $this->db->escape_like_str('\%foo'); + $string = '\%foo' +; $this->db->select('value'); $this->db->from('misc'); $this->db->like('key', $string, 'after'); @@ -39,8 +40,8 @@ class Escape_test extends CI_TestCase { */ public function test_escape_like_backslash_sign() { - $string = $this->db->escape_like_str('\\'); - $res = $this->db->select('value')->from('misc')->like('key', $string, 'after')->get(); + $string = '\\'; + $this->db->select('value'); $this->db->from('misc'); $this->db->like('key', $string, 'after'); -- cgit v1.2.3-24-g4f1b From 502942bd94fef292970df331b15652ef6e1385e7 Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Fri, 25 May 2012 07:00:41 +0700 Subject: Explicitely testing escape_like_str API --- tests/codeigniter/database/query_builder/escape_test.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/codeigniter/database/query_builder/escape_test.php b/tests/codeigniter/database/query_builder/escape_test.php index 5dd2da058..ac1c8f659 100644 --- a/tests/codeigniter/database/query_builder/escape_test.php +++ b/tests/codeigniter/database/query_builder/escape_test.php @@ -13,6 +13,9 @@ class Escape_test extends CI_TestCase { Mock_Database_Schema_Skeleton::create_tables(); Mock_Database_Schema_Skeleton::create_data(); + + $this->pre = (strpos(DB_DRIVER, 'pgsql') === FALSE) ? '`' : '"'; + $this->esc = (strpos(DB_DRIVER, 'mysql') === FALSE) ? '!' : ''; } // ------------------------------------------------------------------------ @@ -23,8 +26,8 @@ class Escape_test extends CI_TestCase { public function test_escape_like_percent_sign() { $string = $this->db->escape_like_str('\%foo'); - $sql = "SELECT `value` FROM `misc` WHERE `key` LIKE '$string%'"; - $sql .= (strpos(DB_DRIVER, 'mysql') !== FALSE) ? ";" : "ESCAPE '!';"; + + $sql = "SELECT {$this->pre}value{$this->pre} FROM {$this->pre}misc{$this->pre} WHERE {$this->pre}key{$this->pre} LIKE '$string%' ESCAPE '$this->esc';"; $res = $this->db->query($sql)->result_array(); @@ -40,8 +43,9 @@ class Escape_test extends CI_TestCase { public function test_escape_like_backslash_sign() { $string = $this->db->escape_like_str('\\'); - $sql = "SELECT `value` FROM `misc` WHERE `key` LIKE '$string%'"; - $sql .= (strpos(DB_DRIVER, 'mysql') !== FALSE) ? ";" : "ESCAPE '!';"; + + $sql = "SELECT {$this->pre}value{$this->pre} FROM {$this->pre}misc{$this->pre} WHERE {$this->pre}key{$this->pre} LIKE '$string%' ESCAPE '$this->esc';"; + $res = $this->db->query($sql)->result_array(); // Check the result -- cgit v1.2.3-24-g4f1b From 3c5abf93d3031064c8181069cfee83ebfb54dcf0 Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Fri, 25 May 2012 07:17:26 +0700 Subject: Clean up --- tests/codeigniter/database/query_builder/escape_test.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/codeigniter/database/query_builder/escape_test.php b/tests/codeigniter/database/query_builder/escape_test.php index fe225436a..5df812ca6 100644 --- a/tests/codeigniter/database/query_builder/escape_test.php +++ b/tests/codeigniter/database/query_builder/escape_test.php @@ -32,7 +32,7 @@ class Escape_test extends CI_TestCase { $res = $this->db->query($sql)->result_array(); // Check the result - $this->assertEquals(1, count($res->result_array())); + $this->assertEquals(1, count($res)); } // ------------------------------------------------------------------------ @@ -49,7 +49,7 @@ class Escape_test extends CI_TestCase { $res = $this->db->query($sql)->result_array(); // Check the result - $this->assertEquals(2, count($res->result_array())); + $this->assertEquals(2, count($res)); } } \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 1af5b47ad6f95f805d9f411ce020f2e2fa88b302 Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Sat, 26 May 2012 16:04:39 +0700 Subject: Remove ternary --- .../database/query_builder/escape_test.php | 24 ++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/tests/codeigniter/database/query_builder/escape_test.php b/tests/codeigniter/database/query_builder/escape_test.php index 5df812ca6..5d575a37b 100644 --- a/tests/codeigniter/database/query_builder/escape_test.php +++ b/tests/codeigniter/database/query_builder/escape_test.php @@ -13,9 +13,6 @@ class Escape_test extends CI_TestCase { Mock_Database_Schema_Skeleton::create_tables(); Mock_Database_Schema_Skeleton::create_data(); - - $this->pre = (strpos(DB_DRIVER, 'pgsql') === FALSE) ? '`' : '"'; - $this->esc = (strpos(DB_DRIVER, 'mysql') === FALSE) ? '!' : ''; } // ------------------------------------------------------------------------ @@ -25,9 +22,17 @@ class Escape_test extends CI_TestCase { */ public function test_escape_like_percent_sign() { + // Escape the like string $string = $this->db->escape_like_str('\%foo'); - $sql = "SELECT {$this->pre}value{$this->pre} FROM {$this->pre}misc{$this->pre} WHERE {$this->pre}key{$this->pre} LIKE '$string%' ESCAPE '$this->esc';"; + if (strpos(DB_DRIVER, 'mysql') !== FALSE) + { + $sql = "SELECT `value` FROM `misc` WHERE `key` LIKE '$string%' ESCAPE '';"; + } + else + { + $sql = 'SELECT "value" FROM "misc" WHERE "key" LIKE \''.$string.'%\' ESCAPE \'!\';'; + } $res = $this->db->query($sql)->result_array(); @@ -42,14 +47,21 @@ class Escape_test extends CI_TestCase { */ public function test_escape_like_backslash_sign() { + // Escape the like string $string = $this->db->escape_like_str('\\'); - $sql = "SELECT {$this->pre}value{$this->pre} FROM {$this->pre}misc{$this->pre} WHERE {$this->pre}key{$this->pre} LIKE '$string%' ESCAPE '$this->esc';"; + if (strpos(DB_DRIVER, 'mysql') !== FALSE) + { + $sql = "SELECT `value` FROM `misc` WHERE `key` LIKE '$string%' ESCAPE '';"; + } + else + { + $sql = 'SELECT "value" FROM "misc" WHERE "key" LIKE \''.$string.'%\' ESCAPE \'!\';'; + } $res = $this->db->query($sql)->result_array(); // Check the result $this->assertEquals(2, count($res)); } - } \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 4912f8b25cd8fa1b88b4babd1bad2b6bf29dd235 Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Sat, 26 May 2012 22:09:58 +0700 Subject: Allowing main constants defined via phpunit config or other bootstraper --- tests/Bootstrap.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index 38615dd89..5216038c6 100644 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -7,10 +7,10 @@ error_reporting(E_ALL | E_STRICT); $dir = realpath(dirname(__FILE__)); // Path constants -define('PROJECT_BASE', realpath($dir.'/../').'/'); -define('BASEPATH', PROJECT_BASE.'system/'); -define('APPPATH', PROJECT_BASE.'application/'); -define('VIEWPATH', PROJECT_BASE.''); +defined('PROJECT_BASE') OR define('PROJECT_BASE', realpath($dir.'/../').'/'); +defined('BASEPATH') OR define('BASEPATH', PROJECT_BASE.'system/'); +defined('APPPATH') OR define('APPPATH', PROJECT_BASE.'application/'); +defined('VIEWPATH') OR define('VIEWPATH', PROJECT_BASE.''); // Get vfsStream either via PEAR or composer foreach (explode(PATH_SEPARATOR, get_include_path()) as $path) -- cgit v1.2.3-24-g4f1b From 16bb9bd93698335fc1692adcfbd20d8e4fda6268 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 26 May 2012 18:21:14 +0300 Subject: Move count_all() from the drivers to CI_DB_driver --- system/database/DB_driver.php | 32 ++++++++++++++++++++-- system/database/drivers/cubrid/cubrid_driver.php | 29 -------------------- .../drivers/interbase/interbase_driver.php | 29 -------------------- system/database/drivers/mssql/mssql_driver.php | 29 -------------------- system/database/drivers/mysql/mysql_driver.php | 29 -------------------- system/database/drivers/mysqli/mysqli_driver.php | 29 -------------------- system/database/drivers/oci8/oci8_driver.php | 29 -------------------- system/database/drivers/odbc/odbc_driver.php | 30 -------------------- system/database/drivers/pdo/pdo_driver.php | 32 ---------------------- system/database/drivers/postgre/postgre_driver.php | 29 -------------------- system/database/drivers/sqlite/sqlite_driver.php | 29 -------------------- system/database/drivers/sqlite3/sqlite3_driver.php | 24 ---------------- system/database/drivers/sqlsrv/sqlsrv_driver.php | 29 -------------------- 13 files changed, 30 insertions(+), 349 deletions(-) diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index d8a1c13f0..bbb7b7a80 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -741,6 +741,35 @@ abstract class CI_DB_driver { // -------------------------------------------------------------------- + /** + * "Count All" query + * + * Generates a platform-specific query string that counts all records in + * the specified database + * + * @param string + * @return int + */ + public function count_all($table = '') + { + if ($table == '') + { + return 0; + } + + $query = $this->query($this->_count_string.$this->escape_identifiers('numrows').' FROM '.$this->protect_identifiers($table, TRUE, NULL, FALSE)); + if ($query->num_rows() == 0) + { + return 0; + } + + $query = $query->row(); + $this->_reset_select(); + return (int) $query->numrows; + } + + // -------------------------------------------------------------------- + /** * Returns an array of table names * @@ -1395,8 +1424,7 @@ abstract class CI_DB_driver { /** * Dummy method that allows Query Builder class to be disabled - * - * This function is used extensively by every db driver. + * and keep count_all() working. * * @return void */ diff --git a/system/database/drivers/cubrid/cubrid_driver.php b/system/database/drivers/cubrid/cubrid_driver.php index 944df99b5..817dfdc98 100644 --- a/system/database/drivers/cubrid/cubrid_driver.php +++ b/system/database/drivers/cubrid/cubrid_driver.php @@ -328,35 +328,6 @@ class CI_DB_cubrid_driver extends CI_DB { // -------------------------------------------------------------------- - /** - * "Count All" query - * - * Generates a platform-specific query string that counts all records in - * the specified table - * - * @param string - * @return int - */ - public function count_all($table = '') - { - if ($table == '') - { - return 0; - } - - $query = $this->query($this->_count_string.$this->protect_identifiers('numrows').' FROM '.$this->protect_identifiers($table, TRUE, NULL, FALSE)); - if ($query->num_rows() == 0) - { - return 0; - } - - $query = $query->row(); - $this->_reset_select(); - return (int) $query->numrows; - } - - // -------------------------------------------------------------------- - /** * List table query * diff --git a/system/database/drivers/interbase/interbase_driver.php b/system/database/drivers/interbase/interbase_driver.php index c457f6340..49d3cda87 100644 --- a/system/database/drivers/interbase/interbase_driver.php +++ b/system/database/drivers/interbase/interbase_driver.php @@ -243,35 +243,6 @@ class CI_DB_interbase_driver extends CI_DB { // -------------------------------------------------------------------- - /** - * "Count All" query - * - * Generates a platform-specific query string that counts all records in - * the specified database - * - * @param string - * @return string - */ - public function count_all($table = '') - { - if ($table == '') - { - return 0; - } - - $query = $this->query($this->_count_string.$this->protect_identifiers('numrows').' FROM '.$this->protect_identifiers($table, TRUE, NULL, FALSE)); - if ($query->num_rows() == 0) - { - return 0; - } - - $query = $query->row(); - $this->_reset_select(); - return (int) $query->numrows; - } - - // -------------------------------------------------------------------- - /** * List table query * diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php index 914de499f..342ff2647 100644 --- a/system/database/drivers/mssql/mssql_driver.php +++ b/system/database/drivers/mssql/mssql_driver.php @@ -303,35 +303,6 @@ class CI_DB_mssql_driver extends CI_DB { // -------------------------------------------------------------------- - /** - * "Count All" query - * - * Generates a platform-specific query string that counts all records in - * the specified database - * - * @param string - * @return string - */ - public function count_all($table = '') - { - if ($table == '') - { - return 0; - } - - $query = $this->query($this->_count_string.$this->protect_identifiers('numrows').' FROM '.$this->protect_identifiers($table, TRUE, NULL, FALSE)); - if ($query->num_rows() == 0) - { - return 0; - } - - $row = $query->row(); - $this->_reset_select(); - return (int) $row->numrows; - } - - // -------------------------------------------------------------------- - /** * List table query * diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php index d801a9aaf..7a1a7b9a2 100644 --- a/system/database/drivers/mysql/mysql_driver.php +++ b/system/database/drivers/mysql/mysql_driver.php @@ -325,35 +325,6 @@ class CI_DB_mysql_driver extends CI_DB { // -------------------------------------------------------------------- - /** - * "Count All" query - * - * Generates a platform-specific query string that counts all records in - * the specified database - * - * @param string - * @return string - */ - public function count_all($table = '') - { - if ($table == '') - { - return 0; - } - - $query = $this->query($this->_count_string.$this->protect_identifiers('numrows').' FROM '.$this->protect_identifiers($table, TRUE, NULL, FALSE)); - if ($query->num_rows() == 0) - { - return 0; - } - - $query = $query->row(); - $this->_reset_select(); - return (int) $query->numrows; - } - - // -------------------------------------------------------------------- - /** * List table query * diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php index 61761e0c6..dd544f686 100644 --- a/system/database/drivers/mysqli/mysqli_driver.php +++ b/system/database/drivers/mysqli/mysqli_driver.php @@ -325,35 +325,6 @@ class CI_DB_mysqli_driver extends CI_DB { // -------------------------------------------------------------------- - /** - * "Count All" query - * - * Generates a platform-specific query string that counts all records in - * the specified database - * - * @param string - * @return string - */ - public function count_all($table = '') - { - if ($table == '') - { - return 0; - } - - $query = $this->query($this->_count_string.$this->protect_identifiers('numrows').' FROM '.$this->protect_identifiers($table, TRUE, NULL, FALSE)); - if ($query->num_rows() == 0) - { - return 0; - } - - $query = $query->row(); - $this->_reset_select(); - return (int) $query->numrows; - } - - // -------------------------------------------------------------------- - /** * List table query * diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php index e2fa51349..b979c8a17 100644 --- a/system/database/drivers/oci8/oci8_driver.php +++ b/system/database/drivers/oci8/oci8_driver.php @@ -454,35 +454,6 @@ class CI_DB_oci8_driver extends CI_DB { // -------------------------------------------------------------------- - /** - * "Count All" query - * - * Generates a platform-specific query string that counts all records in - * the specified database - * - * @param string - * @return int - */ - public function count_all($table = '') - { - if ($table == '') - { - return 0; - } - - $query = $this->query($this->_count_string.$this->protect_identifiers('numrows').' FROM '.$this->protect_identifiers($table, TRUE, NULL, FALSE)); - if ($query == FALSE) - { - return 0; - } - - $row = $query->row(); - $this->_reset_select(); - return (int) $row->numrows; - } - - // -------------------------------------------------------------------- - /** * Show table query * diff --git a/system/database/drivers/odbc/odbc_driver.php b/system/database/drivers/odbc/odbc_driver.php index e3172117a..98fd806a8 100644 --- a/system/database/drivers/odbc/odbc_driver.php +++ b/system/database/drivers/odbc/odbc_driver.php @@ -244,36 +244,6 @@ class CI_DB_odbc_driver extends CI_DB { // -------------------------------------------------------------------- - /** - * "Count All" query - * - * Generates a platform-specific query string that counts all records in - * the specified database - * - * @param string - * @return string - */ - public function count_all($table = '') - { - if ($table == '') - { - return 0; - } - - $query = $this->query($this->_count_string . $this->protect_identifiers('numrows') . " FROM " . $this->protect_identifiers($table, TRUE, NULL, FALSE)); - - if ($query->num_rows() == 0) - { - return 0; - } - - $row = $query->row(); - $this->_reset_select(); - return (int) $row->numrows; - } - - // -------------------------------------------------------------------- - /** * Show table query * diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php index 4784fc65b..ec7f3e19b 100644 --- a/system/database/drivers/pdo/pdo_driver.php +++ b/system/database/drivers/pdo/pdo_driver.php @@ -408,38 +408,6 @@ class CI_DB_pdo_driver extends CI_DB { // -------------------------------------------------------------------- - /** - * "Count All" query - * - * Generates a platform-specific query string that counts all records in - * the specified database - * - * @param string - * @return string - */ - public function count_all($table = '') - { - if ($table == '') - { - return 0; - } - - $sql = $this->_count_string.$this->protect_identifiers('numrows').' FROM '.$this->protect_identifiers($table, TRUE, NULL, FALSE); - $query = $this->query($sql); - - if ($query->num_rows() == 0) - { - return 0; - } - - $row = $query->row(); - $this->_reset_select(); - - return (int) $row->numrows; - } - - // -------------------------------------------------------------------- - /** * Show table query * diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php index 30689cc70..c2a188416 100644 --- a/system/database/drivers/postgre/postgre_driver.php +++ b/system/database/drivers/postgre/postgre_driver.php @@ -389,35 +389,6 @@ class CI_DB_postgre_driver extends CI_DB { // -------------------------------------------------------------------- - /** - * "Count All" query - * - * Generates a platform-specific query string that counts all records in - * the specified database - * - * @param string - * @return string - */ - public function count_all($table = '') - { - if ($table == '') - { - return 0; - } - - $query = $this->query($this->_count_string.$this->protect_identifiers('numrows').' FROM '.$this->protect_identifiers($table, TRUE, NULL, FALSE)); - if ($query->num_rows() == 0) - { - return 0; - } - - $query = $query->row(); - $this->_reset_select(); - return (int) $query->numrows; - } - - // -------------------------------------------------------------------- - /** * Show table query * diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php index d710b945d..d8b869c2e 100644 --- a/system/database/drivers/sqlite/sqlite_driver.php +++ b/system/database/drivers/sqlite/sqlite_driver.php @@ -267,35 +267,6 @@ class CI_DB_sqlite_driver extends CI_DB { // -------------------------------------------------------------------- - /** - * "Count All" query - * - * Generates a platform-specific query string that counts all records in - * the specified database - * - * @param string - * @return string - */ - public function count_all($table = '') - { - if ($table == '') - { - return 0; - } - - $query = $this->query($this->_count_string.$this->protect_identifiers('numrows').' FROM '.$this->protect_identifiers($table, TRUE, NULL, FALSE)); - if ($query->num_rows() == 0) - { - return 0; - } - - $row = $query->row(); - $this->_reset_select(); - return (int) $row->numrows; - } - - // -------------------------------------------------------------------- - /** * List table query * diff --git a/system/database/drivers/sqlite3/sqlite3_driver.php b/system/database/drivers/sqlite3/sqlite3_driver.php index ad2848ed8..ea4cf2d4f 100644 --- a/system/database/drivers/sqlite3/sqlite3_driver.php +++ b/system/database/drivers/sqlite3/sqlite3_driver.php @@ -244,30 +244,6 @@ class CI_DB_sqlite3_driver extends CI_DB { // -------------------------------------------------------------------- - /** - * "Count All" query - * - * Generates a platform-specific query string that counts all records in - * the specified database - * - * @param string - * @return int - */ - public function count_all($table = '') - { - if ($table == '') - { - return 0; - } - - $result = $this->conn_id->querySingle($this->_count_string.$this->protect_identifiers('numrows') - .' FROM '.$this->protect_identifiers($table, TRUE, NULL, FALSE)); - - return empty($result) ? 0 : (int) $result; - } - - // -------------------------------------------------------------------- - /** * Show table query * diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php index 5a24f5532..961066da7 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_driver.php +++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php @@ -278,35 +278,6 @@ class CI_DB_sqlsrv_driver extends CI_DB { // -------------------------------------------------------------------- - /** - * "Count All" query - * - * Generates a platform-specific query string that counts all records in - * the specified database - * - * @param string - * @return int - */ - public function count_all($table = '') - { - if ($table == '') - { - return 0; - } - - $query = $this->query("SELECT COUNT(*) AS numrows FROM " . $this->dbprefix . $table); - if ($query->num_rows() == 0) - { - return 0; - } - - $row = $query->row(); - $this->_reset_select(); - return (int) $row->numrows; - } - - // -------------------------------------------------------------------- - /** * List table query * -- cgit v1.2.3-24-g4f1b From 650f2a2bc15dd575f50446dcc1315c131652ca49 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 26 May 2012 18:56:29 +0300 Subject: Fix issue #862 --- system/database/drivers/mssql/mssql_forge.php | 39 ++++++++----------------- system/database/drivers/sqlsrv/sqlsrv_forge.php | 39 ++++++++----------------- user_guide_src/source/changelog.rst | 1 + 3 files changed, 25 insertions(+), 54 deletions(-) diff --git a/system/database/drivers/mssql/mssql_forge.php b/system/database/drivers/mssql/mssql_forge.php index 8f8e7c5b9..bbf2d9685 100644 --- a/system/database/drivers/mssql/mssql_forge.php +++ b/system/database/drivers/mssql/mssql_forge.php @@ -48,16 +48,13 @@ class CI_DB_mssql_forge extends CI_DB_forge { */ protected function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) { - $sql = 'CREATE TABLE '; + $sql = ($if_not_exists === TRUE) + ? "IF NOT EXISTS (SELECT * FROM sysobjects WHERE ID = object_id(N'".$table."') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)\n" + : ''; - if ($if_not_exists === TRUE) - { - $sql .= 'IF NOT EXISTS '; - } + $sql .= 'CREATE TABLE '.$this->db->escape_identifiers($table).' ('; - $sql .= $this->db->escape_identifiers($table).' ('; $current_field_count = 0; - foreach ($fields as $field => $attributes) { // Numeric field names aren't allowed in databases, so if the key is @@ -65,15 +62,13 @@ class CI_DB_mssql_forge extends CI_DB_forge { // entered the field information, so we'll simply add it to the list if (is_numeric($field)) { - $sql .= "\n\t$attributes"; + $sql .= "\n\t".$attributes; } else { $attributes = array_change_key_case($attributes, CASE_UPPER); - $sql .= "\n\t".$this->db->protect_identifiers($field); - - $sql .= ' '.$attributes['TYPE']; + $sql .= "\n\t".$this->db->escape_identifiers($field).' '.$attributes['TYPE']; if (array_key_exists('CONSTRAINT', $attributes)) { @@ -115,7 +110,7 @@ class CI_DB_mssql_forge extends CI_DB_forge { if (count($primary_keys) > 0) { $primary_keys = $this->db->protect_identifiers($primary_keys); - $sql .= ",\n\tPRIMARY KEY (" . implode(', ', $primary_keys) . ")"; + $sql .= ",\n\tPRIMARY KEY (".implode(', ', $primary_keys).')'; } if (is_array($keys) && count($keys) > 0) @@ -131,13 +126,11 @@ class CI_DB_mssql_forge extends CI_DB_forge { $key = array($this->db->protect_identifiers($key)); } - $sql .= ",\n\tFOREIGN KEY (" . implode(', ', $key) . ")"; + $sql .= ",\n\tFOREIGN KEY (".implode(', ', $key).')'; } } - $sql .= "\n)"; - - return $sql; + return $sql."\n)"; } // -------------------------------------------------------------------- @@ -167,21 +160,14 @@ class CI_DB_mssql_forge extends CI_DB_forge { return $sql; } - $sql .= " $column_definition"; + $sql .= " ".$column_definition; if ($default_value != '') { - $sql .= " DEFAULT \"$default_value\""; + $sql .= " DEFAULT '".$default_value."'"; } - if ($null === NULL) - { - $sql .= ' NULL'; - } - else - { - $sql .= ' NOT NULL'; - } + $sql .= ($null === NULL) ? ' NULL' : ' NOT NULL'; if ($after_field != '') { @@ -189,7 +175,6 @@ class CI_DB_mssql_forge extends CI_DB_forge { } return $sql; - } } diff --git a/system/database/drivers/sqlsrv/sqlsrv_forge.php b/system/database/drivers/sqlsrv/sqlsrv_forge.php index e9143b269..c817c2c5d 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_forge.php +++ b/system/database/drivers/sqlsrv/sqlsrv_forge.php @@ -48,16 +48,13 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { */ protected function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) { - $sql = 'CREATE TABLE '; + $sql = ($if_not_exists === TRUE) + ? "IF NOT EXISTS (SELECT * FROM sysobjects WHERE ID = object_id(N'".$table."') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)\n" + : ''; - if ($if_not_exists === TRUE) - { - $sql .= 'IF NOT EXISTS '; - } + $sql .= 'CREATE TABLE '.$this->db->escape_identifiers($table).' ('; - $sql .= $this->db->escape_identifiers($table).' ('; $current_field_count = 0; - foreach ($fields as $field => $attributes) { // Numeric field names aren't allowed in databases, so if the key is @@ -65,15 +62,13 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { // entered the field information, so we'll simply add it to the list if (is_numeric($field)) { - $sql .= "\n\t$attributes"; + $sql .= "\n\t".$attributes; } else { $attributes = array_change_key_case($attributes, CASE_UPPER); - $sql .= "\n\t".$this->db->protect_identifiers($field); - - $sql .= ' '.$attributes['TYPE']; + $sql .= "\n\t".$this->db->escape_identifiers($field).' '.$attributes['TYPE']; if (array_key_exists('CONSTRAINT', $attributes)) { @@ -115,7 +110,7 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { if (count($primary_keys) > 0) { $primary_keys = $this->db->protect_identifiers($primary_keys); - $sql .= ",\n\tPRIMARY KEY (" . implode(', ', $primary_keys) . ")"; + $sql .= ",\n\tPRIMARY KEY (".implode(', ', $primary_keys).')'; } if (is_array($keys) && count($keys) > 0) @@ -131,13 +126,11 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { $key = array($this->db->protect_identifiers($key)); } - $sql .= ",\n\tFOREIGN KEY (" . implode(', ', $key) . ")"; + $sql .= ",\n\tFOREIGN KEY (".implode(', ', $key).')'; } } - $sql .= "\n)"; - - return $sql; + return $sql."\n)"; } // -------------------------------------------------------------------- @@ -167,21 +160,14 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { return $sql; } - $sql .= " $column_definition"; + $sql .= ' '.$column_definition; if ($default_value != '') { - $sql .= " DEFAULT \"$default_value\""; + $sql .= " DEFAULT '".$default_value."'"; } - if ($null === NULL) - { - $sql .= ' NULL'; - } - else - { - $sql .= ' NOT NULL'; - } + $sql .= ($null === NULL) ? ' NULL' : ' NOT NULL'; if ($after_field != '') { @@ -189,7 +175,6 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { } return $sql; - } } diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 4b8a0f2d3..a234d6969 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -220,6 +220,7 @@ Bug fixes for 3.0 - Fixed a bug (#121) - ``CI_DB_result::row()`` returned an array when there's no actual result to be returned. - Fixed a bug (#319) - SQLSRV's affected_rows() method failed due to a scrollable cursor being created for write-type queries. - Fixed a bug (#356) - PostgreSQL driver didn't have an _update_batch() method, which resulted in fatal error being triggered when update_batch() is used with it. +- Fixed a bug (#862) - create_table() failed on SQLSRV/MSSQL when used with 'IF NOT EXISTS'. Version 2.1.1 ============= -- cgit v1.2.3-24-g4f1b From 6c7526c95b3fbd502dc8105a67fd38da793caa4e Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Sun, 27 May 2012 13:51:27 +0700 Subject: Continuation for Security and Table code-coverage, add coverage report to travis --- .travis.yml | 2 +- system/core/Security.php | 1 + tests/codeigniter/core/Security_test.php | 32 ++++++++++++++++++++++++++++++ tests/codeigniter/libraries/Table_test.php | 24 ++++++++++++++++++++-- tests/mocks/autoloader.php | 4 ++-- tests/travis/mysql.phpunit.xml | 11 +++++----- tests/travis/pdo/mysql.phpunit.xml | 11 +++++----- tests/travis/pdo/pgsql.phpunit.xml | 11 +++++----- tests/travis/pdo/sqlite.phpunit.xml | 11 +++++----- tests/travis/pgsql.phpunit.xml | 11 +++++----- tests/travis/sqlite.phpunit.xml | 11 +++++----- 11 files changed, 88 insertions(+), 41 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6a7d37812..31b74b13b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ before_script: - sh -c "if [ '$DB' = 'pgsql' ] || [ '$DB' = 'pdo/pgsql' ]; then psql -c 'create database ci_test;' -U postgres; fi" - sh -c "if [ '$DB' = 'mysql' ] || [ '$DB' = 'pdo/mysql' ]; then mysql -e 'create database IF NOT EXISTS ci_test;'; fi" -script: phpunit --configuration tests/travis/$DB.phpunit.xml +script: phpunit --coverage-text --configuration tests/travis/$DB.phpunit.xml branches: only: diff --git a/system/core/Security.php b/system/core/Security.php index f953011eb..9b7ba5799 100755 --- a/system/core/Security.php +++ b/system/core/Security.php @@ -191,6 +191,7 @@ class CI_Security { * Set Cross Site Request Forgery Protection Cookie * * @return object + * @codeCoverageIgnore */ public function csrf_set_cookie() { diff --git a/tests/codeigniter/core/Security_test.php b/tests/codeigniter/core/Security_test.php index 1796ba74d..b2f8c69d2 100644 --- a/tests/codeigniter/core/Security_test.php +++ b/tests/codeigniter/core/Security_test.php @@ -70,4 +70,36 @@ class Security_test extends CI_TestCase { $this->assertEquals("Hello, i try to [removed]alert('Hack');[removed] your site", $harmless_string); } + + // -------------------------------------------------------------------- + + public function test_xss_hash() + { + $this->assertEmpty($this->security->xss_hash); + + // Perform hash + $this->security->xss_hash(); + + $this->assertTrue(preg_match('#^[0-9a-f]{32}$#iS', $this->security->xss_hash) === 1); + } + + // -------------------------------------------------------------------- + + public function test_entity_decode() + { + $encoded = '<div>Hello <b>Booya</b></div>'; + $decoded = $this->security->entity_decode($encoded); + + $this->assertEquals('
    Hello Booya
    ', $decoded); + } + + // -------------------------------------------------------------------- + + public function test_sanitize_filename() + { + $filename = './'; + $safe_filename = $this->security->sanitize_filename($filename); + + $this->assertEquals('foo', $safe_filename); + } } \ No newline at end of file diff --git a/tests/codeigniter/libraries/Table_test.php b/tests/codeigniter/libraries/Table_test.php index 13f338c6b..f5133de1e 100644 --- a/tests/codeigniter/libraries/Table_test.php +++ b/tests/codeigniter/libraries/Table_test.php @@ -291,6 +291,26 @@ class Table_test extends CI_TestCase { ); } - // Test main generate method - // -------------------------------------------------------------------- + function test_generate() + { + // Prepare the data + $data = array( + array('Name', 'Color', 'Size'), + array('Fred', 'Blue', 'Small'), + array('Mary', 'Red', 'Large'), + array('John', 'Green', 'Medium') + ); + + $table = $this->table->generate($data); + + // Test the table header + $this->assertTrue(strpos($table, 'Name') !== FALSE); + $this->assertTrue(strpos($table, 'Color') !== FALSE); + $this->assertTrue(strpos($table, 'Size') !== FALSE); + + // Test the first entry + $this->assertTrue(strpos($table, 'Fred') !== FALSE); + $this->assertTrue(strpos($table, 'Blue') !== FALSE); + $this->assertTrue(strpos($table, 'Small') !== FALSE); + } } \ No newline at end of file diff --git a/tests/mocks/autoloader.php b/tests/mocks/autoloader.php index 92c9bea59..441c88944 100644 --- a/tests/mocks/autoloader.php +++ b/tests/mocks/autoloader.php @@ -22,7 +22,7 @@ function autoload($class) ); $ci_libraries = array( - 'Calendar', 'Cart', 'Driver', + 'Calendar', 'Cart', 'Driver_Library', 'Email', 'Encrypt', 'Form_validation', 'Ftp', 'Image_lib', 'Javascript', 'Log', 'Migration', 'Pagination', @@ -50,7 +50,7 @@ function autoload($class) elseif (in_array($subclass, $ci_libraries)) { $dir = BASEPATH.'libraries'.DIRECTORY_SEPARATOR; - $class = $subclass; + $class = ($subclass == 'Driver_Library') ? 'Driver' : $subclass; } elseif (preg_match('/^CI_DB_(.+)_(driver|forge|result|utility)$/', $class, $m) && count($m) == 3) { diff --git a/tests/travis/mysql.phpunit.xml b/tests/travis/mysql.phpunit.xml index 1792ae38d..38c8eba48 100644 --- a/tests/travis/mysql.phpunit.xml +++ b/tests/travis/mysql.phpunit.xml @@ -17,10 +17,9 @@ ../codeigniter - - - PEAR_INSTALL_DIR - PHP_LIBDIR - - + + + ../../system + + \ No newline at end of file diff --git a/tests/travis/pdo/mysql.phpunit.xml b/tests/travis/pdo/mysql.phpunit.xml index 602030d4e..c3113a66f 100644 --- a/tests/travis/pdo/mysql.phpunit.xml +++ b/tests/travis/pdo/mysql.phpunit.xml @@ -17,10 +17,9 @@ ../../codeigniter - - - PEAR_INSTALL_DIR - PHP_LIBDIR - - + + + ../../../system + + \ No newline at end of file diff --git a/tests/travis/pdo/pgsql.phpunit.xml b/tests/travis/pdo/pgsql.phpunit.xml index 77e1493c6..232025523 100644 --- a/tests/travis/pdo/pgsql.phpunit.xml +++ b/tests/travis/pdo/pgsql.phpunit.xml @@ -17,10 +17,9 @@ ../../codeigniter - - - PEAR_INSTALL_DIR - PHP_LIBDIR - - + + + ../../../system + + \ No newline at end of file diff --git a/tests/travis/pdo/sqlite.phpunit.xml b/tests/travis/pdo/sqlite.phpunit.xml index cdccef017..3d1256721 100644 --- a/tests/travis/pdo/sqlite.phpunit.xml +++ b/tests/travis/pdo/sqlite.phpunit.xml @@ -17,10 +17,9 @@ ../../codeigniter - - - PEAR_INSTALL_DIR - PHP_LIBDIR - - + + + ../../../system + + \ No newline at end of file diff --git a/tests/travis/pgsql.phpunit.xml b/tests/travis/pgsql.phpunit.xml index dfc1bff1c..51e433d76 100644 --- a/tests/travis/pgsql.phpunit.xml +++ b/tests/travis/pgsql.phpunit.xml @@ -17,10 +17,9 @@ ../codeigniter - - - PEAR_INSTALL_DIR - PHP_LIBDIR - - + + + ../../system + + \ No newline at end of file diff --git a/tests/travis/sqlite.phpunit.xml b/tests/travis/sqlite.phpunit.xml index 3223da5e7..701165734 100644 --- a/tests/travis/sqlite.phpunit.xml +++ b/tests/travis/sqlite.phpunit.xml @@ -17,10 +17,9 @@ ../codeigniter - - - PEAR_INSTALL_DIR - PHP_LIBDIR - - + + + ../../system + + \ No newline at end of file -- cgit v1.2.3-24-g4f1b From b2e10b7de0d8979ce19fed5859e696904e2923dd Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Sun, 27 May 2012 15:31:53 +0700 Subject: Adding more flexibilities to mock-common --- tests/mocks/core/common.php | 167 +++++++++++++++++++++++++++----------------- 1 file changed, 103 insertions(+), 64 deletions(-) diff --git a/tests/mocks/core/common.php b/tests/mocks/core/common.php index fc94d7fff..e74576626 100644 --- a/tests/mocks/core/common.php +++ b/tests/mocks/core/common.php @@ -2,53 +2,65 @@ // Set up the global CI functions in their most minimal core representation -function &get_instance() +if ( ! function_exists('get_instance')) { - $test = CI_TestCase::instance(); - $instance = $test->ci_instance(); - return $instance; + function &get_instance() + { + $test = CI_TestCase::instance(); + $instance = $test->ci_instance(); + return $instance; + } } // -------------------------------------------------------------------- -function &get_config() { - $test = CI_TestCase::instance(); - $config = $test->ci_get_config(); - - return $config; +if ( ! function_exists('get_config')) +{ + function &get_config() { + $test = CI_TestCase::instance(); + $config = $test->ci_get_config(); + + return $config; + } } -function config_item($item) +if ( ! function_exists('config_item')) { - $config =& get_config(); - - if ( ! isset($config[$item])) + function config_item($item) { - return FALSE; + $config =& get_config(); + + if ( ! isset($config[$item])) + { + return FALSE; + } + + return $config[$item]; } - - return $config[$item]; } // -------------------------------------------------------------------- -function load_class($class, $directory = 'libraries', $prefix = 'CI_') +if ( ! function_exists('load_class')) { - if ($directory != 'core' OR $prefix != 'CI_') - { - throw new Exception('Not Implemented: Non-core load_class()'); - } - - $test = CI_TestCase::instance(); - - $obj =& $test->ci_core_class($class); - - if (is_string($obj)) + function load_class($class, $directory = 'libraries', $prefix = 'CI_') { - throw new Exception('Bad Isolation: Use ci_set_core_class to set '.$class.''); + if ($directory != 'core' OR $prefix != 'CI_') + { + throw new Exception('Not Implemented: Non-core load_class()'); + } + + $test = CI_TestCase::instance(); + + $obj =& $test->ci_core_class($class); + + if (is_string($obj)) + { + throw new Exception('Bad Isolation: Use ci_set_core_class to set '.$class.''); + } + + return $obj; } - - return $obj; } // This is sort of meh. Should probably be mocked up with @@ -57,76 +69,103 @@ function load_class($class, $directory = 'libraries', $prefix = 'CI_') // bootstrap testsuite. // -------------------------------------------------------------------- -function remove_invisible_characters($str, $url_encoded = TRUE) +if ( ! function_exists('remove_invisible_characters')) { - $non_displayables = array(); - - // every control character except newline (dec 10) - // carriage return (dec 13), and horizontal tab (dec 09) - - if ($url_encoded) + function remove_invisible_characters($str, $url_encoded = TRUE) { - $non_displayables[] = '/%0[0-8bcef]/'; // url encoded 00-08, 11, 12, 14, 15 - $non_displayables[] = '/%1[0-9a-f]/'; // url encoded 16-31 - } - - $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127 + $non_displayables = array(); + + // every control character except newline (dec 10) + // carriage return (dec 13), and horizontal tab (dec 09) + + if ($url_encoded) + { + $non_displayables[] = '/%0[0-8bcef]/'; // url encoded 00-08, 11, 12, 14, 15 + $non_displayables[] = '/%1[0-9a-f]/'; // url encoded 16-31 + } + + $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127 - do - { - $str = preg_replace($non_displayables, '', $str, -1, $count); - } - while ($count); + do + { + $str = preg_replace($non_displayables, '', $str, -1, $count); + } + while ($count); - return $str; + return $str; + } } // Clean up error messages // -------------------------------------------------------------------- -function show_error($message, $status_code = 500, $heading = 'An Error Was Encountered') +if ( ! function_exists('show_error')) { - throw new RuntimeException('CI Error: '.$message); + function show_error($message, $status_code = 500, $heading = 'An Error Was Encountered') + { + throw new RuntimeException('CI Error: '.$message); + } } -function show_404($page = '', $log_error = TRUE) +if ( ! function_exists('show_404')) { - throw new RuntimeException('CI Error: 404'); + function show_404($page = '', $log_error = TRUE) + { + throw new RuntimeException('CI Error: 404'); + } } -function _exception_handler($severity, $message, $filepath, $line) +if ( ! function_exists('_exception_handler')) { - throw new RuntimeException('CI Exception: '.$message.' | '.$filepath.' | '.$line); + function _exception_handler($severity, $message, $filepath, $line) + { + throw new RuntimeException('CI Exception: '.$message.' | '.$filepath.' | '.$line); + } } // We assume a few things about our environment ... // -------------------------------------------------------------------- -function is_php($version = '5.0.0') +if ( ! function_exists('is_php')) { - return ! (version_compare(PHP_VERSION, $version) < 0); + function is_php($version = '5.0.0') + { + return ! (version_compare(PHP_VERSION, $version) < 0); + } } -function is_really_writable($file) +if ( ! function_exists('is_really_writable')) { - return is_writable($file); + function is_really_writable($file) + { + return is_writable($file); + } } -function is_loaded() +if ( ! function_exists('is_loaded')) { - throw new Exception('Bad Isolation: mock up environment'); + function is_loaded() + { + throw new Exception('Bad Isolation: mock up environment'); + } } -function log_message($level = 'error', $message, $php_error = FALSE) +if ( ! function_exists('log_message')) { - return TRUE; + function log_message($level = 'error', $message, $php_error = FALSE) + { + return TRUE; + } } -function set_status_header($code = 200, $text = '') +if ( ! function_exists('set_status_header')) { - return TRUE; + function set_status_header($code = 200, $text = '') + { + return TRUE; + } } // EOF \ No newline at end of file -- cgit v1.2.3-24-g4f1b From bf50a3b15c70441a72ec3012319cd63425ba4d20 Mon Sep 17 00:00:00 2001 From: Eric Roberts Date: Sun, 27 May 2012 19:04:43 -0500 Subject: Fix issue where cache backup is ignored on first call. --- system/libraries/Cache/Cache.php | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/system/libraries/Cache/Cache.php b/system/libraries/Cache/Cache.php index ba732ee8e..53f9f81a7 100644 --- a/system/libraries/Cache/Cache.php +++ b/system/libraries/Cache/Cache.php @@ -68,7 +68,7 @@ class CI_Cache extends CI_Driver_Library { * * @param string */ - protected $_backup_driver; + protected $_backup_driver = 'dummy'; /** * Constructor @@ -102,6 +102,22 @@ class CI_Cache extends CI_Driver_Library { $this->_backup_driver = $config['backup']; } } + + // If the specified adapter isn't available, check the backup. + if ( ! $this->is_supported($this->_adapter)) + { + if ( ! $this->is_supported($this->_backup_driver)) + { + // Backup isn't supported either. Default to 'Dummy' driver. + log_message('error', 'Cache adapter "'.$this->_adapter.'" and backup "'.$this->_backup_driver.'" are both unavailable. Cache is now using "Dummy" adapter.'); + $this->_adapter = 'dummy'; + } + else + { + // Backup is supported. Set it to primary. + $this->_adapter = $this->_backup_driver; + } + } } // ------------------------------------------------------------------------ @@ -206,26 +222,6 @@ class CI_Cache extends CI_Driver_Library { return $support[$driver]; } - // ------------------------------------------------------------------------ - - /** - * __get() - * - * @param child - * @return object - */ - public function __get($child) - { - $obj = parent::__get($child); - - if ( ! $this->is_supported($child)) - { - $this->_adapter = $this->_backup_driver; - } - - return $obj; - } - } /* End of file Cache.php */ -- cgit v1.2.3-24-g4f1b From fa5a9e5f28b2ae61748bb20c2f644c3c156c3d5e Mon Sep 17 00:00:00 2001 From: madhazelnut Date: Wed, 30 May 2012 18:50:39 +0300 Subject: create_captcha() helper documentation --- user_guide_src/source/changelog.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index a234d6969..6e528584b 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -40,7 +40,7 @@ Release Date: Not Released - Moved error templates to "application/views/errors" - Helpers - + - create_captcha() accepts additional colors parameter, allowing for color customization - url_title() will now trim extra dashes from beginning and end. - Added XHTML Basic 1.1 doctype to :doc:`HTML Helper `. - Changed humanize() to include a second param for the separator. -- cgit v1.2.3-24-g4f1b From 8bbf4e09b68a4aa9beb85edbdb0bec75c7a51de6 Mon Sep 17 00:00:00 2001 From: vlakoff Date: Thu, 31 May 2012 13:30:22 +0200 Subject: automatic list formatting was broken --- user_guide_src/source/changelog.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 6e528584b..da3be3adb 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -40,6 +40,7 @@ Release Date: Not Released - Moved error templates to "application/views/errors" - Helpers + - create_captcha() accepts additional colors parameter, allowing for color customization - url_title() will now trim extra dashes from beginning and end. - Added XHTML Basic 1.1 doctype to :doc:`HTML Helper `. @@ -110,7 +111,7 @@ Release Date: Not Released - :doc:`Cart library ` changes include: - It now auto-increments quantity's instead of just resetting it, this is the default behaviour of large e-commerce sites. - Product Name strictness can be disabled via the Cart Library by switching "$product_name_safe". - - Added function remove() to remove a cart item, updating with quantity of 0 seemed like a hack but has remained to retain compatability. + - Added function remove() to remove a cart item, updating with quantity of 0 seemed like a hack but has remained to retain compatibility. - :doc:`Image Manipulation library ` changes include: - The initialize() method now only sets existing class properties. - Added support for 3-length hex color values for wm_font_color and wm_shadow_color properties, as well as validation for them. -- cgit v1.2.3-24-g4f1b From b6e0b588522055ddffc44e63e5479309fa3b4b14 Mon Sep 17 00:00:00 2001 From: Thanasis Polychronakis Date: Mon, 14 May 2012 21:31:04 +0300 Subject: Load base config first, then environment's config --- system/core/Common.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/system/core/Common.php b/system/core/Common.php index 4b733ac97..f468747c6 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -231,21 +231,21 @@ if ( ! function_exists('get_config')) return $_config[0]; } - // Is the config file in the environment folder? - if ( ! defined('ENVIRONMENT') OR ! file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/config.php')) - { - $file_path = APPPATH.'config/config.php'; + $file_path = APPPATH.'config/config.php'; + $found = false; + if (file_exists($file_path)) { + $found = true; + require($file_path); } - // Fetch the config file - if ( ! file_exists($file_path)) + // Is the config file in the environment folder? + if (defined(ENVIRONMENT) && file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/config.php')) { - set_status_header(503); + require($file_path); + } else if (!$found) { exit('The configuration file does not exist.'); } - require($file_path); - // Does the $config array exist in the file? if ( ! isset($config) OR ! is_array($config)) { -- cgit v1.2.3-24-g4f1b From 8991cb85b9d9955270bdbbd96a08ba9141c5e11d Mon Sep 17 00:00:00 2001 From: Thanasis Polychronakis Date: Sun, 20 May 2012 18:44:21 +0300 Subject: Indended code to meet CI standards --- system/core/Common.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/system/core/Common.php b/system/core/Common.php index f468747c6..8ed18cdae 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -233,7 +233,8 @@ if ( ! function_exists('get_config')) $file_path = APPPATH.'config/config.php'; $found = false; - if (file_exists($file_path)) { + if (file_exists($file_path)) + { $found = true; require($file_path); } @@ -242,7 +243,10 @@ if ( ! function_exists('get_config')) if (defined(ENVIRONMENT) && file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/config.php')) { require($file_path); - } else if (!$found) { + } + else if (!$found) + { + set_status_header(503); exit('The configuration file does not exist.'); } -- cgit v1.2.3-24-g4f1b From 142eef9c0024420fdc1442eafe8e5cdd357451bb Mon Sep 17 00:00:00 2001 From: Thanasis Polychronakis Date: Mon, 21 May 2012 14:38:22 +0300 Subject: Edit to meet CI coding standards --- system/core/Common.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/system/core/Common.php b/system/core/Common.php index 8ed18cdae..159cc0d2b 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -232,10 +232,10 @@ if ( ! function_exists('get_config')) } $file_path = APPPATH.'config/config.php'; - $found = false; + $found = FALSE; if (file_exists($file_path)) { - $found = true; + $found = TRUE; require($file_path); } @@ -244,7 +244,7 @@ if ( ! function_exists('get_config')) { require($file_path); } - else if (!$found) + elseif ( ! $found) { set_status_header(503); exit('The configuration file does not exist.'); -- cgit v1.2.3-24-g4f1b From 991cfa2e5843df05c6295445133882b9f35e3f7b Mon Sep 17 00:00:00 2001 From: Thanasis Polychronakis Date: Thu, 31 May 2012 21:54:35 +0300 Subject: Changed documentation and added note to changelog as per @philsturgeon request --- user_guide_src/source/changelog.rst | 1 + user_guide_src/source/libraries/config.rst | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index da3be3adb..3989b52d2 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -38,6 +38,7 @@ Release Date: Not Released - Added some more doctypes. - Updated all classes to be written in PHP 5 style, with visibility declarations and no ``var`` usage for properties. - Moved error templates to "application/views/errors" + - Global config files are loaded first, then environment ones. Environment config keys overwrite base ones, allowing to only set the keys we want changed per Env. - Helpers diff --git a/user_guide_src/source/libraries/config.rst b/user_guide_src/source/libraries/config.rst index c81cad7b3..08d9c2905 100644 --- a/user_guide_src/source/libraries/config.rst +++ b/user_guide_src/source/libraries/config.rst @@ -149,11 +149,13 @@ folders: - Your own custom configuration files .. note:: - CodeIgniter always tries to load the configuration files for - the current environment first. If the file does not exist, the global - config file (i.e., the one in application/config/) is loaded. This means - you are not obligated to place **all** of your configuration files in an - environment folder − only the files that change per environment. + CodeIgniter always loads the global config file first (i.e., the one in application/config/), + then tries to load the configuration files for the current environment. + This means you are not obligated to place **all** of your configuration files in an + environment folder. Only the files that change per environment. Additionally you don't + have to copy **all** the config items in the environment config file. Only the config items + that you wish to change for your environment. The config items declared in your environment + folders always overwrite those in your global config files. Helper Functions ================ -- cgit v1.2.3-24-g4f1b From bfc1cad4fbf6d6640d782f39169af6c3799fa3e8 Mon Sep 17 00:00:00 2001 From: Mickey Wu Date: Thu, 31 May 2012 22:28:40 -0700 Subject: Made set_header() public in Email library and updated documentation. --- system/libraries/Email.php | 32 +++++++++++++++---------------- user_guide_src/source/libraries/email.rst | 8 ++++++++ 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/system/libraries/Email.php b/system/libraries/Email.php index 56d60c802..07a0dd584 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -166,8 +166,8 @@ class CI_Email { $this->_headers = array(); $this->_debug_msg = array(); - $this->_set_header('User-Agent', $this->useragent); - $this->_set_header('Date', $this->_set_date()); + $this->set_header('User-Agent', $this->useragent); + $this->set_header('Date', $this->_set_date()); if ($clear_attachments !== FALSE) { @@ -215,8 +215,8 @@ class CI_Email { } } - $this->_set_header('From', $name.' <'.$from.'>'); - $this->_set_header('Return-Path', '<'.$from.'>'); + $this->set_header('From', $name.' <'.$from.'>'); + $this->set_header('Return-Path', '<'.$from.'>'); return $this; } @@ -252,7 +252,7 @@ class CI_Email { $name = '"'.$name.'"'; } - $this->_set_header('Reply-To', $name.' <'.$replyto.'>'); + $this->set_header('Reply-To', $name.' <'.$replyto.'>'); $this->_replyto_flag = TRUE; return $this; @@ -278,7 +278,7 @@ class CI_Email { if ($this->_get_protocol() !== 'mail') { - $this->_set_header('To', implode(', ', $to)); + $this->set_header('To', implode(', ', $to)); } switch ($this->_get_protocol()) @@ -312,7 +312,7 @@ class CI_Email { $this->validate_email($cc); } - $this->_set_header('Cc', implode(', ', $cc)); + $this->set_header('Cc', implode(', ', $cc)); if ($this->_get_protocol() === 'smtp') { @@ -352,7 +352,7 @@ class CI_Email { } else { - $this->_set_header('Bcc', implode(', ', $bcc)); + $this->set_header('Bcc', implode(', ', $bcc)); } return $this; @@ -369,7 +369,7 @@ class CI_Email { public function subject($subject) { $subject = $this->_prep_q_encoding($subject); - $this->_set_header('Subject', $subject); + $this->set_header('Subject', $subject); return $this; } @@ -424,7 +424,7 @@ class CI_Email { * @param string * @return void */ - protected function _set_header($header, $value) + public function set_header($header, $value) { $this->_headers[$header] = $value; } @@ -867,11 +867,11 @@ class CI_Email { */ protected function _build_headers() { - $this->_set_header('X-Sender', $this->clean_email($this->_headers['From'])); - $this->_set_header('X-Mailer', $this->useragent); - $this->_set_header('X-Priority', $this->_priorities[$this->priority - 1]); - $this->_set_header('Message-ID', $this->_get_message_id()); - $this->_set_header('Mime-Version', '1.0'); + $this->set_header('X-Sender', $this->clean_email($this->_headers['From'])); + $this->set_header('X-Mailer', $this->useragent); + $this->set_header('X-Priority', $this->_priorities[$this->priority - 1]); + $this->set_header('Message-ID', $this->_get_message_id()); + $this->set_header('Mime-Version', '1.0'); } // -------------------------------------------------------------------- @@ -1305,7 +1305,7 @@ class CI_Email { if ($this->protocol !== 'smtp') { - $this->_set_header('Bcc', implode(', ', $bcc)); + $this->set_header('Bcc', implode(', ', $bcc)); } else { diff --git a/user_guide_src/source/libraries/email.rst b/user_guide_src/source/libraries/email.rst index daf000907..f99eb91df 100644 --- a/user_guide_src/source/libraries/email.rst +++ b/user_guide_src/source/libraries/email.rst @@ -182,6 +182,14 @@ formatting which is added to the header string for people who do not accept HTML email. If you do not set your own message CodeIgniter will extract the message from your HTML email and strip the tags. +$this->email->set_header() +----------------------- + +Appends additional headers to the e-mail:: + + $this->email->set_header('Header1', 'Value1'); + $this->email->set_header('Header2', 'Value2'); + $this->email->clear() --------------------- -- cgit v1.2.3-24-g4f1b From 2e757d844caede9784da0b30faa7d5c405c6b172 Mon Sep 17 00:00:00 2001 From: Mickey Wu Date: Fri, 1 Jun 2012 10:24:22 -0700 Subject: Update user_guide_src/source/changelog.rst --- user_guide_src/source/changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index da3be3adb..13482d826 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -132,6 +132,7 @@ Release Date: Not Released - Allowed for setting table class defaults in a config file. - Added a Wincache driver to the :doc:`Caching Library `. - Added dsn (delivery status notification) option to the :doc:`Email Library `. + - Enabled public access to Email library's set_header() for adding additional headers to e-mails. - Core -- cgit v1.2.3-24-g4f1b From ed944a3c70a0bad158cd5a6ca5ce1f2e717aff5d Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Sat, 2 Jun 2012 11:07:47 +0100 Subject: Replaced `==` with `===` and `!=` with `!==` in /system/core --- system/core/Benchmark.php | 2 +- system/core/CodeIgniter.php | 4 ++-- system/core/Common.php | 14 +++++++------- system/core/Config.php | 14 +++++++------- system/core/Hooks.php | 2 +- system/core/Input.php | 18 +++++++++--------- system/core/Lang.php | 14 +++++++------- system/core/Loader.php | 26 +++++++++++++------------- system/core/Output.php | 14 +++++++------- system/core/Router.php | 8 ++++---- system/core/Security.php | 8 ++++---- system/core/URI.php | 14 +++++++------- system/core/Utf8.php | 2 +- 13 files changed, 70 insertions(+), 70 deletions(-) diff --git a/system/core/Benchmark.php b/system/core/Benchmark.php index bb630f40b..2fabdf46e 100755 --- a/system/core/Benchmark.php +++ b/system/core/Benchmark.php @@ -79,7 +79,7 @@ class CI_Benchmark { */ public function elapsed_time($point1 = '', $point2 = '', $decimals = 4) { - if ($point1 == '') + if ($point1 === '') { return '{elapsed_time}'; } diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php index c8245fcfa..182f17ab3 100755 --- a/system/core/CodeIgniter.php +++ b/system/core/CodeIgniter.php @@ -94,7 +94,7 @@ * Note: Since the config file data is cached it doesn't * hurt to load it here. */ - if (isset($assign_to_config['subclass_prefix']) && $assign_to_config['subclass_prefix'] != '') + if (isset($assign_to_config['subclass_prefix']) && $assign_to_config['subclass_prefix'] !== '') { get_config(array('subclass_prefix' => $assign_to_config['subclass_prefix'])); } @@ -182,7 +182,7 @@ * ------------------------------------------------------ */ if ($EXT->call_hook('cache_override') === FALSE - && $OUT->_display_cache($CFG, $URI) == TRUE) + && $OUT->_display_cache($CFG, $URI) === TRUE) { exit; } diff --git a/system/core/Common.php b/system/core/Common.php index 159cc0d2b..a773c4f20 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -200,7 +200,7 @@ if ( ! function_exists('is_loaded')) { static $_is_loaded = array(); - if ($class != '') + if ($class !== '') { $_is_loaded[strtolower($class)] = $class; } @@ -370,7 +370,7 @@ if ( ! function_exists('log_message')) { static $_log; - if (config_item('log_threshold') == 0) + if (config_item('log_threshold') === 0) { return; } @@ -436,17 +436,17 @@ if ( ! function_exists('set_status_header')) 505 => 'HTTP Version Not Supported' ); - if ($code == '' OR ! is_numeric($code)) + if ($code === '' OR ! is_numeric($code)) { show_error('Status codes must be numeric', 500); } - if (isset($stati[$code]) && $text == '') + if (isset($stati[$code]) && $text === '') { $text = $stati[$code]; } - if ($text == '') + if ($text === '') { show_error('No status text available. Please check your status code number or supply your own message text.', 500); } @@ -495,13 +495,13 @@ if ( ! function_exists('_exception_handler')) // Should we display the error? We'll get the current error_reporting // level and add its bits with the severity bits to find out. - if (($severity & error_reporting()) == $severity) + if (($severity & error_reporting()) === $severity) { $_error->show_php_error($severity, $message, $filepath, $line); } // Should we log the error? No? We're done... - if (config_item('log_threshold') == 0) + if (config_item('log_threshold') === 0) { return; } diff --git a/system/core/Config.php b/system/core/Config.php index c07ffa591..0e5fa5265 100755 --- a/system/core/Config.php +++ b/system/core/Config.php @@ -100,7 +100,7 @@ class CI_Config { */ public function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE) { - $file = ($file == '') ? 'config' : str_replace('.php', '', $file); + $file = ($file === '') ? 'config' : str_replace('.php', '', $file); $found = $loaded = FALSE; foreach ($this->_config_paths as $path) @@ -189,7 +189,7 @@ class CI_Config { */ public function item($item, $index = '') { - if ($index == '') + if ($index === '') { return isset($this->config[$item]) ? $this->config[$item] : FALSE; } @@ -211,7 +211,7 @@ class CI_Config { { return FALSE; } - elseif (trim($this->config[$item]) == '') + elseif (trim($this->config[$item]) === '') { return ''; } @@ -230,14 +230,14 @@ class CI_Config { */ public function site_url($uri = '') { - if ($uri == '') + if ($uri === '') { return $this->slash_item('base_url').$this->item('index_page'); } - if ($this->item('enable_query_strings') == FALSE) + if ($this->item('enable_query_strings') === FALSE) { - $suffix = ($this->item('url_suffix') == FALSE) ? '' : $this->item('url_suffix'); + $suffix = ($this->item('url_suffix') === FALSE) ? '' : $this->item('url_suffix'); return $this->slash_item('base_url').$this->slash_item('index_page').$this->_uri_string($uri).$suffix; } else @@ -270,7 +270,7 @@ class CI_Config { */ protected function _uri_string($uri) { - if ($this->item('enable_query_strings') == FALSE) + if ($this->item('enable_query_strings') === FALSE) { if (is_array($uri)) { diff --git a/system/core/Hooks.php b/system/core/Hooks.php index 5bbb0009a..29fd88201 100755 --- a/system/core/Hooks.php +++ b/system/core/Hooks.php @@ -72,7 +72,7 @@ class CI_Hooks { // If hooks are not enabled in the config file // there is nothing else to do - if ($CFG->item('enable_hooks') == FALSE) + if ($CFG->item('enable_hooks') === FALSE) { return; } diff --git a/system/core/Input.php b/system/core/Input.php index 97be9e690..284b15697 100755 --- a/system/core/Input.php +++ b/system/core/Input.php @@ -263,23 +263,23 @@ class CI_Input { } } - if ($prefix == '' && config_item('cookie_prefix') != '') + if ($prefix === '' && config_item('cookie_prefix') !== '') { $prefix = config_item('cookie_prefix'); } - if ($domain == '' && config_item('cookie_domain') != '') + if ($domain === '' && config_item('cookie_domain') !== '') { $domain = config_item('cookie_domain'); } - if ($path == '/' && config_item('cookie_path') !== '/') + if ($path === '/' && config_item('cookie_path') !== '/') { $path = config_item('cookie_path'); } - if ($secure == FALSE && config_item('cookie_secure') != FALSE) + if ($secure === FALSE && config_item('cookie_secure') !== FALSE) { $secure = config_item('cookie_secure'); } - if ($httponly == FALSE && config_item('cookie_httponly') != FALSE) + if ($httponly === FALSE && config_item('cookie_httponly') !== FALSE) { $httponly = config_item('cookie_httponly'); } @@ -324,7 +324,7 @@ class CI_Input { return $this->ip_address; } - if (config_item('proxy_ips') != '' && $this->server('HTTP_X_FORWARDED_FOR') && $this->server('REMOTE_ADDR')) + if (config_item('proxy_ips') !== '' && $this->server('HTTP_X_FORWARDED_FOR') && $this->server('REMOTE_ADDR')) { $proxies = preg_split('/[\s,]/', config_item('proxy_ips'), -1, PREG_SPLIT_NO_EMPTY); $proxies = is_array($proxies) ? $proxies : array($proxies); @@ -459,7 +459,7 @@ class CI_Input { } // Is $_GET data allowed? If not we'll set the $_GET to an empty array - if ($this->_allow_get_array == FALSE) + if ($this->_allow_get_array === FALSE) { $_GET = array(); } @@ -502,7 +502,7 @@ class CI_Input { $_SERVER['PHP_SELF'] = strip_tags($_SERVER['PHP_SELF']); // CSRF Protection check - if ($this->_enable_csrf == TRUE) + if ($this->_enable_csrf === TRUE) { $this->security->csrf_verify(); } @@ -559,7 +559,7 @@ class CI_Input { } // Standardize newlines if needed - if ($this->_standardize_newlines == TRUE && strpos($str, "\r") !== FALSE) + if ($this->_standardize_newlines === TRUE && strpos($str, "\r") !== FALSE) { return str_replace(array("\r\n", "\r", "\r\n\n"), PHP_EOL, $str); } diff --git a/system/core/Lang.php b/system/core/Lang.php index 73c9127ac..3001f1b13 100755 --- a/system/core/Lang.php +++ b/system/core/Lang.php @@ -76,26 +76,26 @@ class CI_Lang { { $langfile = str_replace('.php', '', $langfile); - if ($add_suffix == TRUE) + if ($add_suffix === TRUE) { $langfile = str_replace('_lang', '', $langfile).'_lang'; } $langfile .= '.php'; - if ($idiom == '') + if ($idiom === '') { $config =& get_config(); $idiom = ( ! empty($config['language'])) ? $config['language'] : 'english'; } - if ($return == FALSE && isset($this->is_loaded[$langfile]) && $this->is_loaded[$langfile] === $idiom) + if ($return === FALSE && isset($this->is_loaded[$langfile]) && $this->is_loaded[$langfile] === $idiom) { return; } // Determine where the language file is and load it - if ($alt_path != '' && file_exists($alt_path.'language/'.$idiom.'/'.$langfile)) + if ($alt_path !== '' && file_exists($alt_path.'language/'.$idiom.'/'.$langfile)) { include($alt_path.'language/'.$idiom.'/'.$langfile); } @@ -124,14 +124,14 @@ class CI_Lang { { log_message('error', 'Language file contains no data: language/'.$idiom.'/'.$langfile); - if ($return == TRUE) + if ($return === TRUE) { return array(); } return; } - if ($return == TRUE) + if ($return === TRUE) { return $lang; } @@ -153,7 +153,7 @@ class CI_Lang { */ public function line($line = '') { - $value = ($line == '' OR ! isset($this->language[$line])) ? FALSE : $this->language[$line]; + $value = ($line === '' OR ! isset($this->language[$line])) ? FALSE : $this->language[$line]; // Because killer robots like unicorns! if ($value === FALSE) diff --git a/system/core/Loader.php b/system/core/Loader.php index 3eb09e6ab..adfe92845 100644 --- a/system/core/Loader.php +++ b/system/core/Loader.php @@ -208,7 +208,7 @@ class CI_Loader { return; } - if ($library == '' OR isset($this->_base_classes[$library])) + if ($library === '' OR isset($this->_base_classes[$library])) { return FALSE; } @@ -244,7 +244,7 @@ class CI_Loader { return; } - if ($model == '') + if ($model === '') { return; } @@ -261,7 +261,7 @@ class CI_Loader { $model = substr($model, $last_slash); } - if ($name == '') + if ($name === '') { $name = $model; } @@ -329,7 +329,7 @@ class CI_Loader { $CI =& get_instance(); // Do we even need to load the database class? - if (class_exists('CI_DB') && $return == FALSE && $query_builder == NULL && isset($CI->db) && is_object($CI->db)) + if (class_exists('CI_DB') && $return === FALSE && $query_builder === NULL && isset($CI->db) && is_object($CI->db)) { return FALSE; } @@ -452,7 +452,7 @@ class CI_Loader { */ public function vars($vars = array(), $val = '') { - if ($val != '' && is_string($vars)) + if ($val !== '' && is_string($vars)) { $vars = array($vars => $val); } @@ -642,7 +642,7 @@ class CI_Loader { require BASEPATH.'libraries/Driver.php'; } - if ($library == '') + if ($library === '') { return FALSE; } @@ -714,7 +714,7 @@ class CI_Loader { { $config =& $this->_ci_get_component('config'); - if ($path == '') + if ($path === '') { array_shift($this->_ci_library_paths); array_shift($this->_ci_model_paths); @@ -775,7 +775,7 @@ class CI_Loader { $file_exists = FALSE; // Set the path to the requested file - if ($_ci_path != '') + if ($_ci_path !== '') { $_ci_x = explode('/', $_ci_path); $_ci_file = end($_ci_x); @@ -783,7 +783,7 @@ class CI_Loader { else { $_ci_ext = pathinfo($_ci_view, PATHINFO_EXTENSION); - $_ci_file = ($_ci_ext == '') ? $_ci_view.'.php' : $_ci_view; + $_ci_file = ($_ci_ext === '') ? $_ci_view.'.php' : $_ci_view; foreach ($this->_ci_view_paths as $view_file => $cascade) { @@ -847,7 +847,7 @@ class CI_Loader { // If the PHP installation does not support short tags we'll // do a little string replacement, changing the short tags // to standard PHP echo statements. - if ( ! is_php('5.4') && (bool) @ini_get('short_open_tag') === FALSE && config_item('rewrite_short_tags') == TRUE) + if ( ! is_php('5.4') && (bool) @ini_get('short_open_tag') === FALSE && config_item('rewrite_short_tags') === TRUE) { echo eval('?>'.preg_replace('/;*\s*\?>/', '; ?>', str_replace('_ci_load_class($path, $params); @@ -1008,7 +1008,7 @@ class CI_Loader { // If we got this far we were unable to find the requested class. // We do not issue errors if the load call failed due to a duplicate request - if ($is_duplicate == FALSE) + if ($is_duplicate === FALSE) { log_message('error', 'Unable to load the requested class: '.$class); show_error('Unable to load the requested class: '.$class); @@ -1067,7 +1067,7 @@ class CI_Loader { } } - if ($prefix == '') + if ($prefix === '') { if (class_exists('CI_'.$class)) { diff --git a/system/core/Output.php b/system/core/Output.php index c8feb4e67..496948ab7 100755 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -160,7 +160,7 @@ class CI_Output { */ public function append_output($output) { - if ($this->final_output == '') + if ($this->final_output === '') { $this->final_output = $output; } @@ -192,7 +192,7 @@ class CI_Output { // but it will not modify the content-length header to compensate for // the reduction, causing the browser to hang waiting for more data. // We'll just skip content-length in those cases. - if ($this->_zlib_oc && strncasecmp($header, 'content-length', 14) == 0) + if ($this->_zlib_oc && strncasecmp($header, 'content-length', 14) === 0) { return; } @@ -349,7 +349,7 @@ class CI_Output { // -------------------------------------------------------------------- // Set the output data - if ($output == '') + if ($output === '') { $output =& $this->final_output; } @@ -381,7 +381,7 @@ class CI_Output { // -------------------------------------------------------------------- // Is compression requested? - if ($CFG->item('compress_output') === TRUE && $this->_zlib_oc == FALSE + if ($CFG->item('compress_output') === TRUE && $this->_zlib_oc === FALSE && extension_loaded('zlib') && isset($_SERVER['HTTP_ACCEPT_ENCODING']) && strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== FALSE) { @@ -416,7 +416,7 @@ class CI_Output { // Do we need to generate profile data? // If so, load the Profile class and run it. - if ($this->enable_profiler == TRUE) + if ($this->enable_profiler === TRUE) { $CI->load->library('profiler'); if ( ! empty($this->_profiler_sections)) @@ -460,7 +460,7 @@ class CI_Output { { $CI =& get_instance(); $path = $CI->config->item('cache_path'); - $cache_path = ($path == '') ? APPPATH.'cache/' : $path; + $cache_path = ($path === '') ? APPPATH.'cache/' : $path; if ( ! is_dir($cache_path) OR ! is_really_writable($cache_path)) { @@ -509,7 +509,7 @@ class CI_Output { */ public function _display_cache(&$CFG, &$URI) { - $cache_path = ($CFG->item('cache_path') == '') ? APPPATH.'cache/' : $CFG->item('cache_path'); + $cache_path = ($CFG->item('cache_path') === '') ? APPPATH.'cache/' : $CFG->item('cache_path'); // Build the file path. The file name is an MD5 hash of the full URI $uri = $CFG->item('base_url').$CFG->item('index_page').$URI->uri_string; diff --git a/system/core/Router.php b/system/core/Router.php index 5ea13797b..93875bdd9 100755 --- a/system/core/Router.php +++ b/system/core/Router.php @@ -165,7 +165,7 @@ class CI_Router { $this->uri->_fetch_uri_string(); // Is there a URI string? If not, the default controller specified in the "routes" file will be shown. - if ($this->uri->uri_string == '') + if ($this->uri->uri_string === '') { return $this->_set_default_controller(); } @@ -435,7 +435,7 @@ class CI_Router { */ public function fetch_method() { - return ($this->method == $this->fetch_class()) ? 'index' : $this->method; + return ($this->method === $this->fetch_class()) ? 'index' : $this->method; } // -------------------------------------------------------------------- @@ -483,14 +483,14 @@ class CI_Router { $this->set_directory($routing['directory']); } - if (isset($routing['controller']) && $routing['controller'] != '') + if (isset($routing['controller']) && $routing['controller'] !== '') { $this->set_class($routing['controller']); } if (isset($routing['function'])) { - $routing['function'] = ($routing['function'] == '') ? 'index' : $routing['function']; + $routing['function'] = ($routing['function'] === '') ? 'index' : $routing['function']; $this->set_method($routing['function']); } } diff --git a/system/core/Security.php b/system/core/Security.php index 9b7ba5799..9cbcd9248 100755 --- a/system/core/Security.php +++ b/system/core/Security.php @@ -162,7 +162,7 @@ class CI_Security { // Do the tokens exist in both the _POST and _COOKIE arrays? if ( ! isset($_POST[$this->_csrf_token_name]) OR ! isset($_COOKIE[$this->_csrf_cookie_name]) - OR $_POST[$this->_csrf_token_name] != $_COOKIE[$this->_csrf_cookie_name]) // Do the tokens match? + OR $_POST[$this->_csrf_token_name] !== $_COOKIE[$this->_csrf_cookie_name]) // Do the tokens match? { $this->csrf_show_error(); } @@ -408,7 +408,7 @@ class CI_Security { $str = preg_replace('#<(/*)(script|xss)(.*?)\>#si', '[removed]', $str); } } - while($original != $str); + while($original !== $str); unset($original); @@ -475,7 +475,7 @@ class CI_Security { */ public function xss_hash() { - if ($this->_xss_hash == '') + if ($this->_xss_hash === '') { mt_srand(); $this->_xss_hash = md5(time() + mt_rand(0, 1999999999)); @@ -825,7 +825,7 @@ class CI_Security { */ protected function _csrf_set_hash() { - if ($this->_csrf_hash == '') + if ($this->_csrf_hash === '') { // If the cookie exists we will use it's value. // We don't necessarily want to regenerate it with diff --git a/system/core/URI.php b/system/core/URI.php index a9432e05d..9c5025128 100755 --- a/system/core/URI.php +++ b/system/core/URI.php @@ -112,7 +112,7 @@ class CI_URI { // Is there a PATH_INFO variable? // Note: some servers seem to have trouble with getenv() so we'll test it two ways $path = (isset($_SERVER['PATH_INFO'])) ? $_SERVER['PATH_INFO'] : @getenv('PATH_INFO'); - if (trim($path, '/') != '' && $path !== '/'.SELF) + if (trim($path, '/') !== '' && $path !== '/'.SELF) { $this->_set_uri_string($path); return; @@ -120,14 +120,14 @@ class CI_URI { // No PATH_INFO?... What about QUERY_STRING? $path = (isset($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : @getenv('QUERY_STRING'); - if (trim($path, '/') != '') + if (trim($path, '/') !== '') { $this->_set_uri_string($path); return; } // As a last ditch effort lets try using the $_GET array - if (is_array($_GET) && count($_GET) === 1 && trim(key($_GET), '/') != '') + if (is_array($_GET) && count($_GET) === 1 && trim(key($_GET), '/') !== '') { $this->_set_uri_string(key($_GET)); return; @@ -218,7 +218,7 @@ class CI_URI { $_GET = array(); } - if ($uri == '/' OR empty($uri)) + if ($uri === '/' OR empty($uri)) { return '/'; } @@ -270,7 +270,7 @@ class CI_URI { */ public function _filter_uri($str) { - if ($str != '' && $this->config->item('permitted_uri_chars') != '' && $this->config->item('enable_query_strings') == FALSE) + if ($str !== '' && $this->config->item('permitted_uri_chars') !== '' && $this->config->item('enable_query_strings') === FALSE) { // preg_quote() in PHP 5.3 escapes -, so the str_replace() and addition of - to preg_quote() is to maintain backwards // compatibility as many are unaware of how characters in the permitted_uri_chars will be parsed as a regex pattern @@ -298,7 +298,7 @@ class CI_URI { */ public function _remove_url_suffix() { - if ($this->config->item('url_suffix') != '') + if ($this->config->item('url_suffix') !== '') { $this->uri_string = preg_replace('|'.preg_quote($this->config->item('url_suffix')).'$|', '', $this->uri_string); } @@ -321,7 +321,7 @@ class CI_URI { // Filter segments for security $val = trim($this->_filter_uri($val)); - if ($val != '') + if ($val !== '') { $this->segments[] = $val; } diff --git a/system/core/Utf8.php b/system/core/Utf8.php index a6faa84ec..2b5a1f5eb 100644 --- a/system/core/Utf8.php +++ b/system/core/Utf8.php @@ -54,7 +54,7 @@ class CI_Utf8 { if ( @preg_match('/./u', 'é') === 1 // PCRE must support UTF-8 && function_exists('iconv') // iconv must be installed - && @ini_get('mbstring.func_overload') != 1 // Multibyte string function overloading cannot be enabled + && @ini_get('mbstring.func_overload') !== 1 // Multibyte string function overloading cannot be enabled && $CFG->item('charset') === 'UTF-8' // Application charset must be UTF-8 ) { -- cgit v1.2.3-24-g4f1b From 48a2baf0e288accd206f5da5031d29076e130792 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Sat, 2 Jun 2012 11:09:54 +0100 Subject: Replaced `==` with `===` and `!=` with `!==` in /system/database --- system/database/DB.php | 10 ++-- system/database/DB_cache.php | 20 ++++---- system/database/DB_driver.php | 50 +++++++++--------- system/database/DB_forge.php | 22 ++++---- system/database/DB_query_builder.php | 60 +++++++++++----------- system/database/DB_result.php | 14 ++--- system/database/DB_utility.php | 4 +- system/database/drivers/cubrid/cubrid_driver.php | 10 ++-- system/database/drivers/cubrid/cubrid_forge.php | 2 +- .../drivers/interbase/interbase_driver.php | 2 +- .../database/drivers/interbase/interbase_forge.php | 4 +- system/database/drivers/mssql/mssql_driver.php | 6 +-- system/database/drivers/mssql/mssql_forge.php | 6 +-- system/database/drivers/mysql/mysql_driver.php | 12 ++--- system/database/drivers/mysql/mysql_forge.php | 2 +- system/database/drivers/mysql/mysql_utility.php | 8 +-- system/database/drivers/mysqli/mysqli_driver.php | 14 ++--- system/database/drivers/mysqli/mysqli_forge.php | 2 +- system/database/drivers/oci8/oci8_driver.php | 6 +-- system/database/drivers/oci8/oci8_forge.php | 4 +- system/database/drivers/odbc/odbc_driver.php | 4 +- system/database/drivers/odbc/odbc_forge.php | 6 +-- system/database/drivers/pdo/pdo_driver.php | 22 ++++---- system/database/drivers/pdo/pdo_forge.php | 8 +-- system/database/drivers/postgre/postgre_driver.php | 14 ++--- system/database/drivers/postgre/postgre_forge.php | 2 +- system/database/drivers/sqlite/sqlite_driver.php | 4 +- system/database/drivers/sqlite/sqlite_forge.php | 6 +-- system/database/drivers/sqlite3/sqlite3_driver.php | 2 +- system/database/drivers/sqlite3/sqlite3_forge.php | 2 +- system/database/drivers/sqlsrv/sqlsrv_forge.php | 6 +-- 31 files changed, 167 insertions(+), 167 deletions(-) diff --git a/system/database/DB.php b/system/database/DB.php index 1fe44c0e5..b0113b6f4 100755 --- a/system/database/DB.php +++ b/system/database/DB.php @@ -53,7 +53,7 @@ function &DB($params = '', $query_builder_override = NULL) show_error('No database connection settings were found in the database config file.'); } - if ($params != '') + if ($params !== '') { $active_group = $params; } @@ -106,7 +106,7 @@ function &DB($params = '', $query_builder_override = NULL) } // No DB specified yet? Beat them senseless... - if ( ! isset($params['dbdriver']) OR $params['dbdriver'] == '') + if ( ! isset($params['dbdriver']) OR $params['dbdriver'] === '') { show_error('You have not selected a database type to connect to.'); } @@ -128,7 +128,7 @@ function &DB($params = '', $query_builder_override = NULL) require_once(BASEPATH.'database/DB_driver.php'); - if ( ! isset($query_builder) OR $query_builder == TRUE) + if ( ! isset($query_builder) OR $query_builder === TRUE) { require_once(BASEPATH.'database/DB_query_builder.php'); if ( ! class_exists('CI_DB')) @@ -152,12 +152,12 @@ function &DB($params = '', $query_builder_override = NULL) $driver = 'CI_DB_'.$params['dbdriver'].'_driver'; $DB = new $driver($params); - if ($DB->autoinit == TRUE) + if ($DB->autoinit === TRUE) { $DB->initialize(); } - if (isset($params['stricton']) && $params['stricton'] == TRUE) + if (isset($params['stricton']) && $params['stricton'] === TRUE) { $DB->query('SET SESSION sql_mode="STRICT_ALL_TABLES"'); } diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index ff942856b..443bbce5f 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -55,9 +55,9 @@ class CI_DB_Cache { */ public function check_path($path = '') { - if ($path == '') + if ($path === '') { - if ($this->db->cachedir == '') + if ($this->db->cachedir === '') { return $this->db->cache_off(); } @@ -95,8 +95,8 @@ class CI_DB_Cache { return $this->db->cache_off(); } - $segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1); - $segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2); + $segment_one = ($this->CI->uri->segment(1) === FALSE) ? 'default' : $this->CI->uri->segment(1); + $segment_two = ($this->CI->uri->segment(2) === FALSE) ? 'index' : $this->CI->uri->segment(2); $filepath = $this->db->cachedir.$segment_one.'+'.$segment_two.'/'.md5($sql); if (FALSE === ($cachedata = read_file($filepath))) @@ -121,8 +121,8 @@ class CI_DB_Cache { return $this->db->cache_off(); } - $segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1); - $segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2); + $segment_one = ($this->CI->uri->segment(1) === FALSE) ? 'default' : $this->CI->uri->segment(1); + $segment_two = ($this->CI->uri->segment(2) === FALSE) ? 'index' : $this->CI->uri->segment(2); $dir_path = $this->db->cachedir.$segment_one.'+'.$segment_two.'/'; $filename = md5($sql); @@ -154,14 +154,14 @@ class CI_DB_Cache { */ public function delete($segment_one = '', $segment_two = '') { - if ($segment_one == '') + if ($segment_one === '') { - $segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1); + $segment_one = ($this->CI->uri->segment(1) === FALSE) ? 'default' : $this->CI->uri->segment(1); } - if ($segment_two == '') + if ($segment_two === '') { - $segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2); + $segment_two = ($this->CI->uri->segment(2) === FALSE) ? 'index' : $this->CI->uri->segment(2); } $dir_path = $this->db->cachedir.$segment_one.'+'.$segment_two.'/'; diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index bbb7b7a80..39c19cdf7 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -113,7 +113,7 @@ abstract class CI_DB_driver { // ---------------------------------------------------------------- // Connect to the database and set the connection ID - $this->conn_id = ($this->pconnect == FALSE) ? $this->db_connect() : $this->db_pconnect(); + $this->conn_id = ($this->pconnect === FALSE) ? $this->db_connect() : $this->db_pconnect(); // No connection resource? Check if there is a failover else throw an error if ( ! $this->conn_id) @@ -131,7 +131,7 @@ abstract class CI_DB_driver { } // Try to connect - $this->conn_id = ($this->pconnect == FALSE) ? $this->db_connect() : $this->db_pconnect(); + $this->conn_id = ($this->pconnect === FALSE) ? $this->db_connect() : $this->db_pconnect(); // If a connection is made break the foreach loop if ($this->conn_id) @@ -297,7 +297,7 @@ abstract class CI_DB_driver { */ public function query($sql, $binds = FALSE, $return_object = TRUE) { - if ($sql == '') + if ($sql === '') { log_message('error', 'Invalid query: '.$sql); @@ -305,7 +305,7 @@ abstract class CI_DB_driver { } // Verify table prefix and replace if necessary - if ($this->dbprefix != '' && $this->swap_pre != '' && $this->dbprefix != $this->swap_pre) + if ($this->dbprefix !== '' && $this->swap_pre !== '' && $this->dbprefix !== $this->swap_pre) { $sql = preg_replace('/(\W)'.$this->swap_pre.'(\S+?)/', '\\1'.$this->dbprefix.'\\2', $sql); } @@ -319,7 +319,7 @@ abstract class CI_DB_driver { // Is query caching enabled? If the query is a "read type" // we will load the caching class and return the previously // cached query if it exists - if ($this->cache_on == TRUE && stripos($sql, 'SELECT') !== FALSE && $this->_cache_init()) + if ($this->cache_on === TRUE && stripos($sql, 'SELECT') !== FALSE && $this->_cache_init()) { $this->load_rdriver(); if (FALSE !== ($cache = $this->CACHE->read($sql))) @@ -329,7 +329,7 @@ abstract class CI_DB_driver { } // Save the query for debugging - if ($this->save_queries == TRUE) + if ($this->save_queries === TRUE) { $this->queries[] = $sql; } @@ -340,7 +340,7 @@ abstract class CI_DB_driver { // Run the Query if (FALSE === ($this->result_id = $this->simple_query($sql))) { - if ($this->save_queries == TRUE) + if ($this->save_queries === TRUE) { $this->query_times[] = 0; } @@ -373,7 +373,7 @@ abstract class CI_DB_driver { $time_end = microtime(TRUE); $this->benchmark += $time_end - $time_start; - if ($this->save_queries == TRUE) + if ($this->save_queries === TRUE) { $this->query_times[] = $time_end - $time_start; } @@ -387,7 +387,7 @@ abstract class CI_DB_driver { { // If caching is enabled we'll auto-cleanup any // existing files related to this particular URI - if ($this->cache_on == TRUE && $this->cache_autodel == TRUE && $this->_cache_init()) + if ($this->cache_on === TRUE && $this->cache_autodel === TRUE && $this->_cache_init()) { $this->CACHE->delete(); } @@ -409,7 +409,7 @@ abstract class CI_DB_driver { // Is query caching enabled? If so, we'll serialize the // result object and save it to a cache file. - if ($this->cache_on == TRUE && $this->_cache_init()) + if ($this->cache_on === TRUE && $this->_cache_init()) { // We'll create a new instance of the result object // only without the platform specific driver since @@ -752,13 +752,13 @@ abstract class CI_DB_driver { */ public function count_all($table = '') { - if ($table == '') + if ($table === '') { return 0; } $query = $this->query($this->_count_string.$this->escape_identifiers('numrows').' FROM '.$this->protect_identifiers($table, TRUE, NULL, FALSE)); - if ($query->num_rows() == 0) + if ($query->num_rows() === 0) { return 0; } @@ -850,7 +850,7 @@ abstract class CI_DB_driver { return $this->data_cache['field_names'][$table]; } - if ($table == '') + if ($table === '') { return ($this->db_debug) ? $this->display_error('db_field_param_missing') : FALSE; } @@ -918,7 +918,7 @@ abstract class CI_DB_driver { */ public function field_data($table = '') { - if ($table == '') + if ($table === '') { return ($this->db_debug) ? $this->display_error('db_field_param_missing') : FALSE; } @@ -939,7 +939,7 @@ abstract class CI_DB_driver { */ public function escape_identifiers($item) { - if ($this->_escape_char == '') + if ($this->_escape_char === '') { return $item; } @@ -998,7 +998,7 @@ abstract class CI_DB_driver { */ public function update_string($table, $data, $where) { - if ($where == '') + if ($where === '') { return FALSE; } @@ -1018,7 +1018,7 @@ abstract class CI_DB_driver { $dest = array(); foreach ($where as $key => $val) { - $prefix = (count($dest) == 0) ? '' : ' AND '; + $prefix = (count($dest) === 0) ? '' : ' AND '; $key = $this->protect_identifiers($key); if ($val !== '') @@ -1062,7 +1062,7 @@ abstract class CI_DB_driver { */ public function call_function($function) { - $driver = ($this->dbdriver == 'postgre') ? 'pg_' : $this->dbdriver.'_'; + $driver = ($this->dbdriver === 'postgre') ? 'pg_' : $this->dbdriver.'_'; if (FALSE === strpos($driver, $function)) { @@ -1217,7 +1217,7 @@ abstract class CI_DB_driver { $heading = $LANG->line('db_error_heading'); - if ($native == TRUE) + if ($native === TRUE) { $message = (array) $error; } @@ -1345,7 +1345,7 @@ abstract class CI_DB_driver { } // Is there a table prefix defined in the config file? If not, no need to do anything - if ($this->dbprefix != '') + if ($this->dbprefix !== '') { // We now add the table prefix based on some logic. // Do we have 4 segments (hostname.database.table.column)? @@ -1369,13 +1369,13 @@ abstract class CI_DB_driver { // This flag is set when the supplied $item does not contain a field name. // This can happen when this function is being called from a JOIN. - if ($field_exists == FALSE) + if ($field_exists === FALSE) { $i++; } // Verify table prefix and replace if necessary - if ($this->swap_pre != '' && strpos($parts[$i], $this->swap_pre) === 0) + if ($this->swap_pre !== '' && strpos($parts[$i], $this->swap_pre) === 0) { $parts[$i] = preg_replace('/^'.$this->swap_pre.'(\S+?)/', $this->dbprefix.'\\1', $parts[$i]); } @@ -1398,15 +1398,15 @@ abstract class CI_DB_driver { } // Is there a table prefix? If not, no need to insert it - if ($this->dbprefix != '') + if ($this->dbprefix !== '') { // Verify table prefix and replace if necessary - if ($this->swap_pre != '' && strpos($item, $this->swap_pre) === 0) + if ($this->swap_pre !== '' && strpos($item, $this->swap_pre) === 0) { $item = preg_replace('/^'.$this->swap_pre.'(\S+?)/', $this->dbprefix.'\\1', $item); } // Do we prefix an item with no segments? - elseif ($prefix_single == TRUE && strpos($item, $this->dbprefix) !== 0) + elseif ($prefix_single === TRUE && strpos($item, $this->dbprefix) !== 0) { $item = $this->dbprefix.$item; } diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php index a519575f0..ff5eb3fe6 100644 --- a/system/database/DB_forge.php +++ b/system/database/DB_forge.php @@ -85,7 +85,7 @@ abstract class CI_DB_forge { */ public function drop_database($db_name) { - if ($db_name == '') + if ($db_name === '') { show_error('A table name is required for that operation.'); return FALSE; @@ -123,7 +123,7 @@ abstract class CI_DB_forge { return; } - if ($key == '') + if ($key === '') { show_error('Key information is required for that operation.'); } @@ -150,7 +150,7 @@ abstract class CI_DB_forge { */ public function add_field($field = '') { - if ($field == '') + if ($field === '') { show_error('Field information is required.'); } @@ -197,7 +197,7 @@ abstract class CI_DB_forge { */ public function create_table($table = '', $if_not_exists = FALSE) { - if ($table == '') + if ($table === '') { show_error('A table name is required for that operation.'); } @@ -222,7 +222,7 @@ abstract class CI_DB_forge { */ public function drop_table($table_name) { - if ($table_name == '') + if ($table_name === '') { return ($this->db->db_debug) ? $this->db->display_error('db_table_name_required') : FALSE; } @@ -245,7 +245,7 @@ abstract class CI_DB_forge { */ public function rename_table($table_name, $new_table_name) { - if ($table_name == '' OR $new_table_name == '') + if ($table_name === '' OR $new_table_name === '') { show_error('A table name is required for that operation.'); return FALSE; @@ -273,7 +273,7 @@ abstract class CI_DB_forge { */ public function add_column($table = '', $field = array(), $after_field = '') { - if ($table == '') + if ($table === '') { show_error('A table name is required for that operation.'); } @@ -284,7 +284,7 @@ abstract class CI_DB_forge { { $this->add_field(array($k => $field[$k])); - if (count($this->fields) == 0) + if (count($this->fields) === 0) { show_error('Field information is required.'); } @@ -312,12 +312,12 @@ abstract class CI_DB_forge { */ public function drop_column($table = '', $column_name = '') { - if ($table == '') + if ($table === '') { show_error('A table name is required for that operation.'); } - if ($column_name == '') + if ($column_name === '') { show_error('A column name is required for that operation.'); } @@ -337,7 +337,7 @@ abstract class CI_DB_forge { */ public function modify_column($table = '', $field = array()) { - if ($table == '') + if ($table === '') { show_error('A table name is required for that operation.'); } diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php index cee4354e9..45d68cd39 100644 --- a/system/database/DB_query_builder.php +++ b/system/database/DB_query_builder.php @@ -97,7 +97,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { { $val = trim($val); - if ($val != '') + if ($val !== '') { $this->qb_select[] = $val; $this->qb_no_escape[] = $escape; @@ -194,7 +194,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { */ protected function _max_min_avg_sum($select = '', $alias = '', $type = 'MAX') { - if ( ! is_string($select) OR $select == '') + if ( ! is_string($select) OR $select === '') { $this->display_error('db_invalid_query'); } @@ -206,7 +206,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { show_error('Invalid function type: '.$type); } - if ($alias == '') + if ($alias === '') { $alias = $this->_create_alias_from_table(trim($select)); } @@ -325,7 +325,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { */ public function join($table, $cond, $type = '') { - if ($type != '') + if ($type !== '') { $type = strtoupper(trim($type)); @@ -691,7 +691,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { } // some platforms require an escape sequence definition for LIKE wildcards - if ($this->_like_escape_str != '') + if ($this->_like_escape_str !== '') { $like_statement = $like_statement.sprintf($this->_like_escape_str, $this->_like_escape_chr); } @@ -829,7 +829,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { { $val = trim($val); - if ($val != '') + if ($val !== '') { $this->qb_groupby[] = $val = $this->protect_identifiers($val); @@ -908,7 +908,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { $k .= ' = '; } - if ($v != '') + if ($v !== '') { $v = ' '.$this->escape($v); } @@ -941,7 +941,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { $orderby = ''; // Random results want or don't need a field name $direction = $this->_random_keyword; } - elseif (trim($direction) != '') + elseif (trim($direction) !== '') { $direction = (in_array(strtoupper(trim($direction)), array('ASC', 'DESC'), TRUE)) ? ' '.$direction : ' ASC'; } @@ -963,7 +963,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { $orderby = implode(', ', $temp); } - elseif ($direction != $this->_random_keyword) + elseif ($direction !== $this->_random_keyword) { if ($escape === TRUE) { @@ -1064,7 +1064,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { */ public function get_compiled_select($table = '', $reset = TRUE) { - if ($table != '') + if ($table !== '') { $this->_track_aliases($table); $this->from($table); @@ -1095,7 +1095,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { */ public function get($table = '', $limit = null, $offset = null) { - if ($table != '') + if ($table !== '') { $this->_track_aliases($table); $this->from($table); @@ -1124,7 +1124,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { */ public function count_all_results($table = '') { - if ($table != '') + if ($table !== '') { $this->_track_aliases($table); $this->from($table); @@ -1156,7 +1156,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { */ public function get_where($table = '', $where = null, $limit = null, $offset = null) { - if ($table != '') + if ($table !== '') { $this->from($table); } @@ -1204,7 +1204,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { return FALSE; } - if ($table == '') + if ($table === '') { if ( ! isset($this->qb_from[0])) { @@ -1404,7 +1404,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { return ($this->db_debug) ? $this->display_error('db_must_use_set') : FALSE; } - if ($table != '') + if ($table !== '') { $this->qb_from[0] = $table; } @@ -1439,7 +1439,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { return ($this->db_debug) ? $this->display_error('db_must_use_set') : FALSE; } - if ($table == '') + if ($table === '') { if ( ! isset($this->qb_from[0])) { @@ -1530,12 +1530,12 @@ abstract class CI_DB_query_builder extends CI_DB_driver { return FALSE; } - if ($where != NULL) + if ($where !== NULL) { $this->where($where); } - if ($limit != NULL) + if ($limit !== NULL) { $this->limit($limit); } @@ -1595,12 +1595,12 @@ abstract class CI_DB_query_builder extends CI_DB_driver { */ protected function _validate_update($table = '') { - if (count($this->qb_set) == 0) + if (count($this->qb_set) === 0) { return ($this->db_debug) ? $this->display_error('db_must_use_set') : FALSE; } - if ($table != '') + if ($table !== '') { $this->qb_from[0] = $table; } @@ -1644,7 +1644,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { return ($this->db_debug) ? $this->display_error('db_must_use_set') : FALSE; } - if ($table == '') + if ($table === '') { if ( ! isset($this->qb_from[0])) { @@ -1689,7 +1689,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { $clean = array(); foreach ($v as $k2 => $v2) { - if ($k2 == $index) + if ($k2 === $index) { $index_set = TRUE; } @@ -1720,7 +1720,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { */ public function empty_table($table = '') { - if ($table == '') + if ($table === '') { if ( ! isset($this->qb_from[0])) { @@ -1753,7 +1753,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { */ public function truncate($table = '') { - if ($table == '') + if ($table === '') { if ( ! isset($this->qb_from[0])) { @@ -1827,7 +1827,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { // Combine any cached components with the current statements $this->_merge_cache(); - if ($table == '') + if ($table === '') { if ( ! isset($this->qb_from[0])) { @@ -1851,12 +1851,12 @@ abstract class CI_DB_query_builder extends CI_DB_driver { $table = $this->protect_identifiers($table, TRUE, NULL, FALSE); } - if ($where != '') + if ($where !== '') { $this->where($where); } - if ($limit != NULL) + if ($limit !== NULL) { $this->limit($limit); } @@ -1912,7 +1912,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { */ public function dbprefix($table = '') { - if ($table == '') + if ($table === '') { $this->display_error('db_table_name_required'); } @@ -2072,7 +2072,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { $sql .= "\nORDER BY ".implode(', ', $this->qb_orderby); if ($this->qb_order !== FALSE) { - $sql .= ($this->qb_order == 'desc') ? ' DESC' : ' ASC'; + $sql .= ($this->qb_order === 'desc') ? ' DESC' : ' ASC'; } } @@ -2106,7 +2106,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { foreach (get_object_vars($object) as $key => $val) { // There are some built in keys we need to ignore for this conversion - if ( ! is_object($val) && ! is_array($val) && $key != '_parent_name') + if ( ! is_object($val) && ! is_array($val) && $key !== '_parent_name') { $array[$key] = $val; } diff --git a/system/database/DB_result.php b/system/database/DB_result.php index 334e08c72..991f6ba94 100644 --- a/system/database/DB_result.php +++ b/system/database/DB_result.php @@ -81,7 +81,7 @@ class CI_DB_result { return $this->custom_result_object[$class_name]; } - if ($this->result_id === FALSE OR $this->num_rows() == 0) + if ($this->result_id === FALSE OR $this->num_rows() === 0) { return array(); } @@ -122,7 +122,7 @@ class CI_DB_result { // In the event that query caching is on the result_id variable // will return FALSE since there isn't a valid SQL resource so // we'll simply return an empty array. - if ($this->result_id === FALSE OR $this->num_rows() == 0) + if ($this->result_id === FALSE OR $this->num_rows() === 0) { return array(); } @@ -153,7 +153,7 @@ class CI_DB_result { // In the event that query caching is on the result_id variable // will return FALSE since there isn't a valid SQL resource so // we'll simply return an empty array. - if ($this->result_id === FALSE OR $this->num_rows() == 0) + if ($this->result_id === FALSE OR $this->num_rows() === 0) { return array(); } @@ -224,7 +224,7 @@ class CI_DB_result { return; } - if ($key != '' && ! is_null($value)) + if ($key !== '' && ! is_null($value)) { $this->row_data[$key] = $value; } @@ -245,7 +245,7 @@ class CI_DB_result { return NULL; } - if ($n != $this->current_row && isset($result[$n])) + if ($n !== $this->current_row && isset($result[$n])) { $this->current_row = $n; } @@ -268,7 +268,7 @@ class CI_DB_result { return NULL; } - if ($n != $this->current_row && isset($result[$n])) + if ($n !== $this->current_row && isset($result[$n])) { $this->current_row = $n; } @@ -291,7 +291,7 @@ class CI_DB_result { return NULL; } - if ($n != $this->current_row && isset($result[$n])) + if ($n !== $this->current_row && isset($result[$n])) { $this->current_row = $n; } diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php index cb97ff448..02c921834 100644 --- a/system/database/DB_utility.php +++ b/system/database/DB_utility.php @@ -343,7 +343,7 @@ abstract class CI_DB_utility extends CI_DB_forge { if ($prefs['format'] === 'zip') { // Set the filename if not provided (only needed with Zip files) - if ($prefs['filename'] == '') + if ($prefs['filename'] === '') { $prefs['filename'] = (count($prefs['tables']) === 1 ? $prefs['tables'] : $this->db->database) .date('Y-m-d_H-i', time()).'.sql'; @@ -369,7 +369,7 @@ abstract class CI_DB_utility extends CI_DB_forge { $CI->zip->add_data($prefs['filename'], $this->_backup($prefs)); return $CI->zip->get_zip(); } - elseif ($prefs['format'] == 'txt') // Was a text file requested? + elseif ($prefs['format'] === 'txt') // Was a text file requested? { return $this->_backup($prefs); } diff --git a/system/database/drivers/cubrid/cubrid_driver.php b/system/database/drivers/cubrid/cubrid_driver.php index 817dfdc98..b7763d90f 100644 --- a/system/database/drivers/cubrid/cubrid_driver.php +++ b/system/database/drivers/cubrid/cubrid_driver.php @@ -74,7 +74,7 @@ class CI_DB_cubrid_driver extends CI_DB { else { // If no port is defined by the user, use the default value - $this->port == '' OR $this->port = 33000; + $this->port === '' OR $this->port = 33000; } } @@ -340,7 +340,7 @@ class CI_DB_cubrid_driver extends CI_DB { { $sql = 'SHOW TABLES'; - if ($prefix_limit !== FALSE && $this->dbprefix != '') + if ($prefix_limit !== FALSE && $this->dbprefix !== '') { return $sql." LIKE '".$this->escape_like_str($this->dbprefix)."%'"; } @@ -435,7 +435,7 @@ class CI_DB_cubrid_driver extends CI_DB { foreach (array_keys($val) as $field) { - if ($field != $index) + if ($field !== $index) { $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field]; } @@ -451,7 +451,7 @@ class CI_DB_cubrid_driver extends CI_DB { } return 'UPDATE '.$table.' SET '.substr($cases, 0, -2) - .' WHERE '.(($where != '' && count($where) > 0) ? implode(' ', $where).' AND ' : '') + .' WHERE '.(($where !== '' && count($where) > 0) ? implode(' ', $where).' AND ' : '') .$index.' IN ('.implode(',', $ids).')'; } @@ -469,7 +469,7 @@ class CI_DB_cubrid_driver extends CI_DB { */ protected function _limit($sql, $limit, $offset) { - return $sql.'LIMIT '.($offset == 0 ? '' : $offset.', ').$limit; + return $sql.'LIMIT '.($offset === 0 ? '' : $offset.', ').$limit; } // -------------------------------------------------------------------- diff --git a/system/database/drivers/cubrid/cubrid_forge.php b/system/database/drivers/cubrid/cubrid_forge.php index 4e66f81e3..fb9716226 100644 --- a/system/database/drivers/cubrid/cubrid_forge.php +++ b/system/database/drivers/cubrid/cubrid_forge.php @@ -193,7 +193,7 @@ class CI_DB_cubrid_forge extends CI_DB_forge { } return $sql.$this->_process_fields($fields) - .($after_field != '' ? ' AFTER '.$this->db->protect_identifiers($after_field) : ''); + .($after_field !== '' ? ' AFTER '.$this->db->protect_identifiers($after_field) : ''); } } diff --git a/system/database/drivers/interbase/interbase_driver.php b/system/database/drivers/interbase/interbase_driver.php index 49d3cda87..8cbbfa17d 100644 --- a/system/database/drivers/interbase/interbase_driver.php +++ b/system/database/drivers/interbase/interbase_driver.php @@ -255,7 +255,7 @@ class CI_DB_interbase_driver extends CI_DB { { $sql = 'SELECT "RDB$RELATION_NAME" FROM "RDB$RELATIONS" WHERE "RDB$RELATION_NAME" NOT LIKE \'RDB$%\' AND "RDB$RELATION_NAME" NOT LIKE \'MON$%\''; - if ($prefix_limit !== FALSE && $this->dbprefix != '') + if ($prefix_limit !== FALSE && $this->dbprefix !== '') { return $sql.' AND "RDB$RELATION_NAME" LIKE \''.$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_chr); } diff --git a/system/database/drivers/interbase/interbase_forge.php b/system/database/drivers/interbase/interbase_forge.php index c850656a8..5470179a1 100644 --- a/system/database/drivers/interbase/interbase_forge.php +++ b/system/database/drivers/interbase/interbase_forge.php @@ -195,7 +195,7 @@ class CI_DB_interbase_forge extends CI_DB_forge { $sql .= " {$column_definition}"; - if ($default_value != '') + if ($default_value !== '') { $sql .= " DEFAULT \"{$default_value}\""; } @@ -209,7 +209,7 @@ class CI_DB_interbase_forge extends CI_DB_forge { $sql .= ' NOT NULL'; } - if ($after_field != '') + if ($after_field !== '') { $sql .= ' AFTER ' . $this->db->protect_identifiers($after_field); } diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php index 342ff2647..5bd666960 100644 --- a/system/database/drivers/mssql/mssql_driver.php +++ b/system/database/drivers/mssql/mssql_driver.php @@ -64,7 +64,7 @@ class CI_DB_mssql_driver extends CI_DB { */ public function db_connect() { - if ($this->port != '') + if ($this->port !== '') { $this->hostname .= ','.$this->port; } @@ -81,7 +81,7 @@ class CI_DB_mssql_driver extends CI_DB { */ public function db_pconnect() { - if ($this->port != '') + if ($this->port !== '') { $this->hostname .= ','.$this->port; } @@ -316,7 +316,7 @@ class CI_DB_mssql_driver extends CI_DB { $sql = "SELECT name FROM sysobjects WHERE type = 'U' ORDER BY name"; // for future compatibility - if ($prefix_limit !== FALSE AND $this->dbprefix != '') + if ($prefix_limit !== FALSE AND $this->dbprefix !== '') { //$sql .= " LIKE '".$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_chr); return FALSE; // not currently supported diff --git a/system/database/drivers/mssql/mssql_forge.php b/system/database/drivers/mssql/mssql_forge.php index bbf2d9685..3708c2233 100644 --- a/system/database/drivers/mssql/mssql_forge.php +++ b/system/database/drivers/mssql/mssql_forge.php @@ -155,21 +155,21 @@ class CI_DB_mssql_forge extends CI_DB_forge { $sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '.$this->db->protect_identifiers($column_name); // DROP has everything it needs now. - if ($alter_type == 'DROP') + if ($alter_type === 'DROP') { return $sql; } $sql .= " ".$column_definition; - if ($default_value != '') + if ($default_value !== '') { $sql .= " DEFAULT '".$default_value."'"; } $sql .= ($null === NULL) ? ' NULL' : ' NOT NULL'; - if ($after_field != '') + if ($after_field !== '') { return $sql.' AFTER '.$this->db->protect_identifiers($after_field); } diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php index 7a1a7b9a2..41e86f315 100644 --- a/system/database/drivers/mysql/mysql_driver.php +++ b/system/database/drivers/mysql/mysql_driver.php @@ -68,7 +68,7 @@ class CI_DB_mysql_driver extends CI_DB { { parent::__construct($params); - if ($this->port != '') + if ($this->port !== '') { $this->hostname .= ':'.$this->port; } @@ -337,7 +337,7 @@ class CI_DB_mysql_driver extends CI_DB { { $sql = 'SHOW TABLES FROM '.$this->_escape_char.$this->database.$this->_escape_char; - if ($prefix_limit !== FALSE && $this->dbprefix != '') + if ($prefix_limit !== FALSE && $this->dbprefix !== '') { return $sql." LIKE '".$this->escape_like_str($this->dbprefix)."%'"; } @@ -370,7 +370,7 @@ class CI_DB_mysql_driver extends CI_DB { */ public function field_data($table = '') { - if ($table == '') + if ($table === '') { return ($this->db_debug) ? $this->display_error('db_field_param_missing') : FALSE; } @@ -451,7 +451,7 @@ class CI_DB_mysql_driver extends CI_DB { foreach (array_keys($val) as $field) { - if ($field != $index) + if ($field !== $index) { $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field]; } @@ -467,7 +467,7 @@ class CI_DB_mysql_driver extends CI_DB { } return 'UPDATE '.$table.' SET '.substr($cases, 0, -2) - .' WHERE '.(($where != '' && count($where) > 0) ? implode(' ', $where).' AND ' : '') + .' WHERE '.(($where !== '' && count($where) > 0) ? implode(' ', $where).' AND ' : '') .$index.' IN('.implode(',', $ids).')'; } @@ -485,7 +485,7 @@ class CI_DB_mysql_driver extends CI_DB { */ protected function _limit($sql, $limit, $offset) { - return $sql.' LIMIT '.($offset == 0 ? '' : $offset.', ').$limit; + return $sql.' LIMIT '.($offset === 0 ? '' : $offset.', ').$limit; } // -------------------------------------------------------------------- diff --git a/system/database/drivers/mysql/mysql_forge.php b/system/database/drivers/mysql/mysql_forge.php index 0e39affa7..ffd374fbf 100644 --- a/system/database/drivers/mysql/mysql_forge.php +++ b/system/database/drivers/mysql/mysql_forge.php @@ -178,7 +178,7 @@ class CI_DB_mysql_forge extends CI_DB_forge { } return $sql.$this->_process_fields($fields) - .($after_field != '' ? ' AFTER '.$this->db->protect_identifiers($after_field) : ''); + .($after_field !== '' ? ' AFTER '.$this->db->protect_identifiers($after_field) : ''); } } diff --git a/system/database/drivers/mysql/mysql_utility.php b/system/database/drivers/mysql/mysql_utility.php index 642323dbd..643682fde 100644 --- a/system/database/drivers/mysql/mysql_utility.php +++ b/system/database/drivers/mysql/mysql_utility.php @@ -76,7 +76,7 @@ class CI_DB_mysql_utility extends CI_DB_utility { // Write out the table schema $output .= '#'.$newline.'# TABLE STRUCTURE FOR: '.$table.$newline.'#'.$newline.$newline; - if ($add_drop == TRUE) + if ($add_drop === TRUE) { $output .= 'DROP TABLE IF EXISTS '.$this->db->protect_identifiers($table).';'.$newline.$newline; } @@ -92,7 +92,7 @@ class CI_DB_mysql_utility extends CI_DB_utility { } // If inserts are not needed we're done... - if ($add_insert == FALSE) + if ($add_insert === FALSE) { continue; } @@ -100,7 +100,7 @@ class CI_DB_mysql_utility extends CI_DB_utility { // Grab all the data from the current table $query = $this->db->query('SELECT * FROM '.$this->db->protect_identifiers($table)); - if ($query->num_rows() == 0) + if ($query->num_rows() === 0) { continue; } @@ -143,7 +143,7 @@ class CI_DB_mysql_utility extends CI_DB_utility { else { // Escape the data if it's not an integer - $val_str .= ($is_int[$i] == FALSE) ? $this->db->escape($v) : $v; + $val_str .= ($is_int[$i] === FALSE) ? $this->db->escape($v) : $v; } // Append a comma diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php index dd544f686..5814aceb9 100644 --- a/system/database/drivers/mysqli/mysqli_driver.php +++ b/system/database/drivers/mysqli/mysqli_driver.php @@ -71,7 +71,7 @@ class CI_DB_mysqli_driver extends CI_DB { */ public function db_connect() { - return ($this->port != '') + return ($this->port !== '') ? @new mysqli($this->hostname, $this->username, $this->password, $this->database, $this->port) : @new mysqli($this->hostname, $this->username, $this->password, $this->database); } @@ -91,7 +91,7 @@ class CI_DB_mysqli_driver extends CI_DB { return $this->db_connect(); } - return ($this->port != '') + return ($this->port !== '') ? @new mysqli('p:'.$this->hostname, $this->username, $this->password, $this->database, $this->port) : @new mysqli('p:'.$this->hostname, $this->username, $this->password, $this->database); } @@ -337,7 +337,7 @@ class CI_DB_mysqli_driver extends CI_DB { { $sql = 'SHOW TABLES FROM '.$this->_escape_char.$this->database.$this->_escape_char; - if ($prefix_limit !== FALSE && $this->dbprefix != '') + if ($prefix_limit !== FALSE && $this->dbprefix !== '') { return $sql." LIKE '".$this->escape_like_str($this->dbprefix)."%'"; } @@ -370,7 +370,7 @@ class CI_DB_mysqli_driver extends CI_DB { */ public function field_data($table = '') { - if ($table == '') + if ($table === '') { return ($this->db_debug) ? $this->display_error('db_field_param_missing') : FALSE; } @@ -451,7 +451,7 @@ class CI_DB_mysqli_driver extends CI_DB { foreach (array_keys($val) as $field) { - if ($field != $index) + if ($field !== $index) { $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field]; } @@ -466,10 +466,10 @@ class CI_DB_mysqli_driver extends CI_DB { .'ELSE '.$k.' END, '; } - $where = ($where != '' && count($where) > 0) ? implode(' ', $where).' AND ' : ''; + $where = ($where !== '' && count($where) > 0) ? implode(' ', $where).' AND ' : ''; return 'UPDATE '.$table.' SET '.substr($cases, 0, -2) - .' WHERE '.(($where != '' && count($where) > 0) ? implode(' ', $where).' AND ' : '') + .' WHERE '.(($where !== '' && count($where) > 0) ? implode(' ', $where).' AND ' : '') .$index.' IN('.implode(',', $ids).')'; } diff --git a/system/database/drivers/mysqli/mysqli_forge.php b/system/database/drivers/mysqli/mysqli_forge.php index 503574dfc..b00bfde49 100644 --- a/system/database/drivers/mysqli/mysqli_forge.php +++ b/system/database/drivers/mysqli/mysqli_forge.php @@ -179,7 +179,7 @@ class CI_DB_mysqli_forge extends CI_DB_forge { } return $sql.$this->_process_fields($fields) - .($after_field != '' ? ' AFTER '.$this->db->protect_identifiers($after_field) : ''); + .($after_field !== '' ? ' AFTER '.$this->db->protect_identifiers($after_field) : ''); } } diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php index b979c8a17..e78091614 100644 --- a/system/database/drivers/oci8/oci8_driver.php +++ b/system/database/drivers/oci8/oci8_driver.php @@ -262,7 +262,7 @@ class CI_DB_oci8_driver extends CI_DB { */ public function stored_procedure($package, $procedure, $params) { - if ($package == '' OR $procedure == '' OR ! is_array($params)) + if ($package === '' OR $procedure === '' OR ! is_array($params)) { if ($this->db_debug) { @@ -466,7 +466,7 @@ class CI_DB_oci8_driver extends CI_DB { { $sql = 'SELECT TABLE_NAME FROM ALL_TABLES'; - if ($prefix_limit !== FALSE && $this->dbprefix != '') + if ($prefix_limit !== FALSE && $this->dbprefix !== '') { return $sql." WHERE TABLE_NAME LIKE '".$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_chr); } @@ -634,7 +634,7 @@ class CI_DB_oci8_driver extends CI_DB { { $this->limit_used = TRUE; return 'SELECT * FROM (SELECT inner_query.*, rownum rnum FROM ('.$sql.') inner_query WHERE rownum < '.($offset + $limit).')' - .($offset != 0 ? ' WHERE rnum >= '.$offset : ''); + .($offset !== 0 ? ' WHERE rnum >= '.$offset : ''); } // -------------------------------------------------------------------- diff --git a/system/database/drivers/oci8/oci8_forge.php b/system/database/drivers/oci8/oci8_forge.php index bd265b6e0..837e7eaad 100644 --- a/system/database/drivers/oci8/oci8_forge.php +++ b/system/database/drivers/oci8/oci8_forge.php @@ -141,9 +141,9 @@ class CI_DB_oci8_forge extends CI_DB_forge { } return $sql.' '.$column_definition - .($default_value != '' ? ' DEFAULT "'.$default_value.'"' : '') + .($default_value !== '' ? ' DEFAULT "'.$default_value.'"' : '') .($null === NULL ? ' NULL' : ' NOT NULL') - .($after_field != '' ? ' AFTER '.$this->db->protect_identifiers($after_field) : ''); + .($after_field !== '' ? ' AFTER '.$this->db->protect_identifiers($after_field) : ''); } diff --git a/system/database/drivers/odbc/odbc_driver.php b/system/database/drivers/odbc/odbc_driver.php index 98fd806a8..b493e9335 100644 --- a/system/database/drivers/odbc/odbc_driver.php +++ b/system/database/drivers/odbc/odbc_driver.php @@ -64,7 +64,7 @@ class CI_DB_odbc_driver extends CI_DB { $this->_random_keyword = ' RND('.time().')'; // database specific random keyword // Legacy support for DSN in the hostname field - if ($this->dsn == '') + if ($this->dsn === '') { $this->dsn = $this->hostname; } @@ -256,7 +256,7 @@ class CI_DB_odbc_driver extends CI_DB { { $sql = "SHOW TABLES FROM `".$this->database."`"; - if ($prefix_limit !== FALSE AND $this->dbprefix != '') + if ($prefix_limit !== FALSE AND $this->dbprefix !== '') { //$sql .= " LIKE '".$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_chr); return FALSE; // not currently supported diff --git a/system/database/drivers/odbc/odbc_forge.php b/system/database/drivers/odbc/odbc_forge.php index d59b8a911..ce7a1d2ef 100644 --- a/system/database/drivers/odbc/odbc_forge.php +++ b/system/database/drivers/odbc/odbc_forge.php @@ -163,14 +163,14 @@ class CI_DB_odbc_forge extends CI_DB_forge { $sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '.$this->db->protect_identifiers($column_name); // DROP has everything it needs now. - if ($alter_type == 'DROP') + if ($alter_type === 'DROP') { return $sql; } $sql .= " $column_definition"; - if ($default_value != '') + if ($default_value !== '') { $sql .= " DEFAULT \"$default_value\""; } @@ -184,7 +184,7 @@ class CI_DB_odbc_forge extends CI_DB_forge { $sql .= ' NOT NULL'; } - if ($after_field != '') + if ($after_field !== '') { return $sql.' AFTER '.$this->db->protect_identifiers($after_field); } diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php index ec7f3e19b..dbbcda342 100644 --- a/system/database/drivers/pdo/pdo_driver.php +++ b/system/database/drivers/pdo/pdo_driver.php @@ -65,7 +65,7 @@ class CI_DB_pdo_driver extends CI_DB { { parent::__construct($params); - if (preg_match('/([^;]+):/', $this->dsn, $match) && count($match) == 2) + if (preg_match('/([^;]+):/', $this->dsn, $match) && count($match) === 2) { // If there is a minimum valid dsn string pattern found, we're done // This is for general PDO users, who tend to have a full DSN string. @@ -418,12 +418,12 @@ class CI_DB_pdo_driver extends CI_DB { */ protected function _list_tables($prefix_limit = FALSE) { - if ($this->pdodriver == 'pgsql') + if ($this->pdodriver === 'pgsql') { // Analog function to show all tables in postgre $sql = "SELECT * FROM information_schema.tables WHERE table_schema = 'public'"; } - elseif ($this->pdodriver == 'sqlite') + elseif ($this->pdodriver === 'sqlite') { // Analog function to show all tables in sqlite $sql = "SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%'"; @@ -433,7 +433,7 @@ class CI_DB_pdo_driver extends CI_DB { $sql = 'SHOW TABLES FROM '.$this->escape_identifiers($this->database); } - if ($prefix_limit !== FALSE AND $this->dbprefix != '') + if ($prefix_limit !== FALSE AND $this->dbprefix !== '') { return FALSE; } @@ -468,17 +468,17 @@ class CI_DB_pdo_driver extends CI_DB { */ protected function _field_data($table) { - if ($this->pdodriver == 'mysql' or $this->pdodriver == 'pgsql') + if ($this->pdodriver === 'mysql' or $this->pdodriver === 'pgsql') { // Analog function for mysql and postgre return 'SELECT * FROM '.$this->escape_identifiers($table).' LIMIT 1'; } - elseif ($this->pdodriver == 'oci') + elseif ($this->pdodriver === 'oci') { // Analog function for oci return 'SELECT * FROM '.$this->escape_identifiers($table).' WHERE ROWNUM <= 1'; } - elseif ($this->pdodriver == 'sqlite') + elseif ($this->pdodriver === 'sqlite') { // Analog function for sqlite return 'PRAGMA table_info('.$this->escape_identifiers($table).')'; @@ -552,7 +552,7 @@ class CI_DB_pdo_driver extends CI_DB { protected function _update_batch($table, $values, $index, $where = NULL) { $ids = array(); - $where = ($where != '' && count($where) >=1) ? implode(" ", $where).' AND ' : ''; + $where = ($where !== '' && count($where) >=1) ? implode(" ", $where).' AND ' : ''; foreach ($values as $key => $val) { @@ -560,7 +560,7 @@ class CI_DB_pdo_driver extends CI_DB { foreach (array_keys($val) as $field) { - if ($field != $index) + if ($field !== $index) { $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field]; } @@ -620,9 +620,9 @@ class CI_DB_pdo_driver extends CI_DB { */ protected function _limit($sql, $limit, $offset) { - if ($this->pdodriver == 'cubrid' OR $this->pdodriver == 'sqlite') + if ($this->pdodriver === 'cubrid' OR $this->pdodriver === 'sqlite') { - $offset = ($offset == 0) ? '' : $offset.', '; + $offset = ($offset === 0) ? '' : $offset.', '; return $sql.'LIMIT '.$offset.$limit; } diff --git a/system/database/drivers/pdo/pdo_forge.php b/system/database/drivers/pdo/pdo_forge.php index ca8657a0f..aee8f718a 100644 --- a/system/database/drivers/pdo/pdo_forge.php +++ b/system/database/drivers/pdo/pdo_forge.php @@ -80,7 +80,7 @@ class CI_DB_pdo_forge extends CI_DB_forge { if (array_key_exists('CONSTRAINT', $attributes)) { // Exception for Postgre numeric which not too happy with constraint within those type - if ( ! ($this->db->pdodriver == 'pgsql' && in_array($attributes['TYPE'], $numeric))) + if ( ! ($this->db->pdodriver === 'pgsql' && in_array($attributes['TYPE'], $numeric))) { $sql .= '('.$attributes['CONSTRAINT'].')'; } @@ -168,14 +168,14 @@ class CI_DB_pdo_forge extends CI_DB_forge { $sql = 'ALTER TABLE `'.$this->db->protect_identifiers($table).'` '.$alter_type.' '.$this->db->protect_identifiers($column_name); // DROP has everything it needs now. - if ($alter_type == 'DROP') + if ($alter_type === 'DROP') { return $sql; } $sql .= " $column_definition"; - if ($default_value != '') + if ($default_value !== '') { $sql .= " DEFAULT \"$default_value\""; } @@ -189,7 +189,7 @@ class CI_DB_pdo_forge extends CI_DB_forge { $sql .= ' NOT NULL'; } - if ($after_field != '') + if ($after_field !== '') { return $sql.' AFTER '.$this->db->protect_identifiers($after_field); } diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php index c2a188416..8c5168400 100644 --- a/system/database/drivers/postgre/postgre_driver.php +++ b/system/database/drivers/postgre/postgre_driver.php @@ -356,13 +356,13 @@ class CI_DB_postgre_driver extends CI_DB { $table = (func_num_args() > 0) ? func_get_arg(0) : NULL; $column = (func_num_args() > 1) ? func_get_arg(1) : NULL; - if ($table == NULL && $v >= '8.1') + if ($table === NULL && $v >= '8.1') { $sql = 'SELECT LASTVAL() AS ins_id'; } - elseif ($table != NULL) + elseif ($table !== NULL) { - if ($column != NULL && $v >= '8.0') + if ($column !== NULL && $v >= '8.0') { $sql = 'SELECT pg_get_serial_sequence(\''.$table."', '".$column."') AS seq"; $query = $this->query($sql); @@ -401,7 +401,7 @@ class CI_DB_postgre_driver extends CI_DB { { $sql = "SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'"; - if ($prefix_limit !== FALSE && $this->dbprefix != '') + if ($prefix_limit !== FALSE && $this->dbprefix !== '') { return $sql." AND table_name LIKE '".$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_chr); } @@ -528,7 +528,7 @@ class CI_DB_postgre_driver extends CI_DB { foreach (array_keys($val) as $field) { - if ($field != $index) + if ($field !== $index) { $final[$field][] = 'WHEN '.$val[$index].' THEN '.$val[$field]; } @@ -544,7 +544,7 @@ class CI_DB_postgre_driver extends CI_DB { } return 'UPDATE '.$table.' SET '.substr($cases, 0, -2) - .' WHERE '.(($where != '' && count($where) > 0) ? implode(' ', $where).' AND ' : '') + .' WHERE '.(($where !== '' && count($where) > 0) ? implode(' ', $where).' AND ' : '') .$index.' IN('.implode(',', $ids).')'; } @@ -585,7 +585,7 @@ class CI_DB_postgre_driver extends CI_DB { */ protected function _limit($sql, $limit, $offset) { - return $sql.' LIMIT '.$limit.($offset == 0 ? '' : ' OFFSET '.$offset); + return $sql.' LIMIT '.$limit.($offset === 0 ? '' : ' OFFSET '.$offset); } // -------------------------------------------------------------------- diff --git a/system/database/drivers/postgre/postgre_forge.php b/system/database/drivers/postgre/postgre_forge.php index 94c97af50..af1c45f9b 100644 --- a/system/database/drivers/postgre/postgre_forge.php +++ b/system/database/drivers/postgre/postgre_forge.php @@ -214,7 +214,7 @@ class CI_DB_postgre_forge extends CI_DB_forge { } return $sql.$this->_process_fields($fields) - .($after_field != '' ? ' AFTER '.$this->db->protect_identifiers($after_field) : ''); + .($after_field !== '' ? ' AFTER '.$this->db->protect_identifiers($after_field) : ''); } } diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php index d8b869c2e..e50239027 100644 --- a/system/database/drivers/sqlite/sqlite_driver.php +++ b/system/database/drivers/sqlite/sqlite_driver.php @@ -279,7 +279,7 @@ class CI_DB_sqlite_driver extends CI_DB { { $sql = "SELECT name from sqlite_master WHERE type='table'"; - if ($prefix_limit !== FALSE AND $this->dbprefix != '') + if ($prefix_limit !== FALSE AND $this->dbprefix !== '') { $sql .= " AND 'name' LIKE '".$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_chr); } @@ -404,7 +404,7 @@ class CI_DB_sqlite_driver extends CI_DB { */ protected function _limit($sql, $limit, $offset) { - if ($offset == 0) + if ($offset === 0) { $offset = ''; } diff --git a/system/database/drivers/sqlite/sqlite_forge.php b/system/database/drivers/sqlite/sqlite_forge.php index dd6f0f78d..35be1b74b 100644 --- a/system/database/drivers/sqlite/sqlite_forge.php +++ b/system/database/drivers/sqlite/sqlite_forge.php @@ -194,7 +194,7 @@ class CI_DB_sqlite_forge extends CI_DB_forge { $sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '.$this->db->protect_identifiers($column_name); // DROP has everything it needs now. - if ($alter_type == 'DROP') + if ($alter_type === 'DROP') { // SQLite does not support dropping columns // http://www.sqlite.org/omitted.html @@ -204,7 +204,7 @@ class CI_DB_sqlite_forge extends CI_DB_forge { $sql .= " $column_definition"; - if ($default_value != '') + if ($default_value !== '') { $sql .= " DEFAULT \"$default_value\""; } @@ -218,7 +218,7 @@ class CI_DB_sqlite_forge extends CI_DB_forge { $sql .= ' NOT NULL'; } - if ($after_field != '') + if ($after_field !== '') { return $sql.' AFTER '.$this->db->protect_identifiers($after_field); } diff --git a/system/database/drivers/sqlite3/sqlite3_driver.php b/system/database/drivers/sqlite3/sqlite3_driver.php index ea4cf2d4f..ea7e6d43c 100644 --- a/system/database/drivers/sqlite3/sqlite3_driver.php +++ b/system/database/drivers/sqlite3/sqlite3_driver.php @@ -255,7 +255,7 @@ class CI_DB_sqlite3_driver extends CI_DB { protected function _list_tables($prefix_limit = FALSE) { return 'SELECT "NAME" FROM "SQLITE_MASTER" WHERE "TYPE" = \'table\'' - .(($prefix_limit !== FALSE && $this->dbprefix != '') + .(($prefix_limit !== FALSE && $this->dbprefix !== '') ? ' AND "NAME" LIKE \''.$this->escape_like_str($this->dbprefix).'%\' '.sprintf($this->_like_escape_str, $this->_like_escape_chr) : ''); } diff --git a/system/database/drivers/sqlite3/sqlite3_forge.php b/system/database/drivers/sqlite3/sqlite3_forge.php index 20f1e6f63..0a5dc9211 100644 --- a/system/database/drivers/sqlite3/sqlite3_forge.php +++ b/system/database/drivers/sqlite3/sqlite3_forge.php @@ -184,7 +184,7 @@ class CI_DB_sqlite3_forge extends CI_DB_forge { return 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '.$this->db->protect_identifiers($column_name) .' '.$column_definition - .($default_value != '' ? ' DEFAULT '.$default_value : '') + .($default_value !== '' ? ' DEFAULT '.$default_value : '') // If NOT NULL is specified, the field must have a DEFAULT value other than NULL .(($null !== NULL && $default_value !== 'NULL') ? ' NOT NULL' : ' NULL'); } diff --git a/system/database/drivers/sqlsrv/sqlsrv_forge.php b/system/database/drivers/sqlsrv/sqlsrv_forge.php index c817c2c5d..1529b2a21 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_forge.php +++ b/system/database/drivers/sqlsrv/sqlsrv_forge.php @@ -155,21 +155,21 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { $sql = 'ALTER TABLE '.$this->db->protect_identifiers($table).' '.$alter_type.' '.$this->db->protect_identifiers($column_name); // DROP has everything it needs now. - if ($alter_type == 'DROP') + if ($alter_type === 'DROP') { return $sql; } $sql .= ' '.$column_definition; - if ($default_value != '') + if ($default_value !== '') { $sql .= " DEFAULT '".$default_value."'"; } $sql .= ($null === NULL) ? ' NULL' : ' NOT NULL'; - if ($after_field != '') + if ($after_field !== '') { return $sql.' AFTER '.$this->db->protect_identifiers($after_field); } -- cgit v1.2.3-24-g4f1b From 773ccc318f2769c9b7579630569b5d8ba47b114b Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Sat, 2 Jun 2012 11:11:08 +0100 Subject: Replaced `==` with `===` and `!=` with `!==` in /system/helpers --- system/helpers/captcha_helper.php | 6 +++--- system/helpers/date_helper.php | 38 ++++++++++++++++++------------------- system/helpers/directory_helper.php | 2 +- system/helpers/download_helper.php | 2 +- system/helpers/file_helper.php | 4 ++-- system/helpers/form_helper.php | 32 +++++++++++++++---------------- system/helpers/html_helper.php | 6 +++--- system/helpers/language_helper.php | 2 +- system/helpers/smiley_helper.php | 4 ++-- system/helpers/string_helper.php | 2 +- system/helpers/text_helper.php | 10 +++++----- system/helpers/url_helper.php | 24 +++++++++++------------ system/helpers/xml_helper.php | 4 ++-- 13 files changed, 68 insertions(+), 68 deletions(-) diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php index b11670658..4676b2a65 100644 --- a/system/helpers/captcha_helper.php +++ b/system/helpers/captcha_helper.php @@ -64,7 +64,7 @@ if ( ! function_exists('create_captcha')) } } - if ($img_path == '' OR $img_url == '' + if ($img_path === '' OR $img_url === '' OR ! @is_dir($img_path) OR ! is_writeable($img_path) OR ! extension_loaded('gd')) { @@ -93,7 +93,7 @@ if ( ! function_exists('create_captcha')) // Do we have a "word" yet? // ----------------------------------- - if ($word == '') + if ($word === '') { $pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $word = ''; @@ -156,7 +156,7 @@ if ( ! function_exists('create_captcha')) // Write the text // ----------------------------------- - $use_font = ($font_path != '' && file_exists($font_path) && function_exists('imagettftext')); + $use_font = ($font_path !== '' && file_exists($font_path) && function_exists('imagettftext')); if ($use_font === FALSE) { $font_size = 5; diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php index 5f0427f7d..0bda33378 100644 --- a/system/helpers/date_helper.php +++ b/system/helpers/date_helper.php @@ -50,7 +50,7 @@ if ( ! function_exists('now')) { $CI =& get_instance(); - if (strtolower($CI->config->item('time_reference')) == 'gmt') + if (strtolower($CI->config->item('time_reference')) === 'gmt') { $now = time(); $system_time = mktime(gmdate("H", $now), gmdate("i", $now), gmdate("s", $now), gmdate("m", $now), gmdate("d", $now), gmdate("Y", $now)); @@ -90,12 +90,12 @@ if ( ! function_exists('mdate')) */ function mdate($datestr = '', $time = '') { - if ($datestr == '') + if ($datestr === '') { return ''; } - $time = ($time == '') ? now() : $time; + $time = ($time === '') ? now() : $time; $datestr = str_replace( '%\\', @@ -280,14 +280,14 @@ if ( ! function_exists('days_in_month')) return 0; } - if ( ! is_numeric($year) OR strlen($year) != 4) + if ( ! is_numeric($year) OR strlen($year) !== 4) { $year = date('Y'); } - if ($month == 2) + if ($month === 2) { - if ($year % 400 == 0 OR ($year % 4 == 0 && $year % 100 != 0)) + if ($year % 400 === 0 OR ($year % 4 === 0 && $year % 100 !== 0)) { return 29; } @@ -310,7 +310,7 @@ if ( ! function_exists('local_to_gmt')) */ function local_to_gmt($time = '') { - if ($time == '') + if ($time === '') { $time = time(); } @@ -344,14 +344,14 @@ if ( ! function_exists('gmt_to_local')) */ function gmt_to_local($time = '', $timezone = 'UTC', $dst = FALSE) { - if ($time == '') + if ($time === '') { return now(); } $time += timezones($timezone) * 3600; - if ($dst == TRUE) + if ($dst === TRUE) { $time += 3600; } @@ -410,7 +410,7 @@ if ( ! function_exists('unix_to_human')) { $r = date('Y', $time).'-'.date('m', $time).'-'.date('d', $time).' '; - if ($fmt == 'us') + if ($fmt === 'us') { $r .= date('h', $time).':'.date('i', $time); } @@ -424,7 +424,7 @@ if ( ! function_exists('unix_to_human')) $r .= ':'.date('s', $time); } - if ($fmt == 'us') + if ($fmt === 'us') { $r .= ' '.date('A', $time); } @@ -447,7 +447,7 @@ if ( ! function_exists('human_to_unix')) */ function human_to_unix($datestr = '') { - if ($datestr == '') + if ($datestr === '') { return FALSE; } @@ -491,7 +491,7 @@ if ( ! function_exists('human_to_unix')) $hour += 12; } - if (substr($ampm, 0, 1) === 'a' && $hour == 12) + if (substr($ampm, 0, 1) === 'a' && $hour === 12) { $hour = '00'; } @@ -562,7 +562,7 @@ if ( ! function_exists('nice_date')) // Any other kind of string, when converted into UNIX time, // produces "0 seconds after epoc..." is probably bad... // return "Invalid Date". - if (date('U', strtotime($bad_date)) == '0') + if (date('U', strtotime($bad_date)) === '0') { return 'Invalid Date'; } @@ -591,11 +591,11 @@ if ( ! function_exists('timezone_menu')) $CI =& get_instance(); $CI->lang->load('date'); - $default = ($default == 'GMT') ? 'UTC' : $default; + $default = ($default === 'GMT') ? 'UTC' : $default; $menu = '