From 35be644f6c912f6cdbe9392557ac38a9fbbc0416 Mon Sep 17 00:00:00 2001 From: Stéphane Goetz Date: Mon, 24 Oct 2011 23:10:07 +0300 Subject: Added a "break 2;", When overriding the cache file in an other folder, it would try to load all files corresponding to this name and create an error because of a double file loading --- system/libraries/Driver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/libraries/Driver.php b/system/libraries/Driver.php index 8df137e74..30204d075 100644 --- a/system/libraries/Driver.php +++ b/system/libraries/Driver.php @@ -76,7 +76,7 @@ class CI_Driver_Library { if (file_exists($filepath)) { include_once $filepath; - break; + break 2; } } } -- cgit v1.2.3-24-g4f1b From d08a51047ac462ddc90ddd460fc424683aa8dc84 Mon Sep 17 00:00:00 2001 From: Gustav Bertram Date: Mon, 14 Nov 2011 15:10:41 +0200 Subject: Adding a default memcached config file - GWB --- application/config/memcached.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 application/config/memcached.php diff --git a/application/config/memcached.php b/application/config/memcached.php new file mode 100644 index 000000000..d2ece65cc --- /dev/null +++ b/application/config/memcached.php @@ -0,0 +1,17 @@ + '127.0.0.1', + 'port' => '11211', + 'weight' => '1' +); + +/* End of file memcached.php */ +/* Location: ./application/config/memcached.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From ee04a1c8e25cc98aa5e68b328074efe6d6abf222 Mon Sep 17 00:00:00 2001 From: Gustav Bertram Date: Mon, 14 Nov 2011 15:19:21 +0200 Subject: Adding a default memcached config file - GWB --- application/config/memcached.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/application/config/memcached.php b/application/config/memcached.php index d2ece65cc..1b34aa683 100644 --- a/application/config/memcached.php +++ b/application/config/memcached.php @@ -3,14 +3,19 @@ | ------------------------------------------------------------------------- | Memcached settings | ------------------------------------------------------------------------- -| Memcached doesn't seem to like hostnames. Try use an IP first. -GWB +| To add another server, just add another set in the array. +| +| NOTE: Memcached doesn't seem to like hostnames. Try using an IP first. +| -GWB | */ -$config['default'] = array( - 'hostname' => '127.0.0.1', - 'port' => '11211', - 'weight' => '1' +$config = array( + 'default' => array( + 'hostname' => '127.0.0.1', + 'port' => '11211', + 'weight' => '1', + ), ); /* End of file memcached.php */ -- cgit v1.2.3-24-g4f1b From 8bd8f687827454f83a5512b96bb0f632178a08a6 Mon Sep 17 00:00:00 2001 From: dixy Date: Mon, 19 Dec 2011 22:26:12 +0100 Subject: Prev link and 1 link don't have the same url with use_page_numbers=TRUE --- system/libraries/Pagination.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php index eea953ae4..cc73e0d2f 100644 --- a/system/libraries/Pagination.php +++ b/system/libraries/Pagination.php @@ -236,13 +236,13 @@ class CI_Pagination { { $i = ($this->use_page_numbers) ? $uri_page_number - 1 : $uri_page_number - $this->per_page; - if (($i == 0 OR ($this->use_page_numbers && $i == 1)) AND $this->first_url != '') + if ($i == $base_page AND $this->first_url != '') { $output .= $this->prev_tag_open.'anchor_class.'href="'.$this->first_url.'">'.$this->prev_link.''.$this->prev_tag_close; } else { - $i = ($i == 0) ? '' : $this->prefix.$i.$this->suffix; + $i = ($i == $base_page) ? '' : $this->prefix.$i.$this->suffix; $output .= $this->prev_tag_open.'anchor_class.'href="'.$this->base_url.$i.'">'.$this->prev_link.''.$this->prev_tag_close; } -- cgit v1.2.3-24-g4f1b From 37b1d9ba5bef4594aaf458e0406599bdf33deb46 Mon Sep 17 00:00:00 2001 From: dixy Date: Mon, 19 Dec 2011 22:32:48 +0100 Subject: Add #800 to changelog --- 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 44c9432a2..f5432a95d 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -74,6 +74,7 @@ Bug fixes for 3.0 - Fixed a bug where using $this->dbforge->create_table() with PostgreSQL database could lead to fetching whole table. - Bug #795 - Fixed form method and accept-charset when passing an empty array. - Bug #797 - timespan was using incorrect seconds for year and month. +- In Pagination library, when use_page_numbers=TRUE previous link and page 1 link do not have the same url Version 2.1.0 ============= -- cgit v1.2.3-24-g4f1b From a92b903c0e6c2faa2a9480e23e2d3e4b6308878f Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 24 Dec 2011 19:05:58 +0200 Subject: Improve the Image manipulation library --- system/libraries/Image_lib.php | 150 ++++++++++++++---------------------- user_guide_src/source/changelog.rst | 1 + 2 files changed, 59 insertions(+), 92 deletions(-) diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index 20ca1f055..70a127987 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -1,4 +1,4 @@ -y_axis = ($this->y_axis == '' OR ! is_numeric($this->y_axis)) ? 0 : $this->y_axis; // Watermark-related Stuff... - if ($this->wm_font_color != '') + if ($this->wm_font_color != '' AND strlen($this->wm_font_color) === 6) { - if (strlen($this->wm_font_color) == 6) - { - $this->wm_font_color = '#'.$this->wm_font_color; - } + $this->wm_font_color = '#'.$this->wm_font_color; } - if ($this->wm_shadow_color != '') + if ($this->wm_shadow_color != '' AND strlen($this->wm_shadow_color) === 6) { - if (strlen($this->wm_shadow_color) == 6) - { - $this->wm_shadow_color = '#'.$this->wm_shadow_color; - } + $this->wm_shadow_color = '#'.$this->wm_shadow_color; } if ($this->wm_overlay_path != '') @@ -381,13 +375,7 @@ class CI_Image_lib { */ public function resize() { - $protocol = 'image_process_'.$this->image_library; - - if (preg_match('/gd2$/i', $protocol)) - { - $protocol = 'image_process_gd'; - } - + $protocol = (strtolower(substr($this->image_library, 0, -3)) === 'gd2') ? 'image_process_gd' : 'image_process_'.$this->image_library; return $this->$protocol('resize'); } @@ -404,13 +392,7 @@ class CI_Image_lib { */ public function crop() { - $protocol = 'image_process_'.$this->image_library; - - if (preg_match('/gd2$/i', $protocol)) - { - $protocol = 'image_process_gd'; - } - + $protocol = (strtolower(substr($this->image_library, 0, -3)) === 'gd2') ? 'image_process_gd' : 'image_process_'.$this->image_library; return $this->$protocol('crop'); } @@ -453,7 +435,6 @@ class CI_Image_lib { if ($this->image_library == 'imagemagick' OR $this->image_library == 'netpbm') { $protocol = 'image_process_'.$this->image_library; - return $this->$protocol('rotate'); } @@ -484,20 +465,14 @@ class CI_Image_lib { // If the target width/height match the source, AND if the new file name is not equal to the old file name // we'll simply make a copy of the original with the new name... assuming dynamic rendering is off. - if ($this->dynamic_output === FALSE) + if ($this->dynamic_output === FALSE AND $this->orig_width == $this->width AND $this->orig_height == $this->height) { - if ($this->orig_width == $this->width AND $this->orig_height == $this->height) + if ($this->source_image != $this->new_image AND @copy($this->full_src_path, $this->full_dst_path)) { - if ($this->source_image != $this->new_image) - { - if (@copy($this->full_src_path, $this->full_dst_path)) - { - @chmod($this->full_dst_path, FILE_WRITE_MODE); - } - } - - return TRUE; + @chmod($this->full_dst_path, FILE_WRITE_MODE); } + + return TRUE; } // Let's set up our values based on the action @@ -601,9 +576,7 @@ class CI_Image_lib { if ( ! preg_match("/convert$/i", $this->library_path)) { - $this->library_path = rtrim($this->library_path, '/').'/'; - - $this->library_path .= 'convert'; + $this->library_path = rtrim($this->library_path, '/').'/convert'; } // Execute the command @@ -808,11 +781,8 @@ class CI_Image_lib { if ($this->rotation_angle == 'hor') { - for ($i = 0; $i < $height; $i++) + for ($i = 0; $i < $height; $i++, $left = 0, $right = $width-1) { - $left = 0; - $right = $width-1; - while ($left < $right) { $cl = imagecolorat($src_img, $left, $i); @@ -828,11 +798,8 @@ class CI_Image_lib { } else { - for ($i = 0; $i < $width; $i++) + for ($i = 0; $i < $width; $i++, $top = 0, $bot = $height-1) { - $top = 0; - $bot = $height-1; - while ($top < $bot) { $ct = imagecolorat($src_img, $i, $top); @@ -993,12 +960,9 @@ class CI_Image_lib { { $this->image_display_gd($src_img); } - else + elseif ( ! $this->image_save_gd($src_img)) { - if ( ! $this->image_save_gd($src_img)) - { - return FALSE; - } + return FALSE; } imagedestroy($src_img); @@ -1065,7 +1029,9 @@ class CI_Image_lib { if ($this->wm_use_truetype == TRUE) { if ($this->wm_font_size == '') - $this->wm_font_size = '17'; + { + $this->wm_font_size = 17; + } $fontwidth = $this->wm_font_size-($this->wm_font_size/4); $fontheight = $this->wm_font_size; @@ -1090,11 +1056,11 @@ class CI_Image_lib { switch ($this->wm_vrt_alignment) { - case "T" : + case 'T': break; - case "M": $y_axis += ($this->orig_height/2)+($fontheight/2); + case 'M': $y_axis += ($this->orig_height/2)+($fontheight/2); break; - case "B": $y_axis += ($this->orig_height - $fontheight - $this->wm_shadow_distance - ($fontheight/2)); + case 'B': $y_axis += ($this->orig_height - $fontheight - $this->wm_shadow_distance - ($fontheight/2)); break; } @@ -1104,32 +1070,34 @@ class CI_Image_lib { // Set horizontal alignment switch ($this->wm_hor_alignment) { - case "L": + case 'L': break; - case "R": - if ($this->wm_use_drop_shadow) - $x_shad += ($this->orig_width - $fontwidth*strlen($this->wm_text)); - $x_axis += ($this->orig_width - $fontwidth*strlen($this->wm_text)); + case 'R': + if ($this->wm_use_drop_shadow) + { + $x_shad += ($this->orig_width - $fontwidth*strlen($this->wm_text)); + $x_axis += ($this->orig_width - $fontwidth*strlen($this->wm_text)); + } break; - case "C": - if ($this->wm_use_drop_shadow) - $x_shad += floor(($this->orig_width - $fontwidth*strlen($this->wm_text))/2); - $x_axis += floor(($this->orig_width -$fontwidth*strlen($this->wm_text))/2); + case 'C': + if ($this->wm_use_drop_shadow) + { + $x_shad += floor(($this->orig_width - $fontwidth*strlen($this->wm_text))/2); + $x_axis += floor(($this->orig_width - $fontwidth*strlen($this->wm_text))/2); + } break; } // Add the text to the source image - if ($this->wm_use_truetype) + if ($this->wm_use_truetype AND $this->wm_use_drop_shadow) { - if ($this->wm_use_drop_shadow) - imagettftext($src_img, $this->wm_font_size, 0, $x_shad, $y_shad, $drp_color, $this->wm_font_path, $this->wm_text); - imagettftext($src_img, $this->wm_font_size, 0, $x_axis, $y_axis, $txt_color, $this->wm_font_path, $this->wm_text); + imagettftext($src_img, $this->wm_font_size, 0, $x_shad, $y_shad, $drp_color, $this->wm_font_path, $this->wm_text); + imagettftext($src_img, $this->wm_font_size, 0, $x_axis, $y_axis, $txt_color, $this->wm_font_path, $this->wm_text); } - else + elseif ($this->wm_use_drop_shadow) { - if ($this->wm_use_drop_shadow) - imagestring($src_img, $this->wm_font_size, $x_shad, $y_shad, $this->wm_text, $drp_color); - imagestring($src_img, $this->wm_font_size, $x_axis, $y_axis, $this->wm_text, $txt_color); + imagestring($src_img, $this->wm_font_size, $x_shad, $y_shad, $this->wm_text, $drp_color); + imagestring($src_img, $this->wm_font_size, $x_axis, $y_axis, $this->wm_text, $txt_color); } // Output the final image @@ -1369,26 +1337,24 @@ class CI_Image_lib { } $vals = getimagesize($path); - $types = array(1 => 'gif', 2 => 'jpeg', 3 => 'png'); - - $mime = (isset($types[$vals['2']])) ? 'image/'.$types[$vals['2']] : 'image/jpg'; + $mime = (isset($types[$vals[2]])) ? 'image/'.$types[$vals[2]] : 'image/jpg'; if ($return == TRUE) { - $v['width'] = $vals['0']; - $v['height'] = $vals['1']; - $v['image_type'] = $vals['2']; - $v['size_str'] = $vals['3']; - $v['mime_type'] = $mime; - - return $v; + return array( + 'width' => $vals[0], + 'height' => $vals[1], + 'image_type' => $vals[2], + 'size_str' => $vals[3], + 'mime_type' => $mime + ); } - $this->orig_width = $vals['0']; - $this->orig_height = $vals['1']; - $this->image_type = $vals['2']; - $this->size_str = $vals['3']; + $this->orig_width = $vals[0]; + $this->orig_height = $vals[1]; + $this->image_type = $vals[2]; + $this->size_str = $vals[3]; $this->mime_type = $mime; return TRUE; @@ -1482,10 +1448,10 @@ class CI_Image_lib { { if ( ! extension_loaded('gd')) { - if ( ! dl('gd.so')) - { - return FALSE; - } + /* As it is stated in the PHP manual, dl() is not always available + * and even if so - it could generate an E_WARNING message on failure + */ + return (function_exists('dl') AND @dl('gd.so')); } return TRUE; diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 8a7109feb..6c80be569 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -76,6 +76,7 @@ Bug fixes for 3.0 - Bug #795 - Fixed form method and accept-charset when passing an empty array. - 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 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. Version 2.1.0 ============= -- cgit v1.2.3-24-g4f1b From 41dd4938306b173fdcc57049f610af4c42949268 Mon Sep 17 00:00:00 2001 From: Andrew Bergal Date: Sat, 24 Dec 2011 22:27:21 -0500 Subject: Fix news item href --- user_guide_src/source/tutorial/news_section.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/tutorial/news_section.rst b/user_guide_src/source/tutorial/news_section.rst index fe8e41607..38e4214ca 100644 --- a/user_guide_src/source/tutorial/news_section.rst +++ b/user_guide_src/source/tutorial/news_section.rst @@ -149,7 +149,7 @@ and add the next piece of code.
-

View article

+

View article

-- cgit v1.2.3-24-g4f1b From a30faf95d1d833f716dd1e181cef5b33b02ef8b9 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sun, 25 Dec 2011 18:15:34 +0200 Subject: Improve the Xmlrpc library --- system/libraries/Xmlrpc.php | 408 +++++++++++++++++++------------------------- 1 file changed, 180 insertions(+), 228 deletions(-) diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php index 7b1e3fa6e..ebb04601b 100644 --- a/system/libraries/Xmlrpc.php +++ b/system/libraries/Xmlrpc.php @@ -1,13 +1,13 @@ -xmlrpcName = $this->xmlrpcName; + $this->xmlrpcName = $this->xmlrpcName; $this->xmlrpc_backslash = chr(92).chr(92); // Types for info sent back and forth @@ -101,23 +101,23 @@ class CI_Xmlrpc { // Array of Valid Parents for Various XML-RPC elements $this->valid_parents = array('BOOLEAN' => array('VALUE'), - 'I4' => array('VALUE'), - 'INT' => array('VALUE'), - 'STRING' => array('VALUE'), - 'DOUBLE' => array('VALUE'), - 'DATETIME.ISO8601' => array('VALUE'), - 'BASE64' => array('VALUE'), - 'ARRAY' => array('VALUE'), - 'STRUCT' => array('VALUE'), - 'PARAM' => array('PARAMS'), - 'METHODNAME' => array('METHODCALL'), - 'PARAMS' => array('METHODCALL', 'METHODRESPONSE'), - 'MEMBER' => array('STRUCT'), - 'NAME' => array('MEMBER'), - 'DATA' => array('ARRAY'), - 'FAULT' => array('METHODRESPONSE'), - 'VALUE' => array('MEMBER', 'DATA', 'PARAM', 'FAULT') - ); + 'I4' => array('VALUE'), + 'INT' => array('VALUE'), + 'STRING' => array('VALUE'), + 'DOUBLE' => array('VALUE'), + 'DATETIME.ISO8601' => array('VALUE'), + 'BASE64' => array('VALUE'), + 'ARRAY' => array('VALUE'), + 'STRUCT' => array('VALUE'), + 'PARAM' => array('PARAMS'), + 'METHODNAME' => array('METHODCALL'), + 'PARAMS' => array('METHODCALL', 'METHODRESPONSE'), + 'MEMBER' => array('STRUCT'), + 'NAME' => array('MEMBER'), + 'DATA' => array('ARRAY'), + 'FAULT' => array('METHODRESPONSE'), + 'VALUE' => array('MEMBER', 'DATA', 'PARAM', 'FAULT') + ); // XML-RPC Responses @@ -128,7 +128,7 @@ class CI_Xmlrpc { $this->xmlrpcerr['incorrect_params'] = '3'; $this->xmlrpcstr['incorrect_params'] = 'Incorrect parameters were passed to method'; $this->xmlrpcerr['introspect_unknown'] = '4'; - $this->xmlrpcstr['introspect_unknown'] = "Cannot inspect signature for request: method unknown"; + $this->xmlrpcstr['introspect_unknown'] = 'Cannot inspect signature for request: method unknown'; $this->xmlrpcerr['http_error'] = '5'; $this->xmlrpcstr['http_error'] = "Did not receive a '200 OK' response from remote server."; $this->xmlrpcerr['no_data'] = '6'; @@ -144,7 +144,7 @@ class CI_Xmlrpc { // Initialize Prefs //------------------------------------- - function initialize($config = array()) + public function initialize($config = array()) { if (count($config) > 0) { @@ -163,9 +163,9 @@ class CI_Xmlrpc { // Take URL and parse it //------------------------------------- - function server($url, $port=80) + public function server($url, $port=80) { - if (substr($url, 0, 4) != "http") + if (strpos($url, 'http') !== 0) { $url = "http://".$url; } @@ -187,7 +187,7 @@ class CI_Xmlrpc { // Set Timeout //------------------------------------- - function timeout($seconds=5) + public function timeout($seconds = 5) { if ( ! is_null($this->client) && is_int($seconds)) { @@ -200,7 +200,7 @@ class CI_Xmlrpc { // Set Methods //------------------------------------- - function method($function) + public function method($function) { $this->method = $function; } @@ -210,7 +210,7 @@ class CI_Xmlrpc { // Take Array of Data and Create Objects //------------------------------------- - function request($incoming) + public function request($incoming) { if ( ! is_array($incoming)) { @@ -231,42 +231,34 @@ class CI_Xmlrpc { // Set Debug //------------------------------------- - function set_debug($flag = TRUE) + public function set_debug($flag = TRUE) { - $this->debug = ($flag == TRUE) ? TRUE : FALSE; + $this->debug = ($flag == TRUE); } //------------------------------------- // Values Parsing //------------------------------------- - function values_parsing($value, $return = FALSE) + public function values_parsing($value, $return = FALSE) { if (is_array($value) && array_key_exists(0, $value)) { - if ( ! isset($value['1']) OR ( ! isset($this->xmlrpcTypes[$value['1']]))) + if ( ! isset($value[1]) OR ( ! isset($this->xmlrpcTypes[$value[1]]))) { - if (is_array($value[0])) - { - $temp = new XML_RPC_Values($value['0'], 'array'); - } - else - { - $temp = new XML_RPC_Values($value['0'], 'string'); - } + $temp = new XML_RPC_Values($value[0], (is_array($value[0]) ? 'array' : 'string')); } - elseif (is_array($value['0']) && ($value['1'] == 'struct' OR $value['1'] == 'array')) + else { - while (list($k) = each($value['0'])) + if (is_array($value[0]) && ($value[1] == 'struct' OR $value[1] == 'array')) { - $value['0'][$k] = $this->values_parsing($value['0'][$k], TRUE); + while (list($k) = each($value[0])) + { + $value[0][$k] = $this->values_parsing($value[0][$k], TRUE); + } } - $temp = new XML_RPC_Values($value['0'], $value['1']); - } - else - { - $temp = new XML_RPC_Values($value['0'], $value['1']); + $temp = new XML_RPC_Values($value[0], $value[1]); } } else @@ -283,24 +275,18 @@ class CI_Xmlrpc { // Sends XML-RPC Request //------------------------------------- - function send_request() + public function send_request() { $this->message = new XML_RPC_Message($this->method,$this->data); $this->message->debug = $this->debug; - if ( ! $this->result = $this->client->send($this->message)) - { - $this->error = $this->result->errstr; - return FALSE; - } - elseif ( ! is_object($this->result->val)) + if ( ! $this->result = $this->client->send($this->message) OR ! is_object($this->result->val)) { $this->error = $this->result->errstr; return FALSE; } $this->response = $this->result->decode(); - return TRUE; } // END @@ -309,7 +295,7 @@ class CI_Xmlrpc { // Returns Error //------------------------------------- - function display_error() + public function display_error() { return $this->error; } @@ -319,7 +305,7 @@ class CI_Xmlrpc { // Returns Remote Server Response //------------------------------------- - function display_response() + public function display_response() { return $this->response; } @@ -329,9 +315,9 @@ class CI_Xmlrpc { // Sends an Error Message for Server Request //------------------------------------- - function send_error_message($number, $message) + public function send_error_message($number, $message) { - return new XML_RPC_Response('0',$number, $message); + return new XML_RPC_Response(0, $number, $message); } // END @@ -340,14 +326,11 @@ class CI_Xmlrpc { // Send Response for Server Request //------------------------------------- - function send_response($response) + public function send_response($response) { // $response should be array of values, which will be parsed // based on their data and type into a valid group of XML-RPC values - - $response = $this->values_parsing($response); - - return new XML_RPC_Response($response); + return new XML_RPC_Response($this->values_parsing($response)); } // END @@ -364,13 +347,13 @@ class CI_Xmlrpc { */ class XML_RPC_Client extends CI_Xmlrpc { - var $path = ''; - var $server = ''; - var $port = 80; - var $errno = ''; - var $errstring = ''; - var $timeout = 5; - var $no_multicall = FALSE; + public $path = ''; + public $server = ''; + public $port = 80; + public $errno = ''; + public $errstring = ''; + public $timeout = 5; + public $no_multicall = FALSE; public function __construct($path, $server, $port=80) { @@ -381,7 +364,7 @@ class XML_RPC_Client extends CI_Xmlrpc $this->path = $path; } - function send($msg) + public function send($msg) { if (is_array($msg)) { @@ -393,7 +376,7 @@ class XML_RPC_Client extends CI_Xmlrpc return $this->sendPayload($msg); } - function sendPayload($msg) + public function sendPayload($msg) { $fp = @fsockopen($this->server, $this->port,$this->errno, $this->errstr, $this->timeout); @@ -411,12 +394,12 @@ class XML_RPC_Client extends CI_Xmlrpc } $r = "\r\n"; - $op = "POST {$this->path} HTTP/1.0$r"; - $op .= "Host: {$this->server}$r"; - $op .= "Content-Type: text/xml$r"; - $op .= "User-Agent: {$this->xmlrpcName}$r"; - $op .= "Content-Length: ".strlen($msg->payload). "$r$r"; - $op .= $msg->payload; + $op = "POST {$this->path} HTTP/1.0$r" + . "Host: {$this->server}$r" + . "Content-Type: text/xml$r" + . "User-Agent: {$this->xmlrpcName}$r" + . "Content-Length: ".strlen($msg->payload)."$r$r" + . $msg->payload; if ( ! fputs($fp, $op, strlen($op))) @@ -430,8 +413,8 @@ class XML_RPC_Client extends CI_Xmlrpc return $resp; } -} // end class XML_RPC_Client - +} +// end class XML_RPC_Client /** * XML-RPC Response class @@ -442,11 +425,11 @@ class XML_RPC_Client extends CI_Xmlrpc */ class XML_RPC_Response { - var $val = 0; - var $errno = 0; - var $errstr = ''; - var $headers = array(); - var $xss_clean = TRUE; + public $val = 0; + public $errno = 0; + public $errstr = ''; + public $headers = array(); + public $xss_clean = TRUE; public function __construct($val, $code = 0, $fstr = '') { @@ -468,27 +451,26 @@ class XML_RPC_Response } } - function faultCode() + public function faultCode() { return $this->errno; } - function faultString() + public function faultString() { return $this->errstr; } - function value() + public function value() { return $this->val; } - function prepare_response() + public function prepare_response() { - $result = "\n"; - if ($this->errno) - { - $result .= ' + return "\n" + . ($this->errno + ? ' @@ -501,23 +483,16 @@ class XML_RPC_Response -'; - } - else - { - $result .= "\n\n" . - $this->val->serialize_class() . - "\n"; - } - $result .= "\n"; - return $result; +' + : "\n\n".$this->val->serialize_class()."\n") + . "\n"; } - function decode($array=FALSE) + public function decode($array = FALSE) { $CI =& get_instance(); - - if ($array !== FALSE && is_array($array)) + + if (is_array($array)) { while (list($key) = each($array)) { @@ -556,7 +531,7 @@ class XML_RPC_Response // XML-RPC Object to PHP Types //------------------------------------- - function xmlrpc_decoder($xmlrpc_val) + public function xmlrpc_decoder($xmlrpc_val) { $kind = $xmlrpc_val->kindOf(); @@ -568,11 +543,9 @@ class XML_RPC_Response { reset($xmlrpc_val->me); list($a,$b) = each($xmlrpc_val->me); - $size = count($b); - $arr = array(); - for ($i = 0; $i < $size; $i++) + for ($i = 0, $size = count($b); $i < $size; $i++) { $arr[] = $this->xmlrpc_decoder($xmlrpc_val->me['array'][$i]); } @@ -596,7 +569,7 @@ class XML_RPC_Response // ISO-8601 time to server or UTC time //------------------------------------- - function iso8601_decode($time, $utc=0) + public function iso8601_decode($time, $utc = 0) { // return a timet in the localtime, or UTC $t = 0; @@ -608,9 +581,8 @@ class XML_RPC_Response return $t; } -} // End Response Class - - +} +// End Response Class /** * XML-RPC Message class @@ -621,10 +593,10 @@ class XML_RPC_Response */ class XML_RPC_Message extends CI_Xmlrpc { - var $payload; - var $method_name; - var $params = array(); - var $xh = array(); + public $payload; + public $method_name; + public $params = array(); + public $xh = array(); public function __construct($method, $pars=0) { @@ -633,7 +605,7 @@ class XML_RPC_Message extends CI_Xmlrpc $this->method_name = $method; if (is_array($pars) && count($pars) > 0) { - for ($i=0; $iparams[] = $pars[$i]; @@ -645,13 +617,13 @@ class XML_RPC_Message extends CI_Xmlrpc // Create Payload to Send //------------------------------------- - function createPayload() + public function createPayload() { - $this->payload = "\r\n\r\n"; - $this->payload .= '' . $this->method_name . "\r\n"; - $this->payload .= "\r\n"; + $this->payload = "\r\n\r\n" + . ''.$this->method_name."\r\n" + . "\r\n"; - for ($i=0; $iparams); $i++) + for ($i = 0, $c = count($this->params); $i < $c; $i++) { // $p = XML_RPC_Values $p = $this->params[$i]; @@ -665,7 +637,7 @@ class XML_RPC_Message extends CI_Xmlrpc // Parse External XML-RPC Server's Response //------------------------------------- - function parseResponse($fp) + public function parseResponse($fp) { $data = ''; @@ -680,16 +652,14 @@ class XML_RPC_Message extends CI_Xmlrpc if ($this->debug === TRUE) { - echo "
";
-			echo "---DATA---\n" . htmlspecialchars($data) . "\n---END DATA---\n\n";
-			echo "
"; + echo "
---DATA---\n".htmlspecialchars($data)."\n---END DATA---\n\n
"; } //------------------------------------- // Check for data //------------------------------------- - if ($data == "") + if ($data === '') { error_log($this->xmlrpcstr['no_data']); $r = new XML_RPC_Response(0, $this->xmlrpcerr['no_data'], $this->xmlrpcstr['no_data']); @@ -701,7 +671,7 @@ class XML_RPC_Message extends CI_Xmlrpc // Check for HTTP 200 Response //------------------------------------- - if (strncmp($data, 'HTTP', 4) == 0 && ! preg_match('/^HTTP\/[0-9\.]+ 200 /', $data)) + if (strncmp($data, 'HTTP', 4) === 0 && ! preg_match('/^HTTP\/[0-9\.]+ 200 /', $data)) { $errstr= substr($data, 0, strpos($data, "\n")-1); $r = new XML_RPC_Response(0, $this->xmlrpcerr['http_error'], $this->xmlrpcstr['http_error']. ' (' . $errstr . ')'); @@ -714,13 +684,14 @@ class XML_RPC_Message extends CI_Xmlrpc $parser = xml_parser_create($this->xmlrpc_defencoding); - $this->xh[$parser] = array(); - $this->xh[$parser]['isf'] = 0; - $this->xh[$parser]['ac'] = ''; - $this->xh[$parser]['headers'] = array(); - $this->xh[$parser]['stack'] = array(); - $this->xh[$parser]['valuestack'] = array(); - $this->xh[$parser]['isf_reason'] = 0; + $this->xh[$parser] = array( + 'isf' => 0, + 'ac' => '', + 'headers' => array(), + 'stack' => array(), + 'valuestack' => array(), + 'isf_reason' => 0 + ); xml_set_object($parser, $this); xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true); @@ -769,9 +740,7 @@ class XML_RPC_Message extends CI_Xmlrpc { if ($this->debug === TRUE) { - echo "---Invalid Return---\n"; - echo $this->xh[$parser]['isf_reason']; - echo "---Invalid Return---\n\n"; + echo "---Invalid Return---\n".$this->xh[$parser]['isf_reason']."---Invalid Return---\n\n"; } $r = new XML_RPC_Response(0, $this->xmlrpcerr['invalid_return'],$this->xmlrpcstr['invalid_return'].' '.$this->xh[$parser]['isf_reason']); @@ -801,9 +770,7 @@ class XML_RPC_Message extends CI_Xmlrpc echo "---END HEADERS---\n\n"; } - echo "---DATA---\n" . htmlspecialchars($data) . "\n---END DATA---\n\n"; - - echo "---PARSED---\n" ; + echo "---DATA---\n".htmlspecialchars($data)."\n---END DATA---\n\n---PARSED---\n"; var_dump($this->xh[$parser]['value']); echo "\n---END PARSED---"; } @@ -813,7 +780,6 @@ class XML_RPC_Message extends CI_Xmlrpc //------------------------------------- $v = $this->xh[$parser]['value']; - if ($this->xh[$parser]['isf']) { $errno_v = $v->me['struct']['faultCode']; @@ -855,7 +821,7 @@ class XML_RPC_Message extends CI_Xmlrpc // Start Element Handler //------------------------------------- - function open_tag($the_parser, $name, $attrs) + public function open_tag($the_parser, $name, $attrs) { // If invalid nesting, then return if ($this->xh[$the_parser]['isf'] > 1) return; @@ -957,7 +923,7 @@ class XML_RPC_Message extends CI_Xmlrpc // End Element Handler //------------------------------------- - function closing_tag($the_parser, $name) + public function closing_tag($the_parser, $name) { if ($this->xh[$the_parser]['isf'] > 1) return; @@ -1101,7 +1067,7 @@ class XML_RPC_Message extends CI_Xmlrpc // Parses Character Data //------------------------------------- - function character_data($the_parser, $data) + public function character_data($the_parser, $data) { if ($this->xh[$the_parser]['isf'] > 1) return; // XML Fault found already @@ -1123,13 +1089,16 @@ class XML_RPC_Message extends CI_Xmlrpc } - function addParam($par) { $this->params[]=$par; } + public function addParam($par) + { + $this->params[] = $par; + } - function output_parameters($array=FALSE) + public function output_parameters($array = FALSE) { $CI =& get_instance(); - - if ($array !== FALSE && is_array($array)) + + if (is_array($array)) { while (list($key) = each($array)) { @@ -1151,7 +1120,7 @@ class XML_RPC_Message extends CI_Xmlrpc { $parameters = array(); - for ($i = 0; $i < count($this->params); $i++) + for ($i = 0, $c = count($this->params); $i < $c; $i++) { $a_param = $this->decode_message($this->params[$i]); @@ -1170,7 +1139,7 @@ class XML_RPC_Message extends CI_Xmlrpc } - function decode_message($param) + public function decode_message($param) { $kind = $param->kindOf(); @@ -1185,7 +1154,7 @@ class XML_RPC_Message extends CI_Xmlrpc $arr = array(); - for($i = 0; $i < count($b); $i++) + for($i = 0, $c = count($b); $i < $c; $i++) { $arr[] = $this->decode_message($param->me['array'][$i]); } @@ -1207,9 +1176,8 @@ class XML_RPC_Message extends CI_Xmlrpc } } -} // End XML_RPC_Messages class - - +} +// End XML_RPC_Messages class /** * XML-RPC Values class @@ -1220,10 +1188,10 @@ class XML_RPC_Message extends CI_Xmlrpc */ class XML_RPC_Values extends CI_Xmlrpc { - var $me = array(); - var $mytype = 0; + public $me = array(); + public $mytype = 0; - public function __construct($val=-1, $type='') + public function __construct($val = -1, $type = '') { parent::__construct(); @@ -1246,7 +1214,7 @@ class XML_RPC_Values extends CI_Xmlrpc } } - function addScalar($val, $type='string') + public function addScalar($val, $type = 'string') { $typeof = $this->xmlrpcTypes[$type]; @@ -1264,14 +1232,7 @@ class XML_RPC_Values extends CI_Xmlrpc if ($type == $this->xmlrpcBoolean) { - if (strcasecmp($val,'true')==0 OR $val==1 OR ($val==true && strcasecmp($val,'false'))) - { - $val = 1; - } - else - { - $val=0; - } + $val = (strcasecmp($val,'true') === 0 OR $val == 1 OR ($val == true && strcasecmp($val, 'false'))) ? 1 : 0; } if ($this->mytype == 2) @@ -1290,7 +1251,7 @@ class XML_RPC_Values extends CI_Xmlrpc return 1; } - function addArray($vals) + public function addArray($vals) { if ($this->mytype != 0) { @@ -1303,7 +1264,7 @@ class XML_RPC_Values extends CI_Xmlrpc return 1; } - function addStruct($vals) + public function addStruct($vals) { if ($this->mytype != 0) { @@ -1315,7 +1276,7 @@ class XML_RPC_Values extends CI_Xmlrpc return 1; } - function kindOf() + public function kindOf() { switch($this->mytype) { @@ -1333,7 +1294,7 @@ class XML_RPC_Values extends CI_Xmlrpc } } - function serializedata($typ, $val) + public function serializedata($typ, $val) { $rs = ''; @@ -1345,20 +1306,18 @@ class XML_RPC_Values extends CI_Xmlrpc reset($val); while (list($key2, $val2) = each($val)) { - $rs .= "\n{$key2}\n"; - $rs .= $this->serializeval($val2); - $rs .= "\n"; + $rs .= "\n{$key2}\n".$this->serializeval($val2)."\n"; } $rs .= ''; break; case 2: // array $rs .= "\n\n"; - for($i=0; $i < count($val); $i++) + for($i = 0, $c = count($val); $i < $c; $i++) { $rs .= $this->serializeval($val[$i]); } - $rs.="\n\n"; + $rs .= "\n\n"; break; case 1: // others @@ -1383,22 +1342,21 @@ class XML_RPC_Values extends CI_Xmlrpc return $rs; } - function serialize_class() + public function serialize_class() { return $this->serializeval($this); } - function serializeval($o) + public function serializeval($o) { $ar = $o->me; reset($ar); list($typ, $val) = each($ar); - $rs = "\n".$this->serializedata($typ, $val)."\n"; - return $rs; + return "\n".$this->serializedata($typ, $val)."\n"; } - function scalarval() + public function scalarval() { reset($this->me); list($a,$b) = each($this->me); @@ -1412,24 +1370,18 @@ class XML_RPC_Values extends CI_Xmlrpc // Useful for sending time in XML-RPC - function iso8601_encode($time, $utc=0) + public function iso8601_encode($time, $utc=0) { if ($utc == 1) { - $t = strftime("%Y%m%dT%H:%i:%s", $time); + return strftime("%Y%m%dT%H:%i:%s", $time); } - else - { - if (function_exists('gmstrftime')) - $t = gmstrftime("%Y%m%dT%H:%i:%s", $time); - else - $t = strftime("%Y%m%dT%H:%i:%s", $time - date('Z')); - } - return $t; + + return (function_exists('gmstrftime')) ? gmstrftime('%Y%m%dT%H:%i:%s', $time) : strftime('%Y%m%dT%H:%i:%s', $time - date('Z')); } } // END XML_RPC_Values Class /* End of file Xmlrpc.php */ -/* Location: ./system/libraries/Xmlrpc.php */ \ No newline at end of file +/* Location: ./system/libraries/Xmlrpc.php */ -- cgit v1.2.3-24-g4f1b From 92f019cd6ba0c11ab2d9fee4c1909be99068e74e Mon Sep 17 00:00:00 2001 From: GDmac Date: Mon, 26 Dec 2011 14:55:41 +0100 Subject: No need for eval to extend a class --- system/database/DB.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/database/DB.php b/system/database/DB.php index 5c90f44f3..27142c877 100755 --- a/system/database/DB.php +++ b/system/database/DB.php @@ -138,14 +138,14 @@ function &DB($params = '', $active_record_override = NULL) if ( ! class_exists('CI_DB')) { - eval('class CI_DB extends CI_DB_active_record { }'); + class CI_DB extends CI_DB_active_record { } } } else { if ( ! class_exists('CI_DB')) { - eval('class CI_DB extends CI_DB_driver { }'); + class CI_DB extends CI_DB_driver { } } } -- cgit v1.2.3-24-g4f1b From 5342e8b0d8e4c0b585a4757d60f0fd7127704755 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 27 Dec 2011 02:57:52 +0200 Subject: Remove access lines from method descriptions --- system/libraries/Image_lib.php | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index 70a127987..2737503a8 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -111,7 +111,6 @@ class CI_Image_lib { * * Resets values in case this class is used in a loop * - * @access public * @return void */ public function clear() @@ -154,7 +153,6 @@ class CI_Image_lib { /** * initialize image preferences * - * @access public * @param array * @return bool */ @@ -370,7 +368,6 @@ class CI_Image_lib { * This is a wrapper function that chooses the proper * resize function based on the protocol specified * - * @access public * @return bool */ public function resize() @@ -387,7 +384,6 @@ class CI_Image_lib { * This is a wrapper function that chooses the proper * cropping function based on the protocol specified * - * @access public * @return bool */ public function crop() @@ -404,7 +400,6 @@ class CI_Image_lib { * This is a wrapper function that chooses the proper * rotation function based on the protocol specified * - * @access public * @return bool */ public function rotate() @@ -455,7 +450,6 @@ class CI_Image_lib { * * This function will resize or crop * - * @access public * @param string * @return bool */ @@ -561,7 +555,6 @@ class CI_Image_lib { * * This function will resize, crop or rotate * - * @access public * @param string * @return bool */ @@ -629,7 +622,6 @@ class CI_Image_lib { * * This function will resize, crop or rotate * - * @access public * @param string * @return bool */ @@ -713,7 +705,6 @@ class CI_Image_lib { /** * Image Rotate Using GD * - * @access public * @return bool */ public function image_rotate_gd() @@ -766,7 +757,6 @@ class CI_Image_lib { * * This function will flip horizontal or vertical * - * @access public * @return bool */ public function image_mirror_gd() @@ -845,7 +835,6 @@ class CI_Image_lib { * This is a wrapper function that chooses the type * of watermarking based on the specified preference. * - * @access public * @param string * @return bool */ @@ -866,7 +855,6 @@ class CI_Image_lib { /** * Watermark - Graphic Version * - * @access public * @return bool */ public function overlay_watermark() @@ -976,7 +964,6 @@ class CI_Image_lib { /** * Watermark - Text Version * - * @access public * @return bool */ public function text_watermark() @@ -1123,7 +1110,6 @@ class CI_Image_lib { * This simply creates an image resource handle * based on the type of image being processed * - * @access public * @param string * @return resource */ @@ -1180,7 +1166,6 @@ class CI_Image_lib { * Takes an image resource as input and writes the file * to the specified destination * - * @access public * @param resource * @return bool */ @@ -1241,7 +1226,6 @@ class CI_Image_lib { /** * Dynamically outputs an image * - * @access public * @param resource * @return void */ @@ -1277,7 +1261,6 @@ class CI_Image_lib { * This function lets us re-proportion the width/height * if users choose to maintain the aspect ratio when resizing. * - * @access public * @return void */ public function image_reproportion() @@ -1318,7 +1301,6 @@ class CI_Image_lib { * * A helper function that gets info about the file * - * @access public * @param string * @return mixed */ @@ -1376,7 +1358,6 @@ class CI_Image_lib { * 'new_height' => '' * ); * - * @access public * @param array * @return array */ @@ -1424,7 +1405,6 @@ class CI_Image_lib { * $array['ext'] = '.jpg'; * $array['name'] = 'my.cool'; * - * @access public * @param array * @return array */ @@ -1441,7 +1421,6 @@ class CI_Image_lib { /** * Is GD Installed? * - * @access public * @return bool */ public function gd_loaded() @@ -1462,7 +1441,6 @@ class CI_Image_lib { /** * Get GD version * - * @access public * @return mixed */ public function gd_version() @@ -1483,7 +1461,6 @@ class CI_Image_lib { /** * Set error message * - * @access public * @param string * @return void */ @@ -1515,7 +1492,6 @@ class CI_Image_lib { /** * Show error messages * - * @access public * @param string * @return string */ -- cgit v1.2.3-24-g4f1b From 0cbcc1aecab7aaea719eafc58e68e0a81987ceeb Mon Sep 17 00:00:00 2001 From: Greg Aker Date: Tue, 27 Dec 2011 17:11:38 -0600 Subject: Fix #808 Postgresql DBForge Driver errors. - _process_fields() was missing and add_column(), drop_column() was producing malformed queries. --- system/database/drivers/postgre/postgre_forge.php | 106 +++++++++++----------- 1 file changed, 51 insertions(+), 55 deletions(-) diff --git a/system/database/drivers/postgre/postgre_forge.php b/system/database/drivers/postgre/postgre_forge.php index f86ba2dda..7368b9447 100644 --- a/system/database/drivers/postgre/postgre_forge.php +++ b/system/database/drivers/postgre/postgre_forge.php @@ -63,32 +63,13 @@ class CI_DB_postgre_forge extends CI_DB_forge { } // -------------------------------------------------------------------- - + /** - * Create Table - * - * @access private - * @param string the table name - * @param array the fields - * @param mixed primary key(s) - * @param mixed key(s) - * @param boolean should 'IF NOT EXISTS' be added to the SQL - * @return bool + * Process Fields */ - function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) + function _process_fields($fields, $primary_keys=array()) { - $sql = 'CREATE TABLE '; - - if ($if_not_exists === TRUE) - { - // PostgreSQL doesn't support IF NOT EXISTS syntax so we check if table exists manually - if ($this->db->table_exists($table)) - { - return TRUE; - } - } - - $sql .= $this->db->_escape_identifiers($table)." ("; + $sql = ''; $current_field_count = 0; foreach ($fields as $field=>$attributes) @@ -184,6 +165,38 @@ class CI_DB_postgre_forge extends CI_DB_forge { $sql .= ','; } } + + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * Create Table + * + * @access private + * @param string the table name + * @param array the fields + * @param mixed primary key(s) + * @param mixed key(s) + * @param boolean should 'IF NOT EXISTS' be added to the SQL + * @return bool + */ + function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) + { + $sql = 'CREATE TABLE '; + + if ($if_not_exists === TRUE) + { + // PostgreSQL doesn't support IF NOT EXISTS syntax so we check if table exists manually + if ($this->db->table_exists($table)) + { + return TRUE; + } + } + + $sql .= $this->db->_escape_identifiers($table)." ("; + $sql .= $this->_process_fields($fields, $primary_keys); if (count($primary_keys) > 0) { @@ -249,40 +262,25 @@ class CI_DB_postgre_forge extends CI_DB_forge { * @param string the field after which we should add the new field * @return object */ - function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') - { - $sql = 'ALTER TABLE '.$this->db->_protect_identifiers($table)." $alter_type ".$this->db->_protect_identifiers($column_name); + function _alter_table($alter_type, $table, $fields, $after_field = '') + { + $sql = 'ALTER TABLE '.$this->db->_protect_identifiers($table)." $alter_type "; - // DROP has everything it needs now. - if ($alter_type == 'DROP') - { - return $sql; - } + // DROP has everything it needs now. + if ($alter_type == 'DROP') + { + return $sql.$this->db->_protect_identifiers($fields); + } - $sql .= " $column_definition"; + $sql .= $this->_process_fields($fields); - if ($default_value != '') - { - $sql .= " DEFAULT \"$default_value\""; - } + if ($after_field != '') + { + $sql .= ' AFTER ' . $this->db->_protect_identifiers($after_field); + } - if ($null === NULL) - { - $sql .= ' NULL'; - } - else - { - $sql .= ' NOT NULL'; - } - - if ($after_field != '') - { - $sql .= ' AFTER ' . $this->db->_protect_identifiers($after_field); - } - - return $sql; - - } + return $sql; + } // -------------------------------------------------------------------- @@ -301,8 +299,6 @@ class CI_DB_postgre_forge extends CI_DB_forge { $sql = 'ALTER TABLE '.$this->db->_protect_identifiers($table_name)." RENAME TO ".$this->db->_protect_identifiers($new_table_name); return $sql; } - - } /* End of file postgre_forge.php */ -- cgit v1.2.3-24-g4f1b From 6924e40a4841eeb87d4c38294cfbe452bb6368cb Mon Sep 17 00:00:00 2001 From: Greg Aker Date: Tue, 27 Dec 2011 17:19:50 -0600 Subject: Adding docblock to _process_fields() in the postgres dbforge file. --- system/database/drivers/postgre/postgre_forge.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/system/database/drivers/postgre/postgre_forge.php b/system/database/drivers/postgre/postgre_forge.php index 7368b9447..d54b99b23 100644 --- a/system/database/drivers/postgre/postgre_forge.php +++ b/system/database/drivers/postgre/postgre_forge.php @@ -66,6 +66,9 @@ class CI_DB_postgre_forge extends CI_DB_forge { /** * Process Fields + * + * @param mixed the fields + * @return string */ function _process_fields($fields, $primary_keys=array()) { -- cgit v1.2.3-24-g4f1b From 345e7ee1c655c53b8022c3e725a4266e15bd2542 Mon Sep 17 00:00:00 2001 From: Ronald Beilsma Date: Wed, 28 Dec 2011 12:59:04 +0100 Subject: fixed bug in pagination library return value of ceil is of type float --- system/libraries/Pagination.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php index 008c15192..d10bef3e5 100644 --- a/system/libraries/Pagination.php +++ b/system/libraries/Pagination.php @@ -131,7 +131,7 @@ class CI_Pagination { $num_pages = ceil($this->total_rows / $this->per_page); // Is there only one page? Hm... nothing more to do here then. - if ($num_pages === 1) + if ($num_pages == 1) { return ''; } -- cgit v1.2.3-24-g4f1b From 64b013611f65006197fdf465186ca36adf12847d Mon Sep 17 00:00:00 2001 From: Ronald Beilsma Date: Wed, 28 Dec 2011 12:59:45 +0100 Subject: fixed bug in typography library array index starts at 0, not 1 --- system/libraries/Typography.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/libraries/Typography.php b/system/libraries/Typography.php index 651ba7bff..ac9486a6b 100644 --- a/system/libraries/Typography.php +++ b/system/libraries/Typography.php @@ -144,7 +144,7 @@ class CI_Typography { $process = TRUE; $paragraph = FALSE; - for ($i = 1, $c = count($chunks); $i <= $c; $i++) + for ($i = 0, $c = count($chunks) - 1; $i <= $c; $i++) { // Are we dealing with a tag? If so, we'll skip the processing for this cycle. // Well also set the "process" flag which allows us to skip
 tags and a few other things.
-- 
cgit v1.2.3-24-g4f1b


From 7219c07e9e6be839cbf9931a17d587ef4b2895b1 Mon Sep 17 00:00:00 2001
From: WanWizard 
Date: Wed, 28 Dec 2011 14:09:05 +0100
Subject: added query grouping to Active Record

this is a feature that has been lacking for a very long time. lots of people complained
about it over the years, but it never got added so you'd have to resort to handcrafted
queries when you needed this feature.

This is a port of code from DataMapper, in use since CI 1.6.
---
 system/database/DB_active_rec.php                | 258 ++++++++++++++++-------
 user_guide_src/source/database/active_record.rst | 170 +++++++++------
 2 files changed, 295 insertions(+), 133 deletions(-)

diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php
index 530b44e09..b7f43945c 100644
--- a/system/database/DB_active_rec.php
+++ b/system/database/DB_active_rec.php
@@ -5,9 +5,9 @@
  * An open source application development framework for PHP 5.1.6 or newer
  *
  * NOTICE OF LICENSE
- * 
+ *
  * Licensed under the Open Software License version 3.0
- * 
+ *
  * This source file is subject to the Open Software License (OSL 3.0) that is
  * bundled with this package in the files license.txt / license.rst.  It is
  * also available through the world wide web at this URL:
@@ -40,42 +40,44 @@
  */
 class CI_DB_active_record extends CI_DB_driver {
 
-	protected $return_delete_sql	= FALSE;
-	protected $reset_delete_data	= FALSE;
-	
-	protected $ar_select			= array();
-	protected $ar_distinct			= FALSE;
-	protected $ar_from				= array();
-	protected $ar_join				= array();
-	protected $ar_where				= array();
-	protected $ar_like				= array();
-	protected $ar_groupby			= array();
-	protected $ar_having			= array();
-	protected $ar_keys				= array();
-	protected $ar_limit				= FALSE;
-	protected $ar_offset			= FALSE;
-	protected $ar_order				= FALSE;
-	protected $ar_orderby			= array();
-	protected $ar_set				= array();
-	protected $ar_wherein			= array();
-	protected $ar_aliased_tables	= array();
-	protected $ar_store_array		= array();
+	protected $return_delete_sql		= FALSE;
+	protected $reset_delete_data		= FALSE;
+
+	protected $ar_select				= array();
+	protected $ar_distinct				= FALSE;
+	protected $ar_from					= array();
+	protected $ar_join					= array();
+	protected $ar_where					= array();
+	protected $ar_like					= array();
+	protected $ar_groupby				= array();
+	protected $ar_having				= array();
+	protected $ar_keys					= array();
+	protected $ar_limit					= FALSE;
+	protected $ar_offset				= FALSE;
+	protected $ar_order					= FALSE;
+	protected $ar_orderby				= array();
+	protected $ar_set					= array();
+	protected $ar_wherein				= array();
+	protected $ar_aliased_tables		= array();
+	protected $ar_store_array			= array();
+	protected $ar_where_group_started	= FALSE;
+	protected $ar_where_group_count		= 0;
 
 	// Active Record Caching variables
-	protected $ar_caching			= FALSE;
-	protected $ar_cache_exists		= array();
-	protected $ar_cache_select		= array();
-	protected $ar_cache_from		= array();
-	protected $ar_cache_join		= array();
-	protected $ar_cache_where		= array();
-	protected $ar_cache_like		= array();
-	protected $ar_cache_groupby		= array();
-	protected $ar_cache_having		= array();
-	protected $ar_cache_orderby		= array();
-	protected $ar_cache_set			= array();
-	
-	protected $ar_no_escape 		= array();
-	protected $ar_cache_no_escape	= array();
+	protected $ar_caching				= FALSE;
+	protected $ar_cache_exists			= array();
+	protected $ar_cache_select			= array();
+	protected $ar_cache_from			= array();
+	protected $ar_cache_join			= array();
+	protected $ar_cache_where			= array();
+	protected $ar_cache_like			= array();
+	protected $ar_cache_groupby			= array();
+	protected $ar_cache_having			= array();
+	protected $ar_cache_orderby			= array();
+	protected $ar_cache_set				= array();
+
+	protected $ar_no_escape 			= array();
+	protected $ar_cache_no_escape		= array();
 
 	// --------------------------------------------------------------------
 
@@ -412,6 +414,8 @@ class CI_DB_active_record extends CI_DB_driver {
 	 */
 	protected function _where($key, $value = NULL, $type = 'AND ', $escape = NULL)
 	{
+		$type = $this->_group_get_type($type);
+
 		if ( ! is_array($key))
 		{
 			$key = array($key => $value);
@@ -441,7 +445,7 @@ class CI_DB_active_record extends CI_DB_driver {
 
 					$v = ' '.$this->escape($v);
 				}
-				
+
 				if ( ! $this->_has_operator($k))
 				{
 					$k .= ' = ';
@@ -553,6 +557,8 @@ class CI_DB_active_record extends CI_DB_driver {
 			return;
 		}
 
+		$type = $this->_group_get_type($type);
+
 		if ( ! is_array($values))
 		{
 			$values = array($values);
@@ -663,6 +669,8 @@ class CI_DB_active_record extends CI_DB_driver {
 	 */
 	protected function _like($field, $match = '', $type = 'AND ', $side = 'both', $not = '')
 	{
+		$type = $this->_group_get_type($type);
+
 		if ( ! is_array($field))
 		{
 			$field = array($field => $match);
@@ -712,6 +720,112 @@ class CI_DB_active_record extends CI_DB_driver {
 
 	// --------------------------------------------------------------------
 
+	/**
+	 * Starts a query group.
+	 *
+	 * @param	string (Internal use only)
+	 * @param	string (Internal use only)
+	 * @return	object
+	 */
+	public function group_start($not = '', $type = 'AND ')
+	{
+		$type = $this->_group_get_type($type);
+
+		$this->ar_where_group_started = TRUE;
+
+		$prefix = (count($this->ar_where) == 0 AND count($this->ar_cache_where) == 0) ? '' : $type;
+		$value =  $prefix . $not . str_repeat(' ', ++$this->ar_where_group_count) . ' (';
+
+		$this->ar_where[] = $value;
+		if ($this->ar_caching)
+		{
+			$this->ar_cache_where[] = $value;
+		}
+
+		return $this;
+	}
+
+	// --------------------------------------------------------------------
+
+	/**
+	 * Starts a query group, but ORs the group
+	 *
+	 * @return	object
+	 */
+	public function or_group_start()
+	{
+		return $this->group_start('', 'OR ');
+	}
+
+	// --------------------------------------------------------------------
+
+	/**
+	 * Starts a query group, but NOTs the group
+	 *
+	 * @return	object
+	 */
+	public function not_group_start()
+	{
+		return $this->group_start('NOT ', 'AND ');
+	}
+
+	// --------------------------------------------------------------------
+
+	/**
+	 * Starts a query group, but OR NOTs the group
+	 *
+	 * @return	object
+	 */
+	public function or_not_group_start()
+	{
+		return $this->group_start('NOT ', 'OR ');
+	}
+
+	// --------------------------------------------------------------------
+
+	/**
+	 * Ends a query group
+	 *
+	 * @return	object
+	 */
+	public function group_end()
+	{
+		$value = str_repeat(' ', $this->ar_where_group_count--) . ')';
+
+		$this->ar_where[] = $value;
+		if ($this->ar_caching)
+		{
+			$this->ar_cache_where[] = $value;
+		}
+
+		$this->ar_where_group_started = FALSE;
+
+		return $this;
+	}
+
+	// --------------------------------------------------------------------
+
+	/**
+	 * Group_get_type
+	 *
+	 * Called by group_start(), _like(), _where() and _where_in()
+	 *
+	 * @param	string
+	 * @return	string
+	 */
+	protected function _group_get_type($type)
+	{
+		if ($this->ar_where_group_started)
+		{
+			$type = '';
+			$this->ar_where_group_started = FALSE;
+		}
+
+		return $type;
+	}
+
+	// --------------------------------------------------------------------
+
 	/**
 	 * GROUP BY
 	 *
@@ -950,7 +1064,7 @@ class CI_DB_active_record extends CI_DB_driver {
 
 		return $this;
 	}
-	
+
 	// --------------------------------------------------------------------
 
 	/**
@@ -963,24 +1077,24 @@ class CI_DB_active_record extends CI_DB_driver {
 	 * @param	boolean	TRUE: resets AR values; FALSE: leave AR vaules alone
 	 * @return	string
 	 */
-	public function get_compiled_select($table = '', $reset = TRUE) 
+	public function get_compiled_select($table = '', $reset = TRUE)
 	{
 		if ($table != '')
 		{
 			$this->_track_aliases($table);
 			$this->from($table);
 		}
-		
+
 		$select =  $this->_compile_select();
-		
+
 		if ($reset === TRUE)
 		{
 			$this->_reset_select();
 		}
-		
+
 		return $select;
 	}
-	
+
 	// --------------------------------------------------------------------
 
 	/**
@@ -1197,7 +1311,7 @@ class CI_DB_active_record extends CI_DB_driver {
 
 		return $this;
 	}
-	
+
 	// --------------------------------------------------------------------
 
 	/**
@@ -1211,25 +1325,25 @@ class CI_DB_active_record extends CI_DB_driver {
 	 * @return	string
 	 */
 	public function get_compiled_insert($table = '', $reset = TRUE)
-	{	
+	{
 		if ($this->_validate_insert($table) === FALSE)
 		{
 			return FALSE;
 		}
-		
+
 		$sql = $this->_insert(
 			$this->_protect_identifiers(
 				$this->ar_from[0], TRUE, NULL, FALSE
 			),
-			array_keys($this->ar_set), 
+			array_keys($this->ar_set),
 			array_values($this->ar_set)
 		);
-		
+
 		if ($reset === TRUE)
 		{
 			$this->_reset_write();
 		}
-		
+
 		return $sql;
 	}
 
@@ -1251,24 +1365,24 @@ class CI_DB_active_record extends CI_DB_driver {
 		{
 			$this->set($set);
 		}
-		
+
 		if ($this->_validate_insert($table) === FALSE)
 		{
 			return FALSE;
 		}
-		
+
 		$sql = $this->_insert(
 			$this->_protect_identifiers(
 				$this->ar_from[0], TRUE, NULL, FALSE
-			), 
-			array_keys($this->ar_set), 
+			),
+			array_keys($this->ar_set),
 			array_values($this->ar_set)
 		);
 
 		$this->_reset_write();
 		return $this->query($sql);
 	}
-	
+
 	// --------------------------------------------------------------------
 
 	/**
@@ -1282,7 +1396,7 @@ class CI_DB_active_record extends CI_DB_driver {
 	 * @param	string	the table to insert data into
 	 * @return	string
 	 */
-	protected function _validate_insert($table = '') 
+	protected function _validate_insert($table = '')
 	{
 		if (count($this->ar_set) == 0)
 		{
@@ -1308,7 +1422,7 @@ class CI_DB_active_record extends CI_DB_driver {
 		{
 			$this->ar_from[0] = $table;
 		}
-		
+
 		return TRUE;
 	}
 
@@ -1358,7 +1472,7 @@ class CI_DB_active_record extends CI_DB_driver {
 		$this->_reset_write();
 		return $this->query($sql);
 	}
-	
+
 	// --------------------------------------------------------------------
 
 	/**
@@ -1375,22 +1489,22 @@ class CI_DB_active_record extends CI_DB_driver {
 	{
 		// Combine any cached components with the current statements
 		$this->_merge_cache();
-	
+
 		if ($this->_validate_update($table) === FALSE)
 		{
 			return FALSE;
 		}
-		
+
 		$sql = $this->_update($this->_protect_identifiers($this->ar_from[0], TRUE, NULL, FALSE), $this->ar_set, $this->ar_where, $this->ar_orderby, $this->ar_limit);
-		
+
 		if ($reset === TRUE)
 		{
 			$this->_reset_write();
 		}
-		
+
 		return $sql;
 	}
-	
+
 	// --------------------------------------------------------------------
 
 	/**
@@ -1433,7 +1547,7 @@ class CI_DB_active_record extends CI_DB_driver {
 		$this->_reset_write();
 		return $this->query($sql);
 	}
-		
+
 	// --------------------------------------------------------------------
 
 	/**
@@ -1474,7 +1588,7 @@ class CI_DB_active_record extends CI_DB_driver {
 			$this->ar_from[0] = $table;
 		}
 	}
-	
+
 	// --------------------------------------------------------------------
 
 	/**
@@ -1673,7 +1787,7 @@ class CI_DB_active_record extends CI_DB_driver {
 
 		return $this->query($sql);
 	}
-	
+
 	// --------------------------------------------------------------------
 
 	/**
@@ -1693,7 +1807,7 @@ class CI_DB_active_record extends CI_DB_driver {
 		$this->return_delete_sql = FALSE;
 		return $sql;
 	}
-	
+
 	// --------------------------------------------------------------------
 
 	/**
@@ -1766,7 +1880,7 @@ class CI_DB_active_record extends CI_DB_driver {
 		{
 			$this->_reset_write();
 		}
-		
+
 		if ($this->return_delete_sql === true)
 		{
 			return $sql;
@@ -1774,7 +1888,7 @@ class CI_DB_active_record extends CI_DB_driver {
 
 		return $this->query($sql);
 	}
-	
+
 	// --------------------------------------------------------------------
 
 	/**
@@ -1854,7 +1968,7 @@ class CI_DB_active_record extends CI_DB_driver {
 			}
 		}
 	}
-	
+
 	// --------------------------------------------------------------------
 
 	/**
@@ -2160,12 +2274,12 @@ class CI_DB_active_record extends CI_DB_driver {
 
 		$this->ar_no_escape = $this->ar_cache_no_escape;
 	}
-	
+
 	// --------------------------------------------------------------------
 
 	/**
 	 * Reset Active Record values.
-	 * 
+	 *
 	 * Publicly-visible method to reset the AR values.
 	 *
 	 * @access	public
@@ -2253,4 +2367,4 @@ class CI_DB_active_record extends CI_DB_driver {
 }
 
 /* End of file DB_active_rec.php */
-/* Location: ./system/database/DB_active_rec.php */
\ No newline at end of file
+/* Location: ./system/database/DB_active_rec.php */
diff --git a/user_guide_src/source/database/active_record.rst b/user_guide_src/source/database/active_record.rst
index 1600f0bd9..c04e67d2a 100644
--- a/user_guide_src/source/database/active_record.rst
+++ b/user_guide_src/source/database/active_record.rst
@@ -45,7 +45,7 @@ You'll notice that the above function is assigned to a variable named
 $query, which can be used to show the results::
 
 	$query = $this->db->get('mytable');
-	
+
 	foreach ($query->result() as $row)
 	{
 		echo $row->title;
@@ -57,31 +57,31 @@ discussion regarding result generation.
 $this->db->get_compiled_select()
 ================================
 
-Compiles the selection query just like `$this->db->get()`_ but does not *run* 
+Compiles the selection query just like `$this->db->get()`_ but does not *run*
 the query. This method simply returns the SQL query as a string.
 
 Example::
 
 	$sql = $this->db->get_compiled_select('mytable');
 	echo $sql;
-	
+
 	// Produces string: SELECT * FROM mytable
-	
-The second parameter enables you to set whether or not the active record query 
+
+The second parameter enables you to set whether or not the active record query
 will be reset (by default it will be—just like `$this->db->get()`)::
 
 	echo $this->db->limit(10,20)->get_compiled_select('mytable', FALSE);
-	// Produces string: SELECT * FROM mytable LIMIT 20, 10 
+	// Produces string: SELECT * FROM mytable LIMIT 20, 10
 	// (in MySQL. Other databases have slightly different syntax)
-	
+
 	echo $this->db->select('title, content, date')->get_compiled_select();
 
 	// Produces string: SELECT title, content, date FROM mytable
-	
-The key thing to notice in the above example is that the second query did not 
-utilize `$this->db->from()`_ and did not pass a table name into the first 
-parameter. The reason for this outcome is because the query has not been 
-executed using `$this->db->get()`_ which resets values or reset directly 
+
+The key thing to notice in the above example is that the second query did not
+utilize `$this->db->from()`_ and did not pass a table name into the first
+parameter. The reason for this outcome is because the query has not been
+executed using `$this->db->get()`_ which resets values or reset directly
 using `$this->db->reset_query()`_.
 
 
@@ -116,7 +116,7 @@ with backticks. This is useful if you need a compound select statement.
 
 ::
 
-	$this->db->select('(SELECT SUM(payments.amount) FROM payments WHERE payments.invoice_id=4') AS amount_paid', FALSE); 
+	$this->db->select('(SELECT SUM(payments.amount) FROM payments WHERE payments.invoice_id=4') AS amount_paid', FALSE);
 	$query = $this->db->get('mytable');
 
 
@@ -130,7 +130,7 @@ include a second parameter to rename the resulting field.
 
 	$this->db->select_max('age');
 	$query = $this->db->get('members');  // Produces: SELECT MAX(age) as age FROM members
-	
+
 	$this->db->select_max('age', 'member_age');
 	$query = $this->db->get('members'); // Produces: SELECT MAX(age) as member_age FROM members
 
@@ -195,7 +195,7 @@ Permits you to write the JOIN portion of your query::
 	$this->db->from('blogs');
 	$this->db->join('comments', 'comments.id = blogs.id');
 	$query = $this->db->get();
-	
+
 	// Produces:
 	// SELECT * FROM blogs JOIN comments ON comments.id = blogs.id
 
@@ -224,7 +224,7 @@ methods:
 
 	::
 
-		$this->db->where('name', $name); // Produces: WHERE name = 'Joe' 
+		$this->db->where('name', $name); // Produces: WHERE name = 'Joe'
 
 	Notice that the equal sign is added for you.
 
@@ -236,7 +236,7 @@ methods:
 		$this->db->where('name', $name);
 		$this->db->where('title', $title);
 		$this->db->where('status', $status);
-		// WHERE name = 'Joe' AND title = 'boss' AND status = 'active'  
+		// WHERE name = 'Joe' AND title = 'boss' AND status = 'active'
 
 #. **Custom key/value method:**
 	You can include an operator in the first parameter in order to
@@ -245,7 +245,7 @@ methods:
 	::
 
 		$this->db->where('name !=', $name);
-		$this->db->where('id <', $id); // Produces: WHERE name != 'Joe' AND id < 45    
+		$this->db->where('id <', $id); // Produces: WHERE name != 'Joe' AND id < 45
 
 #. **Associative array method:**
 
@@ -253,7 +253,7 @@ methods:
 
 		$array = array('name' => $name, 'title' => $title, 'status' => $status);
 		$this->db->where($array);
-		// Produces: WHERE name = 'Joe' AND title = 'boss' AND status = 'active'    
+		// Produces: WHERE name = 'Joe' AND title = 'boss' AND status = 'active'
 
 	You can include your own operators using this method as well:
 
@@ -354,7 +354,7 @@ searches.
 
 	::
 
-		$this->db->like('title', 'match');     // Produces: WHERE title LIKE '%match%' 
+		$this->db->like('title', 'match');     // Produces: WHERE title LIKE '%match%'
 
 	If you use multiple function calls they will be chained together with
 	AND between them::
@@ -371,7 +371,7 @@ searches.
 
 		$this->db->like('title', 'match', 'before');	// Produces: WHERE title LIKE '%match'
 		$this->db->like('title', 'match', 'after');		// Produces: WHERE title LIKE 'match%'
-		$this->db->like('title', 'match', 'both');		// Produces: WHERE title LIKE '%match%' 
+		$this->db->like('title', 'match', 'both');		// Produces: WHERE title LIKE '%match%'
 
 #. **Associative array method:**
 
@@ -443,7 +443,7 @@ Permits you to write the HAVING portion of your query. There are 2
 possible syntaxes, 1 argument or 2::
 
 	$this->db->having('user_id = 45');  // Produces: HAVING user_id = 45
-	$this->db->having('user_id',  45);  // Produces: HAVING user_id = 45 
+	$this->db->having('user_id',  45);  // Produces: HAVING user_id = 45
 
 You can also pass an array of multiple values as well::
 
@@ -486,7 +486,7 @@ Or multiple function calls can be made if you need multiple fields.
 ::
 
 	$this->db->order_by("title", "desc");
-	$this->db->order_by("name", "asc"); // Produces: ORDER BY title DESC, name ASC     
+	$this->db->order_by("name", "asc"); // Produces: ORDER BY title DESC, name ASC
 
 
 .. note:: order_by() was formerly known as orderby(), which has been
@@ -518,7 +518,7 @@ where(), or_where(), like(), or_like(), etc. Example::
 	echo $this->db->count_all_results('my_table');  // Produces an integer, like 25
 	$this->db->like('title', 'match');
 	$this->db->from('my_table');
-	echo $this->db->count_all_results(); // Produces an integer, like 17 
+	echo $this->db->count_all_results(); // Produces an integer, like 17
 
 $this->db->count_all()
 ======================
@@ -528,6 +528,54 @@ Submit the table name in the first parameter. Example::
 
 	echo $this->db->count_all('my_table');  // Produces an integer, like 25
 
+**************
+Query grouping
+**************
+
+Query grouping allows you to create groups of WHERE clauses by enclosing them in parentheses. This will allow
+you to create queries with complex WHERE clauses. Nested groups are supported. Example:
+
+	$this->db->select('*')->from('my_table')
+		->group_start()
+			->where('a', 'a')
+			->or_group_start()
+				->where('b', 'b')
+				->where('c', 'c')
+			->group_end()
+		->group_end()
+		->where('d', 'd')
+	->get();
+
+	// Generates:
+	// SELECT * FROM (`my_table`) WHERE ( `a` = 'a' OR ( `b` = 'b' AND `c` = 'c' ) ) AND `d` = 'd'
+
+.. note:: groups need to be balanced, make sure every group_start() is matched by a group_end().
+
+$this->db->group_start()
+========================
+
+Starts a new group by adding an opening parenthesis to the WHERE clause of the query.
+
+$this->db->or_group_start()
+===========================
+
+Starts a new group by adding an opening parenthesis to the WHERE clause of the query, prefixing it with 'OR'.
+
+$this->db->not_group_start()
+============================
+
+Starts a new group by adding an opening parenthesis to the WHERE clause of the query, prefixing it with 'NOT'.
+
+$this->db->or_not_group_start()
+===============================
+
+Starts a new group by adding an opening parenthesis to the WHERE clause of the query, prefixing it with 'OR NOT'.
+
+$this->db->group_end()
+======================
+
+Ends the current group by adding an closing parenthesis to the WHERE clause of the query.
+
 **************
 Inserting Data
 **************
@@ -544,7 +592,7 @@ function. Here is an example using an array::
 		'name' => 'My Name',
 		'date' => 'My date'
 	);
-	
+
 	$this->db->insert('mytable', $data);
 	// Produces: INSERT INTO mytable (title, name, date) VALUES ('My title', 'My name', 'My date')
 
@@ -560,7 +608,7 @@ Here is an example using an object::
 		var  $date = 'My Date';
 	}
 	*/
-	
+
 	$object = new Myclass;
 	$this->db->insert('mytable', $object);
 	// Produces: INSERT INTO mytable (title, content, date) VALUES ('My Title', 'My Content', 'My Date')
@@ -572,7 +620,7 @@ object.
 
 $this->db->get_compiled_insert()
 ================================
-Compiles the insertion query just like `$this->db->insert()`_ but does not 
+Compiles the insertion query just like `$this->db->insert()`_ but does not
 *run* the query. This method simply returns the SQL query as a string.
 
 Example::
@@ -582,27 +630,27 @@ Example::
 		'name'  => 'My Name',
 		'date'  => 'My date'
 	);
-	
+
 	$sql = $this->db->set($data)->get_compiled_insert('mytable');
 	echo $sql;
-	
+
 	// Produces string: INSERT INTO mytable (title, name, date) VALUES ('My title', 'My name', 'My date')
 
-The second parameter enables you to set whether or not the active record query 
+The second parameter enables you to set whether or not the active record query
 will be reset (by default it will be--just like `$this->db->insert()`_)::
-	
+
 	echo $this->db->set('title', 'My Title')->get_compiled_insert('mytable', FALSE);
-	
+
 	// Produces string: INSERT INTO mytable (title) VALUES ('My Title')
-	
+
 	echo $this->db->set('content', 'My Content')->get_compiled_insert();
 
 	// Produces string: INSERT INTO mytable (title, content) VALUES ('My Title', 'My Content')
-	
-The key thing to notice in the above example is that the second query did not 
-utlize `$this->db->from()`_ nor did it pass a table name into the first 
-parameter. The reason this worked is because the query has not been executed 
-using `$this->db->insert()`_ which resets values or reset directly using 
+
+The key thing to notice in the above example is that the second query did not
+utlize `$this->db->from()`_ nor did it pass a table name into the first
+parameter. The reason this worked is because the query has not been executed
+using `$this->db->insert()`_ which resets values or reset directly using
 `$this->db->reset_query()`_.
 
 $this->db->insert_batch()
@@ -624,7 +672,7 @@ function. Here is an example using an array::
 			'date' => 'Another date'
 		)
 	);
-	
+
 	$this->db->insert_batch('mytable', $data);
 	// Produces: INSERT INTO mytable (title, name, date) VALUES ('My title', 'My name', 'My date'),  ('Another title', 'Another name', 'Another date')
 
@@ -652,7 +700,7 @@ based on whether you are doing an insert or an update::
 	$this->db->set('name', $name);
 	$this->db->set('title', $title);
 	$this->db->set('status', $status);
-	$this->db->insert('mytable'); 
+	$this->db->insert('mytable');
 
 **set()** will also accept an optional third parameter ($escape), that
 will prevent data from being escaped if set to FALSE. To illustrate the
@@ -674,7 +722,7 @@ You can also pass an associative array to this function::
 		'title' => $title,
 		'status' => $status
 	);
-	
+
 	$this->db->set($array);
 	$this->db->insert('mytable');
 
@@ -687,7 +735,7 @@ Or an object::
 		var  $date = 'My Date';
 	}
 	*/
-	
+
 	$object = new Myclass;
 	$this->db->set($object);
 	$this->db->insert('mytable');
@@ -709,7 +757,7 @@ is an example using an array::
 		'name' => $name,
 		'date' => $date
 	);
-	
+
 	$this->db->where('id', $id);
 	$this->db->update('mytable', $data);
 	// Produces: // UPDATE mytable  // SET title = '{$title}', name = '{$name}', date = '{$date}' // WHERE id = $id
@@ -723,7 +771,7 @@ Or you can supply an object::
 		var  $date = 'My Date';
 	}
 	*/
-	
+
 	$object = new Myclass;
 	$this->db->where('id', $id);
 	$this->db->update('mytable', $object);
@@ -764,14 +812,14 @@ Here is an example using an array::
 	   )
 	);
 
-	$this->db->update_batch('mytable', $data, 'title'); 
+	$this->db->update_batch('mytable', $data, 'title');
 
-	// Produces: 
+	// Produces:
 	// UPDATE `mytable` SET `name` = CASE
 	// WHEN `title` = 'My title' THEN 'My Name 2'
 	// WHEN `title` = 'Another title' THEN 'Another Name 2'
 	// ELSE `name` END,
-	// `date` = CASE 
+	// `date` = CASE
 	// WHEN `title` = 'My title' THEN 'My date 2'
 	// WHEN `title` = 'Another title' THEN 'Another date 2'
 	// ELSE `date` END
@@ -810,7 +858,7 @@ the data to the second parameter of the function::
 
 	$this->db->where('id', $id);
 	$this->db->delete('mytable');
-	
+
 	// Produces:
 	// DELETE FROM mytable
 	// WHERE id = $id
@@ -847,17 +895,17 @@ Generates a truncate SQL string and runs the query.
 
 	$this->db->from('mytable');
 	$this->db->truncate();
-	
-	// or  
-	
+
+	// or
+
 	$this->db->truncate('mytable');
-	
+
 	// Produce:
-	// TRUNCATE mytable 
+	// TRUNCATE mytable
 
 .. note:: If the TRUNCATE command isn't available, truncate() will
 	execute as "DELETE FROM table".
-	
+
 $this->db->get_compiled_delete()
 ================================
 This works exactly the same way as ``$this->db->get_compiled_insert()`` except
@@ -917,11 +965,11 @@ Here's a usage example::
 	$this->db->stop_cache();
 	$this->db->get('tablename');
 	//Generates: SELECT `field1` FROM (`tablename`)
-	
+
 	$this->db->select('field2');
 	$this->db->get('tablename');
 	//Generates:  SELECT `field1`, `field2` FROM (`tablename`)
-	
+
 	$this->db->flush_cache();
 	$this->db->select('field2');
 	$this->db->get('tablename');
@@ -935,13 +983,13 @@ Here's a usage example::
 $this->db->reset_query()
 ========================
 
-Resetting Active Record allows you to start fresh with your query without 
-executing it first using a method like $this->db->get() or $this->db->insert(). 
-Just like the methods that execute a query, this will *not* reset items you've 
+Resetting Active Record allows you to start fresh with your query without
+executing it first using a method like $this->db->get() or $this->db->insert().
+Just like the methods that execute a query, this will *not* reset items you've
 cached using `Active Record Caching`_.
 
-This is useful in situations where you are using Active Record to generate SQL 
-(ex. ``$this->db->get_compiled_select()``) but then choose to, for instance, 
+This is useful in situations where you are using Active Record to generate SQL
+(ex. ``$this->db->get_compiled_select()``) but then choose to, for instance,
 run the query::
 
 	// Note that the second parameter of the get_compiled_select method is FALSE
-- 
cgit v1.2.3-24-g4f1b


From 5280c3c24ec581d859babd80cf60eb83efa7d149 Mon Sep 17 00:00:00 2001
From: Phil Sturgeon 
Date: Wed, 28 Dec 2011 15:52:49 +0000
Subject: Turn "pconnect" off by default. Some users were complaining this was
 effecting their performance and having it on by default can potentially cause
 issues with people who don't understand what it does. Having it off by
 default means people are only effected if they want to be, which is safer.

---
 application/config/database.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/application/config/database.php b/application/config/database.php
index 880773d80..19254cde2 100644
--- a/application/config/database.php
+++ b/application/config/database.php
@@ -80,7 +80,7 @@ $db['default']['password'] = '';
 $db['default']['database'] = '';
 $db['default']['dbdriver'] = 'mysql';
 $db['default']['dbprefix'] = '';
-$db['default']['pconnect'] = TRUE;
+$db['default']['pconnect'] = FALSE;
 $db['default']['db_debug'] = TRUE;
 $db['default']['cache_on'] = FALSE;
 $db['default']['cachedir'] = '';
-- 
cgit v1.2.3-24-g4f1b


From dd35b159593917fc517dab35312c9bd108896e59 Mon Sep 17 00:00:00 2001
From: Brandon Jones 
Date: Wed, 28 Dec 2011 15:57:07 -0500
Subject: Updating Moscow and Samoa timezones

---
 system/language/english/date_lang.php | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/system/language/english/date_lang.php b/system/language/english/date_lang.php
index 515feec83..631cfa325 100644
--- a/system/language/english/date_lang.php
+++ b/system/language/english/date_lang.php
@@ -41,7 +41,7 @@ $lang['date_second'] = "Second";
 $lang['date_seconds'] = "Seconds";
 
 $lang['UM12']	= '(UTC -12:00) Baker/Howland Island';
-$lang['UM11']	= '(UTC -11:00) Samoa Time Zone, Niue';
+$lang['UM11']	= '(UTC -11:00) Niue';
 $lang['UM10']	= '(UTC -10:00) Hawaii-Aleutian Standard Time, Cook Islands, Tahiti';
 $lang['UM95']	= '(UTC -9:30) Marquesas Islands';
 $lang['UM9']	= '(UTC -9:00) Alaska Standard Time, Gambier Islands';
@@ -58,9 +58,9 @@ $lang['UM1']	= '(UTC -1:00) Azores, Cape Verde Islands';
 $lang['UTC']	= '(UTC) Greenwich Mean Time, Western European Time';
 $lang['UP1']	= '(UTC +1:00) Central European Time, West Africa Time';
 $lang['UP2']	= '(UTC +2:00) Central Africa Time, Eastern European Time, Kaliningrad Time';
-$lang['UP3']	= '(UTC +3:00) Moscow Time, East Africa Time';
+$lang['UP3']	= '(UTC +3:00) East Africa Time, Arabia Standard Time';
 $lang['UP35']	= '(UTC +3:30) Iran Standard Time';
-$lang['UP4']	= '(UTC +4:00) Azerbaijan Standard Time, Samara Time';
+$lang['UP4']	= '(UTC +4:00) Moscow Time, Azerbaijan Standard Time';
 $lang['UP45']	= '(UTC +4:30) Afghanistan';
 $lang['UP5']	= '(UTC +5:00) Pakistan Standard Time, Yekaterinburg Time';
 $lang['UP55']	= '(UTC +5:30) Indian Standard Time, Sri Lanka Time';
@@ -78,7 +78,7 @@ $lang['UP11']	= '(UTC +11:00) Magadan Time, Solomon Islands, Vanuatu';
 $lang['UP115']	= '(UTC +11:30) Norfolk Island';
 $lang['UP12']	= '(UTC +12:00) Fiji, Gilbert Islands, Kamchatka Time, New Zealand Standard Time';
 $lang['UP1275']	= '(UTC +12:45) Chatham Islands Standard Time';
-$lang['UP13']	= '(UTC +13:00) Phoenix Islands Time, Tonga';
+$lang['UP13']	= '(UTC +13:00) Samoa Time Zone, Phoenix Islands Time, Tonga';
 $lang['UP14']	= '(UTC +14:00) Line Islands';
 
 
-- 
cgit v1.2.3-24-g4f1b


From cfb7021e9f53fa089bfd676978b448b27e4bd996 Mon Sep 17 00:00:00 2001
From: Ronald Beilsma 
Date: Thu, 29 Dec 2011 09:57:49 +0100
Subject: ceil returned float (line 131), so if statement in line 134 was bound
 to return false (===, float vs integer)

---
 system/libraries/Pagination.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php
index d10bef3e5..63b750bdb 100644
--- a/system/libraries/Pagination.php
+++ b/system/libraries/Pagination.php
@@ -128,10 +128,10 @@ class CI_Pagination {
 		}
 
 		// Calculate the total number of pages
-		$num_pages = ceil($this->total_rows / $this->per_page);
+		$num_pages = (int) ceil($this->total_rows / $this->per_page);
 
 		// Is there only one page? Hm... nothing more to do here then.
-		if ($num_pages == 1)
+		if ($num_pages === 1)
 		{
 			return '';
 		}
-- 
cgit v1.2.3-24-g4f1b


From 6209015edde25e8ca82a8e8f5eb5a5eda2750e7b Mon Sep 17 00:00:00 2001
From: Andrey Andreev 
Date: Fri, 30 Dec 2011 12:49:27 +0200
Subject: Some more optimizations

---
 system/libraries/Xmlrpc.php | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php
index ebb04601b..2804e6685 100644
--- a/system/libraries/Xmlrpc.php
+++ b/system/libraries/Xmlrpc.php
@@ -542,7 +542,7 @@ class XML_RPC_Response
 		elseif ($kind == 'array')
 		{
 			reset($xmlrpc_val->me);
-			list($a,$b) = each($xmlrpc_val->me);
+			list(, $b) = each($xmlrpc_val->me);
 			$arr = array();
 
 			for ($i = 0, $size = count($b); $i < $size; $i++)
@@ -1150,7 +1150,7 @@ class XML_RPC_Message extends CI_Xmlrpc
 		elseif ($kind == 'array')
 		{
 			reset($param->me);
-			list($a,$b) = each($param->me);
+			list(, $b) = each($param->me);
 
 			$arr = array();
 
@@ -1359,7 +1359,7 @@ class XML_RPC_Values extends CI_Xmlrpc
 	public function scalarval()
 	{
 		reset($this->me);
-		list($a,$b) = each($this->me);
+		list(, $b) = each($this->me);
 		return $b;
 	}
 
@@ -1370,14 +1370,9 @@ class XML_RPC_Values extends CI_Xmlrpc
 
 	// Useful for sending time in XML-RPC
 
-	public function iso8601_encode($time, $utc=0)
+	public function iso8601_encode($time, $utc = 0)
 	{
-		if ($utc == 1)
-		{
-			return strftime("%Y%m%dT%H:%i:%s", $time);
-		}
-
-		return (function_exists('gmstrftime')) ? gmstrftime('%Y%m%dT%H:%i:%s', $time) : strftime('%Y%m%dT%H:%i:%s', $time - date('Z'));
+		return ($utc) ? strftime('%Y%m%dT%H:%i:%s', $time) : gmstrftime('%Y%m%dT%H:%i:%s', $time);
 	}
 
 }
-- 
cgit v1.2.3-24-g4f1b


From 64dbdfb60e0556177061db2eecdf899111ae4ac9 Mon Sep 17 00:00:00 2001
From: Andrey Andreev 
Date: Fri, 30 Dec 2011 14:14:07 +0200
Subject: Added support for 3-length hex color values format and a number of
 validation improvements

---
 system/libraries/Image_lib.php                | 87 +++++++++++++++------------
 user_guide_src/source/changelog.rst           |  5 ++
 user_guide_src/source/libraries/image_lib.rst | 10 ++-
 3 files changed, 58 insertions(+), 44 deletions(-)

diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php
index 2737503a8..d4fb51923 100644
--- a/system/libraries/Image_lib.php
+++ b/system/libraries/Image_lib.php
@@ -67,8 +67,8 @@ class CI_Image_lib {
 	public $wm_padding			= 0;			// Padding around text
 	public $wm_hor_offset		= 0;			// Lets you push text to the right
 	public $wm_vrt_offset		= 0;			// Lets you push  text down
-	public $wm_font_color		= '#ffffff';	// Text color
-	public $wm_shadow_color	= '';			// Dropshadow color
+	protected $wm_font_color		= '#ffffff';	// Text color
+	protected $wm_shadow_color		= '';	// Dropshadow color
 	public $wm_shadow_distance	= 2;			// Dropshadow distance
 	public $wm_opacity			= 50;			// Image opacity: 1 - 100  Only works with image
 
@@ -85,7 +85,7 @@ class CI_Image_lib {
 	public $create_fnc			= 'imagecreatetruecolor';
 	public $copy_fnc			= 'imagecopyresampled';
 	public $error_msg			= array();
-	public $wm_use_drop_shadow	= FALSE;
+	protected $wm_use_drop_shadow	= FALSE;
 	public $wm_use_truetype	= FALSE;
 
 	/**
@@ -165,7 +165,30 @@ class CI_Image_lib {
 		{
 			foreach ($props as $key => $val)
 			{
-				$this->$key = $val;
+				if (property_exists($this, $key))
+				{
+					if (in_array($key, array('wm_font_color', 'wm_shadow_color')))
+					{
+						if ($val != '' AND preg_match('/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i', $val, $matches))
+						{
+							if (strlen($matches[1]) === 6)
+							{
+								$val = '#'.$val;
+							}
+							else
+							{
+								$val = str_split($val, 1);
+								$val = '#'.$val[0].$val[0].$val[1].$val[1].$val[2].$val[2];
+							}
+						}
+						else
+						{
+							continue;
+						}
+					}
+
+					$this->$key = $val;
+				}
 			}
 		}
 
@@ -332,16 +355,6 @@ class CI_Image_lib {
 		$this->y_axis = ($this->y_axis == '' OR ! is_numeric($this->y_axis)) ? 0 : $this->y_axis;
 
 		// Watermark-related Stuff...
-		if ($this->wm_font_color != '' AND strlen($this->wm_font_color) === 6)
-		{
-			$this->wm_font_color = '#'.$this->wm_font_color;
-		}
-
-		if ($this->wm_shadow_color != '' AND strlen($this->wm_shadow_color) === 6)
-		{
-			$this->wm_shadow_color = '#'.$this->wm_shadow_color;
-		}
-
 		if ($this->wm_overlay_path != '')
 		{
 			$this->wm_overlay_path = str_replace("\\", "/", realpath($this->wm_overlay_path));
@@ -351,6 +364,10 @@ class CI_Image_lib {
 		{
 			$this->wm_use_drop_shadow = TRUE;
 		}
+		elseif ($this->wm_use_drop_shadow == TRUE AND $this->wm_shadow_color == '')
+		{
+			$this->wm_use_drop_shadow = FALSE;
+		}
 
 		if ($this->wm_font_path != '')
 		{
@@ -982,21 +999,6 @@ class CI_Image_lib {
 		//  Fetch source image properties
 		$this->get_image_properties();
 
-		// Set RGB values for text and shadow
-		$this->wm_font_color	= str_replace('#', '', $this->wm_font_color);
-		$this->wm_shadow_color	= str_replace('#', '', $this->wm_shadow_color);
-
-		$R1 = hexdec(substr($this->wm_font_color, 0, 2));
-		$G1 = hexdec(substr($this->wm_font_color, 2, 2));
-		$B1 = hexdec(substr($this->wm_font_color, 4, 2));
-
-		$R2 = hexdec(substr($this->wm_shadow_color, 0, 2));
-		$G2 = hexdec(substr($this->wm_shadow_color, 2, 2));
-		$B2 = hexdec(substr($this->wm_shadow_color, 4, 2));
-
-		$txt_color	= imagecolorclosest($src_img, $R1, $G1, $B1);
-		$drp_color	= imagecolorclosest($src_img, $R2, $G2, $B2);
-
 		// Reverse the vertical offset
 		// When the image is positioned at the bottom
 		// we don't want the vertical offset to push it
@@ -1075,16 +1077,25 @@ class CI_Image_lib {
 				break;
 		}
 
-		//  Add the text to the source image
-		if ($this->wm_use_truetype AND $this->wm_use_drop_shadow)
-		{
-			imagettftext($src_img, $this->wm_font_size, 0, $x_shad, $y_shad, $drp_color, $this->wm_font_path, $this->wm_text);
-			imagettftext($src_img, $this->wm_font_size, 0, $x_axis, $y_axis, $txt_color, $this->wm_font_path, $this->wm_text);
-		}
-		elseif ($this->wm_use_drop_shadow)
+		if ($this->wm_use_drop_shadow)
 		{
-			imagestring($src_img, $this->wm_font_size, $x_shad, $y_shad, $this->wm_text, $drp_color);
-			imagestring($src_img, $this->wm_font_size, $x_axis, $y_axis, $this->wm_text, $txt_color);
+			// Set RGB values for text and shadow
+			$txt_color = str_split(substr($this->wm_font_color, 1, 6));
+			$txt_color = imagecolorclosest($src_img, hexdec($txt_color[0]), hexdec($txt_color[1]), hexdec($txt_color[2]));
+			$drp_color = str_split(substr($this->wm_shadow_color, 1, 6));
+			$drp_color = imagecolorclosest($src_img, hexdec($drp_color[0]), hexdec($drp_color[2]), hexdec($drp_color[3]));
+
+			//  Add the text to the source image
+			if ($this->wm_use_truetype)
+			{
+				imagettftext($src_img, $this->wm_font_size, 0, $x_shad, $y_shad, $drp_color, $this->wm_font_path, $this->wm_text);
+				imagettftext($src_img, $this->wm_font_size, 0, $x_axis, $y_axis, $txt_color, $this->wm_font_path, $this->wm_text);
+			}
+			else
+			{
+				imagestring($src_img, $this->wm_font_size, $x_shad, $y_shad, $this->wm_text, $drp_color);
+				imagestring($src_img, $this->wm_font_size, $x_axis, $y_axis, $this->wm_text, $txt_color);
+			}
 		}
 
 		//  Output the final image
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index a9673de88..927705b63 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -53,6 +53,11 @@ Release Date: Not Released
 	 -  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
+   -  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.
    -  Minor speed optimizations and method & property visibility declarations in the Calendar Library.
 
 -  Core
diff --git a/user_guide_src/source/libraries/image_lib.rst b/user_guide_src/source/libraries/image_lib.rst
index 14bd128a6..ed6575c62 100644
--- a/user_guide_src/source/libraries/image_lib.rst
+++ b/user_guide_src/source/libraries/image_lib.rst
@@ -390,13 +390,11 @@ Preference              Default Value       Options             Description
 **wm_font_size**        16                  None                The size of the text. Note: If you are not using the True Type option
                                                                 above, the number is set using a range of 1 - 5. Otherwise, you can use
                                                                 any valid pixel size for the font you're using.
-**wm_font_color**       ffffff              None                The font color, specified in hex. Note, you must use the full 6
-                                                                character hex value (ie, 993300), rather than the three character
-                                                                abbreviated version (ie fff).
+**wm_font_color**       ffffff              None                The font color, specified in hex. Both the full 6-length (ie, 993300) and
+                                                                the short three character abbreviated version (ie, fff) are supported.
 **wm_shadow_color**     None                None                The color of the drop shadow, specified in hex. If you leave this blank
-                                                                a drop shadow will not be used. Note, you must use the full 6 character
-                                                                hex value (ie, 993300), rather than the three character abbreviated
-                                                                version (ie fff).
+                                                                a drop shadow will not be used. Both the full 6-length (ie, 993300) and
+                                                                the short three character abbreviated version (ie, fff) are supported.
 **wm_shadow_distance**  3                   None                The distance (in pixels) from the font that the drop shadow should
                                                                 appear.
 ======================= =================== =================== ==========================================================================
-- 
cgit v1.2.3-24-g4f1b


From a948f07bde83e149d9fc75e9aaf7260efba39b55 Mon Sep 17 00:00:00 2001
From: Andrey Andreev 
Date: Fri, 30 Dec 2011 14:22:50 +0200
Subject: Remove a str_split() from the previous commit - we can access string
 characters like we do in an indexed array anyways

---
 system/libraries/Image_lib.php | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php
index d4fb51923..72621c9b4 100644
--- a/system/libraries/Image_lib.php
+++ b/system/libraries/Image_lib.php
@@ -171,15 +171,7 @@ class CI_Image_lib {
 					{
 						if ($val != '' AND preg_match('/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i', $val, $matches))
 						{
-							if (strlen($matches[1]) === 6)
-							{
-								$val = '#'.$val;
-							}
-							else
-							{
-								$val = str_split($val, 1);
-								$val = '#'.$val[0].$val[0].$val[1].$val[1].$val[2].$val[2];
-							}
+							$val = (strlen($matches[1]) === 6) ? '#'.$val : '#'.$val[0].$val[0].$val[1].$val[1].$val[2].$val[2];
 						}
 						else
 						{
-- 
cgit v1.2.3-24-g4f1b


From 1d97f291fa1988794b0e6ac2b90a0b1f8c83df25 Mon Sep 17 00:00:00 2001
From: Andrey Andreev 
Date: Fri, 30 Dec 2011 14:24:59 +0200
Subject: Another fix on a previous commit from this request

---
 system/libraries/Image_lib.php | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php
index 72621c9b4..609cb7f98 100644
--- a/system/libraries/Image_lib.php
+++ b/system/libraries/Image_lib.php
@@ -171,7 +171,8 @@ class CI_Image_lib {
 					{
 						if ($val != '' AND preg_match('/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i', $val, $matches))
 						{
-							$val = (strlen($matches[1]) === 6) ? '#'.$val : '#'.$val[0].$val[0].$val[1].$val[1].$val[2].$val[2];
+							$val = (strlen($matches[1]) === 6) ?
+								'#'.$matches[1] : '#'.$matches[1][0].$matches[1][0].$matches[1][1].$matches[1][1].$matches[1][2].$matches[1][2];
 						}
 						else
 						{
-- 
cgit v1.2.3-24-g4f1b


From 665af0cbb98372f8521298aafcde9e0c9023123e Mon Sep 17 00:00:00 2001
From: Andrey Andreev 
Date: Fri, 30 Dec 2011 14:39:29 +0200
Subject: Some alignment for readability

---
 system/libraries/Image_lib.php | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php
index 609cb7f98..7beac0ba0 100644
--- a/system/libraries/Image_lib.php
+++ b/system/libraries/Image_lib.php
@@ -171,8 +171,9 @@ class CI_Image_lib {
 					{
 						if ($val != '' AND preg_match('/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i', $val, $matches))
 						{
-							$val = (strlen($matches[1]) === 6) ?
-								'#'.$matches[1] : '#'.$matches[1][0].$matches[1][0].$matches[1][1].$matches[1][1].$matches[1][2].$matches[1][2];
+							$val = (strlen($matches[1]) === 6)
+								? '#'.$matches[1]
+								: '#'.$matches[1][0].$matches[1][0].$matches[1][1].$matches[1][1].$matches[1][2].$matches[1][2];
 						}
 						else
 						{
-- 
cgit v1.2.3-24-g4f1b


From adc1175f7af1a5fa3a833f72b6f24a82b59e69c1 Mon Sep 17 00:00:00 2001
From: Andrey Andreev 
Date: Fri, 30 Dec 2011 14:46:08 +0200
Subject: Replace some list(...) = each(...) expressions with current(), where
 only values are needed

---
 system/libraries/Xmlrpc.php | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php
index 2804e6685..bb95ca145 100644
--- a/system/libraries/Xmlrpc.php
+++ b/system/libraries/Xmlrpc.php
@@ -542,7 +542,7 @@ class XML_RPC_Response
 		elseif ($kind == 'array')
 		{
 			reset($xmlrpc_val->me);
-			list(, $b) = each($xmlrpc_val->me);
+			$b = current($xmlrpc_val->me);
 			$arr = array();
 
 			for ($i = 0, $size = count($b); $i < $size; $i++)
@@ -1150,8 +1150,7 @@ class XML_RPC_Message extends CI_Xmlrpc
 		elseif ($kind == 'array')
 		{
 			reset($param->me);
-			list(, $b) = each($param->me);
-
+			$b = current($param->me);
 			$arr = array();
 
 			for($i = 0, $c = count($b); $i < $c; $i++)
@@ -1164,7 +1163,6 @@ class XML_RPC_Message extends CI_Xmlrpc
 		elseif ($kind == 'struct')
 		{
 			reset($param->me['struct']);
-
 			$arr = array();
 
 			while (list($key,$value) = each($param->me['struct']))
@@ -1359,8 +1357,7 @@ class XML_RPC_Values extends CI_Xmlrpc
 	public function scalarval()
 	{
 		reset($this->me);
-		list(, $b) = each($this->me);
-		return $b;
+		return current($this->me);
 	}
 
 
-- 
cgit v1.2.3-24-g4f1b


From d268eda6c2b502cc7fa352072482d1924e36127e Mon Sep 17 00:00:00 2001
From: Phil Sturgeon 
Date: Sat, 31 Dec 2011 16:20:11 +0000
Subject: Added SELECT version to migrations to make the query a billionth
 faster.

---
 system/libraries/Migration.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/system/libraries/Migration.php b/system/libraries/Migration.php
index eb5161d76..f89391c0d 100644
--- a/system/libraries/Migration.php
+++ b/system/libraries/Migration.php
@@ -322,7 +322,7 @@ class CI_Migration {
 	 */
 	protected function _get_version()
 	{
-		$row = $this->db->get($this->_migration_table)->row();
+		$row = $this->db->select('version')->get($this->_migration_table)->row();
 		return $row ? $row->version : 0;
 	}
 
-- 
cgit v1.2.3-24-g4f1b


From 8323ae6cebde490bc29141d8dadbdbc07a1c6a4a Mon Sep 17 00:00:00 2001
From: Andrey Andreev 
Date: Sat, 31 Dec 2011 18:39:10 +0200
Subject: Fix a bug and put some comments describing changes from pull #818

---
 system/libraries/Image_lib.php | 26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)

diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php
index 7beac0ba0..c175c6740 100644
--- a/system/libraries/Image_lib.php
+++ b/system/libraries/Image_lib.php
@@ -169,8 +169,21 @@ class CI_Image_lib {
 				{
 					if (in_array($key, array('wm_font_color', 'wm_shadow_color')))
 					{
-						if ($val != '' AND preg_match('/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i', $val, $matches))
+						if (preg_match('/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i', $val, $matches))
 						{
+							/* This particular line has caused a lengthy discussion
+							 * (https://github.com/EllisLab/CodeIgniter/pull/818), so
+							 * just to clarify:
+							 *
+							 * $matches[1] contains our hex color value, but it might be
+							 * both in the full 6-length format or the shortened 3-length
+							 * value.
+							 * We'll later need the full version, so if we keep it if it's
+							 * already there and if not - we'll convert to it. We can
+							 * access string characters by their index as in an array,
+							 * so we'll do that and use concatenation to form the final
+							 * value:
+							 */
 							$val = (strlen($matches[1]) === 6)
 								? '#'.$matches[1]
 								: '#'.$matches[1][0].$matches[1][0].$matches[1][1].$matches[1][1].$matches[1][2].$matches[1][2];
@@ -1073,10 +1086,15 @@ class CI_Image_lib {
 
 		if ($this->wm_use_drop_shadow)
 		{
-			// Set RGB values for text and shadow
-			$txt_color = str_split(substr($this->wm_font_color, 1, 6));
+			/* Set RGB values for text and shadow
+			 *
+			 * First character is #, so we don't really need it.
+			 * Get the rest of the string and split it into 2-length
+			 * hex values:
+			 */
+			$txt_color = str_split(substr($this->wm_font_color, 1, 6), 2);
 			$txt_color = imagecolorclosest($src_img, hexdec($txt_color[0]), hexdec($txt_color[1]), hexdec($txt_color[2]));
-			$drp_color = str_split(substr($this->wm_shadow_color, 1, 6));
+			$drp_color = str_split(substr($this->wm_shadow_color, 1, 6), 2);
 			$drp_color = imagecolorclosest($src_img, hexdec($drp_color[0]), hexdec($drp_color[2]), hexdec($drp_color[3]));
 
 			//  Add the text to the source image
-- 
cgit v1.2.3-24-g4f1b


From bb96c8b466cb618c5fd6f004234a137011a7e374 Mon Sep 17 00:00:00 2001
From: Andrey Andreev 
Date: Sat, 31 Dec 2011 18:48:39 +0200
Subject: Fix a comment typo

---
 system/libraries/Image_lib.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php
index c175c6740..5f5b5f9d5 100644
--- a/system/libraries/Image_lib.php
+++ b/system/libraries/Image_lib.php
@@ -178,7 +178,7 @@ class CI_Image_lib {
 							 * $matches[1] contains our hex color value, but it might be
 							 * both in the full 6-length format or the shortened 3-length
 							 * value.
-							 * We'll later need the full version, so if we keep it if it's
+							 * We'll later need the full version, so we keep it if it's
 							 * already there and if not - we'll convert to it. We can
 							 * access string characters by their index as in an array,
 							 * so we'll do that and use concatenation to form the final
-- 
cgit v1.2.3-24-g4f1b


From 2be25a6fdb9aa197debca28d1cfe0e0e542296b0 Mon Sep 17 00:00:00 2001
From: RS71 
Date: Sat, 31 Dec 2011 16:02:04 -0200
Subject: Update system/core/Security.php

---
 system/core/Security.php | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/system/core/Security.php b/system/core/Security.php
index 60a64f358..510f3d1ae 100755
--- a/system/core/Security.php
+++ b/system/core/Security.php
@@ -180,9 +180,14 @@ class CI_Security {
 		// polute the _POST array
 		unset($_POST[$this->_csrf_token_name]);
 
-		// Nothing should last forever
-		unset($_COOKIE[$this->_csrf_cookie_name]);
-		$this->_csrf_hash = '';
+		// Regenerate on every submission?
+		if (config_item('csrf_regenerate'))
+		{
+			// Nothing should last forever
+			unset($_COOKIE[$this->_csrf_cookie_name]);
+			$this->_csrf_hash = '';
+		}
+		
 		$this->_csrf_set_hash();
 		$this->csrf_set_cookie();
 
-- 
cgit v1.2.3-24-g4f1b


From 4b2e9fea1f34b4b2cff30b3211579e883b31005d Mon Sep 17 00:00:00 2001
From: RS71 
Date: Sat, 31 Dec 2011 16:02:50 -0200
Subject: Update application/config/config.php

---
 application/config/config.php | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/application/config/config.php b/application/config/config.php
index 063c3d5d1..70a9856fd 100644
--- a/application/config/config.php
+++ b/application/config/config.php
@@ -326,12 +326,14 @@ $config['global_xss_filtering'] = FALSE;
 | 'csrf_token_name' = The token name
 | 'csrf_cookie_name' = The cookie name
 | 'csrf_expire' = The number in seconds the token should expire.
+| 'csrf_regenerate' = Regenerate token on every submission
 | 'csrf_exclude_uris' = Array of URIs which ignore CSRF checks
 */
 $config['csrf_protection'] = FALSE;
 $config['csrf_token_name'] = 'csrf_test_name';
 $config['csrf_cookie_name'] = 'csrf_cookie_name';
 $config['csrf_expire'] = 7200;
+$config['csrf_regenerate'] = TRUE;
 $config['csrf_exclude_uris'] = array();
 
 /*
-- 
cgit v1.2.3-24-g4f1b


From a7de97e74cbfe21cd2606c2253134a3bc8dda1f7 Mon Sep 17 00:00:00 2001
From: Phil Sturgeon 
Date: Sat, 31 Dec 2011 18:41:08 +0000
Subject: Added method chaining to DBForge.

---
 system/database/DB_forge.php | 49 +++++++++++++++++++-------------------------
 1 file changed, 21 insertions(+), 28 deletions(-)

diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php
index 78bf77a9f..c74fa4068 100644
--- a/system/database/DB_forge.php
+++ b/system/database/DB_forge.php
@@ -102,12 +102,11 @@ class CI_DB_forge {
 	/**
 	 * Add Key
 	 *
-	 * @access	public
 	 * @param	string	key
 	 * @param	string	type
-	 * @return	void
+	 * @return	object
 	 */
-	function add_key($key = '', $primary = FALSE)
+	public function add_key($key = '', $primary = FALSE)
 	{
 		if (is_array($key))
 		{
@@ -132,6 +131,8 @@ class CI_DB_forge {
 		{
 			$this->keys[] = $key;
 		}
+
+		return $this;
 	}
 
 	// --------------------------------------------------------------------
@@ -139,11 +140,10 @@ class CI_DB_forge {
 	/**
 	 * Add Field
 	 *
-	 * @access	public
 	 * @param	string	collation
-	 * @return	void
+	 * @return	object
 	 */
-	function add_field($field = '')
+	public function add_field($field = '')
 	{
 		if ($field == '')
 		{
@@ -155,12 +155,12 @@ class CI_DB_forge {
 			if ($field == 'id')
 			{
 				$this->add_field(array(
-										'id' => array(
-													'type' => 'INT',
-													'constraint' => 9,
-													'auto_increment' => TRUE
-													)
-								));
+					'id' => array(
+						'type' => 'INT',
+						'constraint' => 9,
+						'auto_increment' => TRUE
+					)
+				));
 				$this->add_key('id', TRUE);
 			}
 			else
@@ -178,7 +178,8 @@ class CI_DB_forge {
 		{
 			$this->fields = array_merge($this->fields, $field);
 		}
-
+		
+		return $this;
 	}
 
 	// --------------------------------------------------------------------
@@ -186,11 +187,10 @@ class CI_DB_forge {
 	/**
 	 * Create Table
 	 *
-	 * @access	public
 	 * @param	string	the table name
 	 * @return	bool
 	 */
-	function create_table($table = '', $if_not_exists = FALSE)
+	public function create_table($table = '', $if_not_exists = FALSE)
 	{
 		if ($table == '')
 		{
@@ -219,11 +219,10 @@ class CI_DB_forge {
 	/**
 	 * Drop Table
 	 *
-	 * @access	public
 	 * @param	string	the table name
 	 * @return	bool
 	 */
-	function drop_table($table_name)
+	public function drop_table($table_name)
 	{
 		$sql = $this->_drop_table($this->db->dbprefix.$table_name);
 
@@ -240,12 +239,11 @@ class CI_DB_forge {
 	/**
 	 * Rename Table
 	 *
-	 * @access	public
 	 * @param	string	the old table name
 	 * @param	string	the new table name
 	 * @return	bool
 	 */
-	function rename_table($table_name, $new_table_name)
+	public function rename_table($table_name, $new_table_name)
 	{
 		if ($table_name == '' OR $new_table_name == '')
 		{
@@ -261,13 +259,12 @@ class CI_DB_forge {
 	/**
 	 * Column Add
 	 *
-	 * @access	public
 	 * @param	string	the table name
 	 * @param	string	the column name
 	 * @param	string	the column definition
 	 * @return	bool
 	 */
-	function add_column($table = '', $field = array(), $after_field = '')
+	public function add_column($table = '', $field = array(), $after_field = '')
 	{
 		if ($table == '')
 		{
@@ -297,7 +294,6 @@ class CI_DB_forge {
 		}
 
 		return TRUE;
-
 	}
 
 	// --------------------------------------------------------------------
@@ -305,12 +301,11 @@ class CI_DB_forge {
 	/**
 	 * Column Drop
 	 *
-	 * @access	public
 	 * @param	string	the table name
 	 * @param	string	the column name
 	 * @return	bool
 	 */
-	function drop_column($table = '', $column_name = '')
+	public function drop_column($table = '', $column_name = '')
 	{
 
 		if ($table == '')
@@ -333,13 +328,12 @@ class CI_DB_forge {
 	/**
 	 * Column Modify
 	 *
-	 * @access	public
 	 * @param	string	the table name
 	 * @param	string	the column name
 	 * @param	string	the column definition
 	 * @return	bool
 	 */
-	function modify_column($table = '', $field = array())
+	public function modify_column($table = '', $field = array())
 	{
 		if ($table == '')
 		{
@@ -384,10 +378,9 @@ class CI_DB_forge {
 	 *
 	 * Resets table creation vars
 	 *
-	 * @access	private
 	 * @return	void
 	 */
-	function _reset()
+	protected function _reset()
 	{
 		$this->fields		= array();
 		$this->keys			= array();
-- 
cgit v1.2.3-24-g4f1b


From cf2ba9ee5fc50b8411eba46ddd73c59b66524fea Mon Sep 17 00:00:00 2001
From: Andrey Andreev 
Date: Sun, 1 Jan 2012 21:57:13 +0200
Subject: Cut some comments

---
 system/libraries/Image_lib.php | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php
index 5f5b5f9d5..fe9b8dc79 100644
--- a/system/libraries/Image_lib.php
+++ b/system/libraries/Image_lib.php
@@ -171,11 +171,7 @@ class CI_Image_lib {
 					{
 						if (preg_match('/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i', $val, $matches))
 						{
-							/* This particular line has caused a lengthy discussion
-							 * (https://github.com/EllisLab/CodeIgniter/pull/818), so
-							 * just to clarify:
-							 *
-							 * $matches[1] contains our hex color value, but it might be
+							/* $matches[1] contains our hex color value, but it might be
 							 * both in the full 6-length format or the shortened 3-length
 							 * value.
 							 * We'll later need the full version, so we keep it if it's
-- 
cgit v1.2.3-24-g4f1b


From 0defe5d33ee2633f377a109519ca818becc60f64 Mon Sep 17 00:00:00 2001
From: Greg Aker 
Date: Sun, 1 Jan 2012 18:46:41 -0600
Subject: Updating copyright date to 2012

---
 application/config/autoload.php                                  | 2 +-
 application/config/config.php                                    | 2 +-
 application/config/constants.php                                 | 2 +-
 application/config/database.php                                  | 2 +-
 application/config/doctypes.php                                  | 2 +-
 application/config/foreign_chars.php                             | 2 +-
 application/config/hooks.php                                     | 2 +-
 application/config/migration.php                                 | 2 +-
 application/config/mimes.php                                     | 2 +-
 application/config/profiler.php                                  | 2 +-
 application/config/routes.php                                    | 2 +-
 application/config/smileys.php                                   | 2 +-
 application/config/user_agents.php                               | 2 +-
 application/controllers/welcome.php                              | 2 +-
 application/errors/error_404.php                                 | 2 +-
 application/errors/error_db.php                                  | 2 +-
 application/errors/error_general.php                             | 2 +-
 application/errors/error_php.php                                 | 2 +-
 application/views/welcome_message.php                            | 2 +-
 index.php                                                        | 2 +-
 system/core/Benchmark.php                                        | 2 +-
 system/core/CodeIgniter.php                                      | 2 +-
 system/core/Common.php                                           | 2 +-
 system/core/Config.php                                           | 2 +-
 system/core/Controller.php                                       | 2 +-
 system/core/Exceptions.php                                       | 2 +-
 system/core/Hooks.php                                            | 2 +-
 system/core/Input.php                                            | 2 +-
 system/core/Lang.php                                             | 2 +-
 system/core/Loader.php                                           | 2 +-
 system/core/Model.php                                            | 2 +-
 system/core/Output.php                                           | 2 +-
 system/core/Router.php                                           | 2 +-
 system/core/Security.php                                         | 2 +-
 system/core/URI.php                                              | 2 +-
 system/core/Utf8.php                                             | 2 +-
 system/database/DB.php                                           | 2 +-
 system/database/DB_active_rec.php                                | 2 +-
 system/database/DB_cache.php                                     | 2 +-
 system/database/DB_driver.php                                    | 2 +-
 system/database/DB_forge.php                                     | 2 +-
 system/database/DB_result.php                                    | 2 +-
 system/database/DB_utility.php                                   | 2 +-
 system/database/drivers/cubrid/cubrid_driver.php                 | 2 +-
 system/database/drivers/cubrid/cubrid_forge.php                  | 2 +-
 system/database/drivers/cubrid/cubrid_result.php                 | 2 +-
 system/database/drivers/cubrid/cubrid_utility.php                | 2 +-
 system/database/drivers/mssql/mssql_driver.php                   | 2 +-
 system/database/drivers/mssql/mssql_forge.php                    | 2 +-
 system/database/drivers/mssql/mssql_result.php                   | 2 +-
 system/database/drivers/mssql/mssql_utility.php                  | 2 +-
 system/database/drivers/mysql/mysql_driver.php                   | 2 +-
 system/database/drivers/mysql/mysql_forge.php                    | 2 +-
 system/database/drivers/mysql/mysql_result.php                   | 2 +-
 system/database/drivers/mysql/mysql_utility.php                  | 2 +-
 system/database/drivers/mysqli/mysqli_driver.php                 | 2 +-
 system/database/drivers/mysqli/mysqli_forge.php                  | 2 +-
 system/database/drivers/mysqli/mysqli_result.php                 | 2 +-
 system/database/drivers/mysqli/mysqli_utility.php                | 2 +-
 system/database/drivers/oci8/oci8_driver.php                     | 2 +-
 system/database/drivers/oci8/oci8_forge.php                      | 2 +-
 system/database/drivers/oci8/oci8_result.php                     | 2 +-
 system/database/drivers/oci8/oci8_utility.php                    | 2 +-
 system/database/drivers/odbc/odbc_driver.php                     | 2 +-
 system/database/drivers/odbc/odbc_forge.php                      | 2 +-
 system/database/drivers/odbc/odbc_result.php                     | 2 +-
 system/database/drivers/odbc/odbc_utility.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/database/drivers/postgre/postgre_driver.php               | 2 +-
 system/database/drivers/postgre/postgre_forge.php                | 2 +-
 system/database/drivers/postgre/postgre_result.php               | 2 +-
 system/database/drivers/postgre/postgre_utility.php              | 2 +-
 system/database/drivers/sqlite/sqlite_driver.php                 | 2 +-
 system/database/drivers/sqlite/sqlite_forge.php                  | 2 +-
 system/database/drivers/sqlite/sqlite_result.php                 | 2 +-
 system/database/drivers/sqlite/sqlite_utility.php                | 2 +-
 system/database/drivers/sqlsrv/sqlsrv_driver.php                 | 2 +-
 system/database/drivers/sqlsrv/sqlsrv_forge.php                  | 2 +-
 system/database/drivers/sqlsrv/sqlsrv_result.php                 | 2 +-
 system/database/drivers/sqlsrv/sqlsrv_utility.php                | 2 +-
 system/helpers/array_helper.php                                  | 2 +-
 system/helpers/captcha_helper.php                                | 2 +-
 system/helpers/cookie_helper.php                                 | 2 +-
 system/helpers/date_helper.php                                   | 2 +-
 system/helpers/directory_helper.php                              | 2 +-
 system/helpers/download_helper.php                               | 2 +-
 system/helpers/email_helper.php                                  | 2 +-
 system/helpers/file_helper.php                                   | 2 +-
 system/helpers/form_helper.php                                   | 2 +-
 system/helpers/html_helper.php                                   | 2 +-
 system/helpers/inflector_helper.php                              | 2 +-
 system/helpers/language_helper.php                               | 2 +-
 system/helpers/number_helper.php                                 | 2 +-
 system/helpers/path_helper.php                                   | 2 +-
 system/helpers/security_helper.php                               | 2 +-
 system/helpers/smiley_helper.php                                 | 2 +-
 system/helpers/string_helper.php                                 | 2 +-
 system/helpers/text_helper.php                                   | 2 +-
 system/helpers/typography_helper.php                             | 2 +-
 system/helpers/url_helper.php                                    | 2 +-
 system/helpers/xml_helper.php                                    | 2 +-
 system/language/english/calendar_lang.php                        | 2 +-
 system/language/english/date_lang.php                            | 2 +-
 system/language/english/db_lang.php                              | 2 +-
 system/language/english/email_lang.php                           | 2 +-
 system/language/english/form_validation_lang.php                 | 2 +-
 system/language/english/ftp_lang.php                             | 2 +-
 system/language/english/imglib_lang.php                          | 2 +-
 system/language/english/migration_lang.php                       | 2 +-
 system/language/english/number_lang.php                          | 2 +-
 system/language/english/profiler_lang.php                        | 2 +-
 system/language/english/unit_test_lang.php                       | 2 +-
 system/language/english/upload_lang.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/Calendar.php                                    | 2 +-
 system/libraries/Cart.php                                        | 2 +-
 system/libraries/Driver.php                                      | 2 +-
 system/libraries/Email.php                                       | 2 +-
 system/libraries/Encrypt.php                                     | 2 +-
 system/libraries/Form_validation.php                             | 2 +-
 system/libraries/Ftp.php                                         | 2 +-
 system/libraries/Image_lib.php                                   | 2 +-
 system/libraries/Javascript.php                                  | 2 +-
 system/libraries/Log.php                                         | 2 +-
 system/libraries/Migration.php                                   | 2 +-
 system/libraries/Pagination.php                                  | 2 +-
 system/libraries/Parser.php                                      | 2 +-
 system/libraries/Profiler.php                                    | 2 +-
 system/libraries/Session.php                                     | 2 +-
 system/libraries/Table.php                                       | 2 +-
 system/libraries/Trackback.php                                   | 2 +-
 system/libraries/Typography.php                                  | 2 +-
 system/libraries/Unit_test.php                                   | 2 +-
 system/libraries/Upload.php                                      | 2 +-
 system/libraries/User_agent.php                                  | 2 +-
 system/libraries/Xmlrpc.php                                      | 2 +-
 system/libraries/Xmlrpcs.php                                     | 2 +-
 system/libraries/Zip.php                                         | 2 +-
 system/libraries/javascript/Jquery.php                           | 2 +-
 user_guide_src/cilexer/cilexer/cilexer.py                        | 2 +-
 user_guide_src/source/_themes/eldocs/static/asset/css/common.css | 2 +-
 user_guide_src/source/conf.py                                    | 4 ++--
 user_guide_src/source/tutorial/static_pages.rst                  | 2 +-
 150 files changed, 151 insertions(+), 151 deletions(-)

diff --git a/application/config/autoload.php b/application/config/autoload.php
index a45567b22..db49ca109 100644
--- a/application/config/autoload.php
+++ b/application/config/autoload.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/AFL-3.0 Academic Free License (AFL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/application/config/config.php b/application/config/config.php
index 063c3d5d1..bb35324c3 100644
--- a/application/config/config.php
+++ b/application/config/config.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/AFL-3.0 Academic Free License (AFL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/application/config/constants.php b/application/config/constants.php
index 3b79a0363..c7203e47d 100644
--- a/application/config/constants.php
+++ b/application/config/constants.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/AFL-3.0 Academic Free License (AFL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/application/config/database.php b/application/config/database.php
index 19254cde2..7eac59b23 100644
--- a/application/config/database.php
+++ b/application/config/database.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/AFL-3.0 Academic Free License (AFL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/application/config/doctypes.php b/application/config/doctypes.php
index 48ccc053d..984da5965 100644
--- a/application/config/doctypes.php
+++ b/application/config/doctypes.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/AFL-3.0 Academic Free License (AFL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/application/config/foreign_chars.php b/application/config/foreign_chars.php
index 691762338..1ae0cef5f 100644
--- a/application/config/foreign_chars.php
+++ b/application/config/foreign_chars.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/AFL-3.0 Academic Free License (AFL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/application/config/hooks.php b/application/config/hooks.php
index 000ae514c..80269df59 100644
--- a/application/config/hooks.php
+++ b/application/config/hooks.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/AFL-3.0 Academic Free License (AFL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/application/config/migration.php b/application/config/migration.php
index 4fb027b8e..668c35740 100644
--- a/application/config/migration.php
+++ b/application/config/migration.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/AFL-3.0 Academic Free License (AFL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/application/config/mimes.php b/application/config/mimes.php
index c43f1fc2f..f64db155e 100644
--- a/application/config/mimes.php
+++ b/application/config/mimes.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/AFL-3.0 Academic Free License (AFL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/application/config/profiler.php b/application/config/profiler.php
index b0bd2cd1f..f95614241 100644
--- a/application/config/profiler.php
+++ b/application/config/profiler.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/AFL-3.0 Academic Free License (AFL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/application/config/routes.php b/application/config/routes.php
index b7f4056a5..53fc7e799 100644
--- a/application/config/routes.php
+++ b/application/config/routes.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/AFL-3.0 Academic Free License (AFL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/application/config/smileys.php b/application/config/smileys.php
index ada329aa1..4132aed2f 100644
--- a/application/config/smileys.php
+++ b/application/config/smileys.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/AFL-3.0 Academic Free License (AFL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/application/config/user_agents.php b/application/config/user_agents.php
index 7f5fe810c..e7a689402 100644
--- a/application/config/user_agents.php
+++ b/application/config/user_agents.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/AFL-3.0 Academic Free License (AFL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/application/controllers/welcome.php b/application/controllers/welcome.php
index 0757f2d79..5eb0e9625 100644
--- a/application/controllers/welcome.php
+++ b/application/controllers/welcome.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/AFL-3.0 Academic Free License (AFL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/application/errors/error_404.php b/application/errors/error_404.php
index eb98deb71..4dd8fc407 100644
--- a/application/errors/error_404.php
+++ b/application/errors/error_404.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/AFL-3.0 Academic Free License (AFL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/application/errors/error_db.php b/application/errors/error_db.php
index a53c38992..130ffc11d 100644
--- a/application/errors/error_db.php
+++ b/application/errors/error_db.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/AFL-3.0 Academic Free License (AFL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/application/errors/error_general.php b/application/errors/error_general.php
index 7d9a29f4e..2a844a8e2 100644
--- a/application/errors/error_general.php
+++ b/application/errors/error_general.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/AFL-3.0 Academic Free License (AFL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/application/errors/error_php.php b/application/errors/error_php.php
index 1bf245465..8e293cd5e 100644
--- a/application/errors/error_php.php
+++ b/application/errors/error_php.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/AFL-3.0 Academic Free License (AFL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/application/views/welcome_message.php b/application/views/welcome_message.php
index 709045392..acc36b6d4 100644
--- a/application/views/welcome_message.php
+++ b/application/views/welcome_message.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/AFL-3.0 Academic Free License (AFL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/index.php b/index.php
index 08e5d6df4..4ae1ceebd 100644
--- a/index.php
+++ b/index.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/core/Benchmark.php b/system/core/Benchmark.php
index 0f3104079..da246c9e0 100755
--- a/system/core/Benchmark.php
+++ b/system/core/Benchmark.php
@@ -18,7 +18,7 @@
  * 
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php
index 97527e5ca..5152073d5 100755
--- a/system/core/CodeIgniter.php
+++ b/system/core/CodeIgniter.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/core/Common.php b/system/core/Common.php
index b0921fe0c..f42bb640c 100644
--- a/system/core/Common.php
+++ b/system/core/Common.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/core/Config.php b/system/core/Config.php
index b0b4c9aa4..3e2635494 100755
--- a/system/core/Config.php
+++ b/system/core/Config.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/core/Controller.php b/system/core/Controller.php
index ca2bf41b5..55b3ec235 100644
--- a/system/core/Controller.php
+++ b/system/core/Controller.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php
index ead8d814e..3737f2930 100755
--- a/system/core/Exceptions.php
+++ b/system/core/Exceptions.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/core/Hooks.php b/system/core/Hooks.php
index aa251a389..174adcb19 100755
--- a/system/core/Hooks.php
+++ b/system/core/Hooks.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/core/Input.php b/system/core/Input.php
index 3cbbe787f..7cfa4c63f 100755
--- a/system/core/Input.php
+++ b/system/core/Input.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/core/Lang.php b/system/core/Lang.php
index e03afb07d..5eb2801f6 100755
--- a/system/core/Lang.php
+++ b/system/core/Lang.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/core/Loader.php b/system/core/Loader.php
index d42dbbf38..c4a6b501c 100644
--- a/system/core/Loader.php
+++ b/system/core/Loader.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/core/Model.php b/system/core/Model.php
index c34bab64b..fc640139a 100755
--- a/system/core/Model.php
+++ b/system/core/Model.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/core/Output.php b/system/core/Output.php
index 9727a184f..e529f914d 100755
--- a/system/core/Output.php
+++ b/system/core/Output.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/core/Router.php b/system/core/Router.php
index 748678d67..8cad86888 100755
--- a/system/core/Router.php
+++ b/system/core/Router.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/core/Security.php b/system/core/Security.php
index 60a64f358..272a8bf3f 100755
--- a/system/core/Security.php
+++ b/system/core/Security.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/core/URI.php b/system/core/URI.php
index 578d17429..3c26d307b 100755
--- a/system/core/URI.php
+++ b/system/core/URI.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/core/Utf8.php b/system/core/Utf8.php
index 1bcf526a5..40a7ac4c0 100644
--- a/system/core/Utf8.php
+++ b/system/core/Utf8.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 2.0
diff --git a/system/database/DB.php b/system/database/DB.php
index 5c90f44f3..1fb666fae 100755
--- a/system/database/DB.php
+++ b/system/database/DB.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php
index b7f43945c..486b4d775 100644
--- a/system/database/DB_active_rec.php
+++ b/system/database/DB_active_rec.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php
index 6c1ffc0f3..1ff046c21 100644
--- a/system/database/DB_cache.php
+++ b/system/database/DB_cache.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index 9d92f2f87..661b42ced 100644
--- a/system/database/DB_driver.php
+++ b/system/database/DB_driver.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php
index c74fa4068..762d18a46 100644
--- a/system/database/DB_forge.php
+++ b/system/database/DB_forge.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/DB_result.php b/system/database/DB_result.php
index 9f0b0187c..c4ed20b76 100644
--- a/system/database/DB_result.php
+++ b/system/database/DB_result.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php
index 60ecb5269..8db4f3bac 100644
--- a/system/database/DB_utility.php
+++ b/system/database/DB_utility.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/drivers/cubrid/cubrid_driver.php b/system/database/drivers/cubrid/cubrid_driver.php
index 8181bd605..cde719eae 100644
--- a/system/database/drivers/cubrid/cubrid_driver.php
+++ b/system/database/drivers/cubrid/cubrid_driver.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 2.0.2
diff --git a/system/database/drivers/cubrid/cubrid_forge.php b/system/database/drivers/cubrid/cubrid_forge.php
index 410d0652c..85e740057 100644
--- a/system/database/drivers/cubrid/cubrid_forge.php
+++ b/system/database/drivers/cubrid/cubrid_forge.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/drivers/cubrid/cubrid_result.php b/system/database/drivers/cubrid/cubrid_result.php
index b2f1bcf71..4c0fede10 100644
--- a/system/database/drivers/cubrid/cubrid_result.php
+++ b/system/database/drivers/cubrid/cubrid_result.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 2.0.2
diff --git a/system/database/drivers/cubrid/cubrid_utility.php b/system/database/drivers/cubrid/cubrid_utility.php
index 1fa0390a8..750c0d8dd 100644
--- a/system/database/drivers/cubrid/cubrid_utility.php
+++ b/system/database/drivers/cubrid/cubrid_utility.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php
index 87e7c9d37..2a1098932 100644
--- a/system/database/drivers/mssql/mssql_driver.php
+++ b/system/database/drivers/mssql/mssql_driver.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/drivers/mssql/mssql_forge.php b/system/database/drivers/mssql/mssql_forge.php
index 0a893f68f..dd8aa3448 100644
--- a/system/database/drivers/mssql/mssql_forge.php
+++ b/system/database/drivers/mssql/mssql_forge.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/drivers/mssql/mssql_result.php b/system/database/drivers/mssql/mssql_result.php
index a8cd7c982..bba2e6243 100644
--- a/system/database/drivers/mssql/mssql_result.php
+++ b/system/database/drivers/mssql/mssql_result.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/drivers/mssql/mssql_utility.php b/system/database/drivers/mssql/mssql_utility.php
index 576d13f86..be6ed5bb0 100644
--- a/system/database/drivers/mssql/mssql_utility.php
+++ b/system/database/drivers/mssql/mssql_utility.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php
index 6ded6e531..0f69a0723 100644
--- a/system/database/drivers/mysql/mysql_driver.php
+++ b/system/database/drivers/mysql/mysql_driver.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/drivers/mysql/mysql_forge.php b/system/database/drivers/mysql/mysql_forge.php
index 89aaf5de3..a41a7b446 100644
--- a/system/database/drivers/mysql/mysql_forge.php
+++ b/system/database/drivers/mysql/mysql_forge.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/drivers/mysql/mysql_result.php b/system/database/drivers/mysql/mysql_result.php
index 29297b6a4..dcb99cd60 100644
--- a/system/database/drivers/mysql/mysql_result.php
+++ b/system/database/drivers/mysql/mysql_result.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/drivers/mysql/mysql_utility.php b/system/database/drivers/mysql/mysql_utility.php
index 9cb6645eb..703524165 100644
--- a/system/database/drivers/mysql/mysql_utility.php
+++ b/system/database/drivers/mysql/mysql_utility.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php
index fb5953bd7..aff62a37d 100644
--- a/system/database/drivers/mysqli/mysqli_driver.php
+++ b/system/database/drivers/mysqli/mysqli_driver.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/drivers/mysqli/mysqli_forge.php b/system/database/drivers/mysqli/mysqli_forge.php
index cdd5399f2..590efa939 100644
--- a/system/database/drivers/mysqli/mysqli_forge.php
+++ b/system/database/drivers/mysqli/mysqli_forge.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/drivers/mysqli/mysqli_result.php b/system/database/drivers/mysqli/mysqli_result.php
index 163788b6c..89dd4ded8 100644
--- a/system/database/drivers/mysqli/mysqli_result.php
+++ b/system/database/drivers/mysqli/mysqli_result.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/drivers/mysqli/mysqli_utility.php b/system/database/drivers/mysqli/mysqli_utility.php
index ef7c89fab..76bd49e31 100644
--- a/system/database/drivers/mysqli/mysqli_utility.php
+++ b/system/database/drivers/mysqli/mysqli_utility.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php
index 9c38dcbd6..c6621901b 100644
--- a/system/database/drivers/oci8/oci8_driver.php
+++ b/system/database/drivers/oci8/oci8_driver.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright   Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright   Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/drivers/oci8/oci8_forge.php b/system/database/drivers/oci8/oci8_forge.php
index bafab3d1b..b4a24cdca 100644
--- a/system/database/drivers/oci8/oci8_forge.php
+++ b/system/database/drivers/oci8/oci8_forge.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/drivers/oci8/oci8_result.php b/system/database/drivers/oci8/oci8_result.php
index f32559289..0f69fa9ef 100644
--- a/system/database/drivers/oci8/oci8_result.php
+++ b/system/database/drivers/oci8/oci8_result.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright   Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright   Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/drivers/oci8/oci8_utility.php b/system/database/drivers/oci8/oci8_utility.php
index 28c374d99..d60f98bc4 100644
--- a/system/database/drivers/oci8/oci8_utility.php
+++ b/system/database/drivers/oci8/oci8_utility.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/drivers/odbc/odbc_driver.php b/system/database/drivers/odbc/odbc_driver.php
index 0e9d46d3f..6ba39f0cd 100644
--- a/system/database/drivers/odbc/odbc_driver.php
+++ b/system/database/drivers/odbc/odbc_driver.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/drivers/odbc/odbc_forge.php b/system/database/drivers/odbc/odbc_forge.php
index e326a2801..e0ec687c8 100644
--- a/system/database/drivers/odbc/odbc_forge.php
+++ b/system/database/drivers/odbc/odbc_forge.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/drivers/odbc/odbc_result.php b/system/database/drivers/odbc/odbc_result.php
index b23a821d3..ba660856e 100644
--- a/system/database/drivers/odbc/odbc_result.php
+++ b/system/database/drivers/odbc/odbc_result.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/drivers/odbc/odbc_utility.php b/system/database/drivers/odbc/odbc_utility.php
index 94666acbf..bae3fe853 100644
--- a/system/database/drivers/odbc/odbc_utility.php
+++ b/system/database/drivers/odbc/odbc_utility.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php
index 457cf714a..4f4f44ba7 100644
--- a/system/database/drivers/pdo/pdo_driver.php
+++ b/system/database/drivers/pdo/pdo_driver.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 2.1.0
diff --git a/system/database/drivers/pdo/pdo_forge.php b/system/database/drivers/pdo/pdo_forge.php
index bf3066529..076415928 100644
--- a/system/database/drivers/pdo/pdo_forge.php
+++ b/system/database/drivers/pdo/pdo_forge.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 2.1.0
diff --git a/system/database/drivers/pdo/pdo_result.php b/system/database/drivers/pdo/pdo_result.php
index 559c2edb3..6b523b001 100644
--- a/system/database/drivers/pdo/pdo_result.php
+++ b/system/database/drivers/pdo/pdo_result.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 2.1.0
diff --git a/system/database/drivers/pdo/pdo_utility.php b/system/database/drivers/pdo/pdo_utility.php
index 90b46af3e..971ec8803 100644
--- a/system/database/drivers/pdo/pdo_utility.php
+++ b/system/database/drivers/pdo/pdo_utility.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 2.1.0
diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php
index 50f096b5d..42329bded 100644
--- a/system/database/drivers/postgre/postgre_driver.php
+++ b/system/database/drivers/postgre/postgre_driver.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/drivers/postgre/postgre_forge.php b/system/database/drivers/postgre/postgre_forge.php
index d54b99b23..756fd347a 100644
--- a/system/database/drivers/postgre/postgre_forge.php
+++ b/system/database/drivers/postgre/postgre_forge.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/drivers/postgre/postgre_result.php b/system/database/drivers/postgre/postgre_result.php
index 808e8bf72..9161bf955 100644
--- a/system/database/drivers/postgre/postgre_result.php
+++ b/system/database/drivers/postgre/postgre_result.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/drivers/postgre/postgre_utility.php b/system/database/drivers/postgre/postgre_utility.php
index f81f85782..dffd8c549 100644
--- a/system/database/drivers/postgre/postgre_utility.php
+++ b/system/database/drivers/postgre/postgre_utility.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php
index a6257cb1f..28c3caecd 100644
--- a/system/database/drivers/sqlite/sqlite_driver.php
+++ b/system/database/drivers/sqlite/sqlite_driver.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/drivers/sqlite/sqlite_forge.php b/system/database/drivers/sqlite/sqlite_forge.php
index 96a5e0edb..2b723be0b 100644
--- a/system/database/drivers/sqlite/sqlite_forge.php
+++ b/system/database/drivers/sqlite/sqlite_forge.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/drivers/sqlite/sqlite_result.php b/system/database/drivers/sqlite/sqlite_result.php
index 2bbd1dbc0..74c0dc549 100644
--- a/system/database/drivers/sqlite/sqlite_result.php
+++ b/system/database/drivers/sqlite/sqlite_result.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/drivers/sqlite/sqlite_utility.php b/system/database/drivers/sqlite/sqlite_utility.php
index c9914f28d..f00687e38 100644
--- a/system/database/drivers/sqlite/sqlite_utility.php
+++ b/system/database/drivers/sqlite/sqlite_utility.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php
index 340cd3a66..6fd52ef70 100644
--- a/system/database/drivers/sqlsrv/sqlsrv_driver.php
+++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/drivers/sqlsrv/sqlsrv_forge.php b/system/database/drivers/sqlsrv/sqlsrv_forge.php
index 4fa0596cd..2a7766927 100644
--- a/system/database/drivers/sqlsrv/sqlsrv_forge.php
+++ b/system/database/drivers/sqlsrv/sqlsrv_forge.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/drivers/sqlsrv/sqlsrv_result.php b/system/database/drivers/sqlsrv/sqlsrv_result.php
index 38aaec723..1ee19c2d1 100644
--- a/system/database/drivers/sqlsrv/sqlsrv_result.php
+++ b/system/database/drivers/sqlsrv/sqlsrv_result.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/database/drivers/sqlsrv/sqlsrv_utility.php b/system/database/drivers/sqlsrv/sqlsrv_utility.php
index f58b5bd04..e96df96f9 100644
--- a/system/database/drivers/sqlsrv/sqlsrv_utility.php
+++ b/system/database/drivers/sqlsrv/sqlsrv_utility.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/helpers/array_helper.php b/system/helpers/array_helper.php
index 6b8695c11..c46c4d103 100644
--- a/system/helpers/array_helper.php
+++ b/system/helpers/array_helper.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php
index 0fed81996..668b034d4 100644
--- a/system/helpers/captcha_helper.php
+++ b/system/helpers/captcha_helper.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/helpers/cookie_helper.php b/system/helpers/cookie_helper.php
index a4c1e4966..7b439c47f 100644
--- a/system/helpers/cookie_helper.php
+++ b/system/helpers/cookie_helper.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php
index 49dbdbeb3..9e58d8630 100644
--- a/system/helpers/date_helper.php
+++ b/system/helpers/date_helper.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/helpers/directory_helper.php b/system/helpers/directory_helper.php
index cb37446f8..be65b388d 100644
--- a/system/helpers/directory_helper.php
+++ b/system/helpers/directory_helper.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php
index 5f5d1aaf7..4a1a79cc3 100644
--- a/system/helpers/download_helper.php
+++ b/system/helpers/download_helper.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/helpers/email_helper.php b/system/helpers/email_helper.php
index 22099e58a..e6a9003e2 100644
--- a/system/helpers/email_helper.php
+++ b/system/helpers/email_helper.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php
index 5b5085381..cc9dea22a 100644
--- a/system/helpers/file_helper.php
+++ b/system/helpers/file_helper.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php
index 347e8be90..3a7f8fe3e 100644
--- a/system/helpers/form_helper.php
+++ b/system/helpers/form_helper.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php
index b6bb402a8..2a603a607 100644
--- a/system/helpers/html_helper.php
+++ b/system/helpers/html_helper.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php
index 7c5082192..f093dd921 100644
--- a/system/helpers/inflector_helper.php
+++ b/system/helpers/inflector_helper.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/helpers/language_helper.php b/system/helpers/language_helper.php
index b5217c903..ed17bfa4c 100644
--- a/system/helpers/language_helper.php
+++ b/system/helpers/language_helper.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/helpers/number_helper.php b/system/helpers/number_helper.php
index 71cdabb60..71d39df1f 100644
--- a/system/helpers/number_helper.php
+++ b/system/helpers/number_helper.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/helpers/path_helper.php b/system/helpers/path_helper.php
index bca9dcb25..da2b8d307 100644
--- a/system/helpers/path_helper.php
+++ b/system/helpers/path_helper.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/helpers/security_helper.php b/system/helpers/security_helper.php
index ad4e29a87..d64bd12e1 100644
--- a/system/helpers/security_helper.php
+++ b/system/helpers/security_helper.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/helpers/smiley_helper.php b/system/helpers/smiley_helper.php
index 38e2965fc..700f4486c 100644
--- a/system/helpers/smiley_helper.php
+++ b/system/helpers/smiley_helper.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/helpers/string_helper.php b/system/helpers/string_helper.php
index 6691681e0..04d51c2f9 100644
--- a/system/helpers/string_helper.php
+++ b/system/helpers/string_helper.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php
index 38b46e248..842a31d75 100644
--- a/system/helpers/text_helper.php
+++ b/system/helpers/text_helper.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/helpers/typography_helper.php b/system/helpers/typography_helper.php
index b1cedcd9d..f81c46210 100644
--- a/system/helpers/typography_helper.php
+++ b/system/helpers/typography_helper.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php
index 5d9afe457..c630ebea8 100755
--- a/system/helpers/url_helper.php
+++ b/system/helpers/url_helper.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/helpers/xml_helper.php b/system/helpers/xml_helper.php
index 0cf8f13dc..b38dab479 100644
--- a/system/helpers/xml_helper.php
+++ b/system/helpers/xml_helper.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/language/english/calendar_lang.php b/system/language/english/calendar_lang.php
index 313eee1de..bf61db039 100644
--- a/system/language/english/calendar_lang.php
+++ b/system/language/english/calendar_lang.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/language/english/date_lang.php b/system/language/english/date_lang.php
index 631cfa325..cd6cf39c4 100644
--- a/system/language/english/date_lang.php
+++ b/system/language/english/date_lang.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/language/english/db_lang.php b/system/language/english/db_lang.php
index f42e469e9..2a91597df 100644
--- a/system/language/english/db_lang.php
+++ b/system/language/english/db_lang.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/language/english/email_lang.php b/system/language/english/email_lang.php
index f2dba27a4..e0ef427a6 100644
--- a/system/language/english/email_lang.php
+++ b/system/language/english/email_lang.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/language/english/form_validation_lang.php b/system/language/english/form_validation_lang.php
index 1960dfec1..6afa37a29 100644
--- a/system/language/english/form_validation_lang.php
+++ b/system/language/english/form_validation_lang.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/language/english/ftp_lang.php b/system/language/english/ftp_lang.php
index e934a19d9..18ca92713 100644
--- a/system/language/english/ftp_lang.php
+++ b/system/language/english/ftp_lang.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/language/english/imglib_lang.php b/system/language/english/imglib_lang.php
index b431d39ed..fbb92abfb 100644
--- a/system/language/english/imglib_lang.php
+++ b/system/language/english/imglib_lang.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/language/english/migration_lang.php b/system/language/english/migration_lang.php
index d87ac8dee..9765562b5 100644
--- a/system/language/english/migration_lang.php
+++ b/system/language/english/migration_lang.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 3.0
diff --git a/system/language/english/number_lang.php b/system/language/english/number_lang.php
index a4e6c8996..5dfd882ed 100644
--- a/system/language/english/number_lang.php
+++ b/system/language/english/number_lang.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/language/english/profiler_lang.php b/system/language/english/profiler_lang.php
index 790abfaf3..1d10efa76 100644
--- a/system/language/english/profiler_lang.php
+++ b/system/language/english/profiler_lang.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/language/english/unit_test_lang.php b/system/language/english/unit_test_lang.php
index 185d83d0d..ed98439f4 100644
--- a/system/language/english/unit_test_lang.php
+++ b/system/language/english/unit_test_lang.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/language/english/upload_lang.php b/system/language/english/upload_lang.php
index 2821055b7..a9a2fe74b 100644
--- a/system/language/english/upload_lang.php
+++ b/system/language/english/upload_lang.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/libraries/Cache/Cache.php b/system/libraries/Cache/Cache.php
index 87253739c..2e78a6660 100644
--- a/system/libraries/Cache/Cache.php
+++ b/system/libraries/Cache/Cache.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2006 - 2011 EllisLab, Inc.
+ * @copyright	Copyright (c) 2006 - 2012 EllisLab, Inc.
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @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 90b68688d..93993d07a 100644
--- a/system/libraries/Cache/drivers/Cache_apc.php
+++ b/system/libraries/Cache/drivers/Cache_apc.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2006 - 2011 EllisLab, Inc.
+ * @copyright	Copyright (c) 2006 - 2012 EllisLab, Inc.
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @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 ff787e90b..fcd55da39 100644
--- a/system/libraries/Cache/drivers/Cache_dummy.php
+++ b/system/libraries/Cache/drivers/Cache_dummy.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2006 - 2011 EllisLab, Inc.
+ * @copyright	Copyright (c) 2006 - 2012 EllisLab, Inc.
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @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 194279726..4a81b0422 100644
--- a/system/libraries/Cache/drivers/Cache_file.php
+++ b/system/libraries/Cache/drivers/Cache_file.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2006 - 2011 EllisLab, Inc.
+ * @copyright	Copyright (c) 2006 - 2012 EllisLab, Inc.
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @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 0037e6755..ffe6f2ff7 100644
--- a/system/libraries/Cache/drivers/Cache_memcached.php
+++ b/system/libraries/Cache/drivers/Cache_memcached.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2006 - 2011 EllisLab, Inc.
+ * @copyright	Copyright (c) 2006 - 2012 EllisLab, Inc.
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 2.0
diff --git a/system/libraries/Calendar.php b/system/libraries/Calendar.php
index 605765bf6..a05a7babf 100644
--- a/system/libraries/Calendar.php
+++ b/system/libraries/Calendar.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php
index 01a0cb8ce..ba8d69be2 100644
--- a/system/libraries/Cart.php
+++ b/system/libraries/Cart.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2006 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2006 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/libraries/Driver.php b/system/libraries/Driver.php
index 183a95985..2112a7ee6 100644
--- a/system/libraries/Driver.php
+++ b/system/libraries/Driver.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2006 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2006 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index 1066535c7..922107e9f 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/libraries/Encrypt.php b/system/libraries/Encrypt.php
index 92b0b3c4a..e297576e6 100644
--- a/system/libraries/Encrypt.php
+++ b/system/libraries/Encrypt.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index d83afdd25..2761d060b 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/libraries/Ftp.php b/system/libraries/Ftp.php
index 99850a9e5..ab395b0a0 100644
--- a/system/libraries/Ftp.php
+++ b/system/libraries/Ftp.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php
index fe9b8dc79..c86224ffb 100644
--- a/system/libraries/Image_lib.php
+++ b/system/libraries/Image_lib.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/libraries/Javascript.php b/system/libraries/Javascript.php
index f872d672f..33df6007a 100644
--- a/system/libraries/Javascript.php
+++ b/system/libraries/Javascript.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/libraries/Log.php b/system/libraries/Log.php
index 7f3a307f3..944173fdd 100644
--- a/system/libraries/Log.php
+++ b/system/libraries/Log.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/libraries/Migration.php b/system/libraries/Migration.php
index f89391c0d..d07097223 100644
--- a/system/libraries/Migration.php
+++ b/system/libraries/Migration.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2006 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2006 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 3.0
diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php
index 008c15192..23ca549e2 100644
--- a/system/libraries/Pagination.php
+++ b/system/libraries/Pagination.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/libraries/Parser.php b/system/libraries/Parser.php
index 39aa61e45..321248277 100644
--- a/system/libraries/Parser.php
+++ b/system/libraries/Parser.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php
index 9cbd69bb2..89c616543 100644
--- a/system/libraries/Profiler.php
+++ b/system/libraries/Profiler.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/libraries/Session.php b/system/libraries/Session.php
index 137b037b8..04103a4d9 100644
--- a/system/libraries/Session.php
+++ b/system/libraries/Session.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/libraries/Table.php b/system/libraries/Table.php
index 1851bf3bc..fb154e50f 100644
--- a/system/libraries/Table.php
+++ b/system/libraries/Table.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.3.1
diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php
index b5e68507f..79a009133 100644
--- a/system/libraries/Trackback.php
+++ b/system/libraries/Trackback.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/libraries/Typography.php b/system/libraries/Typography.php
index 651ba7bff..76f0d4fc5 100644
--- a/system/libraries/Typography.php
+++ b/system/libraries/Typography.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php
index fd3880d29..38d767c69 100644
--- a/system/libraries/Unit_test.php
+++ b/system/libraries/Unit_test.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.3.1
diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php
index 826bcceb8..0c63886e7 100644
--- a/system/libraries/Upload.php
+++ b/system/libraries/Upload.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/libraries/User_agent.php b/system/libraries/User_agent.php
index c31ff2646..cd644c00d 100644
--- a/system/libraries/User_agent.php
+++ b/system/libraries/User_agent.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php
index 7b1e3fa6e..1bdc27512 100644
--- a/system/libraries/Xmlrpc.php
+++ b/system/libraries/Xmlrpc.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/libraries/Xmlrpcs.php b/system/libraries/Xmlrpcs.php
index 893e51873..355d43f29 100644
--- a/system/libraries/Xmlrpcs.php
+++ b/system/libraries/Xmlrpcs.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php
index 52f1bc3d0..50e84920e 100644
--- a/system/libraries/Zip.php
+++ b/system/libraries/Zip.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/system/libraries/javascript/Jquery.php b/system/libraries/javascript/Jquery.php
index 888e89b1b..03574c66e 100644
--- a/system/libraries/javascript/Jquery.php
+++ b/system/libraries/javascript/Jquery.php
@@ -18,7 +18,7 @@
  *
  * @package		CodeIgniter
  * @author		EllisLab Dev Team
- * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright	Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
  * @license		http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
  * @link		http://codeigniter.com
  * @since		Version 1.0
diff --git a/user_guide_src/cilexer/cilexer/cilexer.py b/user_guide_src/cilexer/cilexer/cilexer.py
index e571ce627..713268e9c 100644
--- a/user_guide_src/cilexer/cilexer/cilexer.py
+++ b/user_guide_src/cilexer/cilexer/cilexer.py
@@ -15,7 +15,7 @@
 # through the world wide web, please send an email to
 # licensing@ellislab.com so we can send you a copy immediately.
 # 
-# Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+# Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
 # http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
 
 
diff --git a/user_guide_src/source/_themes/eldocs/static/asset/css/common.css b/user_guide_src/source/_themes/eldocs/static/asset/css/common.css
index 45b1fe724..b9e28aec0 100644
--- a/user_guide_src/source/_themes/eldocs/static/asset/css/common.css
+++ b/user_guide_src/source/_themes/eldocs/static/asset/css/common.css
@@ -16,7 +16,7 @@ If you did not receive a copy of the license and are unable to obtain it
 through the world wide web, please send an email to
 licensing@ellislab.com so we can send you a copy immediately.
 
-Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
 http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
 */
 
diff --git a/user_guide_src/source/conf.py b/user_guide_src/source/conf.py
index bb10d06e4..593ceaf1c 100644
--- a/user_guide_src/source/conf.py
+++ b/user_guide_src/source/conf.py
@@ -41,7 +41,7 @@ master_doc = 'index'
 
 # General information about the project.
 project = u'CodeIgniter'
-copyright = u'2011, EllisLab, Inc.'
+copyright = u'2012, EllisLab, Inc.'
 
 # The version info for the project you're documenting, acts as replacement for
 # |version| and |release|, also used in various other places throughout the
@@ -223,7 +223,7 @@ man_pages = [
 epub_title = u'CodeIgniter'
 epub_author = u'EllisLab, Inc.'
 epub_publisher = u'EllisLab, Inc.'
-epub_copyright = u'2011, EllisLab, Inc.'
+epub_copyright = u'2012, EllisLab, Inc.'
 
 # The language of the text. It defaults to the language option
 # or en if the language is not set.
diff --git a/user_guide_src/source/tutorial/static_pages.rst b/user_guide_src/source/tutorial/static_pages.rst
index 82de2a8cb..c7f737951 100644
--- a/user_guide_src/source/tutorial/static_pages.rst
+++ b/user_guide_src/source/tutorial/static_pages.rst
@@ -72,7 +72,7 @@ includes the following code:
 
 ::
 
-            © 2011
+            © 2012
         
     
 
-- 
cgit v1.2.3-24-g4f1b


From d09d650acf612652627d77efda3616e5bbc3871c Mon Sep 17 00:00:00 2001
From: Andrey Andreev 
Date: Tue, 3 Jan 2012 06:38:33 +0200
Subject: Fix a comment and remove access description lines

---
 system/libraries/Form_validation.php | 46 ++++--------------------------------
 1 file changed, 4 insertions(+), 42 deletions(-)

diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index 2761d060b..0a6a2af0d 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -78,7 +78,6 @@ class CI_Form_validation {
 	 * This function takes an array of field names and validation
 	 * rules as input, validates the info, and stores it
 	 *
-	 * @access	public
 	 * @param	mixed
 	 * @param	string
 	 * @return	void
@@ -168,7 +167,6 @@ class CI_Form_validation {
 	 * Lets users set their own error messages on the fly.  Note:  The key
 	 * name has to match the  function name that it corresponds to.
 	 *
-	 * @access	public
 	 * @param	string
 	 * @param	string
 	 * @return	string
@@ -192,7 +190,6 @@ class CI_Form_validation {
 	 *
 	 * Permits a prefix/suffix to be added to each error message
 	 *
-	 * @access	public
 	 * @param	string
 	 * @param	string
 	 * @return	void
@@ -212,7 +209,6 @@ class CI_Form_validation {
 	 *
 	 * Gets the error message associated with a particular field
 	 *
-	 * @access	public
 	 * @param	string	the field name
 	 * @return	void
 	 */
@@ -243,7 +239,6 @@ class CI_Form_validation {
 	 *
 	 * Returns the error messages as a string, wrapped in the error delimiters
 	 *
-	 * @access	public
 	 * @param	string
 	 * @param	string
 	 * @return	str
@@ -286,7 +281,6 @@ class CI_Form_validation {
 	 *
 	 * This function does all the work.
 	 *
-	 * @access	public
 	 * @return	bool
 	 */
 	public function run($group = '')
@@ -371,7 +365,6 @@ class CI_Form_validation {
 	/**
 	 * Traverse a multidimensional $_POST array index until the data is found
 	 *
-	 * @access	protected
 	 * @param	array
 	 * @param	array
 	 * @param	integer
@@ -392,7 +385,6 @@ class CI_Form_validation {
 	/**
 	 * Re-populate the _POST array with our finalized and processed data
 	 *
-	 * @access	protected
 	 * @return	null
 	 */
 	protected function _reset_post_array()
@@ -450,7 +442,6 @@ class CI_Form_validation {
 	/**
 	 * Executes the Validation routines
 	 *
-	 * @access	protected
 	 * @param	array
 	 * @param	array
 	 * @param	mixed
@@ -680,7 +671,6 @@ class CI_Form_validation {
 	/**
 	 * Translate a field name
 	 *
-	 * @access	protected
 	 * @param	string	the field name
 	 * @return	string
 	 */
@@ -711,7 +701,6 @@ class CI_Form_validation {
 	 * Permits you to repopulate a form field with the value it was submitted
 	 * with, or, if that value doesn't exist, with the default
 	 *
-	 * @access	public
 	 * @param	string	the field name
 	 * @param	string
 	 * @return	void
@@ -741,7 +730,6 @@ class CI_Form_validation {
 	 * Enables pull-down lists to be set to the value the user
 	 * selected in the event of an error
 	 *
-	 * @access	public
 	 * @param	string
 	 * @param	string
 	 * @return	string
@@ -785,7 +773,6 @@ class CI_Form_validation {
 	 * Enables radio buttons to be set to the value the user
 	 * selected in the event of an error
 	 *
-	 * @access	public
 	 * @param	string
 	 * @param	string
 	 * @return	string
@@ -829,7 +816,6 @@ class CI_Form_validation {
 	 * Enables checkboxes to be set to the value the user
 	 * selected in the event of an error
 	 *
-	 * @access	public
 	 * @param	string
 	 * @param	string
 	 * @return	string
@@ -845,7 +831,6 @@ class CI_Form_validation {
 	/**
 	 * Required
 	 *
-	 * @access	public
 	 * @param	string
 	 * @return	bool
 	 */
@@ -859,7 +844,6 @@ class CI_Form_validation {
 	/**
 	 * Performs a Regular Expression match test.
 	 *
-	 * @access	public
 	 * @param	string
 	 * @param	regex
 	 * @return	bool
@@ -874,7 +858,6 @@ class CI_Form_validation {
 	/**
 	 * Match one field to another
 	 *
-	 * @access	public
 	 * @param	string
 	 * @param	field
 	 * @return	bool
@@ -894,9 +877,11 @@ class CI_Form_validation {
 	// --------------------------------------------------------------------
 
 	/**
-	 * Match one field to another
+	 * Is Unique
+	 *
+	 * Check if the input value doesn't already exist
+	 * in the specified database field.
 	 *
-	 * @access	public
 	 * @param	string
 	 * @param	field
 	 * @return	bool
@@ -917,7 +902,6 @@ class CI_Form_validation {
 	/**
 	 * Minimum Length
 	 *
-	 * @access	public
 	 * @param	string
 	 * @param	value
 	 * @return	bool
@@ -942,7 +926,6 @@ class CI_Form_validation {
 	/**
 	 * Max Length
 	 *
-	 * @access	public
 	 * @param	string
 	 * @param	value
 	 * @return	bool
@@ -967,7 +950,6 @@ class CI_Form_validation {
 	/**
 	 * Exact Length
 	 *
-	 * @access	public
 	 * @param	string
 	 * @param	value
 	 * @return	bool
@@ -992,7 +974,6 @@ class CI_Form_validation {
 	/**
 	 * Valid Email
 	 *
-	 * @access	public
 	 * @param	string
 	 * @return	bool
 	 */
@@ -1006,7 +987,6 @@ class CI_Form_validation {
 	/**
 	 * Valid Emails
 	 *
-	 * @access	public
 	 * @param	string
 	 * @return	bool
 	 */
@@ -1033,7 +1013,6 @@ class CI_Form_validation {
 	/**
 	 * Validate IP Address
 	 *
-	 * @access	public
 	 * @param	string
 	 * @return	bool
 	 */
@@ -1047,7 +1026,6 @@ class CI_Form_validation {
 	/**
 	 * Alpha
 	 *
-	 * @access	public
 	 * @param	string
 	 * @return	bool
 	 */
@@ -1061,7 +1039,6 @@ class CI_Form_validation {
 	/**
 	 * Alpha-numeric
 	 *
-	 * @access	public
 	 * @param	string
 	 * @return	bool
 	 */
@@ -1075,7 +1052,6 @@ class CI_Form_validation {
 	/**
 	 * Alpha-numeric with underscores and dashes
 	 *
-	 * @access	public
 	 * @param	string
 	 * @return	bool
 	 */
@@ -1089,7 +1065,6 @@ class CI_Form_validation {
 	/**
 	 * Numeric
 	 *
-	 * @access	public
 	 * @param	string
 	 * @return	bool
 	 */
@@ -1104,7 +1079,6 @@ class CI_Form_validation {
 	/**
 	 * Is Numeric
 	 *
-	 * @access	public
 	 * @param	string
 	 * @return	bool
 	 */
@@ -1118,7 +1092,6 @@ class CI_Form_validation {
 	/**
 	 * Integer
 	 *
-	 * @access	public
 	 * @param	string
 	 * @return	bool
 	 */
@@ -1132,7 +1105,6 @@ class CI_Form_validation {
 	/**
 	 * Decimal number
 	 *
-	 * @access	public
 	 * @param	string
 	 * @return	bool
 	 */
@@ -1146,7 +1118,6 @@ class CI_Form_validation {
 	/**
 	 * Greather than
 	 *
-	 * @access	public
 	 * @param	string
 	 * @return	bool
 	 */
@@ -1164,7 +1135,6 @@ class CI_Form_validation {
 	/**
 	 * Less than
 	 *
-	 * @access	public
 	 * @param	string
 	 * @return	bool
 	 */
@@ -1182,7 +1152,6 @@ class CI_Form_validation {
 	/**
 	 * Is a Natural number  (0,1,2,3, etc.)
 	 *
-	 * @access	public
 	 * @param	string
 	 * @return	bool
 	 */
@@ -1196,7 +1165,6 @@ class CI_Form_validation {
 	/**
 	 * Is a Natural number, but not a zero  (1,2,3, etc.)
 	 *
-	 * @access	public
 	 * @param	string
 	 * @return	bool
 	 */
@@ -1213,7 +1181,6 @@ class CI_Form_validation {
 	 * Tests a string for characters outside of the Base64 alphabet
 	 * as defined by RFC 2045 http://www.faqs.org/rfcs/rfc2045
 	 *
-	 * @access	public
 	 * @param	string
 	 * @return	bool
 	 */
@@ -1230,7 +1197,6 @@ class CI_Form_validation {
 	 * This function allows HTML to be safely shown in a form.
 	 * Special characters are converted.
 	 *
-	 * @access	public
 	 * @param	string
 	 * @return	string
 	 */
@@ -1259,7 +1225,6 @@ class CI_Form_validation {
 	/**
 	 * Prep URL
 	 *
-	 * @access	public
 	 * @param	string
 	 * @return	string
 	 */
@@ -1283,7 +1248,6 @@ class CI_Form_validation {
 	/**
 	 * Strip Image Tags
 	 *
-	 * @access	public
 	 * @param	string
 	 * @return	string
 	 */
@@ -1297,7 +1261,6 @@ class CI_Form_validation {
 	/**
 	 * XSS Clean
 	 *
-	 * @access	public
 	 * @param	string
 	 * @return	string
 	 */
@@ -1311,7 +1274,6 @@ class CI_Form_validation {
 	/**
 	 * Convert PHP tags to entities
 	 *
-	 * @access	public
 	 * @param	string
 	 * @return	string
 	 */
-- 
cgit v1.2.3-24-g4f1b


From 7c9766a67948613b7fcb141728fb41fcd3ea1844 Mon Sep 17 00:00:00 2001
From: Andrey Andreev 
Date: Tue, 3 Jan 2012 10:18:41 +0200
Subject: Some additions to mimes.php

---
 application/config/mimes.php        | 13 +++++++------
 user_guide_src/source/changelog.rst |  8 +++++---
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/application/config/mimes.php b/application/config/mimes.php
index f64db155e..8c34fd298 100644
--- a/application/config/mimes.php
+++ b/application/config/mimes.php
@@ -1,13 +1,13 @@
-	array('application/mac-binhex40', 'application/mac-binhe
 				'log'	=>	array('text/plain', 'text/x-log'),
 				'rtx'	=>	'text/richtext',
 				'rtf'	=>	'text/rtf',
-				'xml'	=>	'text/xml',
-				'xsl'	=>	'text/xml',
+				'xml'	=>	array('application/xml', 'text/xml'),
+				'xsl'	=>	array('application/xml', 'text/xsl', 'text/xml'),
 				'mpeg'	=>	'video/mpeg',
 				'mpg'	=>	'video/mpeg',
 				'mpe'	=>	'video/mpeg',
@@ -160,8 +160,9 @@ $mimes = array('hqx'	=>	array('application/mac-binhex40', 'application/mac-binhe
 				'ac3'   =>	'audio/ac3',
 				'flac'  =>	'audio/x-flac',
 				'ogg'   =>	'audio/ogg',
+				'kmz'	=>	array('application/vnd.google-earth.kmz', 'application/zip', 'application/x-zip'),
+				'kml'	=>	array('application/vnd.google-earth.kml+xml', 'application/xml', 'text/xml')
 			);
 
-
 /* End of file mimes.php */
 /* Location: ./application/config/mimes.php */
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 59d2ea88d..f611be5c3 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -24,9 +24,11 @@ Release Date: Not Released
    -  Added Windows 7 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 pgp and gpg to mimes.php.
-   -  Added support 3gp, 3g2, mp4, wmv, f4v, vlc Video files to mimes.php.
-   -  Added support m4a, aac, m4u, xspf, au, ac3, flac, ogg Audio files to mimes.php.
+   -  Added support for pgp and gpg to mimes.php.
+   -  Added support for 3gp, 3g2, mp4, wmv, f4v, vlc Video files to mimes.php.
+   -  Added support for m4a, aac, m4u, xspf, au, ac3, flac, ogg Audio files to mimes.php.
+   -  Added support for kmz and kml (Google Earth) files to mimes.php.
+   -  Added application/xml for xml and application/xml, text/xsl for xsl in mimes.php.
    -  Changed logger to only chmod when file is first created.
    -  Removed previously deprecated SHA1 Library.
 
-- 
cgit v1.2.3-24-g4f1b


From b195637240bbbc7c3dc7ee0585f0e4cd39cb9d81 Mon Sep 17 00:00:00 2001
From: Andrey Andreev 
Date: Tue, 3 Jan 2012 11:01:48 +0200
Subject: Replace htmlentities() with htmlspecialchars() to fix issue #561

---
 system/libraries/Xmlrpc.php | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php
index bb95ca145..a9f8d9c38 100644
--- a/system/libraries/Xmlrpc.php
+++ b/system/libraries/Xmlrpc.php
@@ -437,7 +437,14 @@ class XML_RPC_Response
 		{
 			// error
 			$this->errno = $code;
-			$this->errstr = htmlentities($fstr);
+			if ( ! is_php('5.4'))
+			{
+				$this->errstr = htmlspecialchars($fstr, ENT_NOQUOTES, 'UTF-8');
+			}
+			else
+			{
+				$this->errstr = htmlspecialchars($fstr, ENT_XML1 | ENT_NOQUOTES, 'UTF-8');
+			}
 		}
 		else if ( ! is_object($val))
 		{
-- 
cgit v1.2.3-24-g4f1b


From d81150feddf5605d6afe70d4f641f013e42df586 Mon Sep 17 00:00:00 2001
From: Andrey Andreev 
Date: Tue, 3 Jan 2012 11:06:32 +0200
Subject: Update the changelog

---
 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 59d2ea88d..1fa374334 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -89,6 +89,7 @@ Bug fixes for 3.0
 -  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.
+-  Fixed a bug (#561) - Errors in :doc:`XML-RPC Library ` were not properly escaped.
 
 Version 2.1.0
 =============
-- 
cgit v1.2.3-24-g4f1b


From 23ea93bf58bb3ad47bad08c17efa4067abbb5253 Mon Sep 17 00:00:00 2001
From: RS71 
Date: Tue, 3 Jan 2012 12:43:16 -0200
Subject: Update user_guide_src/source/libraries/security.rst

---
 user_guide_src/source/libraries/security.rst | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/user_guide_src/source/libraries/security.rst b/user_guide_src/source/libraries/security.rst
index 8ee0c6e77..e7d25555f 100644
--- a/user_guide_src/source/libraries/security.rst
+++ b/user_guide_src/source/libraries/security.rst
@@ -85,6 +85,10 @@ If you use the :doc:`form helper <../helpers/form_helper>` the
 form_open() function will automatically insert a hidden csrf field in
 your forms.
 
+Tokens may be either regenerated on every submission (default) or kept the same throughout the life of the CSRF cookie. The default regeneration of tokens provides stricter security but may result in usability concerns as other tokens become invalid (back/forward navigation, multiple tabs/windows, asynchronous actions, etc). You may alter this behavior by editing the following config parameter::
+
+	$config['csrf_regeneration'] = TRUE;
+
 Select URIs can be whitelisted from csrf protection (for example API
 endpoints expecting externally POSTed content). You can add these URIs
 by editing the 'csrf_exclude_uris' config parameter::
-- 
cgit v1.2.3-24-g4f1b


From 0fc6409cae13c6be6749e1f160a144fc90713f8b Mon Sep 17 00:00:00 2001
From: RS71 
Date: Tue, 3 Jan 2012 12:50:55 -0200
Subject: Update user_guide_src/source/changelog.rst

---
 user_guide_src/source/changelog.rst | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 59d2ea88d..b2f247589 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -61,6 +61,8 @@ Release Date: Not Released
 	    if they are set manually after initialization.
    -  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.
+
 
 -  Core
 
-- 
cgit v1.2.3-24-g4f1b


From 26cba2ae6c47ecbacdf34fe94a32f1f00fbef72c Mon Sep 17 00:00:00 2001
From: Eric Barnes 
Date: Tue, 3 Jan 2012 23:39:24 -0500
Subject: Updated the memcached config file.

---
 application/config/memcached.php | 38 +++++++++++++++++++++++++++++++-------
 1 file changed, 31 insertions(+), 7 deletions(-)

diff --git a/application/config/memcached.php b/application/config/memcached.php
index 1b34aa683..2b1a77266 100644
--- a/application/config/memcached.php
+++ b/application/config/memcached.php
@@ -1,22 +1,46 @@
- array(
 		'hostname' => '127.0.0.1',
 		'port'     => '11211',
 		'weight'   => '1',
-	),      
-);  
+	),
+);
 
 /* End of file memcached.php */
 /* Location: ./application/config/memcached.php */
\ No newline at end of file
-- 
cgit v1.2.3-24-g4f1b


From 8d727f14446f31d919e808e3833d252ef12cf1ae Mon Sep 17 00:00:00 2001
From: Eric Barnes 
Date: Wed, 4 Jan 2012 00:06:36 -0500
Subject: Fixed prefix and suffix in pagination. Fixes #677

---
 system/libraries/Pagination.php | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php
index 23ca549e2..2fe4cf31b 100644
--- a/system/libraries/Pagination.php
+++ b/system/libraries/Pagination.php
@@ -142,6 +142,11 @@ class CI_Pagination {
 		// Determine the current page number.
 		$CI =& get_instance();
 
+		if ($this->prefix != '' OR $this->suffix != '')
+		{
+			$this->cur_page = str_replace(array($this->prefix, $this->suffix), '', $CI->uri->segment($this->uri_segment));
+		}
+
 		if ($CI->config->item('enable_query_strings') === TRUE OR $this->page_query_string === TRUE)
 		{
 			if ($CI->input->get($this->query_string_segment) != $base_page)
-- 
cgit v1.2.3-24-g4f1b


From 3b376595183e0e0db5559ccbfc368c442408dca9 Mon Sep 17 00:00:00 2001
From: Eric Barnes 
Date: Wed, 4 Jan 2012 00:28:27 -0500
Subject: Fixed paging with prefix and suffix for real page numbers. Refs #677
 Fixes #52

---
 system/libraries/Pagination.php | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php
index 2fe4cf31b..e0cab2128 100644
--- a/system/libraries/Pagination.php
+++ b/system/libraries/Pagination.php
@@ -142,9 +142,10 @@ class CI_Pagination {
 		// Determine the current page number.
 		$CI =& get_instance();
 
+		// See if we are using a prefix or suffix on links
 		if ($this->prefix != '' OR $this->suffix != '')
 		{
-			$this->cur_page = str_replace(array($this->prefix, $this->suffix), '', $CI->uri->segment($this->uri_segment));
+			$this->cur_page = (int) str_replace(array($this->prefix, $this->suffix), '', $CI->uri->segment($this->uri_segment));
 		}
 
 		if ($CI->config->item('enable_query_strings') === TRUE OR $this->page_query_string === TRUE)
@@ -154,7 +155,7 @@ class CI_Pagination {
 				$this->cur_page = (int) $CI->input->get($this->query_string_segment);
 			}
 		}
-		elseif ($CI->uri->segment($this->uri_segment) != $base_page)
+		elseif ( ! $this->cur_page AND $CI->uri->segment($this->uri_segment) != $base_page)
 		{
 			$this->cur_page = (int) $CI->uri->segment($this->uri_segment);
 		}
@@ -165,7 +166,7 @@ class CI_Pagination {
 			$this->cur_page = $base_page;
 		}
 
-		$this->num_links = (int)$this->num_links;
+		$this->num_links = (int) $this->num_links;
 
 		if ($this->num_links < 1)
 		{
-- 
cgit v1.2.3-24-g4f1b


From 43fcdbcac05a0cdc5c2a77c79c641849c41caa9e Mon Sep 17 00:00:00 2001
From: Eric Barnes 
Date: Wed, 4 Jan 2012 21:27:47 -0500
Subject: Added pagination change log item back.

---
 user_guide_src/source/changelog.rst | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index f611be5c3..668f073df 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -91,6 +91,9 @@ Bug fixes for 3.0
 -  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
+
+
 
 Version 2.1.0
 =============
-- 
cgit v1.2.3-24-g4f1b


From 8bf6bb654da32626e9c3a4e40f9ca7ea464a9e19 Mon Sep 17 00:00:00 2001
From: Andrey Andreev 
Date: Fri, 6 Jan 2012 16:11:04 +0200
Subject: Improve email, file & form helpers

---
 system/helpers/email_helper.php | 11 +++---
 system/helpers/file_helper.php  | 72 ++++++++++++++++++---------------------
 system/helpers/form_helper.php  | 74 ++++++++++++++---------------------------
 3 files changed, 62 insertions(+), 95 deletions(-)

diff --git a/system/helpers/email_helper.php b/system/helpers/email_helper.php
index e6a9003e2..f184031a9 100644
--- a/system/helpers/email_helper.php
+++ b/system/helpers/email_helper.php
@@ -1,13 +1,13 @@
-config->site_url($CI->uri->uri_string());
 
-		$form = '
\n"; - $form .= '>'; - - // Add CSRF field if enabled, but leave it out for GET requests and requests to external websites - if ($CI->config->item('csrf_protection') === TRUE AND ! (strpos($action, $CI->config->site_url()) === FALSE OR strpos($form, 'method="get"'))) + // Add CSRF field if enabled, but leave it out for GET requests and requests to external websites + if ($CI->config->item('csrf_protection') === TRUE AND ! (strpos($action, $CI->config->site_url()) === FALSE OR strpos($form, 'method="get"'))) { $hidden[$CI->security->get_csrf_token_name()] = $CI->security->get_csrf_hash(); } @@ -156,7 +152,7 @@ if ( ! function_exists('form_hidden')) if ( ! is_array($value)) { - $form .= ''."\n"; + $form .= '\n"; } else { @@ -188,7 +184,7 @@ if ( ! function_exists('form_input')) { $defaults = array('type' => 'text', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value); - return ""; + return '\n"; } } @@ -274,7 +270,7 @@ if ( ! function_exists('form_textarea')) } $name = (is_array($data)) ? $data['name'] : $data; - return ""; + return '\n"; } } @@ -325,13 +321,9 @@ if ( ! function_exists('form_dropdown')) } // If no selected state was submitted we will attempt to set it automatically - if (count($selected) === 0) + if (count($selected) === 0 && isset($_POST[$name])) { - // If the form name appears in the $_POST array we have a winner! - if (isset($_POST[$name])) - { - $selected = array($_POST[$name]); - } + $selected = array($_POST[$name]); } if ($extra != '') $extra = ' '.$extra; @@ -346,12 +338,11 @@ if ( ! function_exists('form_dropdown')) if (is_array($val) && ! empty($val)) { - $form .= ''."\n"; + $form .= '\n"; foreach ($val as $optgroup_key => $optgroup_val) { $sel = (in_array($optgroup_key, $selected)) ? ' selected="selected"' : ''; - $form .= '\n"; } @@ -359,13 +350,11 @@ if ( ! function_exists('form_dropdown')) } else { - $sel = (in_array($key, $selected)) ? ' selected="selected"' : ''; - - $form .= '\n"; + $form .= '\n"; } } - $form .= ''; + $form .= "\n"; return $form; } @@ -412,7 +401,7 @@ if ( ! function_exists('form_checkbox')) unset($defaults['checked']); } - return ""; + return '\n"; } } @@ -458,8 +447,7 @@ if ( ! function_exists('form_submit')) function form_submit($data = '', $value = '', $extra = '') { $defaults = array('type' => 'submit', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value); - - return ""; + return '\n"; } } @@ -479,8 +467,7 @@ if ( ! function_exists('form_reset')) function form_reset($data = '', $value = '', $extra = '') { $defaults = array('type' => 'reset', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value); - - return ""; + return '\n"; } } @@ -500,14 +487,13 @@ if ( ! function_exists('form_button')) function form_button($data = '', $content = '', $extra = '') { $defaults = array('name' => (( ! is_array($data)) ? $data : ''), 'type' => 'button'); - if ( is_array($data) AND isset($data['content'])) { $content = $data['content']; unset($data['content']); // content is not an attribute } - return ""; + return '\n"; } } @@ -542,9 +528,7 @@ if ( ! function_exists('form_label')) } } - $label .= ">$label_text"; - - return $label; + return $label .= ">$label_text"; } } @@ -564,12 +548,7 @@ if ( ! function_exists('form_fieldset')) { function form_fieldset($legend_text = '', $attributes = array()) { - $fieldset = "\n"; if ($legend_text != '') { $fieldset .= "$legend_text\n"; @@ -654,15 +633,13 @@ if ( ! function_exists('form_prep')) { return $str; } - - $str = html_escape($str); if ($field_name != '') { $prepped_fields[$field_name] = $field_name; } - return $str; + return html_escape($str); } } @@ -992,7 +969,7 @@ if ( ! function_exists('_attributes_to_string')) $attributes .= ' accept-charset="'.strtolower(config_item('charset')).'"'; } - return ' '.$attributes; + return ' '.$attributes; } if (is_object($attributes) AND count($attributes) > 0) @@ -1043,21 +1020,20 @@ if ( ! function_exists('_get_validation_object')) // We set this as a variable since we're returning by reference. $return = FALSE; - + if (FALSE !== ($object = $CI->load->is_loaded('form_validation'))) { if ( ! isset($CI->$object) OR ! is_object($CI->$object)) { return $return; } - + return $CI->$object; } - + return $return; } } - /* End of file form_helper.php */ /* Location: ./system/helpers/form_helper.php */ -- cgit v1.2.3-24-g4f1b From 1e6b72cca80354619cf7ddceb2b5f23d37b972e9 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 6 Jan 2012 19:09:22 +0200 Subject: Improve html, inflector & language helpers --- system/helpers/html_helper.php | 70 +++++++++++++------------------------ system/helpers/inflector_helper.php | 30 +++------------- system/helpers/language_helper.php | 9 +++-- 3 files changed, 33 insertions(+), 76 deletions(-) diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index 2a603a607..72970d9ca 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -1,13 +1,13 @@ -".$data.""; + return ''.$data.''; } } @@ -124,7 +123,7 @@ if ( ! function_exists('_list')) } // Set the indentation based on the depth - $out = str_repeat(" ", $depth); + $out = str_repeat(' ', $depth); // Were any attributes submitted? If so generate a string if (is_array($attributes)) @@ -142,7 +141,7 @@ if ( ! function_exists('_list')) } // Write the opening list tag - $out .= "<".$type.$attributes.">\n"; + $out .= '<'.$type.$attributes.">\n"; // Cycle through the list elements. If an array is // encountered we will recursively call _list() @@ -152,8 +151,7 @@ if ( ! function_exists('_list')) { $_last_list_item = $key; - $out .= str_repeat(" ", $depth + 2); - $out .= "
  • "; + $out .= str_repeat(' ', $depth + 2).'
  • '; if ( ! is_array($val)) { @@ -161,21 +159,14 @@ if ( ! function_exists('_list')) } else { - $out .= $_last_list_item."\n"; - $out .= _list($type, $val, '', $depth + 4); - $out .= str_repeat(" ", $depth + 2); + $out .= $_last_list_item."\n"._list($type, $val, '', $depth + 4).str_repeat(' ', $depth + 2); } $out .= "
  • \n"; } - // Set the indentation for the closing tag - $out .= str_repeat(" ", $depth); - - // Write the closing list tag - $out .= "\n"; - - return $out; + // Set the indentation for the closing tag and apply it + return $out.str_repeat(' ', $depth).'\n"; } } @@ -192,7 +183,7 @@ if ( ! function_exists('br')) { function br($num = 1) { - return str_repeat("
    ", $num); + return str_repeat('
    ', $num); } } @@ -224,10 +215,9 @@ if ( ! function_exists('img')) $img = '$v) + foreach ($src as $k => $v) { - - if ($k == 'src' AND strpos($v, '://') === FALSE) + if ($k === 'src' AND strpos($v, '://') === FALSE) { $CI =& get_instance(); @@ -246,9 +236,7 @@ if ( ! function_exists('img')) } } - $img .= '/>'; - - return $img; + return $img.'/>'; } } @@ -290,14 +278,7 @@ if ( ! function_exists('doctype')) } } - if (isset($_doctypes[$type])) - { - return $_doctypes[$type]; - } - else - { - return FALSE; - } + return (isset($_doctypes[$type])) ? $_doctypes[$type] : FALSE; } } @@ -322,14 +303,13 @@ if ( ! function_exists('link_tag')) function link_tag($href = '', $rel = 'stylesheet', $type = 'text/css', $title = '', $media = '', $index_page = FALSE) { $CI =& get_instance(); - $link = '$v) + foreach ($href as $k => $v) { - if ($k == 'href' AND strpos($v, '://') === FALSE) + if ($k === 'href' AND strpos($v, '://') === FALSE) { if ($index_page === TRUE) { @@ -346,11 +326,11 @@ if ( ! function_exists('link_tag')) } } - $link .= "/>"; + $link .= '/>'; } else { - if ( strpos($href, '://') !== FALSE) + if (strpos($href, '://') !== FALSE) { $link .= 'href="'.$href.'" '; } @@ -365,21 +345,20 @@ if ( ! function_exists('link_tag')) $link .= 'rel="'.$rel.'" type="'.$type.'" '; - if ($media != '') + if ($media != '') { $link .= 'media="'.$media.'" '; } - if ($title != '') + if ($title != '') { $link .= 'title="'.$title.'" '; } $link .= '/>'; } - $link .= "\n"; - return $link; + return $link."\n"; } } @@ -439,10 +418,9 @@ if ( ! function_exists('nbs')) { function nbs($num = 1) { - return str_repeat(" ", $num); + return str_repeat(' ', $num); } } - /* End of file html_helper.php */ -/* Location: ./system/helpers/html_helper.php */ \ No newline at end of file +/* Location: ./system/helpers/html_helper.php */ diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php index f093dd921..0bd1e112f 100644 --- a/system/helpers/inflector_helper.php +++ b/system/helpers/inflector_helper.php @@ -1,4 +1,4 @@ - '\1', ); - foreach ($singular_rules as $rule => $replacement) - { - if (preg_match($rule, $result)) - { - $result = preg_replace($rule, $replacement, $result); - break; - } - } - - return $result; + return preg_replace(array_keys($singular_values), $singular_values, $result); } } @@ -138,16 +129,7 @@ if ( ! function_exists('plural')) '/$/' => 's', ); - foreach ($plural_rules as $rule => $replacement) - { - if (preg_match($rule, $result)) - { - $result = preg_replace($rule, $replacement, $result); - break; - } - } - - return $result; + return preg_replace(array_keys($plural_rules), $plural_rules, $result); } } @@ -166,9 +148,7 @@ if ( ! function_exists('camelize')) { function camelize($str) { - $str = 'x'.strtolower(trim($str)); - $str = ucwords(preg_replace('/[\s_]+/', ' ', $str)); - return substr(str_replace(' ', '', $str), 1); + return substr(str_replace(' ', '', ucwords(preg_replace('/[\s_]+/', ' ', $str))), 1); } } @@ -212,4 +192,4 @@ if ( ! function_exists('humanize')) } /* End of file inflector_helper.php */ -/* Location: ./system/helpers/inflector_helper.php */ \ No newline at end of file +/* Location: ./system/helpers/inflector_helper.php */ diff --git a/system/helpers/language_helper.php b/system/helpers/language_helper.php index ed17bfa4c..a83580a97 100644 --- a/system/helpers/language_helper.php +++ b/system/helpers/language_helper.php @@ -1,13 +1,13 @@ - Date: Fri, 6 Jan 2012 19:19:37 +0200 Subject: Improve number, path & security helpers --- system/helpers/number_helper.php | 9 ++++----- system/helpers/path_helper.php | 20 ++++++++------------ system/helpers/security_helper.php | 23 ++++++----------------- 3 files changed, 18 insertions(+), 34 deletions(-) diff --git a/system/helpers/number_helper.php b/system/helpers/number_helper.php index 71d39df1f..331b468c6 100644 --- a/system/helpers/number_helper.php +++ b/system/helpers/number_helper.php @@ -1,13 +1,13 @@ -#", "\\1", $str); - $str = preg_replace("##", "\\1", $str); - - return $str; + return preg_replace(array("##", "##"), "\\1", $str); } } @@ -135,6 +125,5 @@ if ( ! function_exists('encode_php_tags')) } } - /* End of file security_helper.php */ -/* Location: ./system/helpers/security_helper.php */ \ No newline at end of file +/* Location: ./system/helpers/security_helper.php */ -- cgit v1.2.3-24-g4f1b From 1a9f52c8ec021f6169b977ee936bb8cf2b972230 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 7 Jan 2012 01:06:34 +0200 Subject: Fixed a bug in CI_Image_lib::resize() --- system/libraries/Image_lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index c86224ffb..39f9887f1 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -392,7 +392,7 @@ class CI_Image_lib { */ public function resize() { - $protocol = (strtolower(substr($this->image_library, 0, -3)) === 'gd2') ? 'image_process_gd' : 'image_process_'.$this->image_library; + $protocol = ($this->image_library === 'gd2') ? 'image_process_gd' : 'image_process_'.$this->image_library; return $this->$protocol('resize'); } -- cgit v1.2.3-24-g4f1b From 5a67e3d09fe934af6f1bd75bb4e3dac87eb1361f Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 7 Jan 2012 01:21:09 +0200 Subject: Fix the same expression in crop() --- system/libraries/Image_lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index 39f9887f1..dc7d362ce 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -408,7 +408,7 @@ class CI_Image_lib { */ public function crop() { - $protocol = (strtolower(substr($this->image_library, 0, -3)) === 'gd2') ? 'image_process_gd' : 'image_process_'.$this->image_library; + $protocol = ($this->image_library === 'gd2') ? 'image_process_gd' : 'image_process_'.$this->image_library; return $this->$protocol('crop'); } -- cgit v1.2.3-24-g4f1b From debcc3676083eca34f89d00e6197e9892f77c0e2 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 7 Jan 2012 02:05:29 +0200 Subject: Improve typography, url & xml helpers --- system/helpers/typography_helper.php | 10 +-- system/helpers/url_helper.php | 130 ++++++++++++++++------------------- system/helpers/xml_helper.php | 26 ++++--- 3 files changed, 78 insertions(+), 88 deletions(-) mode change 100755 => 100644 system/helpers/url_helper.php diff --git a/system/helpers/typography_helper.php b/system/helpers/typography_helper.php index f81c46210..c49348e6a 100644 --- a/system/helpers/typography_helper.php +++ b/system/helpers/typography_helper.php @@ -1,13 +1,13 @@ -'.$title.''; + return ''.$title.''; } } @@ -278,19 +275,16 @@ if ( ! function_exists('safe_mailto')) { $title = (string) $title; - if ($title == "") + if ($title == '') { $title = $email; } - for ($i = 0; $i < 16; $i++) - { - $x[] = substr(' $val) { $x[] = ' '.$key.'="'; - for ($i = 0; $i < strlen($val); $i++) + for ($i = 0, $l = strlen($val); $i < $l; $i++) { - $x[] = "|".ord(substr($val, $i, 1)); + $x[] = '|'.ord($val[$i]); } $x[] = '"'; } } else { - for ($i = 0; $i < strlen($attributes); $i++) + for ($i = 0, $l = strlen($attributes); $i < $l; $i++) { - $x[] = substr($attributes, $i, 1); + $x[] = $attributes[$i]; } } } @@ -321,26 +315,28 @@ if ( ! function_exists('safe_mailto')) $x[] = '>'; $temp = array(); - for ($i = 0; $i < strlen($title); $i++) + for ($i = 0, $l = strlen($title); $i < $l; $i++) { $ordinal = ord($title[$i]); if ($ordinal < 128) { - $x[] = "|".$ordinal; + $x[] = '|'.$ordinal; } else { - if (count($temp) == 0) + if (count($temp) === 0) { $count = ($ordinal < 224) ? 2 : 3; } $temp[] = $ordinal; - if (count($temp) == $count) + if (count($temp) === $count) { - $number = ($count == 3) ? (($temp['0'] % 16) * 4096) + (($temp['1'] % 64) * 64) + ($temp['2'] % 64) : (($temp['0'] % 32) * 64) + ($temp['1'] % 64); - $x[] = "|".$number; + $number = ($count === 3) + ? (($temp[0] % 16) * 4096) + (($temp[1] % 64) * 64) + ($temp[2] % 64) + : (($temp[0] % 32) * 64) + ($temp[1] % 64); + $x[] = '|'.$number; $count = 1; $temp = array(); } @@ -356,8 +352,7 @@ if ( ! function_exists('safe_mailto')) //l[]=''; + for ($i = 0, $c = count($x); $i < $c; $i++) { ?>l[]=''; for (var i = l.length-1; i >= 0; i=i-1){ if (l[i].substring(0, 1) == '|') document.write("&#"+unescape(l[i].substring(1))+";"); @@ -391,49 +386,46 @@ if ( ! function_exists('auto_link')) { function auto_link($str, $type = 'both', $popup = FALSE) { - if ($type != 'email') + if ($type !== 'email' && preg_match_all('#(^|\s|\(|\b)((http(s?)://)|(www\.))(\w+[^\s\)\<]+)#i', $str, $matches)) { - if (preg_match_all("#(^|\s|\(|\b)((http(s?)://)|(www\.))(\w+[^\s\)\<]+)#i", $str, $matches)) - { - $pop = ($popup == TRUE) ? " target=\"_blank\" " : ""; + $pop = ($popup) ? ' target="_blank" ' : ''; - for ($i = 0; $i < count($matches['0']); $i++) + for ($i = 0, $c = count($matches[0]); $i < $c; $i++) + { + if (preg_match('|\.$|', $matches[6][$i])) + { + $period = '.'; + $matches[6][$i] = substr($matches[6][$i], 0, -1); + } + else { $period = ''; - if (preg_match("|\.$|", $matches['6'][$i])) - { - $period = '.'; - $matches['6'][$i] = substr($matches['6'][$i], 0, -1); - } - - $str = str_replace($matches['0'][$i], - $matches['1'][$i].'http'. - $matches['4'][$i].'://'. - $matches['5'][$i]. - $matches['6'][$i].''. - $period, $str); } + + $str = str_replace($matches[0][$i], + $matches[1][$i].'http' + .$matches[4][$i].'://'.$matches[5][$i] + .$matches[6][$i].''.$period, + $str); } } - if ($type != 'url') + if ($type !== 'url' && preg_match_all('/([a-zA-Z0-9_\.\-\+]+)@([a-zA-Z0-9\-]+)\.([a-zA-Z0-9\-\.]*)/i', $str, $matches)) { - if (preg_match_all("/([a-zA-Z0-9_\.\-\+]+)@([a-zA-Z0-9\-]+)\.([a-zA-Z0-9\-\.]*)/i", $str, $matches)) + for ($i = 0, $c = count($matches); $i < $c; $i++) { - for ($i = 0; $i < count($matches['0']); $i++) + if (preg_match('|\.$|', $matches[3][$i])) + { + $period = '.'; + $matches[3][$i] = substr($matches[3][$i], 0, -1); + } + else { $period = ''; - if (preg_match("|\.$|", $matches['3'][$i])) - { - $period = '.'; - $matches['3'][$i] = substr($matches['3'][$i], 0, -1); - } - - $str = str_replace($matches['0'][$i], safe_mailto($matches['1'][$i].'@'.$matches['2'][$i].'.'.$matches['3'][$i]).$period, $str); } + + $str = str_replace($matches[0][$i], safe_mailto($matches[1][$i].'@'.$matches[2][$i].'.'.$matches[3][$i]).$period, $str); } } @@ -456,7 +448,7 @@ if ( ! function_exists('prep_url')) { function prep_url($str = '') { - if ($str == 'http://' OR $str == '') + if ($str === 'http://' OR $str == '') { return ''; } @@ -465,7 +457,7 @@ if ( ! function_exists('prep_url')) if ( ! $url OR ! isset($url['scheme'])) { - $str = 'http://'.$str; + return 'http://'.$str; } return $str; @@ -490,7 +482,7 @@ if ( ! function_exists('url_title')) { function url_title($str, $separator = 'dash', $lowercase = FALSE) { - if ($separator == 'dash') + if ($separator === 'dash') { $search = '_'; $replace = '-'; @@ -513,10 +505,9 @@ if ( ! function_exists('url_title')) ); $str = strip_tags($str); - foreach ($trans as $key => $val) { - $str = preg_replace("#".$key."#i", $val, $str); + $str = preg_replace('#'.$key.'#i', $val, $str); } if ($lowercase === TRUE) @@ -552,16 +543,18 @@ if ( ! function_exists('redirect')) } // IIS environment likely? Use 'refresh' for better compatibility - if (DIRECTORY_SEPARATOR != '/' && $method == 'auto') + if (DIRECTORY_SEPARATOR !== '/' && $method === 'auto') { $method = 'refresh'; } switch($method) { - case 'refresh' : header("Refresh:0;url=".$uri); + case 'refresh': + header('Refresh:0;url='.$uri); break; - default : header("Location: ".$uri, TRUE, $http_response_code); + default: + header('Location: '.$uri, TRUE, $http_response_code); break; } exit; @@ -604,13 +597,12 @@ if ( ! function_exists('_parse_attributes')) if ($javascript == TRUE AND $att != '') { - $att = substr($att, 0, -1); + return substr($att, 0, -1); } return $att; } } - /* End of file url_helper.php */ -/* Location: ./system/helpers/url_helper.php */ \ No newline at end of file +/* Location: ./system/helpers/url_helper.php */ diff --git a/system/helpers/xml_helper.php b/system/helpers/xml_helper.php index b38dab479..5242193ac 100644 --- a/system/helpers/xml_helper.php +++ b/system/helpers/xml_helper.php @@ -1,13 +1,13 @@ -","\"", "'", "-"), - array("&", "<", ">", """, "'", "-"), - $str); + $str = str_replace(array('&', '<', '>', '"', "'", '-'), + array('&', '<', '>', '"', ''', '-'), + $str); // Decode the temp markers back to entities - $str = preg_replace("/$temp(\d+);/","&#\\1;",$str); + $str = preg_replace('/$temp(\d+);/', '&#\\1;', $str); - if ($protect_all === TRUE) + if ($protect_all == TRUE) { - $str = preg_replace("/$temp(\w+);/","&\\1;", $str); + return preg_replace("/$temp(\w+);/", '&\\1;', $str); } return $str; } } -// ------------------------------------------------------------------------ - /* End of file xml_helper.php */ -/* Location: ./system/helpers/xml_helper.php */ \ No newline at end of file +/* Location: ./system/helpers/xml_helper.php */ -- cgit v1.2.3-24-g4f1b From 2fbbfe34033dba5f362382818d0ae4c809ff6698 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 7 Jan 2012 18:37:15 +0200 Subject: Improve the Benchmark library --- system/core/Benchmark.php | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/system/core/Benchmark.php b/system/core/Benchmark.php index da246c9e0..f4dfd3dab 100755 --- a/system/core/Benchmark.php +++ b/system/core/Benchmark.php @@ -1,13 +1,13 @@ -marker[$name] = microtime(); } @@ -75,13 +74,12 @@ class CI_Benchmark { * execution time to be shown in a template. The output class will * swap the real value for this variable. * - * @access public * @param string a particular marked point * @param string a particular marked point * @param integer the number of decimal places * @return mixed */ - function elapsed_time($point1 = '', $point2 = '', $decimals = 4) + public function elapsed_time($point1 = '', $point2 = '', $decimals = 4) { if ($point1 == '') { @@ -114,17 +112,14 @@ class CI_Benchmark { * without the memory being calculated until the end. * The output class will swap the real value for this variable. * - * @access public * @return string */ - function memory_usage() + public function memory_usage() { return '{memory_usage}'; } } -// END CI_Benchmark class - /* End of file Benchmark.php */ -/* Location: ./system/core/Benchmark.php */ \ No newline at end of file +/* Location: ./system/core/Benchmark.php */ -- cgit v1.2.3-24-g4f1b From 9c5c24a582b32659c89f74fb5f773d06db23e426 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 7 Jan 2012 18:51:21 +0200 Subject: Improve core/CodeIgniter.php --- system/core/CodeIgniter.php | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php index 5152073d5..e3d818825 100755 --- a/system/core/CodeIgniter.php +++ b/system/core/CodeIgniter.php @@ -1,13 +1,13 @@ -_call_hook('cache_override') === FALSE) + if ($EXT->_call_hook('cache_override') === FALSE + AND $OUT->_display_cache($CFG, $URI) == TRUE) { - if ($OUT->_display_cache($CFG, $URI) == TRUE) - { - exit; - } + exit; } /* @@ -273,13 +267,13 @@ $method = $RTR->fetch_method(); if ( ! class_exists($class) - OR strncmp($method, '_', 1) == 0 + OR strpos($method, '_', 1) === 0 OR in_array(strtolower($method), array_map('strtolower', get_class_methods('CI_Controller'))) ) { if ( ! empty($RTR->routes['404_override'])) { - $x = explode('/', $RTR->routes['404_override']); + $x = explode('/', $RTR->routes['404_override'], 2); $class = $x[0]; $method = (isset($x[1]) ? $x[1] : 'index'); if ( ! class_exists($class)) @@ -341,7 +335,7 @@ // Check and see if we are using a 404 override and use it. if ( ! empty($RTR->routes['404_override'])) { - $x = explode('/', $RTR->routes['404_override']); + $x = explode('/', $RTR->routes['404_override'], 2); $class = $x[0]; $method = (isset($x[1]) ? $x[1] : 'index'); if ( ! class_exists($class)) @@ -367,7 +361,6 @@ call_user_func_array(array(&$CI, $method), array_slice($URI->rsegments, 2)); } - // Mark a benchmark end point $BM->mark('controller_execution_time_( '.$class.' / '.$method.' )_end'); @@ -405,6 +398,5 @@ $CI->db->close(); } - /* End of file CodeIgniter.php */ -/* Location: ./system/core/CodeIgniter.php */ \ No newline at end of file +/* Location: ./system/core/CodeIgniter.php */ -- cgit v1.2.3-24-g4f1b From 188abafcd3cc9b196755c0227eebc9a10f33d3a7 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 7 Jan 2012 19:09:42 +0200 Subject: Improve core/Common.php --- system/core/Common.php | 133 ++++++++++++++++++++++++------------------------- 1 file changed, 66 insertions(+), 67 deletions(-) diff --git a/system/core/Common.php b/system/core/Common.php index f42bb640c..abbe789e2 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -1,13 +1,13 @@ - 'OK', - 201 => 'Created', - 202 => 'Accepted', - 203 => 'Non-Authoritative Information', - 204 => 'No Content', - 205 => 'Reset Content', - 206 => 'Partial Content', - - 300 => 'Multiple Choices', - 301 => 'Moved Permanently', - 302 => 'Found', - 304 => 'Not Modified', - 305 => 'Use Proxy', - 307 => 'Temporary Redirect', - - 400 => 'Bad Request', - 401 => 'Unauthorized', - 403 => 'Forbidden', - 404 => 'Not Found', - 405 => 'Method Not Allowed', - 406 => 'Not Acceptable', - 407 => 'Proxy Authentication Required', - 408 => 'Request Timeout', - 409 => 'Conflict', - 410 => 'Gone', - 411 => 'Length Required', - 412 => 'Precondition Failed', - 413 => 'Request Entity Too Large', - 414 => 'Request-URI Too Long', - 415 => 'Unsupported Media Type', - 416 => 'Requested Range Not Satisfiable', - 417 => 'Expectation Failed', - 422 => 'Unprocessable Entity', - - 500 => 'Internal Server Error', - 501 => 'Not Implemented', - 502 => 'Bad Gateway', - 503 => 'Service Unavailable', - 504 => 'Gateway Timeout', - 505 => 'HTTP Version Not Supported' - ); + 200 => 'OK', + 201 => 'Created', + 202 => 'Accepted', + 203 => 'Non-Authoritative Information', + 204 => 'No Content', + 205 => 'Reset Content', + 206 => 'Partial Content', + + 300 => 'Multiple Choices', + 301 => 'Moved Permanently', + 302 => 'Found', + 304 => 'Not Modified', + 305 => 'Use Proxy', + 307 => 'Temporary Redirect', + + 400 => 'Bad Request', + 401 => 'Unauthorized', + 403 => 'Forbidden', + 404 => 'Not Found', + 405 => 'Method Not Allowed', + 406 => 'Not Acceptable', + 407 => 'Proxy Authentication Required', + 408 => 'Request Timeout', + 409 => 'Conflict', + 410 => 'Gone', + 411 => 'Length Required', + 412 => 'Precondition Failed', + 413 => 'Request Entity Too Large', + 414 => 'Request-URI Too Long', + 415 => 'Unsupported Media Type', + 416 => 'Requested Range Not Satisfiable', + 417 => 'Expectation Failed', + 422 => 'Unprocessable Entity', + + 500 => 'Internal Server Error', + 501 => 'Not Implemented', + 502 => 'Bad Gateway', + 503 => 'Service Unavailable', + 504 => 'Gateway Timeout', + 505 => 'HTTP Version Not Supported' + ); if ($code == '' OR ! is_numeric($code)) { @@ -441,12 +441,12 @@ if ( ! function_exists('set_status_header')) if ($text == '') { - show_error('No status text available. Please check your status code number or supply your own message text.', 500); + show_error('No status text available. Please check your status code number or supply your own message text.', 500); } $server_protocol = (isset($_SERVER['SERVER_PROTOCOL'])) ? $_SERVER['SERVER_PROTOCOL'] : FALSE; - if (substr(php_sapi_name(), 0, 3) == 'cgi') + if (strpos(php_sapi_name(), 'cgi') === 0) { header("Status: {$code} {$text}", TRUE); } @@ -527,16 +527,15 @@ if ( ! function_exists('remove_invisible_characters')) function remove_invisible_characters($str, $url_encoded = TRUE) { $non_displayables = array(); - - // every control character except newline (dec 10) - // carriage return (dec 13), and horizontal tab (dec 09) - + + // 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 @@ -574,4 +573,4 @@ if ( ! function_exists('html_escape')) } /* End of file Common.php */ -/* Location: ./system/core/Common.php */ \ No newline at end of file +/* Location: ./system/core/Common.php */ -- cgit v1.2.3-24-g4f1b From ccabcfd68919ecf146cd5f21079365afbffad000 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 7 Jan 2012 19:30:47 +0200 Subject: Improve the Config library --- system/core/Config.php | 114 +++++++++++++++++-------------------------------- 1 file changed, 40 insertions(+), 74 deletions(-) diff --git a/system/core/Config.php b/system/core/Config.php index 3e2635494..55da4e338 100755 --- a/system/core/Config.php +++ b/system/core/Config.php @@ -1,13 +1,13 @@ -config =& get_config(); log_message('debug', "Config Class Initialized"); @@ -81,10 +81,9 @@ class CI_Config { if (isset($_SERVER['HTTP_HOST'])) { $base_url = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off' ? 'https' : 'http'; - $base_url .= '://'. $_SERVER['HTTP_HOST']; - $base_url .= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']); + $base_url .= '://'. $_SERVER['HTTP_HOST'] + . str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']); } - else { $base_url = 'http://localhost/'; @@ -99,27 +98,25 @@ class CI_Config { /** * Load Config File * - * @access public * @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 + * @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 */ - function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE) + public function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE) { $file = ($file == '') ? 'config' : str_replace('.php', '', $file); - $found = FALSE; - $loaded = FALSE; + $found = $loaded = FALSE; foreach ($this->_config_paths as $path) { $check_locations = defined('ENVIRONMENT') - ? array(ENVIRONMENT.'/'.$file, $file) + ? array(ENVIRONMENT.DIRECTORY_SEPARATOR.$file, $file) : array($file); foreach ($check_locations as $location) { - $file_path = $path.'config/'.$location.'.php'; + $file_path = $path.'config'.DIRECTORY_SEPARATOR.$location.'.php'; if (in_array($file_path, $this->is_loaded, TRUE)) { @@ -192,39 +189,19 @@ class CI_Config { * Fetch a config file item * * - * @access public * @param string the config item name * @param string the index name * @param bool * @return string */ - function item($item, $index = '') + public function item($item, $index = '') { if ($index == '') { - if ( ! isset($this->config[$item])) - { - return FALSE; - } - - $pref = $this->config[$item]; - } - else - { - if ( ! isset($this->config[$index])) - { - return FALSE; - } - - if ( ! isset($this->config[$index][$item])) - { - return FALSE; - } - - $pref = $this->config[$index][$item]; + return isset($this->config[$item]) ? $this->config[$item] : FALSE; } - return $pref; + return isset($this->config[$index], $this->config[$index][$item]) ? $this->config[$index][$item] : FALSE; } // -------------------------------------------------------------------- @@ -232,18 +209,17 @@ class CI_Config { /** * Fetch a config file item - adds slash after item (if item is not empty) * - * @access public * @param string the config item name * @param bool * @return string */ - function slash_item($item) + public function slash_item($item) { if ( ! isset($this->config[$item])) { return FALSE; } - if( trim($this->config[$item]) == '') + elseif (trim($this->config[$item]) == '') { return ''; } @@ -257,11 +233,10 @@ class CI_Config { * Site URL * Returns base_url . index_page [. uri_string] * - * @access public * @param string the URI string * @return string */ - function site_url($uri = '') + public function site_url($uri = '') { if ($uri == '') { @@ -285,11 +260,10 @@ class CI_Config { * Base URL * Returns base_url [. uri_string] * - * @access public * @param string $uri * @return string */ - function base_url($uri = '') + public function base_url($uri = '') { return $this->slash_item('base_url').ltrim($this->_uri_string($uri),'/'); } @@ -299,8 +273,7 @@ class CI_Config { /** * Build URI string for use in Config::site_url() and Config::base_url() * - * @access protected - * @param $uri + * @param mixed $uri * @return string */ protected function _uri_string($uri) @@ -311,23 +284,21 @@ class CI_Config { { $uri = implode('/', $uri); } - $uri = trim($uri, '/'); + return trim($uri, '/'); } - else + elseif (is_array($uri)) { - if (is_array($uri)) + $i = 0; + $str = ''; + foreach ($uri as $key => $val) { - $i = 0; - $str = ''; - foreach ($uri as $key => $val) - { - $prefix = ($i == 0) ? '' : '&'; - $str .= $prefix.$key.'='.$val; - $i++; - } - $uri = $str; + $prefix = ($i === 0) ? '' : '&'; + $str .= $prefix.$key.'='.$val; + $i++; } + return $str; } + return $uri; } @@ -336,12 +307,11 @@ class CI_Config { /** * System URL * - * @access public * @return string */ - function system_url() + public function system_url() { - $x = explode("/", preg_replace("|/*(.+?)/*$|", "\\1", BASEPATH)); + $x = explode('/', preg_replace('|/*(.+?)/*$|', '\\1', BASEPATH)); return $this->slash_item('base_url').end($x).'/'; } @@ -350,12 +320,11 @@ class CI_Config { /** * Set a config file item * - * @access public * @param string the config item key * @param string the config item value * @return void */ - function set_item($item, $value) + public function set_item($item, $value) { $this->config[$item] = $value; } @@ -366,14 +335,13 @@ class CI_Config { * Assign to Config * * This function is called by the front controller (CodeIgniter.php) - * after the Config class is instantiated. It permits config items + * after the Config class is instantiated. It permits config items * to be assigned or overriden by variables contained in the index.php file * - * @access private * @param array * @return void */ - function _assign_to_config($items = array()) + public function _assign_to_config($items = array()) { if (is_array($items)) { @@ -385,7 +353,5 @@ class CI_Config { } } -// END CI_Config class - /* End of file Config.php */ /* Location: ./system/core/Config.php */ -- cgit v1.2.3-24-g4f1b From 7ac33d7a615f9b5e27fe92a0a91c4ebfb19faad3 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 7 Jan 2012 19:39:39 +0200 Subject: Improve core Controller & Exceptions libraries --- system/core/Controller.php | 16 +++------ system/core/Exceptions.php | 83 +++++++++++++++++++--------------------------- 2 files changed, 40 insertions(+), 59 deletions(-) diff --git a/system/core/Controller.php b/system/core/Controller.php index 55b3ec235..5ae0b0924 100644 --- a/system/core/Controller.php +++ b/system/core/Controller.php @@ -1,13 +1,13 @@ -load =& load_class('Loader', 'core'); - $this->load->initialize(); - log_message('debug', "Controller Class Initialized"); } @@ -70,7 +65,6 @@ class CI_Controller { return self::$instance; } } -// END Controller class /* End of file Controller.php */ -/* Location: ./system/core/Controller.php */ \ No newline at end of file +/* Location: ./system/core/Controller.php */ diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index 3737f2930..9b672ac54 100755 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -1,13 +1,13 @@ - 'Error', - E_WARNING => 'Warning', - E_PARSE => 'Parsing Error', - E_NOTICE => 'Notice', - E_CORE_ERROR => 'Core Error', - E_CORE_WARNING => 'Core Warning', - E_COMPILE_ERROR => 'Compile Error', - E_COMPILE_WARNING => 'Compile Warning', - E_USER_ERROR => 'User Error', - E_USER_WARNING => 'User Warning', - E_USER_NOTICE => 'User Notice', - E_STRICT => 'Runtime Notice' - ); + public $levels = array( + E_ERROR => 'Error', + E_WARNING => 'Warning', + E_PARSE => 'Parsing Error', + E_NOTICE => 'Notice', + E_CORE_ERROR => 'Core Error', + E_CORE_WARNING => 'Core Warning', + E_COMPILE_ERROR => 'Compile Error', + E_COMPILE_WARNING => 'Compile Warning', + E_USER_ERROR => 'User Error', + E_USER_WARNING => 'User Warning', + E_USER_NOTICE => 'User Notice', + E_STRICT => 'Runtime Notice' + ); - - /** - * Constructor - */ public function __construct() { $this->ob_level = ob_get_level(); - // Note: Do not log messages from this constructor. + // Note: Do not log messages from this constructor. } // -------------------------------------------------------------------- @@ -89,17 +84,15 @@ class CI_Exceptions { * * This function logs PHP generated error messages * - * @access private * @param string the error severity * @param string the error string * @param string the error filepath * @param string the error line number - * @return string + * @return void */ - function log_exception($severity, $message, $filepath, $line) + public function log_exception($severity, $message, $filepath, $line) { $severity = ( ! isset($this->levels[$severity])) ? $severity : $this->levels[$severity]; - log_message('error', 'Severity: '.$severity.' --> '.$message. ' '.$filepath.' '.$line, TRUE); } @@ -108,15 +101,14 @@ class CI_Exceptions { /** * 404 Page Not Found Handler * - * @access private * @param string the page * @param bool log error yes/no * @return string */ - function show_404($page = '', $log_error = TRUE) + public function show_404($page = '', $log_error = TRUE) { - $heading = "404 Page Not Found"; - $message = "The page you requested was not found."; + $heading = '404 Page Not Found'; + $message = 'The page you requested was not found.'; // By default we log this, but allow a dev to skip it if ($log_error) @@ -137,14 +129,13 @@ class CI_Exceptions { * (either as a string or an array) and displays * it using the specified template. * - * @access private * @param string the heading * @param string the message * @param string the template name * @param int the status code * @return string */ - function show_error($heading, $message, $template = 'error_general', $status_code = 500) + public function show_error($heading, $message, $template = 'error_general', $status_code = 500) { set_status_header($status_code); @@ -155,7 +146,7 @@ class CI_Exceptions { ob_end_flush(); } ob_start(); - include(APPPATH.'errors/'.$template.'.php'); + include(APPPATH.'errors'.DIRECTORY_SEPARATOR.$template.'.php'); $buffer = ob_get_contents(); ob_end_clean(); return $buffer; @@ -166,7 +157,6 @@ class CI_Exceptions { /** * Native PHP error handler * - * @access private * @param string the error severity * @param string the error string * @param string the error filepath @@ -176,8 +166,7 @@ class CI_Exceptions { function show_php_error($severity, $message, $filepath, $line) { $severity = ( ! isset($this->levels[$severity])) ? $severity : $this->levels[$severity]; - - $filepath = str_replace("\\", "/", $filepath); + $filepath = str_replace('\\', '/', $filepath); // For safety reasons we do not show the full file path if (FALSE !== strpos($filepath, '/')) @@ -191,15 +180,13 @@ class CI_Exceptions { ob_end_flush(); } ob_start(); - include(APPPATH.'errors/error_php.php'); + include(APPPATH.'errors'.DIRECTORY_SEPARATOR.'error_php.php'); $buffer = ob_get_contents(); ob_end_clean(); echo $buffer; } - } -// END Exceptions Class /* End of file Exceptions.php */ -/* Location: ./system/core/Exceptions.php */ \ No newline at end of file +/* Location: ./system/core/Exceptions.php */ -- cgit v1.2.3-24-g4f1b From 64e98aab6ba2c692a881035245efb94a76deb428 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 7 Jan 2012 20:29:10 +0200 Subject: Improve code Input & Model libraries --- system/core/Input.php | 97 ++++++++++++++++++--------------------------------- system/core/Model.php | 19 ++++------ 2 files changed, 39 insertions(+), 77 deletions(-) diff --git a/system/core/Input.php b/system/core/Input.php index 7cfa4c63f..07bb30b15 100755 --- a/system/core/Input.php +++ b/system/core/Input.php @@ -1,13 +1,13 @@ -_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); + $this->_enable_xss = (config_item('global_xss_filtering') === TRUE); + $this->_enable_csrf = (config_item('csrf_protection') === TRUE); global $SEC; $this->security =& $SEC; @@ -122,7 +122,6 @@ class CI_Input { * * This is a helper function to retrieve values from global arrays * - * @access protected * @param array * @param string * @param bool @@ -148,7 +147,6 @@ class CI_Input { /** * Fetch an item from the GET array * - * @access public * @param string * @param bool * @return string @@ -176,7 +174,6 @@ class CI_Input { /** * Fetch an item from the POST array * - * @access public * @param string * @param bool * @return string @@ -205,21 +202,15 @@ class CI_Input { /** * Fetch an item from either the GET array or the POST * - * @access public * @param string The index key * @param bool XSS cleaning * @return string */ public function get_post($index = '', $xss_clean = FALSE) { - if ( ! isset($_POST[$index]) ) - { - return $this->get($index, $xss_clean); - } - else - { - return $this->post($index, $xss_clean); - } + return ( ! isset($_POST[$index])) + ? $this->get($index, $xss_clean) + : $this->post($index, $xss_clean); } // -------------------------------------------------------------------- @@ -227,7 +218,6 @@ class CI_Input { /** * Fetch an item from the COOKIE array * - * @access public * @param string * @param bool * @return string @@ -245,7 +235,6 @@ class CI_Input { * Accepts six parameter, or you can submit an associative * array in the first parameter containing all the values. * - * @access public * @param mixed * @param string the value of the cookie * @param string the number of seconds until expiration @@ -303,7 +292,6 @@ class CI_Input { /** * Fetch an item from the SERVER array * - * @access public * @param string * @param bool * @return string @@ -318,7 +306,6 @@ class CI_Input { /** * Fetch the IP Address * - * @access public * @return string */ public function ip_address() @@ -335,7 +322,7 @@ class CI_Input { $this->ip_address = in_array($_SERVER['REMOTE_ADDR'], $proxies) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; } - elseif (! $this->server('HTTP_CLIENT_IP') AND $this->server('REMOTE_ADDR')) + elseif ( ! $this->server('HTTP_CLIENT_IP') AND $this->server('REMOTE_ADDR')) { $this->ip_address = $_SERVER['REMOTE_ADDR']; } @@ -354,8 +341,7 @@ class CI_Input { if ($this->ip_address === FALSE) { - $this->ip_address = '0.0.0.0'; - return $this->ip_address; + return $this->ip_address = '0.0.0.0'; } if (strpos($this->ip_address, ',') !== FALSE) @@ -366,7 +352,7 @@ class CI_Input { if ( ! $this->valid_ip($this->ip_address)) { - $this->ip_address = '0.0.0.0'; + return $this->ip_address = '0.0.0.0'; } return $this->ip_address; @@ -379,7 +365,6 @@ class CI_Input { * * Updated version suggested by Geert De Deckere * - * @access public * @param string * @return bool */ @@ -394,7 +379,7 @@ class CI_Input { $ip_segments = explode('.', $ip); // Always 4 segments needed - if (count($ip_segments) != 4) + if (count($ip_segments) !== 4) { return FALSE; } @@ -422,7 +407,6 @@ class CI_Input { /** * User Agent * - * @access public * @return string */ public function user_agent() @@ -432,9 +416,7 @@ class CI_Input { return $this->user_agent; } - $this->user_agent = ( ! isset($_SERVER['HTTP_USER_AGENT'])) ? FALSE : $_SERVER['HTTP_USER_AGENT']; - - return $this->user_agent; + return $this->user_agent = ( ! isset($_SERVER['HTTP_USER_AGENT'])) ? FALSE : $_SERVER['HTTP_USER_AGENT']; } // -------------------------------------------------------------------- @@ -444,22 +426,20 @@ class CI_Input { * * This function does the following: * - * Unsets $_GET data (if query strings are not enabled) - * - * Unsets all globals if register_globals is enabled + * - Unsets $_GET data (if query strings are not enabled) + * - Unsets all globals if register_globals is enabled + * - Standardizes newline characters to \n * - * Standardizes newline characters to \n - * - * @access private * @return void */ private function _sanitize_globals() { // It would be "wrong" to unset any of these GLOBALS. $protected = array('_SERVER', '_GET', '_POST', '_FILES', '_REQUEST', - '_SESSION', '_ENV', 'GLOBALS', 'HTTP_RAW_POST_DATA', - 'system_folder', 'application_folder', 'BM', 'EXT', - 'CFG', 'URI', 'RTR', 'OUT', 'IN'); + '_SESSION', '_ENV', 'GLOBALS', 'HTTP_RAW_POST_DATA', + 'system_folder', 'application_folder', 'BM', 'EXT', + 'CFG', 'URI', 'RTR', 'OUT', 'IN' + ); // Unset globals for securiy. // This is effectively the same as register_globals = off @@ -532,7 +512,6 @@ class CI_Input { // Sanitize PHP_SELF $_SERVER['PHP_SELF'] = strip_tags($_SERVER['PHP_SELF']); - // CSRF Protection check if ($this->_enable_csrf == TRUE) { @@ -550,7 +529,6 @@ class CI_Input { * This is a helper function. It escapes data and * standardizes newline characters to \n * - * @access private * @param string * @return string */ @@ -592,12 +570,9 @@ class CI_Input { } // Standardize newlines if needed - if ($this->_standardize_newlines == TRUE) + if ($this->_standardize_newlines == TRUE AND strpos($str, "\r") !== FALSE) { - if (strpos($str, "\r") !== FALSE) - { - $str = str_replace(array("\r\n", "\r", "\r\n\n"), PHP_EOL, $str); - } + return str_replace(array("\r\n", "\r", "\r\n\n"), PHP_EOL, $str); } return $str; @@ -612,13 +587,12 @@ class CI_Input { * from trying to exploit keys we make sure that keys are * only named with alpha-numeric text and a few other items. * - * @access private * @param string * @return string */ private function _clean_input_keys($str) { - if ( ! preg_match("/^[a-z0-9:_\/-]+$/i", $str)) + if ( ! preg_match('/^[a-z0-9:_\/-]+$/i', $str)) { exit('Disallowed Key Characters.'); } @@ -626,7 +600,7 @@ class CI_Input { // Clean UTF-8 if supported if (UTF8_ENABLED === TRUE) { - $str = $this->uni->clean_string($str); + return $this->uni->clean_string($str); } return $str; @@ -640,10 +614,8 @@ class CI_Input { * In Apache, you can simply call apache_request_headers(), however for * people running other webservers the function is undefined. * - * @access public * @param bool XSS cleaning - * - * @return array + * @return array */ public function request_headers($xss_clean = FALSE) { @@ -658,7 +630,7 @@ class CI_Input { foreach ($_SERVER as $key => $val) { - if (strncmp($key, 'HTTP_', 5) === 0) + if (strpos($key, 'HTTP_') === 0) { $headers[substr($key, 5)] = $this->_fetch_from_array($_SERVER, $key, $xss_clean); } @@ -684,7 +656,6 @@ class CI_Input { * * Returns the value of a single member of the headers class member * - * @access public * @param string array key for $this->headers * @param boolean XSS Clean or not * @return mixed FALSE on failure, string on success @@ -716,7 +687,6 @@ class CI_Input { * * Test to see if a request contains the HTTP_X_REQUESTED_WITH header * - * @access public * @return boolean */ public function is_ajax_request() @@ -731,12 +701,11 @@ class CI_Input { * * Test to see if a request was made from the command line * - * @access public * @return boolean */ public function is_cli_request() { - return (php_sapi_name() == 'cli') or defined('STDIN'); + return (php_sapi_name() === 'cli') or defined('STDIN'); } } diff --git a/system/core/Model.php b/system/core/Model.php index fc640139a..cd64468b8 100755 --- a/system/core/Model.php +++ b/system/core/Model.php @@ -1,13 +1,13 @@ -$key; } } -// END Model Class /* End of file Model.php */ -/* Location: ./system/core/Model.php */ \ No newline at end of file +/* Location: ./system/core/Model.php */ -- cgit v1.2.3-24-g4f1b From 1f5fbb6cb35f5d234f9f2c95f730b13a9015f3c2 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 7 Jan 2012 20:53:29 +0200 Subject: Improve the core Output library --- system/core/Output.php | 150 +++++++++++++++---------------------------------- 1 file changed, 46 insertions(+), 104 deletions(-) diff --git a/system/core/Output.php b/system/core/Output.php index e529f914d..272545046 100755 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -1,13 +1,13 @@ -_zlib_oc = @ini_get('zlib.output_compression'); @@ -117,8 +105,7 @@ class CI_Output { $this->mime_types = $mimes; - - log_message('debug', "Output Class Initialized"); + log_message('debug', 'Output Class Initialized'); } // -------------------------------------------------------------------- @@ -128,10 +115,9 @@ class CI_Output { * * Returns the current output string * - * @access public * @return string */ - function get_output() + public function get_output() { return $this->final_output; } @@ -147,10 +133,9 @@ class CI_Output { * @param string * @return void */ - function set_output($output) + public function set_output($output) { $this->final_output = $output; - return $this; } @@ -161,11 +146,10 @@ class CI_Output { * * Appends data onto the output string * - * @access public * @param string * @return void */ - function append_output($output) + public function append_output($output) { if ($this->final_output == '') { @@ -189,25 +173,22 @@ class CI_Output { * 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... * - * @access public * @param string * @param bool * @return void */ - function set_header($header, $replace = TRUE) + public function set_header($header, $replace = TRUE) { // If zlib.output_compression is enabled it will compress the 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) { return; } $this->headers[] = array($header, $replace); - return $this; } @@ -216,11 +197,10 @@ class CI_Output { /** * Set Content Type Header * - * @access public * @param string extension of the file we're outputting * @return void */ - function set_content_type($mime_type) + public function set_content_type($mime_type) { if (strpos($mime_type, '/') === FALSE) { @@ -241,7 +221,6 @@ class CI_Output { $header = 'Content-Type: '.$mime_type; $this->headers[] = array($header, TRUE); - return $this; } @@ -251,15 +230,13 @@ class CI_Output { * Set HTTP Status Header * moved to Common procedural functions in 1.7.2 * - * @access public * @param int the status code * @param string * @return void */ - function set_status_header($code = 200, $text = '') + public function set_status_header($code = 200, $text = '') { set_status_header($code, $text); - return $this; } @@ -268,14 +245,12 @@ class CI_Output { /** * Enable/disable Profiler * - * @access public * @param bool * @return void */ - function enable_profiler($val = TRUE) + public function enable_profiler($val = TRUE) { $this->enable_profiler = (is_bool($val)) ? $val : TRUE; - return $this; } @@ -286,11 +261,10 @@ class CI_Output { * * Allows override of default / config settings for Profiler section display * - * @access public * @param array * @return void */ - function set_profiler_sections($sections) + public function set_profiler_sections($sections) { foreach ($sections as $section => $enable) { @@ -305,14 +279,12 @@ class CI_Output { /** * Set Cache * - * @access public * @param integer * @return void */ - function cache($time) + publi function cache($time) { $this->cache_expiration = ( ! is_numeric($time)) ? 0 : $time; - return $this; } @@ -329,11 +301,10 @@ class CI_Output { * with any server headers and profile data. It also stops the * benchmark timer so the page rendering speed and memory usage can be shown. * - * @access public * @param string * @return mixed */ - function _display($output = '') + public function _display($output = '') { // Note: We use globals because we can't use $CI =& get_instance() // since this function is sometimes called by the caching mechanism, @@ -375,22 +346,17 @@ class CI_Output { { $memory = ( ! function_exists('memory_get_usage')) ? '0' : round(memory_get_usage()/1024/1024, 2).'MB'; - $output = str_replace('{elapsed_time}', $elapsed, $output); - $output = str_replace('{memory_usage}', $memory, $output); + $output = str_replace(array('{elapsed_time}', '{memory_usage}'), array($elapsed, $memory), $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) { - if (extension_loaded('zlib')) - { - if (isset($_SERVER['HTTP_ACCEPT_ENCODING']) AND strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== FALSE) - { - ob_start('ob_gzhandler'); - } - } + ob_start('ob_gzhandler'); } // -------------------------------------------------------------------- @@ -412,8 +378,8 @@ class CI_Output { if ( ! isset($CI)) { echo $output; - log_message('debug', "Final output sent to browser"); - log_message('debug', "Total execution time: ".$elapsed); + log_message('debug', 'Final output sent to browser'); + log_message('debug', 'Total execution time: '.$elapsed); return TRUE; } @@ -424,7 +390,6 @@ class CI_Output { if ($this->enable_profiler == TRUE) { $CI->load->library('profiler'); - if ( ! empty($this->_profiler_sections)) { $CI->profiler->set_sections($this->_profiler_sections); @@ -432,16 +397,11 @@ class CI_Output { // If the output data contains closing and tags // we will remove them and add them back after we insert the profile data - if (preg_match("|.*?|is", $output)) + $output = preg_replace('|.*?|is', '', $output, $count).$CI->profiler->run(); + if ($count > 0) { - $output = preg_replace("|.*?|is", '', $output); - $output .= $CI->profiler->run(); $output .= ''; } - else - { - $output .= $CI->profiler->run(); - } } // -------------------------------------------------------------------- @@ -457,8 +417,8 @@ class CI_Output { echo $output; // Send it to the browser! } - log_message('debug', "Final output sent to browser"); - log_message('debug', "Total execution time: ".$elapsed); + log_message('debug', 'Final output sent to browser'); + log_message('debug', 'Total execution time: '.$elapsed); } // -------------------------------------------------------------------- @@ -466,20 +426,18 @@ class CI_Output { /** * Write a Cache File * - * @access public * @param string * @return void */ - function _write_cache($output) + public function _write_cache($output) { $CI =& get_instance(); $path = $CI->config->item('cache_path'); - $cache_path = ($path == '') ? APPPATH.'cache/' : $path; if ( ! is_dir($cache_path) OR ! is_really_writable($cache_path)) { - log_message('error', "Unable to write cache file: ".$cache_path); + log_message('error', 'Unable to write cache file: '.$cache_path); return; } @@ -491,7 +449,7 @@ class CI_Output { if ( ! $fp = @fopen($cache_path, FOPEN_WRITE_CREATE_DESTRUCTIVE)) { - log_message('error', "Unable to write cache file: ".$cache_path); + log_message('error', 'Unable to write cache file: '.$cache_path); return; } @@ -504,13 +462,13 @@ class CI_Output { } else { - log_message('error', "Unable to secure a file lock for file at: ".$cache_path); + log_message('error', 'Unable to secure a file lock for file at: '.$cache_path); return; } fclose($fp); @chmod($cache_path, FILE_WRITE_MODE); - log_message('debug', "Cache file written: ".$cache_path); + log_message('debug', 'Cache file written: '.$cache_path); } // -------------------------------------------------------------------- @@ -518,69 +476,53 @@ class CI_Output { /** * Update/serve a cached file * - * @access public * @param object config class * @param object uri class * @return void */ - function _display_cache(&$CFG, &$URI) + public function _display_cache(&$CFG, &$URI) { $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; - + // 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; $filepath = $cache_path.md5($uri); - if ( ! @file_exists($filepath)) - { - return FALSE; - } - - if ( ! $fp = @fopen($filepath, FOPEN_READ)) + if ( ! @file_exists($filepath) + OR ! $fp = @fopen($filepath, FOPEN_READ)) { return FALSE; } flock($fp, LOCK_SH); - $cache = ''; - if (filesize($filepath) > 0) - { - $cache = fread($fp, filesize($filepath)); - } + $cache = (filesize($filepath) > 0) ? fread($fp, filesize($filepath)) : ''; flock($fp, LOCK_UN); fclose($fp); // Strip out the embedded timestamp - if ( ! preg_match("/(\d+TS--->)/", $cache, $match)) + if ( ! preg_match('/(\d+TS--->)/', $cache, $match)) { return FALSE; } // Has the file expired? If so we'll delete it. - if (time() >= trim(str_replace('TS--->', '', $match['1']))) + if (time() >= trim(str_replace('TS--->', '', $match[1])) + AND is_really_writable($cache_path)) { - if (is_really_writable($cache_path)) - { - @unlink($filepath); - log_message('debug', "Cache file has expired. File deleted"); - return FALSE; - } + @unlink($filepath); + log_message('debug', 'Cache file has expired. File deleted.'); + return FALSE; } // Display the cache - $this->_display(str_replace($match['0'], '', $cache)); - log_message('debug', "Cache file is current. Sending it to browser."); + $this->_display(str_replace($match[0], '', $cache)); + log_message('debug', 'Cache file is current. Sending it to browser.'); return TRUE; } - } -// END Output Class /* End of file Output.php */ -/* Location: ./system/core/Output.php */ \ No newline at end of file +/* Location: ./system/core/Output.php */ -- cgit v1.2.3-24-g4f1b From ba6c04113313d49618b00c434fd5eedc6ab8a653 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 7 Jan 2012 21:10:09 +0200 Subject: Improve the core Router library --- system/core/Router.php | 107 +++++++++++++++++-------------------------------- 1 file changed, 37 insertions(+), 70 deletions(-) diff --git a/system/core/Router.php b/system/core/Router.php index 8cad86888..d21319565 100755 --- a/system/core/Router.php +++ b/system/core/Router.php @@ -1,13 +1,13 @@ -config =& load_class('Config', 'core'); $this->uri =& load_class('URI', 'core'); - log_message('debug', "Router Class Initialized"); + log_message('debug', 'Router Class Initialized'); } // -------------------------------------------------------------------- @@ -110,12 +103,11 @@ class CI_Router { * This function determines what should be served based on the URI request, * as well as any "routes" that have been set in the routing config file. * - * @access private * @return void */ - function _set_routing() + public function _set_routing() { - // Are query strings enabled in the config file? Normally CI doesn't utilize query strings + // Are query strings enabled in the config file? Normally CI doesn't utilize query strings // since URI segments are more search-engine friendly, but they can optionally be used. // If this feature is enabled, we will gather the directory/class/method a little differently $segments = array(); @@ -157,7 +149,7 @@ class CI_Router { // the URI doesn't correlated to a valid controller. $this->default_controller = ( ! isset($this->routes['default_controller']) OR $this->routes['default_controller'] == '') ? FALSE : strtolower($this->routes['default_controller']); - // Were there any query string segments? If so, we'll validate them and bail out since we're done. + // Were there any query string segments? If so, we'll validate them and bail out since we're done. if (count($segments) > 0) { return $this->_validate_request($segments); @@ -172,17 +164,10 @@ class CI_Router { return $this->_set_default_controller(); } - // Do we need to remove the URL suffix? - $this->uri->_remove_url_suffix(); - - // Compile the segments into an array - $this->uri->_explode_segments(); - - // Parse any custom routing that may exist - $this->_parse_routes(); - - // Re-index the segment array so that it starts with 1 rather than 0 - $this->uri->_reindex_segments(); + $this->uri->_remove_url_suffix(); // Remove the URL suffix + $this->uri->_explode_segments(); // Compile the segments into an array + $this->_parse_routes(); // Parse any custom routing that may exist + $this->uri->_reindex_segments(); // Re-index the segment array so that it starts with 1 rather than 0 } // -------------------------------------------------------------------- @@ -190,20 +175,18 @@ class CI_Router { /** * Set the default controller * - * @access private * @return void */ - function _set_default_controller() + protected function _set_default_controller() { if ($this->default_controller === FALSE) { - show_error("Unable to determine what should be displayed. A default route has not been specified in the routing file."); + show_error('Unable to determine what should be displayed. A default route has not been specified in the routing file.'); } // Is the method being specified? if (strpos($this->default_controller, '/') !== FALSE) { $x = explode('/', $this->default_controller); - $this->set_class($x[0]); $this->set_method($x[1]); $this->_set_request($x); @@ -218,7 +201,7 @@ class CI_Router { // re-index the routed segments array so it starts with 1 rather than 0 $this->uri->_reindex_segments(); - log_message('debug', "No URI present. Default controller set."); + log_message('debug', 'No URI present. Default controller set.'); } // -------------------------------------------------------------------- @@ -229,16 +212,15 @@ class CI_Router { * This function takes an array of URI segments as * input, and sets the current class/method * - * @access private * @param array * @param bool * @return void */ - function _set_request($segments = array()) + protected function _set_request($segments = array()) { $segments = $this->_validate_request($segments); - if (count($segments) == 0) + if (count($segments) === 0) { return $this->_set_default_controller(); } @@ -269,13 +251,12 @@ class CI_Router { * Validates the supplied segments. Attempts to determine the path to * the controller. * - * @access private * @param array * @return array */ - function _validate_request($segments) + protected function _validate_request($segments) { - if (count($segments) == 0) + if (count($segments) === 0) { return $segments; } @@ -301,7 +282,6 @@ class CI_Router { if ( ! empty($this->routes['404_override'])) { $x = explode('/', $this->routes['404_override']); - $this->set_directory(''); $this->set_class($x[0]); $this->set_method(isset($x[1]) ? $x[1] : 'index'); @@ -320,7 +300,6 @@ class CI_Router { if (strpos($this->default_controller, '/') !== FALSE) { $x = explode('/', $this->default_controller); - $this->set_class($x[0]); $this->set_method($x[1]); } @@ -344,18 +323,16 @@ class CI_Router { // If we've gotten this far it means that the URI does not correlate to a valid - // controller class. We will now see if there is an override + // controller class. We will now see if there is an override if ( ! empty($this->routes['404_override'])) { $x = explode('/', $this->routes['404_override']); - $this->set_class($x[0]); $this->set_method(isset($x[1]) ? $x[1] : 'index'); return $x; } - // Nothing else to do at this point but show a 404 show_404($segments[0]); } @@ -369,10 +346,9 @@ class CI_Router { * the config/routes.php file against the URI to * determine if the class/method need to be remapped. * - * @access private * @return void */ - function _parse_routes() + protected function _parse_routes() { // Turn the segment array into a URI string $uri = implode('/', $this->uri->segments); @@ -387,7 +363,7 @@ class CI_Router { foreach ($this->routes as $key => $val) { // Convert wild-cards to RegEx - $key = str_replace(':any', '.+', str_replace(':num', '[0-9]+', $key)); + $key = str_replace(array(':any', ':num'), array('.+', '[0-9]+'), $key); // Does the RegEx match? if (preg_match('#^'.$key.'$#', $uri)) @@ -412,11 +388,10 @@ class CI_Router { /** * Set the class name * - * @access public * @param string * @return void */ - function set_class($class) + public function set_class($class) { $this->class = str_replace(array('/', '.'), '', $class); } @@ -426,10 +401,9 @@ class CI_Router { /** * Fetch the current class * - * @access public * @return string */ - function fetch_class() + public function fetch_class() { return $this->class; } @@ -439,11 +413,10 @@ class CI_Router { /** * Set the method name * - * @access public * @param string * @return void */ - function set_method($method) + public function set_method($method) { $this->method = $method; } @@ -453,10 +426,9 @@ class CI_Router { /** * Fetch the current method * - * @access public * @return string */ - function fetch_method() + public function fetch_method() { if ($this->method == $this->fetch_class()) { @@ -471,11 +443,10 @@ class CI_Router { /** * Set the directory name * - * @access public * @param string * @return void */ - function set_directory($dir) + public function set_directory($dir) { $this->directory = str_replace(array('/', '.'), '', $dir).'/'; } @@ -485,10 +456,9 @@ class CI_Router { /** * Fetch the sub-directory (if any) that contains the requested controller class * - * @access public * @return string */ - function fetch_directory() + public function fetch_directory() { return $this->directory; } @@ -498,11 +468,10 @@ class CI_Router { /** * Set the controller overrides * - * @access public * @param array * @return null */ - function _set_overrides($routing) + public function _set_overrides($routing) { if ( ! is_array($routing)) { @@ -526,9 +495,7 @@ class CI_Router { } } - } -// END Router Class /* End of file Router.php */ -/* Location: ./system/core/Router.php */ \ No newline at end of file +/* Location: ./system/core/Router.php */ -- cgit v1.2.3-24-g4f1b From fdc63828a876e87742380a4ae077e43f514320b8 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 7 Jan 2012 21:17:46 +0200 Subject: Revert DIRECTORY_SEPARATOR changes --- system/core/Controller.php | 2 +- system/core/Exceptions.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/system/core/Controller.php b/system/core/Controller.php index 5ae0b0924..0dc131701 100644 --- a/system/core/Controller.php +++ b/system/core/Controller.php @@ -57,7 +57,7 @@ class CI_Controller { $this->load =& load_class('Loader', 'core'); $this->load->initialize(); - log_message('debug', "Controller Class Initialized"); + log_message('debug', 'Controller Class Initialized'); } public static function &get_instance() diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index 9b672ac54..bf9901252 100755 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -146,7 +146,7 @@ class CI_Exceptions { ob_end_flush(); } ob_start(); - include(APPPATH.'errors'.DIRECTORY_SEPARATOR.$template.'.php'); + include(APPPATH.'errors/'.$template.'.php'); $buffer = ob_get_contents(); ob_end_clean(); return $buffer; @@ -180,7 +180,7 @@ class CI_Exceptions { ob_end_flush(); } ob_start(); - include(APPPATH.'errors'.DIRECTORY_SEPARATOR.'error_php.php'); + include(APPPATH.'errors/'.'error_php.php'); $buffer = ob_get_contents(); ob_end_clean(); echo $buffer; -- cgit v1.2.3-24-g4f1b From d52b242545376db2eb8146f16125819a391db763 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 7 Jan 2012 21:28:32 +0200 Subject: Reverted DIRECTORY_SEPARATOR changes --- system/core/Config.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/system/core/Config.php b/system/core/Config.php index 55da4e338..66369115a 100755 --- a/system/core/Config.php +++ b/system/core/Config.php @@ -73,7 +73,7 @@ class CI_Config { public function __construct() { $this->config =& get_config(); - log_message('debug', "Config Class Initialized"); + log_message('debug', 'Config Class Initialized'); // Set the base_url automatically if none was provided if ($this->config['base_url'] == '') @@ -111,12 +111,12 @@ class CI_Config { foreach ($this->_config_paths as $path) { $check_locations = defined('ENVIRONMENT') - ? array(ENVIRONMENT.DIRECTORY_SEPARATOR.$file, $file) + ? array(ENVIRONMENT.'/'.$file, $file) : array($file); foreach ($check_locations as $location) { - $file_path = $path.'config'.DIRECTORY_SEPARATOR.$location.'.php'; + $file_path = $path.'config/'.$location.'.php'; if (in_array($file_path, $this->is_loaded, TRUE)) { -- cgit v1.2.3-24-g4f1b From 536b771cfe2f459890c2c0865fd08411df352318 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 7 Jan 2012 21:31:25 +0200 Subject: Reverted DIRECTORY_SEPARATOR changes --- system/core/Common.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/system/core/Common.php b/system/core/Common.php index abbe789e2..6ef229629 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -94,7 +94,7 @@ if ( ! function_exists('is_really_writable')) */ if (is_dir($file)) { - $file = rtrim($file, '/\\').DIRECTORY_SEPARATOR.md5(mt_rand(1,100).mt_rand(1,100)); + $file = rtrim($file, '/').'/'.md5(mt_rand(1,100).mt_rand(1,100)); if (($fp = @fopen($file, FOPEN_WRITE_CREATE)) === FALSE) { return FALSE; @@ -148,13 +148,13 @@ if ( ! function_exists('load_class')) // then in the native system/libraries folder foreach (array(APPPATH, BASEPATH) as $path) { - if (file_exists($path.$directory.DIRECTORY_SEPARATOR.$class.'.php')) + if (file_exists($path.$directory.'/'.$class.'.php')) { $name = $prefix.$class; if (class_exists($name) === FALSE) { - require($path.$directory.DIRECTORY_SEPARATOR.$class.'.php'); + require($path.$directory.'/'.$class.'.php'); } break; @@ -162,13 +162,13 @@ if ( ! function_exists('load_class')) } // Is the request a class extension? If so we load it too - if (file_exists(APPPATH.$directory.DIRECTORY_SEPARATOR.config_item('subclass_prefix').$class.'.php')) + if (file_exists(APPPATH.$directory.'/'.config_item('subclass_prefix').$class.'.php')) { $name = config_item('subclass_prefix').$class; if (class_exists($name) === FALSE) { - require(APPPATH.$directory.DIRECTORY_SEPARATOR.config_item('subclass_prefix').$class.'.php'); + require(APPPATH.$directory.'/'.config_item('subclass_prefix').$class.'.php'); } } @@ -235,9 +235,9 @@ if ( ! function_exists('get_config')) } // Is the config file in the environment folder? - if ( ! defined('ENVIRONMENT') OR ! file_exists($file_path = APPPATH.'config'.DIRECTORY_SEPARATOR.ENVIRONMENT.DIRECTORY_SEPARATOR.'config.php')) + if ( ! defined('ENVIRONMENT') OR ! file_exists($file_path = APPPATH.'config/'.ENVIRONMENT..'/config.php')) { - $file_path = APPPATH.'config'.DIRECTORY_SEPARATOR.'config.php'; + $file_path = APPPATH.'config/config.php'; } // Fetch the config file -- cgit v1.2.3-24-g4f1b From 88d03c48d5a11f3419feb2409a76bf0591575fd2 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 7 Jan 2012 21:59:00 +0200 Subject: Switch quotes --- system/core/Model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/core/Model.php b/system/core/Model.php index cd64468b8..a595a6ae2 100755 --- a/system/core/Model.php +++ b/system/core/Model.php @@ -40,7 +40,7 @@ class CI_Model { public function __construct() { - log_message('debug', "Model Class Initialized"); + log_message('debug', 'Model Class Initialized'); } /** -- cgit v1.2.3-24-g4f1b From f9938a2cf9af2341b1f44e6c465852405fc15897 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 7 Jan 2012 22:10:47 +0200 Subject: Improve core Hooks & Lang libraries --- system/core/Hooks.php | 41 ++++++++++++++--------------------------- system/core/Lang.php | 26 +++++++++----------------- 2 files changed, 23 insertions(+), 44 deletions(-) diff --git a/system/core/Hooks.php b/system/core/Hooks.php index 174adcb19..e1ac58e6e 100755 --- a/system/core/Hooks.php +++ b/system/core/Hooks.php @@ -1,13 +1,13 @@ -_initialize(); - log_message('debug', "Hooks Class Initialized"); + log_message('debug', 'Hooks Class Initialized'); } // -------------------------------------------------------------------- @@ -74,24 +70,20 @@ class CI_Hooks { /** * Initialize the Hooks Preferences * - * @access private * @return void */ - function _initialize() + private function _initialize() { $CFG =& load_class('Config', 'core'); // If hooks are not enabled in the config file // there is nothing else to do - if ($CFG->item('enable_hooks') == FALSE) { return; } // Grab the "hooks" definition file. - // If there are no hooks, we're done. - if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/hooks.php')) { include(APPPATH.'config/'.ENVIRONMENT.'/hooks.php'); @@ -101,7 +93,7 @@ class CI_Hooks { include(APPPATH.'config/hooks.php'); } - + // If there are no hooks, we're done. if ( ! isset($hook) OR ! is_array($hook)) { return; @@ -116,13 +108,12 @@ class CI_Hooks { /** * Call Hook * - * Calls a particular hook + * Calls a particular hook. Called by CodeIgniter.php. * - * @access private * @param string the hook name * @return mixed */ - function _call_hook($which = '') + public function _call_hook($which = '') { if ( ! $this->enabled OR ! isset($this->hooks[$which])) { @@ -151,11 +142,10 @@ class CI_Hooks { * * Runs a particular hook * - * @access private * @param array the hook details * @return bool */ - function _run_hook($data) + protected function _run_hook($data) { if ( ! is_array($data)) { @@ -168,7 +158,6 @@ 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) { return; @@ -254,7 +243,5 @@ class CI_Hooks { } -// END CI_Hooks class - /* End of file Hooks.php */ -/* Location: ./system/core/Hooks.php */ \ No newline at end of file +/* Location: ./system/core/Hooks.php */ diff --git a/system/core/Lang.php b/system/core/Lang.php index 5eb2801f6..088cb6c9c 100755 --- a/system/core/Lang.php +++ b/system/core/Lang.php @@ -1,13 +1,13 @@ -language[$line])) ? FALSE : $this->language[$line]; @@ -166,7 +159,6 @@ class CI_Lang { } } -// END Language Class /* End of file Lang.php */ /* Location: ./system/core/Lang.php */ -- cgit v1.2.3-24-g4f1b From d72973519623f40f121e9cd2df93146ee2543a1f Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 7 Jan 2012 22:53:14 +0200 Subject: Improve the core Loader library --- system/core/Loader.php | 90 +++++++++++++++++++++----------------------------- 1 file changed, 37 insertions(+), 53 deletions(-) diff --git a/system/core/Loader.php b/system/core/Loader.php index c4a6b501c..689ae1ecd 100644 --- a/system/core/Loader.php +++ b/system/core/Loader.php @@ -1,13 +1,13 @@ - 'unit', - 'user_agent' => 'agent'); + protected $_ci_varmap = array( + 'unit_test' => 'unit', + 'user_agent' => 'agent' + ); /** * Constructor @@ -141,7 +130,7 @@ class CI_Loader { $this->_ci_model_paths = array(APPPATH); $this->_ci_view_paths = array(VIEWPATH => TRUE); - log_message('debug', "Loader Class Initialized"); + log_message('debug', 'Loader Class Initialized'); } // -------------------------------------------------------------------- @@ -162,7 +151,6 @@ class CI_Loader { $this->_base_classes =& is_loaded(); $this->_ci_autoloader(); - return $this; } @@ -311,9 +299,7 @@ class CI_Loader { require_once($mod_path.'models/'.$path.$model.'.php'); $model = ucfirst($model); - $CI->$name = new $model(); - $this->_ci_models[] = $name; return; } @@ -350,7 +336,7 @@ class CI_Loader { return DB($params, $active_record); } - // Initialize the db variable. Needed to prevent + // Initialize the db variable. Needed to prevent // reference errors with some configurations $CI->db = ''; @@ -716,11 +702,11 @@ class CI_Loader { if ($path == '') { - $void = array_shift($this->_ci_library_paths); - $void = array_shift($this->_ci_model_paths); - $void = array_shift($this->_ci_helper_paths); - $void = array_shift($this->_ci_view_paths); - $void = array_shift($config->_config_paths); + array_shift($this->_ci_library_paths); + array_shift($this->_ci_model_paths); + array_shift($this->_ci_helper_paths); + array_shift($this->_ci_view_paths); + array_shift($config->_config_paths); } else { @@ -808,7 +794,6 @@ class CI_Loader { // This allows anything loaded using $this->load (views, files, etc.) // to become accessible from within the Controller and Model functions. - $_ci_CI =& get_instance(); foreach (get_object_vars($_ci_CI) as $_ci_key => $_ci_var) { @@ -837,12 +822,11 @@ class CI_Loader { * * We buffer the output for two reasons: * 1. Speed. You get a significant speed boost. - * 2. So that the final rendered template can be - * post-processed by the output class. Why do we - * need post processing? For one thing, in order to - * show the elapsed page load time. Unless we - * can intercept the content right before it's sent to - * the browser and then stop the timer it won't be accurate. + * 2. So that the final rendered template can be post-processed by + * the output class. Why do we need post processing? For one thing, + * in order to show the elapsed page load time. Unless we can + * intercept the content right before it's sent to the browser and + * then stop the timer it won't be accurate. */ ob_start(); @@ -915,10 +899,10 @@ class CI_Loader { if (($last_slash = strrpos($class, '/')) !== FALSE) { // Extract the path - $subdir = substr($class, 0, $last_slash + 1); + $subdir = substr($class, 0, ++$last_slash); // Get the filename from the path - $class = substr($class, $last_slash + 1); + $class = substr($class, $last_slash); } // We'll test for both lowercase and capitalized versions of the file name @@ -933,15 +917,15 @@ class CI_Loader { if ( ! file_exists($baseclass)) { - log_message('error', "Unable to load the requested class: ".$class); - show_error("Unable to load the requested class: ".$class); + log_message('error', 'Unable to load the requested class: '.$class); + show_error('Unable to load the requested class: '.$class); } - // Safety: Was the class already loaded by a previous call? + // Safety: Was the class already loaded by a previous call? if (in_array($subclass, $this->_ci_loaded_files)) { // Before we deem this to be a duplicate request, let's see - // if a custom object name is being supplied. If so, we'll + // if a custom object name is being supplied. If so, we'll // return a new instance of the object if ( ! is_null($object_name)) { @@ -953,7 +937,7 @@ class CI_Loader { } $is_duplicate = TRUE; - log_message('debug', $class." class already loaded. Second attempt ignored."); + log_message('debug', $class.' class already loaded. Second attempt ignored.'); return; } @@ -970,17 +954,17 @@ class CI_Loader { { $filepath = $path.'libraries/'.$subdir.$class.'.php'; - // Does the file exist? No? Bummer... + // Does the file exist? No? Bummer... if ( ! file_exists($filepath)) { continue; } - // Safety: Was the class already loaded by a previous call? + // Safety: Was the class already loaded by a previous call? if (in_array($filepath, $this->_ci_loaded_files)) { // Before we deem this to be a duplicate request, let's see - // if a custom object name is being supplied. If so, we'll + // if a custom object name is being supplied. If so, we'll // return a new instance of the object if ( ! is_null($object_name)) { @@ -992,7 +976,7 @@ class CI_Loader { } $is_duplicate = TRUE; - log_message('debug', $class." class already loaded. Second attempt ignored."); + log_message('debug', $class.' class already loaded. Second attempt ignored.'); return; } @@ -1003,7 +987,7 @@ class CI_Loader { } // END FOREACH - // One last attempt. Maybe the library is in a subdirectory, but it wasn't specified? + // One last attempt. Maybe the library is in a subdirectory, but it wasn't specified? if ($subdir == '') { $path = strtolower($class).'/'.$class; @@ -1014,8 +998,8 @@ class CI_Loader { // We do not issue errors if the load call failed due to a duplicate request if ($is_duplicate == FALSE) { - log_message('error', "Unable to load the requested class: ".$class); - show_error("Unable to load the requested class: ".$class); + log_message('error', 'Unable to load the requested class: '.$class); + show_error('Unable to load the requested class: '.$class); } } @@ -1094,12 +1078,12 @@ class CI_Loader { // Is the class name valid? if ( ! class_exists($name)) { - log_message('error', "Non-existent class: ".$name); - show_error("Non-existent class: ".$class); + log_message('error', 'Non-existent class: '.$name); + show_error('Non-existent class: '.$class); } // Set the variable name we will assign the class to - // Was a custom class name supplied? If so we'll use it + // Was a custom class name supplied? If so we'll use it $class = strtolower($class); if (is_null($object_name)) @@ -1271,4 +1255,4 @@ class CI_Loader { } /* End of file Loader.php */ -/* Location: ./system/core/Loader.php */ \ No newline at end of file +/* Location: ./system/core/Loader.php */ -- cgit v1.2.3-24-g4f1b From bb488dc3d4bbac9ac9a1860f066069e4bb4afdcb Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 7 Jan 2012 23:35:16 +0200 Subject: Improve the core Security library --- system/core/Security.php | 254 ++++++++++++++++++----------------------------- 1 file changed, 99 insertions(+), 155 deletions(-) diff --git a/system/core/Security.php b/system/core/Security.php index 272a8bf3f..d0d3c0803 100755 --- a/system/core/Security.php +++ b/system/core/Security.php @@ -1,13 +1,13 @@ - '[removed]', - 'document.write' => '[removed]', - '.parentNode' => '[removed]', - '.innerHTML' => '[removed]', - 'window.location' => '[removed]', - '-moz-binding' => '[removed]', - '' => '-->', - ' '<![CDATA[', - '' => '<comment>' - ); + 'document.cookie' => '[removed]', + 'document.write' => '[removed]', + '.parentNode' => '[removed]', + '.innerHTML' => '[removed]', + 'window.location' => '[removed]', + '-moz-binding' => '[removed]', + '' => '-->', + ' '<![CDATA[', + '' => '<comment>' + ); /** * List of never allowed regex replacement * * @var array - * @access protected */ protected $_never_allowed_regex = array( - "javascript\s*:" => '[removed]', - "expression\s*(\(|&\#40;)" => '[removed]', // CSS and IE - "vbscript\s*:" => '[removed]', // IE, surprise! - "Redirect\s+302" => '[removed]' - ); + 'javascript\s*:', + 'expression\s*(\(|&\#40;)', // CSS and IE + 'vbscript\s*:', // IE, surprise! + 'Redirect\s+302' + ); - /** - * Constructor - */ public function __construct() { // CSRF config @@ -135,7 +124,7 @@ class CI_Security { // Set the CSRF hash $this->_csrf_set_hash(); - log_message('debug', "Security Class Initialized"); + log_message('debug', 'Security Class Initialized'); } // -------------------------------------------------------------------- @@ -148,7 +137,7 @@ class CI_Security { public function csrf_verify() { // If no POST data exists we will set the CSRF cookie - if (count($_POST) == 0) + if (count($_POST) === 0) { return $this->csrf_set_cookie(); } @@ -186,8 +175,7 @@ class CI_Security { $this->_csrf_set_hash(); $this->csrf_set_cookie(); - log_message('debug', "CSRF token verified"); - + log_message('debug', 'CSRF token verified'); return $this; } @@ -203,19 +191,13 @@ class CI_Security { $expire = time() + $this->_csrf_expire; $secure_cookie = (bool) config_item('cookie_secure'); - if ($secure_cookie) + if ($secure_cookie && ( ! isset($_SERVER['HTTPS']) OR $_SERVER['HTTPS'] == 'off' OR ! $_SERVER['HTTPS'])) { - $req = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : FALSE; - - if ( ! $req OR $req == 'off') - { - return FALSE; - } + return FALSE; } setcookie($this->_csrf_cookie_name, $this->_csrf_hash, $expire, config_item('cookie_path'), config_item('cookie_domain'), $secure_cookie); - - log_message('debug', "CRSF cookie Set"); + log_message('debug', 'CRSF cookie Set'); return $this; } @@ -253,7 +235,7 @@ class CI_Security { * * Getter Method * - * @return string self::csrf_token_name + * @return string self::_csrf_token_name */ public function get_csrf_token_name() { @@ -273,7 +255,7 @@ class CI_Security { * the filter. * * Note: This function should only be used to deal with data - * upon submission. It's not something that should + * upon submission. It's not something that should * be used for general runtime processing. * * This function was based in part on some code and ideas I @@ -290,10 +272,7 @@ class CI_Security { */ public function xss_clean($str, $is_image = FALSE) { - /* - * Is the string an array? - * - */ + // Is the string an array? if (is_array($str)) { while (list($key) = each($str)) @@ -304,13 +283,8 @@ class CI_Security { return $str; } - /* - * Remove Invisible Characters - */ - $str = remove_invisible_characters($str); - - // Validate Entities in URLs - $str = $this->_validate_entities($str); + // Remove Invisible Characters and validate entities in URLs + $str = $this->_validate_entities(remove_invisible_characters($str)); /* * URL Decode @@ -320,7 +294,6 @@ class CI_Security { * Google * * Note: Use rawurldecode() so it does not remove plus signs - * */ $str = rawurldecode($str); @@ -332,14 +305,10 @@ class CI_Security { * these are the ones that will pose security problems. * */ - $str = preg_replace_callback("/[a-z]+=([\'\"]).*?\\1/si", array($this, '_convert_attribute'), $str); - $str = preg_replace_callback("/<\w+.*?(?=>|<|$)/si", array($this, '_decode_entity'), $str); - /* - * Remove Invisible Characters Again! - */ + // Remove Invisible Characters Again! $str = remove_invisible_characters($str); /* @@ -350,11 +319,7 @@ class CI_Security { * NOTE: preg_replace was found to be amazingly slow here on * large blocks of data, so we use str_replace. */ - - if (strpos($str, "\t") !== FALSE) - { - $str = str_replace("\t", ' ', $str); - } + $str = str_replace("\t", ' ', $str); /* * Capture converted string for later comparison @@ -378,7 +343,7 @@ class CI_Security { // Images have a tendency to have the PHP short opening and // closing tags every so often so we skip those and only // do the long opening tags. - $str = preg_replace('/<\?(php)/i', "<?\\1", $str); + $str = preg_replace('/<\?(php)/i', '<?\\1', $str); } else { @@ -415,19 +380,19 @@ class CI_Security { { $original = $str; - if (preg_match("/]*?)(>|$)#si", array($this, '_js_link_removal'), $str); + $str = preg_replace_callback('#]*?)(>|$)#si', array($this, '_js_link_removal'), $str); } - if (preg_match("/]*?)(\s?/?>|$)#si", array($this, '_js_img_removal'), $str); + $str = preg_replace_callback('#]*?)(\s?/?>|$)#si', array($this, '_js_img_removal'), $str); } - if (preg_match("/script/i", $str) OR preg_match("/xss/i", $str)) + if (preg_match('/(script|xss)/i', $str)) { - $str = preg_replace("#<(/*)(script|xss)(.*?)\>#si", '[removed]', $str); + $str = preg_replace('#<(/*)(script|xss)(.*?)\>#si', '[removed]', $str); } } while($original != $str); @@ -454,14 +419,16 @@ class CI_Security { * * Similar to above, only instead of looking for * tags it looks for PHP and JavaScript commands - * that are disallowed. Rather than removing the + * that are disallowed. Rather than removing the * code, it simply converts the parenthesis to entities * rendering the code un-executable. * * For example: eval('some code') - * Becomes: eval('some code') + * Becomes: eval('some code') */ - $str = preg_replace('#(alert|cmd|passthru|eval|exec|expression|system|fopen|fsockopen|file|file_get_contents|readfile|unlink)(\s*)\((.*?)\)#si', "\\1\\2(\\3)", $str); + $str = preg_replace('#(alert|cmd|passthru|eval|exec|expression|system|fopen|fsockopen|file|file_get_contents|readfile|unlink)(\s*)\((.*?)\)#si', + '\\1\\2(\\3)', + $str); // Final clean up @@ -478,13 +445,12 @@ class CI_Security { * string post-removal of XSS, then it fails, as there was unwanted XSS * code found and removed/changed during processing. */ - if ($is_image === TRUE) { - return ($str === $converted_string) ? TRUE : FALSE; + return ($str === $converted_string); } - log_message('debug', "XSS Filtering completed"); + log_message('debug', 'XSS Filtering completed'); return $str; } @@ -516,7 +482,7 @@ class CI_Security { * The reason we are not using html_entity_decode() by itself is because * while it is not technically correct to leave out the semicolon * at the end of an entity most browsers will still interpret the entity - * correctly. html_entity_decode() does not convert entities without + * correctly. html_entity_decode() does not convert entities without * semicolons, so we are left with our own little solution here. Bummer. * * @param string @@ -552,38 +518,23 @@ class CI_Security { public function sanitize_filename($str, $relative_path = FALSE) { $bad = array( - "../", - "", - "<", - ">", - "'", - '"', - '&', - '$', - '#', - '{', - '}', - '[', - ']', - '=', - ';', - '?', - "%20", - "%22", - "%3c", // < - "%253c", // < - "%3e", // > - "%0e", // > - "%28", // ( - "%29", // ) - "%2528", // ( - "%26", // & - "%24", // $ - "%3f", // ? - "%3b", // ; - "%3d" // = - ); + '../', '', '<', '>', + "'", '"', '&', '$', '#', + '{', '}', '[', ']', '=', + ';', '?', '%20', '%22', + '%3c', // < + '%253c', // < + '%3e', // > + '%0e', // > + '%28', // ( + '%29', // ) + '%2528', // ( + '%26', // & + '%24', // $ + '%3f', // ? + '%3b', // ; + '%3d' // = + ); if ( ! $relative_path) { @@ -636,26 +587,26 @@ class CI_Security { if ($is_image === TRUE) { /* - * Adobe Photoshop puts XML metadata into JFIF images, + * Adobe Photoshop puts XML metadata into JFIF images, * including namespacing, so we have to allow this for images. */ unset($evil_attributes[array_search('xmlns', $evil_attributes)]); } - + do { $count = 0; $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], '/'); } - + // find occurrences of illegal attribute strings with quotes (042 and 047 are octal quotes) - preg_match_all("/(".implode('|', $evil_attributes).")\s*=\s*(\042|\047)([^\\2]*?)(\\2)/is", $str, $matches, PREG_SET_ORDER); + preg_match_all('/('.implode('|', $evil_attributes).')\s*=\s*(\042|\047)([^\\2]*?)(\\2)/is', $str, $matches, PREG_SET_ORDER); foreach ($matches as $attr) { @@ -665,11 +616,11 @@ 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$2$4$5', $str, -1, $count); } - + } while ($count); - + return $str; } @@ -685,14 +636,9 @@ class CI_Security { */ protected function _sanitize_naughty_html($matches) { - // encode opening brace - $str = '<'.$matches[1].$matches[2].$matches[3]; - - // encode captured opening or closing brace to prevent recursive vectors - $str .= str_replace(array('>', '<'), array('>', '<'), - $matches[4]); - - return $str; + return '<'.$matches[1].$matches[2].$matches[3] // encode opening brace + // encode captured opening or closing brace to prevent recursive vectors: + . str_replace(array('>', '<'), array('>', '<'), $matches[4]); } // -------------------------------------------------------------------- @@ -710,9 +656,12 @@ class CI_Security { */ protected function _js_link_removal($match) { - $attributes = $this->_filter_attributes(str_replace(array('<', '>'), '', $match[1])); - - 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])) + ), + $match[0]); } // -------------------------------------------------------------------- @@ -730,9 +679,12 @@ class CI_Security { */ protected function _js_img_removal($match) { - $attributes = $this->_filter_attributes(str_replace(array('<', '>'), '', $match[1])); - - return str_replace($match[1], preg_replace("#src=.*?(alert\(|alert&\#40;|javascript\:|livescript\:|mocha\:|charset\=|window\.|document\.|\.cookie|_filter_attributes(str_replace(array('<', '>'), '', $match[1])) + ), + $match[0]); } // -------------------------------------------------------------------- @@ -806,33 +758,28 @@ class CI_Security { * Protect GET variables in URLs */ - // 901119URL5918AMP18930PROTECT8198 - - $str = preg_replace('|\&([a-z\_0-9\-]+)\=([a-z\_0-9\-]+)|i', $this->xss_hash()."\\1=\\2", $str); + // 901119URL5918AMP18930PROTECT8198 + $str = preg_replace('|\&([a-z\_0-9\-]+)\=([a-z\_0-9\-]+)|i', $this->xss_hash().'\\1=\\2', $str); /* * Validate standard character entities * * Add a semicolon if missing. We do this to enable * the conversion of entities to ASCII later. - * */ - $str = preg_replace('#(&\#?[0-9a-z]{2,})([\x00-\x20])*;?#i', "\\1;\\2", $str); + $str = preg_replace('#(&\#?[0-9a-z]{2,})([\x00-\x20])*;?#i', '\\1;\\2', $str); /* * Validate UTF16 two byte encoding (x00) * * Just as above, adds a semicolon if missing. - * */ - $str = preg_replace('#(&\#x?)([0-9A-F]+);?#i',"\\1\\2;",$str); + $str = preg_replace('#(&\#x?)([0-9A-F]+);?#i', '\\1\\2;', $str); /* * Un-Protect GET variables in URLs */ - $str = str_replace($this->xss_hash(), '&', $str); - - return $str; + return str_replace($this->xss_hash(), '&', $str); } // ---------------------------------------------------------------------- @@ -847,14 +794,11 @@ class CI_Security { */ protected function _do_never_allowed($str) { - foreach ($this->_never_allowed_str as $key => $val) - { - $str = str_replace($key, $val, $str); - } + $str = str_replace(array_keys($this->_never_allowed_str), $this->_never_allowed_str, $str); - foreach ($this->_never_allowed_regex as $key => $val) + foreach ($this->_never_allowed_regex as $regex) { - $str = preg_replace("#".$key."#i", $val, $str); + $str = preg_replace('#'.$regex.'#i', '[removed]', $str); } return $str; @@ -891,4 +835,4 @@ class CI_Security { } /* End of file Security.php */ -/* Location: ./system/core/Security.php */ \ No newline at end of file +/* Location: ./system/core/Security.php */ -- cgit v1.2.3-24-g4f1b From c123e118de32e2b31b9bf21fdb43458bc9f4cbda Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sun, 8 Jan 2012 00:17:34 +0200 Subject: Improve core URI & UTF8 libraries --- system/core/URI.php | 197 ++++++++++++++++++++++----------------------------- system/core/Utf8.php | 32 ++++----- 2 files changed, 96 insertions(+), 133 deletions(-) diff --git a/system/core/URI.php b/system/core/URI.php index 3c26d307b..93105b1fd 100755 --- a/system/core/URI.php +++ b/system/core/URI.php @@ -1,13 +1,13 @@ -config =& load_class('Config', 'core'); - log_message('debug', "URI Class Initialized"); + log_message('debug', 'URI Class Initialized'); } - // -------------------------------------------------------------------- /** * Get the URI String * - * @access private - * @return string + * Called by CI_Router + * + * @return void */ - function _fetch_uri_string() + public function _fetch_uri_string() { - if (strtoupper($this->config->item('uri_protocol')) == 'AUTO') + if (strtoupper($this->config->item('uri_protocol')) === 'AUTO') { // Is the request coming from the command line? - if (php_sapi_name() == 'cli' or defined('STDIN')) + if (php_sapi_name() === 'cli' OR defined('STDIN')) { $this->_set_uri_string($this->_parse_cli_args()); return; @@ -115,14 +109,14 @@ 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; } // No PATH_INFO?... What about QUERY_STRING? - $path = (isset($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : @getenv('QUERY_STRING'); + $path = (isset($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : @getenv('QUERY_STRING'); if (trim($path, '/') != '') { $this->_set_uri_string($path); @@ -130,7 +124,7 @@ class CI_URI { } // 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; @@ -143,12 +137,12 @@ class CI_URI { $uri = strtoupper($this->config->item('uri_protocol')); - if ($uri == 'REQUEST_URI') + if ($uri === 'REQUEST_URI') { $this->_set_uri_string($this->_detect_uri()); return; } - elseif ($uri == 'CLI') + elseif ($uri === 'CLI') { $this->_set_uri_string($this->_parse_cli_args()); return; @@ -163,17 +157,16 @@ class CI_URI { /** * Set the URI String * - * @access public * @param string - * @return string + * @return void */ - function _set_uri_string($str) + public function _set_uri_string($str) { // Filter out control characters $str = remove_invisible_characters($str, FALSE); // If the URI contains only a slash we'll kill it - $this->uri_string = ($str == '/') ? '' : $str; + $this->uri_string = ($str === '/') ? '' : $str; } // -------------------------------------------------------------------- @@ -184,7 +177,6 @@ class CI_URI { * This function will detect the URI automatically and fix the query string * if necessary. * - * @access private * @return string */ protected function _detect_uri() @@ -194,12 +186,11 @@ class CI_URI { return ''; } - $uri = $_SERVER['REQUEST_URI']; - if (strpos($uri, $_SERVER['SCRIPT_NAME']) === 0) + if (strpos($_SERVER['REQUEST_URI'], $_SERVER['SCRIPT_NAME']) === 0) { $uri = substr($uri, strlen($_SERVER['SCRIPT_NAME'])); } - elseif (strpos($uri, dirname($_SERVER['SCRIPT_NAME'])) === 0) + elseif (strpos($_SERVER['REQUEST_URI'], dirname($_SERVER['SCRIPT_NAME'])) === 0) { $uri = substr($uri, strlen(dirname($_SERVER['SCRIPT_NAME']))); } @@ -223,7 +214,7 @@ class CI_URI { $_GET = array(); } - if ($uri == '/' || empty($uri)) + if ($uri == '/' OR empty($uri)) { return '/'; } @@ -241,13 +232,11 @@ class CI_URI { * * Take each command line argument and assume it is a URI segment. * - * @access private * @return string */ protected function _parse_cli_args() { $args = array_slice($_SERVER['argv'], 1); - return $args ? '/' . implode('/', $args) : ''; } @@ -256,27 +245,28 @@ class CI_URI { /** * Filter segments for malicious characters * - * @access private + * Called by CI_Router + * * @param string * @return string */ - function _filter_uri($str) + public function _filter_uri($str) { 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 - if ( ! preg_match("|^[".str_replace(array('\\-', '\-'), '-', preg_quote($this->config->item('permitted_uri_chars'), '-'))."]+$|i", $str)) + if ( ! preg_match('|^['.str_replace(array('\\-', '\-'), '-', preg_quote($this->config->item('permitted_uri_chars'), '-')).']+$|i', $str)) { show_error('The URI you submitted has disallowed characters.', 400); } } - // Convert programatic characters to entities - $bad = array('$', '(', ')', '%28', '%29'); - $good = array('$', '(', ')', '(', ')'); - - return str_replace($bad, $good, $str); + // Convert programatic characters to entities and return + return str_replace( + array('$', '(', ')', '%28', '%29'), // Bad + array('$', '(', ')', '(', ')'), // Good + $str); } // -------------------------------------------------------------------- @@ -284,14 +274,15 @@ class CI_URI { /** * Remove the suffix from the URL if needed * - * @access private + * Called by CI_Router + * * @return void */ - function _remove_url_suffix() + 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); + $this->uri_string = preg_replace('|'.preg_quote($this->config->item('url_suffix')).'$|', '', $this->uri_string); } } @@ -301,12 +292,13 @@ class CI_URI { * Explode the URI Segments. The individual segments will * be stored in the $this->segments array. * - * @access private + * Called by CI_Router + * * @return void */ - function _explode_segments() + public function _explode_segments() { - foreach (explode("/", preg_replace("|/*(.+?)/*$|", "\\1", $this->uri_string)) as $val) + foreach (explode('/', preg_replace('|/*(.+?)/*$|', '\\1', $this->uri_string)) as $val) { // Filter segments for security $val = trim($this->_filter_uri($val)); @@ -323,14 +315,15 @@ class CI_URI { * Re-index Segments * * This function re-indexes the $this->segment array so that it - * starts at 1 rather than 0. Doing so makes it simpler to + * starts at 1 rather than 0. Doing so makes it simpler to * use functions like $this->uri->segment(n) since there is * a 1:1 relationship between the segment array and the actual segments. * - * @access private + * Called by CI_Router + * * @return void */ - function _reindex_segments() + public function _reindex_segments() { array_unshift($this->segments, NULL); array_unshift($this->rsegments, NULL); @@ -345,12 +338,11 @@ class CI_URI { * * This function returns the URI segment based on the number provided. * - * @access public * @param integer * @param bool * @return string */ - function segment($n, $no_result = FALSE) + public function segment($n, $no_result = FALSE) { return ( ! isset($this->segments[$n])) ? $no_result : $this->segments[$n]; } @@ -364,12 +356,11 @@ class CI_URI { * based on the number provided. If there is no routing this function returns the * same result as $this->segment() * - * @access public * @param integer * @param bool * @return string */ - function rsegment($n, $no_result = FALSE) + public function rsegment($n, $no_result = FALSE) { return ( ! isset($this->rsegments[$n])) ? $no_result : $this->rsegments[$n]; } @@ -392,25 +383,22 @@ class CI_URI { * gender => male * ) * - * @access public * @param integer the starting segment number * @param array an array of default values * @return array */ - function uri_to_assoc($n = 3, $default = array()) + public function uri_to_assoc($n = 3, $default = array()) { return $this->_uri_to_assoc($n, $default, 'segment'); } /** * Identical to above only it uses the re-routed segment array * - * @access public * @param integer the starting segment number * @param array an array of default values * @return array - * */ - function ruri_to_assoc($n = 3, $default = array()) + public function ruri_to_assoc($n = 3, $default = array()) { return $this->_uri_to_assoc($n, $default, 'rsegment'); } @@ -420,25 +408,13 @@ class CI_URI { /** * Generate a key value pair from the URI string or Re-routed URI string * - * @access private * @param integer the starting segment number * @param array an array of default values * @param string which array we should use * @return array */ - function _uri_to_assoc($n = 3, $default = array(), $which = 'segment') + protected function _uri_to_assoc($n = 3, $default = array(), $which = 'segment') { - if ($which == 'segment') - { - $total_segments = 'total_segments'; - $segment_array = 'segment_array'; - } - else - { - $total_segments = 'total_rsegments'; - $segment_array = 'rsegment_array'; - } - if ( ! is_numeric($n)) { return $default; @@ -449,23 +425,30 @@ class CI_URI { return $this->keyval[$n]; } + if ($which === 'segment') + { + $total_segments = 'total_segments'; + $segment_array = 'segment_array'; + } + else + { + $total_segments = 'total_rsegments'; + $segment_array = 'rsegment_array'; + } + if ($this->$total_segments() < $n) { - if (count($default) == 0) + if (count($default) === 0) { return array(); } - $retval = array(); - foreach ($default as $val) - { - $retval[$val] = FALSE; - } - return $retval; + return function_exists('array_fill_keys') + ? array_fill_keys($default, FALSE) + : array_combine($default, array_fill(0, count($default), FALSE)); } $segments = array_slice($this->$segment_array(), ($n - 1)); - $i = 0; $lastval = ''; $retval = array(); @@ -506,16 +489,15 @@ class CI_URI { * Generate a URI string from an associative array * * - * @access public * @param array an associative array of key/values * @return array */ - function assoc_to_uri($array) + public function assoc_to_uri($array) { $temp = array(); foreach ((array)$array as $key => $val) { - $temp[] = $key; + $temp[] = $key; $temp[] = $val; } @@ -527,12 +509,11 @@ class CI_URI { /** * Fetch a URI Segment and add a trailing slash * - * @access public * @param integer * @param string * @return string */ - function slash_segment($n, $where = 'trailing') + public function slash_segment($n, $where = 'trailing') { return $this->_slash_segment($n, $where, 'segment'); } @@ -542,12 +523,11 @@ class CI_URI { /** * Fetch a URI Segment and add a trailing slash * - * @access public * @param integer * @param string * @return string */ - function slash_rsegment($n, $where = 'trailing') + public function slash_rsegment($n, $where = 'trailing') { return $this->_slash_segment($n, $where, 'rsegment'); } @@ -557,22 +537,20 @@ class CI_URI { /** * Fetch a URI Segment and add a trailing slash - helper function * - * @access private * @param integer * @param string * @param string * @return string */ - function _slash_segment($n, $where = 'trailing', $which = 'segment') + protected function _slash_segment($n, $where = 'trailing', $which = 'segment') { - $leading = '/'; - $trailing = '/'; + $leading = $trailing = '/'; - if ($where == 'trailing') + if ($where === 'trailing') { $leading = ''; } - elseif ($where == 'leading') + elseif ($where === 'leading') { $trailing = ''; } @@ -585,10 +563,9 @@ class CI_URI { /** * Segment Array * - * @access public * @return array */ - function segment_array() + public function segment_array() { return $this->segments; } @@ -598,10 +575,9 @@ class CI_URI { /** * Routed Segment Array * - * @access public * @return array */ - function rsegment_array() + public function rsegment_array() { return $this->rsegments; } @@ -611,10 +587,9 @@ class CI_URI { /** * Total number of segments * - * @access public * @return integer */ - function total_segments() + public function total_segments() { return count($this->segments); } @@ -624,10 +599,9 @@ class CI_URI { /** * Total number of routed segments * - * @access public * @return integer */ - function total_rsegments() + public function total_rsegments() { return count($this->rsegments); } @@ -637,10 +611,9 @@ class CI_URI { /** * Fetch the entire URI string * - * @access public * @return string */ - function uri_string() + public function uri_string() { return $this->uri_string; } @@ -651,16 +624,14 @@ class CI_URI { /** * Fetch the entire Re-routed URI string * - * @access public * @return string */ - function ruri_string() + public function ruri_string() { return '/'.implode('/', $this->rsegment_array()); } } -// END URI Class /* End of file URI.php */ -/* Location: ./system/core/URI.php */ \ No newline at end of file +/* Location: ./system/core/URI.php */ diff --git a/system/core/Utf8.php b/system/core/Utf8.php index 40a7ac4c0..0e180d36f 100644 --- a/system/core/Utf8.php +++ b/system/core/Utf8.php @@ -1,13 +1,13 @@ -item('charset') == 'UTF-8' // Application charset must be UTF-8 + && @ini_get('mbstring.func_overload') != 1 // Multibyte string function overloading cannot be enabled + && $CFG->item('charset') === 'UTF-8' // Application charset must be UTF-8 ) { - log_message('debug', "UTF-8 Support Enabled"); - define('UTF8_ENABLED', TRUE); + log_message('debug', 'UTF-8 Support Enabled'); // set internal encoding for multibyte string functions if necessary // and set a flag so we don't have to repeatedly use extension_loaded() @@ -77,8 +76,8 @@ class CI_Utf8 { } else { - log_message('debug', "UTF-8 Support Disabled"); define('UTF8_ENABLED', FALSE); + log_message('debug', 'UTF-8 Support Disabled'); } } @@ -134,18 +133,14 @@ class CI_Utf8 { { if (function_exists('iconv')) { - $str = @iconv($encoding, 'UTF-8', $str); + return @iconv($encoding, 'UTF-8', $str); } elseif (function_exists('mb_convert_encoding')) { - $str = @mb_convert_encoding($str, 'UTF-8', $encoding); - } - else - { - return FALSE; + return @mb_convert_encoding($str, 'UTF-8', $encoding); } - return $str; + return FALSE; } // -------------------------------------------------------------------- @@ -163,10 +158,7 @@ class CI_Utf8 { return (preg_match('/[^\x00-\x7F]/S', $str) === 0); } - // -------------------------------------------------------------------- - } -// End Utf8 Class /* End of file Utf8.php */ -/* Location: ./system/core/Utf8.php */ \ No newline at end of file +/* Location: ./system/core/Utf8.php */ -- cgit v1.2.3-24-g4f1b From a798fdb9a08a6f549bcc2a4ea6c6bad45cfef0a2 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sun, 8 Jan 2012 00:20:49 +0200 Subject: Remove a space :) --- system/core/URI.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/core/URI.php b/system/core/URI.php index 93105b1fd..eaf7b752b 100755 --- a/system/core/URI.php +++ b/system/core/URI.php @@ -497,7 +497,7 @@ class CI_URI { $temp = array(); foreach ((array)$array as $key => $val) { - $temp[] = $key; + $temp[] = $key; $temp[] = $val; } -- cgit v1.2.3-24-g4f1b From 282592c744b969d5cdebe00673f2bdc8d956261e Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sun, 8 Jan 2012 01:01:55 +0200 Subject: Clear some spaces from index.php --- index.php | 57 +++++++++++++++++++++++---------------------------------- 1 file changed, 23 insertions(+), 34 deletions(-) diff --git a/index.php b/index.php index 4ae1ceebd..1712a7d66 100644 --- a/index.php +++ b/index.php @@ -5,9 +5,9 @@ * An open source application development framework for PHP 5.1.6 or newer * * NOTICE OF LICENSE - * + * * Licensed under the Open Software License version 3.0 - * + * * This source file is subject to the Open Software License (OSL 3.0) that is * bundled with this package in the files license.txt / license.rst. It is * also available through the world wide web at this URL: @@ -41,7 +41,6 @@ * production * * NOTE: If you change these, also change the error_reporting() code below - * */ define('ENVIRONMENT', 'development'); /* @@ -60,12 +59,10 @@ if (defined('ENVIRONMENT')) case 'development': error_reporting(-1); break; - case 'testing': case 'production': error_reporting(0); break; - default: exit('The application environment is not set correctly.'); } @@ -79,7 +76,6 @@ if (defined('ENVIRONMENT')) * This variable must contain the name of your "system" folder. * Include the path if the folder is not in the same directory * as this file. - * */ $system_path = 'system'; @@ -90,30 +86,28 @@ if (defined('ENVIRONMENT')) * * If you want this front controller to use a different "application" * folder then the default one you can set its name here. The folder - * can also be renamed or relocated anywhere on your server. If + * can also be renamed or relocated anywhere on your server. If * you do, use a full server path. For more info please see the user guide: * http://codeigniter.com/user_guide/general/managing_apps.html * * NO TRAILING SLASH! - * */ $application_folder = 'application'; - + /* *--------------------------------------------------------------- * VIEW FOLDER NAME *--------------------------------------------------------------- - * - * If you want to move the view folder out of the application + * + * If you want to move the view folder out of the application * folder set the path to the folder here. The folder can be renamed - * and relocated anywhere on your server. If blank, it will default - * to the standard location inside your application folder. If you - * do move this, use the full server path to this folder + * and relocated anywhere on your server. If blank, it will default + * to the standard location inside your application folder. If you + * do move this, use the full server path to this folder. * * NO TRAILING SLASH! - * */ - $view_folder = ''; + $view_folder = ''; /* @@ -123,18 +117,17 @@ if (defined('ENVIRONMENT')) * * Normally you will set your default controller in the routes.php file. * You can, however, force a custom routing by hard-coding a - * specific controller class/function here. For most applications, you + * specific controller class/function here. For most applications, you * WILL NOT set your routing here, but it's an option for those * special instances where you might want to override the standard * routing in a specific front controller that shares a common CI installation. * - * IMPORTANT: If you set the routing here, NO OTHER controller will be + * IMPORTANT: If you set the routing here, NO OTHER controller will be * callable. In essence, this preference limits your application to ONE - * specific controller. Leave the function name blank if you need + * specific controller. Leave the function name blank if you need * to call functions dynamically via the URI. * * Un-comment the $routing array below to use this feature - * */ // The directory name, relative to the "controllers" folder. Leave blank // if your controller is not in a sub-folder within the "controllers" folder @@ -160,7 +153,6 @@ if (defined('ENVIRONMENT')) * config values. * * Un-comment the $assign_to_config array below to use this feature - * */ // $assign_to_config['name_of_config_item'] = 'value of config item'; @@ -193,7 +185,7 @@ if (defined('ENVIRONMENT')) // Is the system path correct? if ( ! is_dir($system_path)) { - exit("Your system folder path does not appear to be set correctly. Please open the following file and correct this: ".pathinfo(__FILE__, PATHINFO_BASENAME)); + exit('Your system folder path does not appear to be set correctly. Please open the following file and correct this: '.pathinfo(__FILE__, PATHINFO_BASENAME)); } /* @@ -209,7 +201,7 @@ if (defined('ENVIRONMENT')) define('EXT', '.php'); // Path to the system folder - define('BASEPATH', str_replace("\\", "/", $system_path)); + define('BASEPATH', str_replace('\\', '/', $system_path)); // Path to the front controller (this file) define('FCPATH', str_replace(SELF, '', __FILE__)); @@ -217,7 +209,6 @@ if (defined('ENVIRONMENT')) // Name of the "system folder" define('SYSDIR', trim(strrchr(trim(BASEPATH, '/'), '/'), '/')); - // The path to the "application" folder if (is_dir($application_folder)) { @@ -227,27 +218,26 @@ if (defined('ENVIRONMENT')) { if ( ! is_dir(BASEPATH.$application_folder.'/')) { - exit("Your application folder path does not appear to be set correctly. Please open the following file and correct this: ".SELF); + exit('Your application folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF); } define('APPPATH', BASEPATH.$application_folder.'/'); } - + // The path to the "views" folder - if (is_dir($view_folder)) + if (is_dir($view_folder)) { define ('VIEWPATH', $view_folder .'/'); } - else + else { if ( ! is_dir(APPPATH.'views/')) { - exit("Your view folder path does not appear to be set correctly. Please open the following file and correct this: ".SELF); + exit('Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF); } - - define ('VIEWPATH', APPPATH.'views/' ); + + define ('VIEWPATH', APPPATH.'views/' ); } - /* * -------------------------------------------------------------------- @@ -255,9 +245,8 @@ if (defined('ENVIRONMENT')) * -------------------------------------------------------------------- * * And away we go... - * */ require_once BASEPATH.'core/CodeIgniter.php'; /* End of file index.php */ -/* Location: ./index.php */ \ No newline at end of file +/* Location: ./index.php */ -- cgit v1.2.3-24-g4f1b From 24276a3a204ddf5947c66bd74f183d8058c1171e Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sun, 8 Jan 2012 02:44:38 +0200 Subject: Improve database classes --- system/database/DB.php | 54 ++--- system/database/DB_active_rec.php | 404 ++++++++++++-------------------------- system/database/DB_cache.php | 49 ++--- system/database/DB_forge.php | 94 +++------ system/database/DB_result.php | 83 +++----- system/database/DB_utility.php | 159 ++++++--------- 6 files changed, 270 insertions(+), 573 deletions(-) diff --git a/system/database/DB.php b/system/database/DB.php index a0106c133..ed6afd7ed 100755 --- a/system/database/DB.php +++ b/system/database/DB.php @@ -1,13 +1,13 @@ - $dns['scheme'], - 'hostname' => (isset($dns['host'])) ? rawurldecode($dns['host']) : '', - 'username' => (isset($dns['user'])) ? rawurldecode($dns['user']) : '', - 'password' => (isset($dns['pass'])) ? rawurldecode($dns['pass']) : '', - 'database' => (isset($dns['path'])) ? rawurldecode(substr($dns['path'], 1)) : '' - ); + 'dbdriver' => $dns['scheme'], + 'hostname' => (isset($dns['host'])) ? rawurldecode($dns['host']) : '', + 'username' => (isset($dns['user'])) ? rawurldecode($dns['user']) : '', + 'password' => (isset($dns['pass'])) ? rawurldecode($dns['pass']) : '', + 'database' => (isset($dns['path'])) ? rawurldecode(substr($dns['path'], 1)) : '' + ); // were additional config items set? if (isset($dns['query'])) { parse_str($dns['query'], $extra); - foreach ($extra as $key => $val) { // booleans please - if (strtoupper($val) == "TRUE") + if (strtoupper($val) === 'TRUE') { $val = TRUE; } - elseif (strtoupper($val) == "FALSE") + elseif (strtoupper($val) === 'FALSE') { $val = FALSE; } @@ -114,17 +108,15 @@ function &DB($params = '', $active_record_override = NULL) } } - // No DB specified yet? Beat them senseless... + // No DB specified yet? Beat them senseless... if ( ! isset($params['dbdriver']) OR $params['dbdriver'] == '') { show_error('You have not selected a database type to connect to.'); } - // Load the DB classes. Note: Since the active record class is optional + // Load the DB classes. Note: Since the active record class is optional // we need to dynamically create a class that extends proper parent class // based on whether we're using the active record class or not. - // Kudos to Paul for discovering this clever use of eval() - if ($active_record_override !== NULL) { $active_record = $active_record_override; @@ -135,18 +127,14 @@ function &DB($params = '', $active_record_override = NULL) if ( ! isset($active_record) OR $active_record == TRUE) { require_once(BASEPATH.'database/DB_active_rec.php'); - if ( ! class_exists('CI_DB')) { class CI_DB extends CI_DB_active_record { } } } - else + elseif ( ! class_exists('CI_DB')) { - if ( ! class_exists('CI_DB')) - { - class CI_DB extends CI_DB_driver { } - } + class CI_DB extends CI_DB_driver { } } require_once(BASEPATH.'database/drivers/'.$params['dbdriver'].'/'.$params['dbdriver'].'_driver.php'); @@ -168,7 +156,5 @@ function &DB($params = '', $active_record_override = NULL) return $DB; } - - /* End of file DB.php */ -/* Location: ./system/database/DB.php */ \ No newline at end of file +/* Location: ./system/database/DB.php */ diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php index 486b4d775..30a17d11a 100644 --- a/system/database/DB_active_rec.php +++ b/system/database/DB_active_rec.php @@ -1,4 +1,4 @@ -_protect_identifiers($type.'('.trim($select).')').' AS '.$this->_protect_identifiers(trim($alias)); - $this->ar_select[] = $sql; if ($this->ar_caching === TRUE) @@ -280,30 +278,27 @@ class CI_DB_active_record extends CI_DB_driver { { $v = trim($v); $this->_track_aliases($v); - - $this->ar_from[] = $this->_protect_identifiers($v, TRUE, NULL, FALSE); + $this->ar_from[] = $v = $this->_protect_identifiers($v, TRUE, NULL, FALSE); if ($this->ar_caching === TRUE) { - $this->ar_cache_from[] = $this->_protect_identifiers($v, TRUE, NULL, FALSE); + $this->ar_cache_from[] = $v; $this->ar_cache_exists[] = 'from'; } } - } else { $val = trim($val); - // Extract any aliases that might exist. We use this information + // Extract any aliases that might exist. We use this information // in the _protect_identifiers to know whether to add a table prefix $this->_track_aliases($val); - - $this->ar_from[] = $this->_protect_identifiers($val, TRUE, NULL, FALSE); + $this->ar_from[] = $val = $this->_protect_identifiers($val, TRUE, NULL, FALSE); if ($this->ar_caching === TRUE) { - $this->ar_cache_from[] = $this->_protect_identifiers($val, TRUE, NULL, FALSE); + $this->ar_cache_from[] = $val; $this->ar_cache_exists[] = 'from'; } } @@ -340,23 +335,19 @@ class CI_DB_active_record extends CI_DB_driver { } } - // Extract any aliases that might exist. We use this information + // Extract any aliases that might exist. We use this information // in the _protect_identifiers to know whether to add a table prefix $this->_track_aliases($table); // Strip apart the condition and protect the identifiers if (preg_match('/([\w\.]+)([\W\s]+)(.+)/', $cond, $match)) { - $match[1] = $this->_protect_identifiers($match[1]); - $match[3] = $this->_protect_identifiers($match[3]); - - $cond = $match[1].$match[2].$match[3]; + $cond = $this->_protect_identifiers($match[1]).$match[2].$this->_protect_identifiers($match[3]); } // Assemble the JOIN statement - $join = $type.'JOIN '.$this->_protect_identifiers($table, TRUE, NULL, FALSE).' ON '.$cond; + $this->ar_join[] = $join = $type.'JOIN '.$this->_protect_identifiers($table, TRUE, NULL, FALSE).' ON '.$cond; - $this->ar_join[] = $join; if ($this->ar_caching === TRUE) { $this->ar_cache_join[] = $join; @@ -429,7 +420,7 @@ class CI_DB_active_record extends CI_DB_driver { foreach ($key as $k => $v) { - $prefix = (count($this->ar_where) == 0 AND count($this->ar_cache_where) == 0) ? '' : $type; + $prefix = (count($this->ar_where) === 0 AND count($this->ar_cache_where) === 0) ? '' : $type; if (is_null($v) && ! $this->_has_operator($k)) { @@ -442,7 +433,6 @@ class CI_DB_active_record extends CI_DB_driver { if ($escape === TRUE) { $k = $this->_protect_identifiers($k, FALSE, $escape); - $v = ' '.$this->escape($v); } @@ -457,7 +447,6 @@ class CI_DB_active_record extends CI_DB_driver { } $this->ar_where[] = $prefix.$k.$v; - if ($this->ar_caching === TRUE) { $this->ar_cache_where[] = $prefix.$k.$v; @@ -571,11 +560,9 @@ class CI_DB_active_record extends CI_DB_driver { $this->ar_wherein[] = $this->escape($value); } - $prefix = (count($this->ar_where) == 0) ? '' : $type; - - $where_in = $prefix . $this->_protect_identifiers($key) . $not . " IN (" . implode(", ", $this->ar_wherein) . ") "; + $prefix = (count($this->ar_where) === 0) ? '' : $type; + $this->ar_where[] = $where_in = $prefix.$this->_protect_identifiers($key).$not.' IN ('.implode(', ', $this->ar_wherein).') '; - $this->ar_where[] = $where_in; if ($this->ar_caching === TRUE) { $this->ar_cache_where[] = $where_in; @@ -679,20 +666,18 @@ class CI_DB_active_record extends CI_DB_driver { foreach ($field as $k => $v) { $k = $this->_protect_identifiers($k); - - $prefix = (count($this->ar_like) == 0) ? '' : $type; - + $prefix = (count($this->ar_like) === 0) ? '' : $type; $v = $this->escape_like_str($v); - if ($side == 'none') + if ($side === 'none') { $like_statement = $prefix." $k $not LIKE '{$v}'"; } - elseif ($side == 'before') + elseif ($side === 'before') { $like_statement = $prefix." $k $not LIKE '%{$v}'"; } - elseif ($side == 'after') + elseif ($side === 'after') { $like_statement = $prefix." $k $not LIKE '{$v}%'"; } @@ -715,6 +700,7 @@ class CI_DB_active_record extends CI_DB_driver { } } + return $this; } @@ -730,13 +716,10 @@ class CI_DB_active_record extends CI_DB_driver { public function group_start($not = '', $type = 'AND ') { $type = $this->_group_get_type($type); - $this->ar_where_group_started = TRUE; + $prefix = (count($this->ar_where) === 0 AND count($this->ar_cache_where) === 0) ? '' : $type; + $this->ar_where[] = $value = $prefix.$not.str_repeat(' ', ++$this->ar_where_group_count).' ('; - $prefix = (count($this->ar_where) == 0 AND count($this->ar_cache_where) == 0) ? '' : $type; - $value = $prefix . $not . str_repeat(' ', ++$this->ar_where_group_count) . ' ('; - - $this->ar_where[] = $value; if ($this->ar_caching) { $this->ar_cache_where[] = $value; @@ -790,16 +773,14 @@ class CI_DB_active_record extends CI_DB_driver { */ public function group_end() { - $value = str_repeat(' ', $this->ar_where_group_count--) . ')'; + $this->ar_where_group_started = FALSE; + $this->ar_where[] = $value = str_repeat(' ', $this->ar_where_group_count--) . ')'; - $this->ar_where[] = $value; if ($this->ar_caching) { $this->ar_cache_where[] = $value; } - $this->ar_where_group_started = FALSE; - return $this; } @@ -845,15 +826,16 @@ class CI_DB_active_record extends CI_DB_driver { if ($val != '') { - $this->ar_groupby[] = $this->_protect_identifiers($val); + $this->ar_groupby[] = $val = $this->_protect_identifiers($val); if ($this->ar_caching === TRUE) { - $this->ar_cache_groupby[] = $this->_protect_identifiers($val); + $this->ar_cache_groupby[] = $val; $this->ar_cache_exists[] = 'groupby'; } } } + return $this; } @@ -909,7 +891,7 @@ class CI_DB_active_record extends CI_DB_driver { foreach ($key as $k => $v) { - $prefix = (count($this->ar_having) == 0) ? '' : $type; + $prefix = (count($this->ar_having) === 0) ? '' : $type; if ($escape === TRUE) { @@ -949,7 +931,7 @@ class CI_DB_active_record extends CI_DB_driver { */ public function order_by($orderby, $direction = '', $escape = TRUE) { - if (strtolower($direction) == 'random') + if (strtolower($direction) === 'random') { $orderby = ''; // Random results want or don't need a field name $direction = $this->_random_keyword; @@ -960,7 +942,7 @@ class CI_DB_active_record extends CI_DB_driver { } - if ((strpos($orderby, ',') !== FALSE) && ($escape === TRUE)) + if ((strpos($orderby, ',') !== FALSE) && $escape === TRUE) { $temp = array(); foreach (explode(',', $orderby) as $part) @@ -976,7 +958,7 @@ class CI_DB_active_record extends CI_DB_driver { $orderby = implode(', ', $temp); } - else if ($direction != $this->_random_keyword) + elseif ($direction != $this->_random_keyword) { if ($escape === TRUE) { @@ -984,9 +966,8 @@ class CI_DB_active_record extends CI_DB_driver { } } - $orderby_statement = $orderby.$direction; + $this->ar_orderby[] = $orderby_statement = $orderby.$direction; - $this->ar_orderby[] = $orderby_statement; if ($this->ar_caching === TRUE) { $this->ar_cache_orderby[] = $orderby_statement; @@ -1121,9 +1102,7 @@ class CI_DB_active_record extends CI_DB_driver { $this->limit($limit, $offset); } - $sql = $this->_compile_select(); - - $result = $this->query($sql); + $result = $this->query($this->_compile_select()); $this->_reset_select(); return $result; } @@ -1145,12 +1124,10 @@ class CI_DB_active_record extends CI_DB_driver { $this->from($table); } - $sql = $this->_compile_select($this->_count_string . $this->_protect_identifiers('numrows')); - - $query = $this->query($sql); + $result = $this->query($this->_compile_select($this->_count_string.$this->_protect_identifiers('numrows'))); $this->_reset_select(); - if ($query->num_rows() == 0) + if ($query->num_rows() === 0) { return 0; } @@ -1188,9 +1165,7 @@ class CI_DB_active_record extends CI_DB_driver { $this->limit($limit, $offset); } - $sql = $this->_compile_select(); - - $result = $this->query($sql); + $result = $this->query($this->_compile_select()); $this->_reset_select(); return $result; } @@ -1213,11 +1188,11 @@ class CI_DB_active_record extends CI_DB_driver { $this->set_insert_batch($set); } - if (count($this->ar_set) == 0) + if (count($this->ar_set) === 0) { if ($this->db_debug) { - //No valid data array. Folds in cases where keys and values did not match up + // No valid data array. Folds in cases where keys and values did not match up return $this->display_error('db_must_use_set'); } return FALSE; @@ -1227,30 +1202,19 @@ class CI_DB_active_record extends CI_DB_driver { { if ( ! isset($this->ar_from[0])) { - if ($this->db_debug) - { - return $this->display_error('db_must_set_table'); - } - return FALSE; + return ($this->db_debug) ? $this->display_error('db_must_set_table') : FALSE; } $table = $this->ar_from[0]; } // Batch this baby - for ($i = 0, $total = count($this->ar_set); $i < $total; $i = $i + 100) + for ($i = 0, $total = count($this->ar_set); $i < $total; $i += 100) { - - $sql = $this->_insert_batch($this->_protect_identifiers($table, TRUE, NULL, FALSE), $this->ar_keys, array_slice($this->ar_set, $i, 100)); - - //echo $sql; - - $this->query($sql); + $this->query($this->_insert_batch($this->_protect_identifiers($table, TRUE, NULL, FALSE), $this->ar_keys, array_slice($this->ar_set, $i, 100))); } $this->_reset_write(); - - return TRUE; } @@ -1294,7 +1258,6 @@ class CI_DB_active_record extends CI_DB_driver { else { $clean = array(); - foreach ($row as $value) { $clean[] = $this->escape($value); @@ -1398,24 +1361,16 @@ class CI_DB_active_record extends CI_DB_driver { */ protected function _validate_insert($table = '') { - if (count($this->ar_set) == 0) + if (count($this->ar_set) === 0) { - if ($this->db_debug) - { - return $this->display_error('db_must_use_set'); - } - return FALSE; + return ($this->db_debug) ? $this->display_error('db_must_use_set') : FALSE; } if ($table == '') { if ( ! isset($this->ar_from[0])) { - if ($this->db_debug) - { - return $this->display_error('db_must_set_table'); - } - return FALSE; + return ($this->db_debug) ? $this->display_error('db_must_set_table') : FALSE; } } else @@ -1444,31 +1399,22 @@ class CI_DB_active_record extends CI_DB_driver { $this->set($set); } - if (count($this->ar_set) == 0) + if (count($this->ar_set) === 0) { - if ($this->db_debug) - { - return $this->display_error('db_must_use_set'); - } - return FALSE; + return ($this->db_debug) ? $this->display_error('db_must_use_set') : FALSE; } if ($table == '') { if ( ! isset($this->ar_from[0])) { - if ($this->db_debug) - { - return $this->display_error('db_must_set_table'); - } - return FALSE; + return ($this->db_debug) ? $this->display_error('db_must_set_table') : FALSE; } $table = $this->ar_from[0]; } $sql = $this->_replace($this->_protect_identifiers($table, TRUE, NULL, FALSE), array_keys($this->ar_set), array_values($this->ar_set)); - $this->_reset_write(); return $this->query($sql); } @@ -1543,7 +1489,6 @@ class CI_DB_active_record extends CI_DB_driver { } $sql = $this->_update($this->_protect_identifiers($this->ar_from[0], TRUE, NULL, FALSE), $this->ar_set, $this->ar_where, $this->ar_orderby, $this->ar_limit, $this->ar_like); - $this->_reset_write(); return $this->query($sql); } @@ -1559,34 +1504,28 @@ class CI_DB_active_record extends CI_DB_driver { * * @access public * @param string the table to update data on - * @return string + * @return bool */ protected function _validate_update($table = '') { if (count($this->ar_set) == 0) { - if ($this->db_debug) - { - return $this->display_error('db_must_use_set'); - } - return FALSE; + return ($this->db_debug) ? $this->display_error('db_must_use_set') : FALSE; } if ($table == '') { if ( ! isset($this->ar_from[0])) { - if ($this->db_debug) - { - return $this->display_error('db_must_set_table'); - } - return FALSE; + return ($this->db_debug) ? $this->display_error('db_must_set_table') : FALSE; } } else { $this->ar_from[0] = $table; } + + return TRUE; } // -------------------------------------------------------------------- @@ -1599,7 +1538,7 @@ class CI_DB_active_record extends CI_DB_driver { * @param string the table to retrieve the results from * @param array an associative array of update values * @param string the where key - * @return object + * @return bool */ public function update_batch($table = '', $set = NULL, $index = NULL) { @@ -1608,12 +1547,7 @@ class CI_DB_active_record extends CI_DB_driver { if (is_null($index)) { - if ($this->db_debug) - { - return $this->display_error('db_must_use_index'); - } - - return FALSE; + return ($this->db_debug) ? $this->display_error('db_must_use_index') : FALSE; } if ( ! is_null($set)) @@ -1621,39 +1555,29 @@ class CI_DB_active_record extends CI_DB_driver { $this->set_update_batch($set, $index); } - if (count($this->ar_set) == 0) + if (count($this->ar_set) === 0) { - if ($this->db_debug) - { - return $this->display_error('db_must_use_set'); - } - - return FALSE; + return ($this->db_debug) ? $this->display_error('db_must_use_set') : FALSE; } if ($table == '') { if ( ! isset($this->ar_from[0])) { - if ($this->db_debug) - { - return $this->display_error('db_must_set_table'); - } - return FALSE; + return ($this->db_debug) ? $this->display_error('db_must_set_table') : FALSE; } $table = $this->ar_from[0]; } // Batch this baby - for ($i = 0, $total = count($this->ar_set); $i < $total; $i = $i + 100) + for ($i = 0, $total = count($this->ar_set); $i < $total; $i += 100) { - $sql = $this->_update_batch($this->_protect_identifiers($table, TRUE, NULL, FALSE), array_slice($this->ar_set, $i, 100), $this->_protect_identifiers($index), $this->ar_where); - - $this->query($sql); + $this->query($this->_update_batch($this->_protect_identifiers($table, TRUE, NULL, FALSE), array_slice($this->ar_set, $i, 100), $this->_protect_identifiers($index), $this->ar_where)); } $this->_reset_write(); + return TRUE; } // -------------------------------------------------------------------- @@ -1679,7 +1603,6 @@ class CI_DB_active_record extends CI_DB_driver { { $index_set = FALSE; $clean = array(); - foreach ($v as $k2 => $v2) { if ($k2 == $index) @@ -1691,14 +1614,7 @@ class CI_DB_active_record extends CI_DB_driver { $not[] = $k.'-'.$v; } - if ($escape === FALSE) - { - $clean[$this->_protect_identifiers($k2)] = $v2; - } - else - { - $clean[$this->_protect_identifiers($k2)] = $this->escape($v2); - } + $clean[$this->_protect_identifiers($k2)] = ($escape === FALSE) ? $v2 : $this->escape($v2); } if ($index_set == FALSE) @@ -1728,11 +1644,7 @@ class CI_DB_active_record extends CI_DB_driver { { if ( ! isset($this->ar_from[0])) { - if ($this->db_debug) - { - return $this->display_error('db_must_set_table'); - } - return FALSE; + return ($this->db_debug) ? $this->display_error('db_must_set_table') : FALSE; } $table = $this->ar_from[0]; @@ -1743,9 +1655,7 @@ class CI_DB_active_record extends CI_DB_driver { } $sql = $this->_delete($table); - $this->_reset_write(); - return $this->query($sql); } @@ -1767,11 +1677,7 @@ class CI_DB_active_record extends CI_DB_driver { { if ( ! isset($this->ar_from[0])) { - if ($this->db_debug) - { - return $this->display_error('db_must_set_table'); - } - return FALSE; + return ($this->db_debug) ? $this->display_error('db_must_set_table') : FALSE; } $table = $this->ar_from[0]; @@ -1782,9 +1688,7 @@ class CI_DB_active_record extends CI_DB_driver { } $sql = $this->_truncate($table); - $this->_reset_write(); - return $this->query($sql); } @@ -1830,11 +1734,7 @@ class CI_DB_active_record extends CI_DB_driver { { if ( ! isset($this->ar_from[0])) { - if ($this->db_debug) - { - return $this->display_error('db_must_set_table'); - } - return FALSE; + return ($this->db_debug) ? $this->display_error('db_must_set_table') : FALSE; } $table = $this->ar_from[0]; @@ -1864,29 +1764,18 @@ class CI_DB_active_record extends CI_DB_driver { $this->limit($limit); } - if (count($this->ar_where) == 0 && count($this->ar_wherein) == 0 && count($this->ar_like) == 0) + if (count($this->ar_where) === 0 && count($this->ar_wherein) === 0 && count($this->ar_like) === 0) { - if ($this->db_debug) - { - return $this->display_error('db_del_must_use_where'); - } - - return FALSE; + return ($this->db_debug) ? $this->display_error('db_del_must_use_where') : FALSE; } $sql = $this->_delete($table, $this->ar_where, $this->ar_like, $this->ar_limit); - if ($reset_data) { $this->_reset_write(); } - if ($this->return_delete_sql === true) - { - return $sql; - } - - return $this->query($sql); + return ($this->return_delete_sql === TRUE) ? $sql : $this->query($sql); } // -------------------------------------------------------------------- @@ -1953,13 +1842,13 @@ class CI_DB_active_record extends CI_DB_driver { } // if a table alias is used we can recognize it by a space - if (strpos($table, " ") !== FALSE) + if (strpos($table, ' ') !== FALSE) { // if the alias is written with the AS keyword, remove it $table = preg_replace('/ AS /i', ' ', $table); // Grab the alias - $table = trim(strrchr($table, " ")); + $table = trim(strrchr($table, ' ')); // Store the alias, if it doesn't already exist if ( ! in_array($table, $this->ar_aliased_tables)) @@ -1984,10 +1873,7 @@ class CI_DB_active_record extends CI_DB_driver { // Combine any cached components with the current statements $this->_merge_cache(); - // ---------------------------------------------------------------- - // Write the "select" portion of the query - if ($select_override !== FALSE) { $sql = $select_override; @@ -1996,7 +1882,7 @@ class CI_DB_active_record extends CI_DB_driver { { $sql = ( ! $this->ar_distinct) ? 'SELECT ' : 'SELECT DISTINCT '; - if (count($this->ar_select) == 0) + if (count($this->ar_select) === 0) { $sql .= '*'; } @@ -2015,32 +1901,19 @@ class CI_DB_active_record extends CI_DB_driver { } } - // ---------------------------------------------------------------- - // Write the "FROM" portion of the query - if (count($this->ar_from) > 0) { - $sql .= "\nFROM "; - - $sql .= $this->_from_tables($this->ar_from); + $sql .= "\nFROM ".$this->_from_tables($this->ar_from); } - // ---------------------------------------------------------------- - // Write the "JOIN" portion of the query - if (count($this->ar_join) > 0) { - $sql .= "\n"; - - $sql .= implode("\n", $this->ar_join); + $sql .= "\n".implode("\n", $this->ar_join); } - // ---------------------------------------------------------------- - // Write the "WHERE" portion of the query - if (count($this->ar_where) > 0 OR count($this->ar_like) > 0) { $sql .= "\nWHERE "; @@ -2048,10 +1921,7 @@ class CI_DB_active_record extends CI_DB_driver { $sql .= implode("\n", $this->ar_where); - // ---------------------------------------------------------------- - // Write the "LIKE" portion of the query - if (count($this->ar_like) > 0) { if (count($this->ar_where) > 0) @@ -2062,50 +1932,32 @@ class CI_DB_active_record extends CI_DB_driver { $sql .= implode("\n", $this->ar_like); } - // ---------------------------------------------------------------- - // Write the "GROUP BY" portion of the query - if (count($this->ar_groupby) > 0) { - $sql .= "\nGROUP BY "; - - $sql .= implode(', ', $this->ar_groupby); + $sql .= "\nGROUP BY ".implode(', ', $this->ar_groupby); } - // ---------------------------------------------------------------- - // Write the "HAVING" portion of the query - if (count($this->ar_having) > 0) { - $sql .= "\nHAVING "; - $sql .= implode("\n", $this->ar_having); + $sql .= "\nHAVING ".implode("\n", $this->ar_having); } - // ---------------------------------------------------------------- - // Write the "ORDER BY" portion of the query - if (count($this->ar_orderby) > 0) { - $sql .= "\nORDER BY "; - $sql .= implode(', ', $this->ar_orderby); - + $sql .= "\nORDER BY ".implode(', ', $this->ar_orderby); if ($this->ar_order !== FALSE) { $sql .= ($this->ar_order == 'desc') ? ' DESC' : ' ASC'; } } - // ---------------------------------------------------------------- - // Write the "LIMIT" portion of the query - if (is_numeric($this->ar_limit)) { - $sql .= "\n"; - $sql = $this->_limit($sql, $this->ar_limit, $this->ar_offset); + return $this->_limit($sql."\n", $this->ar_limit, $this->ar_offset); } return $sql; @@ -2165,14 +2017,12 @@ class CI_DB_active_record extends CI_DB_driver { foreach ($fields as $val) { // There are some built in keys we need to ignore for this conversion - if ($val != '_parent_name') + if ($val !== '_parent_name') { - $i = 0; foreach ($out[$val] as $data) { - $array[$i][$val] = $data; - $i++; + $array[$i++][$val] = $data; } } } @@ -2247,7 +2097,7 @@ class CI_DB_active_record extends CI_DB_driver { */ protected function _merge_cache() { - if (count($this->ar_cache_exists) == 0) + if (count($this->ar_cache_exists) === 0) { return; } @@ -2257,7 +2107,7 @@ class CI_DB_active_record extends CI_DB_driver { $ar_variable = 'ar_'.$val; $ar_cache_var = 'ar_cache_'.$val; - if (count($this->$ar_cache_var) == 0) + if (count($this->$ar_cache_var) === 0) { continue; } @@ -2282,7 +2132,6 @@ class CI_DB_active_record extends CI_DB_driver { * * Publicly-visible method to reset the AR values. * - * @access public * @return void */ public function reset_query() @@ -2319,25 +2168,24 @@ class CI_DB_active_record extends CI_DB_driver { */ protected function _reset_select() { - $ar_reset_items = array( - 'ar_select' => array(), - 'ar_from' => array(), - 'ar_join' => array(), - 'ar_where' => array(), - 'ar_like' => array(), - 'ar_groupby' => array(), - 'ar_having' => array(), - 'ar_orderby' => array(), - 'ar_wherein' => array(), - 'ar_aliased_tables' => array(), - 'ar_no_escape' => array(), - 'ar_distinct' => FALSE, - 'ar_limit' => FALSE, - 'ar_offset' => FALSE, - 'ar_order' => FALSE, - ); - - $this->_reset_run($ar_reset_items); + $this->_reset_run(array( + 'ar_select' => array(), + 'ar_from' => array(), + 'ar_join' => array(), + 'ar_where' => array(), + 'ar_like' => array(), + 'ar_groupby' => array(), + 'ar_having' => array(), + 'ar_orderby' => array(), + 'ar_wherein' => array(), + 'ar_aliased_tables' => array(), + 'ar_no_escape' => array(), + 'ar_distinct' => FALSE, + 'ar_limit' => FALSE, + 'ar_offset' => FALSE, + 'ar_order' => FALSE + ) + ); } // -------------------------------------------------------------------- @@ -2351,19 +2199,19 @@ class CI_DB_active_record extends CI_DB_driver { */ protected function _reset_write() { - $ar_reset_items = array( - 'ar_set' => array(), - 'ar_from' => array(), - 'ar_where' => array(), - 'ar_like' => array(), - 'ar_orderby' => array(), - 'ar_keys' => array(), - 'ar_limit' => FALSE, - 'ar_order' => FALSE - ); - - $this->_reset_run($ar_reset_items); + $this->_reset_run(array( + 'ar_set' => array(), + 'ar_from' => array(), + 'ar_where' => array(), + 'ar_like' => array(), + 'ar_orderby' => array(), + 'ar_keys' => array(), + 'ar_limit' => FALSE, + 'ar_order' => FALSE + ) + ); } + } /* End of file DB_active_rec.php */ diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index 1ff046c21..79651fcb0 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -1,13 +1,13 @@ -CI - // and load the file helper since we use it a lot + // Assign the main CI object to $this->CI and load the file helper since we use it a lot $this->CI =& get_instance(); $this->db =& $db; $this->CI->load->helper('file'); @@ -59,11 +50,10 @@ class CI_DB_Cache { /** * Set Cache Directory Path * - * @access public * @param string the path to the cache directory * @return bool */ - function check_path($path = '') + public function check_path($path = '') { if ($path == '') { @@ -76,7 +66,7 @@ class CI_DB_Cache { } // Add a trailing slash to the path if needed - $path = preg_replace("/(.+?)\/*$/", "\\1/", $path); + $path = preg_replace('/(.+?)\/*$/', '\\1/', $path); if ( ! is_dir($path) OR ! is_really_writable($path)) { @@ -96,10 +86,9 @@ class CI_DB_Cache { * The URI being requested will become the name of the cache sub-folder. * An MD5 hash of the SQL statement will become the cache file name * - * @access public * @return string */ - function read($sql) + public function read($sql) { if ( ! $this->check_path()) { @@ -107,9 +96,7 @@ class CI_DB_Cache { } $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))) @@ -125,10 +112,9 @@ class CI_DB_Cache { /** * Write a query to a cache file * - * @access public * @return bool */ - function write($sql, $object) + public function write($sql, $object) { if ( ! $this->check_path()) { @@ -136,11 +122,8 @@ class CI_DB_Cache { } $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); if ( ! @is_dir($dir_path)) @@ -167,10 +150,9 @@ class CI_DB_Cache { /** * Delete cache files within a particular directory * - * @access public * @return bool */ - function delete($segment_one = '', $segment_two = '') + public function delete($segment_one = '', $segment_two = '') { if ($segment_one == '') { @@ -183,7 +165,6 @@ class CI_DB_Cache { } $dir_path = $this->db->cachedir.$segment_one.'+'.$segment_two.'/'; - delete_files($dir_path, TRUE); } @@ -192,16 +173,14 @@ class CI_DB_Cache { /** * Delete all existing cache files * - * @access public * @return bool */ - function delete_all() + public function delete_all() { delete_files($this->db->cachedir, TRUE); } } - /* End of file DB_cache.php */ -/* Location: ./system/database/DB_cache.php */ \ No newline at end of file +/* Location: ./system/database/DB_cache.php */ diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php index 762d18a46..336e9497d 100644 --- a/system/database/DB_forge.php +++ b/system/database/DB_forge.php @@ -1,13 +1,13 @@ -db $CI =& get_instance(); $this->db =& $CI->db; - log_message('debug', "Database Forge Class Initialized"); + log_message('debug', 'Database Forge Class Initialized'); } // -------------------------------------------------------------------- @@ -60,20 +54,13 @@ class CI_DB_forge { /** * Create database * - * @access public * @param string the database name * @return bool */ - function create_database($db_name) + public function create_database($db_name) { $sql = $this->_create_database($db_name); - - if (is_bool($sql)) - { - return $sql; - } - - return $this->db->query($sql); + return is_bool($sql) ? $sql : $this->db->query($sql); } // -------------------------------------------------------------------- @@ -81,20 +68,13 @@ class CI_DB_forge { /** * Drop database * - * @access public * @param string the database name * @return bool */ - function drop_database($db_name) + public function drop_database($db_name) { $sql = $this->_drop_database($db_name); - - if (is_bool($sql)) - { - return $sql; - } - - return $this->db->query($sql); + return is_bool($sql) ? $sql : $this->db->query($sql); } // -------------------------------------------------------------------- @@ -152,7 +132,7 @@ class CI_DB_forge { if (is_string($field)) { - if ($field == 'id') + if ($field === 'id') { $this->add_field(array( 'id' => array( @@ -178,7 +158,7 @@ class CI_DB_forge { { $this->fields = array_merge($this->fields, $field); } - + return $this; } @@ -197,21 +177,14 @@ class CI_DB_forge { show_error('A table name is required for that operation.'); } - if (count($this->fields) == 0) + if (count($this->fields) === 0) { show_error('Field information is required.'); } $sql = $this->_create_table($this->db->dbprefix.$table, $this->fields, $this->primary_keys, $this->keys, $if_not_exists); - $this->_reset(); - - if (is_bool($sql)) - { - return $sql; - } - - return $this->db->query($sql); + return is_bool($sql) ? $sql : $this->db->query($sql); } // -------------------------------------------------------------------- @@ -225,13 +198,7 @@ class CI_DB_forge { public function drop_table($table_name) { $sql = $this->_drop_table($this->db->dbprefix.$table_name); - - if (is_bool($sql)) - { - return $sql; - } - - return $this->db->query($sql); + return is_bool($sql) ? $sql : $this->db->query($sql); } // -------------------------------------------------------------------- @@ -250,8 +217,7 @@ class CI_DB_forge { show_error('A table name is required for that operation.'); } - $sql = $this->_rename_table($this->db->dbprefix.$table_name, $this->db->dbprefix.$new_table_name); - return $this->db->query($sql); + return $this->db->query($this->_rename_table($this->db->dbprefix.$table_name, $this->db->dbprefix.$new_table_name)); } // -------------------------------------------------------------------- @@ -273,8 +239,7 @@ class CI_DB_forge { // add field info into field array, but we can only do one at a time // so we cycle through - - foreach ($field as $k => $v) + foreach (array_keys($field) as $k) { $this->add_field(array($k => $field[$k])); @@ -284,7 +249,6 @@ class CI_DB_forge { } $sql = $this->_alter_table('ADD', $this->db->dbprefix.$table, $this->fields, $after_field); - $this->_reset(); if ($this->db->query($sql) === FALSE) @@ -307,7 +271,6 @@ class CI_DB_forge { */ public function drop_column($table = '', $column_name = '') { - if ($table == '') { show_error('A table name is required for that operation.'); @@ -318,9 +281,7 @@ class CI_DB_forge { show_error('A column name is required for that operation.'); } - $sql = $this->_alter_table('DROP', $this->db->dbprefix.$table, $column_name); - - return $this->db->query($sql); + return $this->db->query($this->_alter_table('DROP', $this->db->dbprefix.$table, $column_name)); } // -------------------------------------------------------------------- @@ -342,8 +303,7 @@ class CI_DB_forge { // add field info into field array, but we can only do one at a time // so we cycle through - - foreach ($field as $k => $v) + foreach (array_keys($field) as $k) { // If no name provided, use the current name if ( ! isset($field[$k]['name'])) @@ -352,14 +312,12 @@ 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.'); } $sql = $this->_alter_table('CHANGE', $this->db->dbprefix.$table, $this->fields); - $this->_reset(); if ($this->db->query($sql) === FALSE) @@ -382,12 +340,10 @@ class CI_DB_forge { */ protected function _reset() { - $this->fields = array(); - $this->keys = array(); - $this->primary_keys = array(); + $this->fields = $this->keys = $this->primary_keys = array(); } } /* End of file DB_forge.php */ -/* Location: ./system/database/DB_forge.php */ \ No newline at end of file +/* Location: ./system/database/DB_forge.php */ diff --git a/system/database/DB_result.php b/system/database/DB_result.php index c4ed20b76..730443222 100644 --- a/system/database/DB_result.php +++ b/system/database/DB_result.php @@ -1,13 +1,13 @@ -result_array(); - else if ($type == 'object') return $this->result_object(); + if ($type === 'array') return $this->result_array(); + elseif ($type === 'object') return $this->result_object(); else return $this->custom_result_object($type); } @@ -69,8 +65,8 @@ class CI_DB_result { /** * Custom query result. * - * @param class_name A string that represents the type of object you want back - * @return array of objects + * @param string A string that represents the type of object you want back + * @return array of objects */ public function custom_result_object($class_name) { @@ -91,7 +87,6 @@ class CI_DB_result { while ($row = $this->_fetch_object()) { $object = new $class_name(); - foreach ($row as $key => $value) { $object->$key = $value; @@ -109,7 +104,6 @@ class CI_DB_result { /** * Query result. "object" version. * - * @access public * @return object */ public function result_object() @@ -141,7 +135,6 @@ class CI_DB_result { /** * Query result. "array" version. * - * @access public * @return array */ public function result_array() @@ -173,7 +166,6 @@ class CI_DB_result { /** * Query result. Acts as a wrapper function for the following functions. * - * @access public * @param string * @param string can be "object" or "array" * @return mixed either a result object or array @@ -197,8 +189,8 @@ class CI_DB_result { $n = 0; } - if ($type == 'object') return $this->row_object($n); - else if ($type == 'array') return $this->row_array($n); + if ($type === 'object') return $this->row_object($n); + elseif ($type === 'array') return $this->row_array($n); else return $this->custom_row_object($n, $type); } @@ -207,8 +199,7 @@ class CI_DB_result { /** * Assigns an item into a particular column slot * - * @access public - * @return object + * @return void */ public function set_row($key, $value = NULL) { @@ -224,7 +215,6 @@ class CI_DB_result { { $this->row_data[$k] = $v; } - return; } @@ -239,14 +229,12 @@ class CI_DB_result { /** * Returns a single result row - custom object version * - * @access public * @return object */ public function custom_row_object($n, $type) { $result = $this->custom_result_object($type); - - if (count($result) == 0) + if (count($result) === 0) { return $result; } @@ -262,14 +250,12 @@ class CI_DB_result { /** * Returns a single result row - object version * - * @access public * @return object */ public function row_object($n = 0) { $result = $this->result_object(); - - if (count($result) == 0) + if (count($result) === 0) { return $result; } @@ -287,14 +273,12 @@ class CI_DB_result { /** * Returns a single result row - array version * - * @access public * @return array */ public function row_array($n = 0) { $result = $this->result_array(); - - if (count($result) == 0) + if (count($result) === 0) { return $result; } @@ -313,18 +297,12 @@ class CI_DB_result { /** * Returns the "first" row * - * @access public * @return object */ public function first_row($type = 'object') { $result = $this->result($type); - - if (count($result) == 0) - { - return $result; - } - return $result[0]; + return (count($result) === 0) ? $result : $result[0]; } // -------------------------------------------------------------------- @@ -332,18 +310,12 @@ class CI_DB_result { /** * Returns the "last" row * - * @access public * @return object */ public function last_row($type = 'object') { $result = $this->result($type); - - if (count($result) == 0) - { - return $result; - } - return $result[count($result) -1]; + return (count($result) === 0) ? $result : $result[count($result) - 1]; } // -------------------------------------------------------------------- @@ -351,14 +323,12 @@ class CI_DB_result { /** * Returns the "next" row * - * @access public * @return object */ public function next_row($type = 'object') { $result = $this->result($type); - - if (count($result) == 0) + if (count($result) === 0) { return $result; } @@ -376,14 +346,12 @@ class CI_DB_result { /** * Returns the "previous" row * - * @access public * @return object */ public function previous_row($type = 'object') { $result = $this->result($type); - - if (count($result) == 0) + if (count($result) === 0) { return $result; } @@ -416,7 +384,6 @@ class CI_DB_result { protected function _fetch_object() { return array(); } } -// END DB_result class /* End of file DB_result.php */ /* Location: ./system/database/DB_result.php */ diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php index 8db4f3bac..4c881d8a1 100644 --- a/system/database/DB_utility.php +++ b/system/database/DB_utility.php @@ -1,13 +1,13 @@ -db $CI =& get_instance(); $this->db =& $CI->db; - - log_message('debug', "Database Utility Class Initialized"); + log_message('debug', 'Database Utility Class Initialized'); } // -------------------------------------------------------------------- @@ -59,10 +50,9 @@ class CI_DB_utility extends CI_DB_forge { /** * List databases * - * @access public * @return bool */ - function list_databases() + public function list_databases() { // Is there a cached result? if (isset($this->data_cache['db_names'])) @@ -80,8 +70,7 @@ class CI_DB_utility extends CI_DB_forge { } } - $this->data_cache['db_names'] = $dbs; - return $this->data_cache['db_names']; + return $this->data_cache['db_names'] = $dbs; } // -------------------------------------------------------------------- @@ -89,11 +78,10 @@ class CI_DB_utility extends CI_DB_forge { /** * Determine if a particular database exists * - * @access public * @param string * @return boolean */ - function database_exists($database_name) + public function database_exists($database_name) { // Some databases won't have access to the list_databases() function, so // this is intended to allow them to override with their own functions as @@ -114,17 +102,17 @@ class CI_DB_utility extends CI_DB_forge { /** * Optimize Table * - * @access public * @param string the table name * @return bool */ - function optimize_table($table_name) + public function optimize_table($table_name) { $sql = $this->_optimize_table($table_name); if (is_bool($sql)) { - show_error('db_must_use_set'); + show_error('db_must_use_set'); + return FALSE; } $query = $this->db->query($sql); @@ -140,10 +128,9 @@ class CI_DB_utility extends CI_DB_forge { /** * Optimize Database * - * @access public * @return array */ - function optimize_database() + public function optimize_database() { $result = array(); foreach ($this->db->list_tables() as $table_name) @@ -177,11 +164,10 @@ class CI_DB_utility extends CI_DB_forge { /** * Repair Table * - * @access public * @param string the table name * @return bool */ - function repair_table($table_name) + public function repair_table($table_name) { $sql = $this->_repair_table($table_name); @@ -203,14 +189,13 @@ class CI_DB_utility extends CI_DB_forge { /** * Generate CSV from a query result object * - * @access public * @param object The query result object * @param string The delimiter - comma by default * @param string The newline character - \n by default * @param string The enclosure - double quote by default * @return string */ - function csv_from_result($query, $delim = ",", $newline = "\n", $enclosure = '"') + public function csv_from_result($query, $delim = ',', $newline = "\n", $enclosure = '"') { if ( ! is_object($query) OR ! method_exists($query, 'list_fields')) { @@ -218,15 +203,13 @@ class CI_DB_utility extends CI_DB_forge { } $out = ''; - // First generate the headings from the table column names foreach ($query->list_fields() as $name) { $out .= $enclosure.str_replace($enclosure, $enclosure.$enclosure, $name).$enclosure.$delim; } - $out = rtrim($out); - $out .= $newline; + $out = rtrim($out).$newline; // Next blast through the result array and build out the rows foreach ($query->result_array() as $row) @@ -235,8 +218,7 @@ class CI_DB_utility extends CI_DB_forge { { $out .= $enclosure.str_replace($enclosure, $enclosure.$enclosure, $item).$enclosure.$delim; } - $out = rtrim($out); - $out .= $newline; + $out = rtrim($out).$newline; } return $out; @@ -247,12 +229,11 @@ class CI_DB_utility extends CI_DB_forge { /** * Generate XML data from a query result object * - * @access public * @param object The query result object * @param array Any preferences * @return string */ - function xml_from_result($query, $params = array()) + public function xml_from_result($query, $params = array()) { if ( ! is_object($query) OR ! method_exists($query, 'list_fields')) { @@ -280,16 +261,14 @@ class CI_DB_utility extends CI_DB_forge { foreach ($query->result_array() as $row) { $xml .= $tab."<{$element}>".$newline; - foreach ($row as $key => $val) { $xml .= $tab.$tab."<{$key}>".xml_convert($val)."".$newline; } $xml .= $tab."".$newline; } - $xml .= "".$newline; - return $xml; + return $xml .= "".$newline; } // -------------------------------------------------------------------- @@ -297,10 +276,9 @@ class CI_DB_utility extends CI_DB_forge { /** * Database Backup * - * @access public * @return void */ - function backup($params = array()) + public function backup($params = array()) { // If the parameters have not been submitted as an // array then we know that it is simply the table @@ -314,14 +292,14 @@ class CI_DB_utility extends CI_DB_forge { // Set up our default preferences $prefs = array( - 'tables' => array(), - 'ignore' => array(), - 'filename' => '', - 'format' => 'gzip', // gzip, zip, txt - 'add_drop' => TRUE, - 'add_insert' => TRUE, - 'newline' => "\n" - ); + 'tables' => array(), + 'ignore' => array(), + 'filename' => '', + 'format' => 'gzip', // gzip, zip, txt + 'add_drop' => TRUE, + 'add_insert' => TRUE, + 'newline' => "\n" + ); // Did the user submit any preferences? If so set them.... if (count($params) > 0) @@ -335,29 +313,23 @@ class CI_DB_utility extends CI_DB_forge { } } - // ------------------------------------------------------ - // Are we backing up a complete database or individual tables? // If no table names were submitted we'll fetch the entire table list - if (count($prefs['tables']) == 0) + if (count($prefs['tables']) === 0) { $prefs['tables'] = $this->db->list_tables(); } - // ------------------------------------------------------ - // Validate the format if ( ! in_array($prefs['format'], array('gzip', 'zip', 'txt'), TRUE)) { $prefs['format'] = 'txt'; } - // ------------------------------------------------------ - - // Is the encoder supported? If not, we'll either issue an + // Is the encoder supported? If not, we'll either issue an // error or use plain text depending on the debug settings - if (($prefs['format'] == 'gzip' AND ! @function_exists('gzencode')) - OR ($prefs['format'] == 'zip' AND ! @function_exists('gzcompress'))) + if (($prefs['format'] === 'gzip' AND ! @function_exists('gzencode')) + OR ($prefs['format'] === 'zip' AND ! @function_exists('gzcompress'))) { if ($this->db->db_debug) { @@ -367,60 +339,49 @@ class CI_DB_utility extends CI_DB_forge { $prefs['format'] = 'txt'; } - // ------------------------------------------------------ - - // Set the filename if not provided - Only needed with Zip files - if ($prefs['filename'] == '' AND $prefs['format'] == 'zip') - { - $prefs['filename'] = (count($prefs['tables']) == 1) ? $prefs['tables'] : $this->db->database; - $prefs['filename'] .= '_'.date('Y-m-d_H-i', time()); - } - - // ------------------------------------------------------ - - // Was a Gzip file requested? - if ($prefs['format'] == 'gzip') - { - return gzencode($this->_backup($prefs)); - } - - // ------------------------------------------------------ - - // Was a text file requested? - if ($prefs['format'] == 'txt') - { - return $this->_backup($prefs); - } - - // ------------------------------------------------------ - // Was a Zip file requested? - if ($prefs['format'] == 'zip') + if ($prefs['format'] === 'zip') { - // If they included the .zip file extension we'll remove it - if (preg_match("|.+?\.zip$|", $prefs['filename'])) + // Set the filename if not provided (only needed with Zip files) + if ($prefs['filename'] == '') { - $prefs['filename'] = str_replace('.zip', '', $prefs['filename']); + $prefs['filename'] = (count($prefs['tables']) === 1 ? $prefs['tables'] : $this->db->database) + .date('Y-m-d_H-i', time()).'.sql'; } - - // Tack on the ".sql" file extension if needed - if ( ! preg_match("|.+?\.sql$|", $prefs['filename'])) + else { - $prefs['filename'] .= '.sql'; + // If they included the .zip file extension we'll remove it + if (preg_match('|.+?\.zip$|', $prefs['filename'])) + { + $prefs['filename'] = str_replace('.zip', '', $prefs['filename']); + } + + // Tack on the ".sql" file extension if needed + if ( ! preg_match('|.+?\.sql$|', $prefs['filename'])) + { + $prefs['filename'] .= '.sql'; + } } // Load the Zip class and output it - $CI =& get_instance(); $CI->load->library('zip'); $CI->zip->add_data($prefs['filename'], $this->_backup($prefs)); return $CI->zip->get_zip(); } + elseif ($prefs['format'] == 'txt') // Was a text file requested? + { + return $this->_backup($prefs); + } + elseif ($prefs['format'] === 'gzip') // Was a Gzip file requested? + { + return gzencode($this->_backup($prefs)); + } + return; } } - /* End of file DB_utility.php */ -/* Location: ./system/database/DB_utility.php */ \ No newline at end of file +/* Location: ./system/database/DB_utility.php */ -- cgit v1.2.3-24-g4f1b From 75f7c12815c62782163a54e84707f50459b6ef5d Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sun, 8 Jan 2012 03:49:25 +0200 Subject: Remove loading of ['core'] elements --- system/core/Loader.php | 7 ------- user_guide_src/source/changelog.rst | 7 ++++--- user_guide_src/source/installation/upgrade_300.rst | 9 +++++++-- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/system/core/Loader.php b/system/core/Loader.php index 689ae1ecd..272fe4291 100644 --- a/system/core/Loader.php +++ b/system/core/Loader.php @@ -1165,13 +1165,6 @@ class CI_Loader { } } - // A little tweak to remain backward compatible - // The $autoload['core'] item was deprecated - if ( ! isset($autoload['libraries']) AND isset($autoload['core'])) - { - $autoload['libraries'] = $autoload['core']; - } - // Load libraries if (isset($autoload['libraries']) AND count($autoload['libraries']) > 0) { diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 763f58b8f..7e7be0689 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -31,6 +31,8 @@ Release Date: Not Released - Added application/xml for xml and application/xml, text/xsl for xsl in mimes.php. - Changed logger to only chmod when file is first created. - Removed previously deprecated SHA1 Library. + - Removed previously deprecated use of ``$autoload['core']`` in application/config/autoload.php. + Only entries in ``$autoload['libraries']`` are auto-loaded now. - Helpers @@ -66,10 +68,9 @@ Release Date: Not Released - Core - - Changed private functions in CI_URI to protected so MY_URI can - override them. + - Changed private functions in CI_URI to protected so MY_URI can override them. - Removed CI_CORE boolean constant from CodeIgniter.php (no longer Reactor and Core versions). - - Added method get_vars() to CI_Loader to retrieve all variables loaded with $this->load->vars() + - Added method get_vars() to CI_Loader to retrieve all variables loaded with $this->load->vars(). Bug fixes for 3.0 ------------------ diff --git a/user_guide_src/source/installation/upgrade_300.rst b/user_guide_src/source/installation/upgrade_300.rst index 960485ae3..4c594ab17 100644 --- a/user_guide_src/source/installation/upgrade_300.rst +++ b/user_guide_src/source/installation/upgrade_300.rst @@ -15,6 +15,9 @@ 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: Change References to the SHA Library ============================================ @@ -23,6 +26,8 @@ Alter your code to use the native `sha1()` PHP function to generate a sha1 hash. Additionally, the `sha1()` method in the :doc:`Encryption Library <../libraries/encryption>` has been removed. +Step 3: Remove $autoload['core'] from your config/autoload.php +============================================================== -.. note:: If you have any custom developed files in these folders please - make copies of them first. +Use of the `$autoload['core']` config array has been deprecated as of CodeIgniter 1.4.1 and is now removed. +Move any entries that you might have listed there to `$autoload['libraries']` instead. -- cgit v1.2.3-24-g4f1b From 137749793d6cce57e03904f05239fa80eec48d13 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sun, 8 Jan 2012 04:30:33 +0200 Subject: Switch some public properties to protected --- system/core/Input.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/system/core/Input.php b/system/core/Input.php index 07bb30b15..13bf76fd6 100755 --- a/system/core/Input.php +++ b/system/core/Input.php @@ -57,20 +57,20 @@ class CI_Input { * * @var bool */ - public $_allow_get_array = TRUE; + protected $_allow_get_array = TRUE; /** * If TRUE, then newlines are standardized * * @var bool */ - public $_standardize_newlines = TRUE; + 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 * * @var bool */ - public $_enable_xss = FALSE; + protected $_enable_xss = FALSE; /** * Enables a CSRF cookie token to be set. * Set automatically based on config setting @@ -85,17 +85,15 @@ class CI_Input { */ protected $headers = array(); - /** * Constructor * * Sets whether to globally enable the XSS processing * and whether to allow the $_GET array - * */ public function __construct() { - log_message('debug', "Input Class Initialized"); + log_message('debug', 'Input Class Initialized'); $this->_allow_get_array = (config_item('allow_get_array') === TRUE); $this->_enable_xss = (config_item('global_xss_filtering') === TRUE); -- cgit v1.2.3-24-g4f1b From c90d651e8531142d36326d5c3451d7899fb00f76 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sun, 8 Jan 2012 04:35:02 +0200 Subject: Style guide stuff --- system/core/Output.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/system/core/Output.php b/system/core/Output.php index 272545046..1beee734f 100755 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -488,8 +488,7 @@ class CI_Output { $uri = $CFG->item('base_url').$CFG->item('index_page').$URI->uri_string; $filepath = $cache_path.md5($uri); - if ( ! @file_exists($filepath) - OR ! $fp = @fopen($filepath, FOPEN_READ)) + if ( ! @file_exists($filepath) OR ! $fp = @fopen($filepath, FOPEN_READ)) { return FALSE; } @@ -508,8 +507,7 @@ class CI_Output { } // Has the file expired? If so we'll delete it. - if (time() >= trim(str_replace('TS--->', '', $match[1])) - AND is_really_writable($cache_path)) + if (time() >= trim(str_replace('TS--->', '', $match[1])) && is_really_writable($cache_path)) { @unlink($filepath); log_message('debug', 'Cache file has expired. File deleted.'); -- cgit v1.2.3-24-g4f1b From 0f7decce7cb64566e63bd910557006f041514d89 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sun, 8 Jan 2012 04:40:29 +0200 Subject: Swap two vars for readability --- system/database/DB_active_rec.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php index 30a17d11a..71762a4de 100644 --- a/system/database/DB_active_rec.php +++ b/system/database/DB_active_rec.php @@ -278,7 +278,7 @@ class CI_DB_active_record extends CI_DB_driver { { $v = trim($v); $this->_track_aliases($v); - $this->ar_from[] = $v = $this->_protect_identifiers($v, TRUE, NULL, FALSE); + $v = $this->ar_from[] = $this->_protect_identifiers($v, TRUE, NULL, FALSE); if ($this->ar_caching === TRUE) { -- cgit v1.2.3-24-g4f1b From 29ce5d90b4276fc8a4e9354c1435963111f09a24 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sun, 8 Jan 2012 04:43:31 +0200 Subject: Replace AND with && --- system/core/CodeIgniter.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php index e3d818825..cb5d439bd 100755 --- a/system/core/CodeIgniter.php +++ b/system/core/CodeIgniter.php @@ -59,7 +59,7 @@ * Load the framework constants * ------------------------------------------------------ */ - if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/constants.php')) + if (defined('ENVIRONMENT') && file_exists(APPPATH.'config/'.ENVIRONMENT.'/constants.php')) { require(APPPATH.'config/'.ENVIRONMENT.'/constants.php'); } @@ -96,7 +96,7 @@ * Note: Since the config file data is cached it doesn't * hurt to load it here. */ - if (isset($assign_to_config['subclass_prefix']) AND $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'])); } @@ -106,8 +106,8 @@ * Set a liberal script execution time limit * ------------------------------------------------------ */ - if (function_exists('set_time_limit') AND @ini_get('safe_mode') == 0 - AND php_sapi_name() !== 'cli') // Do not override the Time Limit value if running from Command Line + 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); } @@ -195,7 +195,7 @@ * ------------------------------------------------------ */ if ($EXT->_call_hook('cache_override') === FALSE - AND $OUT->_display_cache($CFG, $URI) == TRUE) + && $OUT->_display_cache($CFG, $URI) == TRUE) { exit; } @@ -393,7 +393,7 @@ * Close the DB connection if one exists * ------------------------------------------------------ */ - if (class_exists('CI_DB') AND isset($CI->db)) + if (class_exists('CI_DB') && isset($CI->db)) { $CI->db->close(); } -- cgit v1.2.3-24-g4f1b From 90cfe14b8458a3c84825a741cd750c5a02690f3b Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sun, 8 Jan 2012 04:46:42 +0200 Subject: Switch private methods to protected --- system/core/Input.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/system/core/Input.php b/system/core/Input.php index 13bf76fd6..7a16e51ab 100755 --- a/system/core/Input.php +++ b/system/core/Input.php @@ -391,7 +391,7 @@ class CI_Input { { // IP segments must be digits and can not be // longer than 3 digits or greater then 255 - if ($segment == '' OR preg_match("/[^0-9]/", $segment) OR $segment > 255 OR strlen($segment) > 3) + if ($segment == '' OR preg_match('/[^0-9]/', $segment) OR $segment > 255 OR strlen($segment) > 3) { return FALSE; } @@ -430,7 +430,7 @@ class CI_Input { * * @return void */ - private function _sanitize_globals() + protected function _sanitize_globals() { // It would be "wrong" to unset any of these GLOBALS. $protected = array('_SERVER', '_GET', '_POST', '_FILES', '_REQUEST', @@ -516,7 +516,7 @@ class CI_Input { $this->security->csrf_verify(); } - log_message('debug', "Global POST and COOKIE data sanitized"); + log_message('debug', 'Global POST and COOKIE data sanitized'); } // -------------------------------------------------------------------- @@ -530,7 +530,7 @@ class CI_Input { * @param string * @return string */ - private function _clean_input_data($str) + protected function _clean_input_data($str) { if (is_array($str)) { @@ -588,7 +588,7 @@ class CI_Input { * @param string * @return string */ - private function _clean_input_keys($str) + protected function _clean_input_keys($str) { if ( ! preg_match('/^[a-z0-9:_\/-]+$/i', $str)) { -- cgit v1.2.3-24-g4f1b From 8a7d078233bfb80fa01ee090e14ce0664f23b96b Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sun, 8 Jan 2012 05:43:42 +0200 Subject: Remove some tabs --- system/core/Security.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/core/Security.php b/system/core/Security.php index f09298bba..d7881d846 100755 --- a/system/core/Security.php +++ b/system/core/Security.php @@ -176,7 +176,7 @@ class CI_Security { unset($_COOKIE[$this->_csrf_cookie_name]); $this->_csrf_hash = ''; } - + $this->_csrf_set_hash(); $this->csrf_set_cookie(); -- cgit v1.2.3-24-g4f1b From 0609d588a4340fc9a9cfbc0ff76c39bba9ab09fb Mon Sep 17 00:00:00 2001 From: Michiel Vugteveen Date: Sun, 8 Jan 2012 13:26:17 +0100 Subject: Fixes for issue 896 --- system/core/Common.php | 2 +- system/core/Output.php | 3 +-- system/core/URI.php | 5 +++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/system/core/Common.php b/system/core/Common.php index 6ef229629..1f59c02d7 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -235,7 +235,7 @@ if ( ! function_exists('get_config')) } // Is the config file in the environment folder? - if ( ! defined('ENVIRONMENT') OR ! file_exists($file_path = APPPATH.'config/'.ENVIRONMENT..'/config.php')) + if ( ! defined('ENVIRONMENT') OR ! file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/config.php')) { $file_path = APPPATH.'config/config.php'; } diff --git a/system/core/Output.php b/system/core/Output.php index 1beee734f..da5c29044 100755 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -129,7 +129,6 @@ class CI_Output { * * Sets the output string * - * @access public * @param string * @return void */ @@ -282,7 +281,7 @@ class CI_Output { * @param integer * @return void */ - publi function cache($time) + public function cache($time) { $this->cache_expiration = ( ! is_numeric($time)) ? 0 : $time; return $this; diff --git a/system/core/URI.php b/system/core/URI.php index eaf7b752b..b28ee198b 100755 --- a/system/core/URI.php +++ b/system/core/URI.php @@ -186,11 +186,12 @@ class CI_URI { return ''; } - if (strpos($_SERVER['REQUEST_URI'], $_SERVER['SCRIPT_NAME']) === 0) + $uri = $_SERVER['REQUEST_URI']; + if (strpos($uri, $_SERVER['SCRIPT_NAME']) === 0) { $uri = substr($uri, strlen($_SERVER['SCRIPT_NAME'])); } - elseif (strpos($_SERVER['REQUEST_URI'], dirname($_SERVER['SCRIPT_NAME'])) === 0) + elseif (strpos($uri, dirname($_SERVER['SCRIPT_NAME'])) === 0) { $uri = substr($uri, strlen(dirname($_SERVER['SCRIPT_NAME']))); } -- cgit v1.2.3-24-g4f1b From edc875593d3ddbd0fe86caf6380a62b00a20f245 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 9 Jan 2012 09:35:10 +0200 Subject: Fix a possible notice in Output library --- system/core/Output.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/system/core/Output.php b/system/core/Output.php index da5c29044..69a2e5f88 100755 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -397,14 +397,12 @@ class CI_Output { // If the output data contains closing and tags // we will remove them and add them back after we insert the profile data $output = preg_replace('|.*?|is', '', $output, $count).$CI->profiler->run(); - if ($count > 0) + if (isset($count) && $count > 0) { $output .= ''; } } - // -------------------------------------------------------------------- - // Does the controller contain a function named _output()? // If so send the output there. Otherwise, echo it. if (method_exists($CI, '_output')) @@ -413,7 +411,7 @@ class CI_Output { } else { - echo $output; // Send it to the browser! + echo $output; // Send it to the browser! } log_message('debug', 'Final output sent to browser'); -- cgit v1.2.3-24-g4f1b From cba20b164fdb1e60225b4f1fc04b7a31c4ffa106 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 9 Jan 2012 10:16:41 +0200 Subject: Really fix this ... --- system/core/Output.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/system/core/Output.php b/system/core/Output.php index 69a2e5f88..d27133d37 100755 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -396,8 +396,9 @@ class CI_Output { // If the output data contains closing and tags // we will remove them and add them back after we insert the profile data - $output = preg_replace('|.*?|is', '', $output, $count).$CI->profiler->run(); - if (isset($count) && $count > 0) + $count = 0; + $output = preg_replace('|.*?|is', '', $output, -1, $count).$CI->profiler->run(); + if ($count > 0) { $output .= ''; } -- cgit v1.2.3-24-g4f1b From a96a9c8e6c7a113c808ba047808180b33360d3dd Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 9 Jan 2012 11:01:15 +0200 Subject: Remove once again ... --- system/core/Output.php | 1 - 1 file changed, 1 deletion(-) diff --git a/system/core/Output.php b/system/core/Output.php index d27133d37..abd8a0ea9 100755 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -396,7 +396,6 @@ class CI_Output { // If the output data contains closing and tags // we will remove them and add them back after we insert the profile data - $count = 0; $output = preg_replace('|.*?|is', '', $output, -1, $count).$CI->profiler->run(); if ($count > 0) { -- cgit v1.2.3-24-g4f1b From 1d160e78619574bf7fcb3c9b5d6a4bc9f93f2db6 Mon Sep 17 00:00:00 2001 From: Purwandi Date: Mon, 9 Jan 2012 16:33:28 +0700 Subject: Fix error undefined variable query on count_all_results db active record --- system/database/DB_active_rec.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php index 71762a4de..424735157 100644 --- a/system/database/DB_active_rec.php +++ b/system/database/DB_active_rec.php @@ -1127,15 +1127,14 @@ class CI_DB_active_record extends CI_DB_driver { $result = $this->query($this->_compile_select($this->_count_string.$this->_protect_identifiers('numrows'))); $this->_reset_select(); - if ($query->num_rows() === 0) + if ($result->num_rows() === 0) { return 0; } - $row = $query->row(); + $row = $result->row(); return (int) $row->numrows; } - // -------------------------------------------------------------------- /** -- cgit v1.2.3-24-g4f1b From d47baab1bd4d655a68981834d11727ae8c2a3a45 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 9 Jan 2012 16:56:46 +0200 Subject: Fix issue #904 --- system/core/Common.php | 2 +- system/core/Loader.php | 12 +++++------- user_guide_src/source/changelog.rst | 4 ++-- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/system/core/Common.php b/system/core/Common.php index 1f59c02d7..2f9c4ff43 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -199,7 +199,7 @@ if ( ! function_exists('load_class')) */ if ( ! function_exists('is_loaded')) { - function is_loaded($class = '') + function &is_loaded($class = '') { static $_is_loaded = array(); diff --git a/system/core/Loader.php b/system/core/Loader.php index 272fe4291..12daaa928 100644 --- a/system/core/Loader.php +++ b/system/core/Loader.php @@ -250,10 +250,10 @@ class CI_Loader { if (($last_slash = strrpos($model, '/')) !== FALSE) { // The path is in front of the last slash - $path = substr($model, 0, $last_slash + 1); + $path = substr($model, 0, ++$last_slash); // And the model name behind it - $model = substr($model, $last_slash + 1); + $model = substr($model, $last_slash); } if ($name == '') @@ -833,10 +833,9 @@ 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 ((bool) @ini_get('short_open_tag') === FALSE AND config_item('rewrite_short_tags') == TRUE) { - echo eval('?>'.preg_replace("/;*\s*\?>/", "; ?>", str_replace(''.preg_replace('/;*\s*\?>/', '; ?>', str_replace(' $this->_ci_ob_level + 1) { @@ -1233,13 +1231,13 @@ class CI_Loader { { if ( ! is_array($filename)) { - return array(strtolower(str_replace('.php', '', str_replace($extension, '', $filename)).$extension)); + return array(strtolower(str_replace(array($extension, '.php'), '', $filename).$extension)); } else { foreach ($filename as $key => $val) { - $filename[$key] = strtolower(str_replace('.php', '', str_replace($extension, '', $val)).$extension); + $filename[$key] = strtolower(str_replace(array($extension, '.php'), '', $val).$extension); } return $filename; diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index d9eca7fef..48011f208 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -67,12 +67,12 @@ Release Date: Not Released - 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. - - Core - Changed private functions in CI_URI to protected so MY_URI can override them. - Removed CI_CORE boolean constant from CodeIgniter.php (no longer Reactor and Core versions). - Added method get_vars() to CI_Loader to retrieve all variables loaded with $this->load->vars(). + - is_loaded() function from system/core/Commons.php now returns a reference. Bug fixes for 3.0 ------------------ @@ -96,7 +96,7 @@ Bug fixes for 3.0 - 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 (#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. Version 2.1.0 ============= -- cgit v1.2.3-24-g4f1b From 5287f6643f5ca55c360a6372c526c8c06c0c4912 Mon Sep 17 00:00:00 2001 From: insign Date: Mon, 9 Jan 2012 18:07:34 -0200 Subject: Removed the first slash of the line 51. With this, the goal of the code don't work. I tried it in many Apache servers. Sorry if I am wrong. --- user_guide_src/source/general/urls.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/general/urls.rst b/user_guide_src/source/general/urls.rst index 3126fcf36..857078b1c 100644 --- a/user_guide_src/source/general/urls.rst +++ b/user_guide_src/source/general/urls.rst @@ -48,7 +48,7 @@ method in which everything is redirected except the specified items: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d - RewriteRule ^(.*)$ /index.php/$1 [L] + RewriteRule ^(.*)$ index.php/$1 [L] In the above example, any HTTP request other than those for existing directories and existing files is treated as a request for your index.php file. -- cgit v1.2.3-24-g4f1b From 4562f2cbb3e5346c6e341516a31ca87dfa47bafd Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 9 Jan 2012 23:39:50 +0200 Subject: Some more stuff ... --- system/core/Security.php | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/system/core/Security.php b/system/core/Security.php index d7881d846..1007f61f4 100755 --- a/system/core/Security.php +++ b/system/core/Security.php @@ -153,20 +153,13 @@ 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])) + 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? { $this->csrf_show_error(); } - // Do the tokens match? - if ($_POST[$this->_csrf_token_name] != $_COOKIE[$this->_csrf_cookie_name]) - { - $this->csrf_show_error(); - } - - // We kill this since we're done and we don't want to - // polute the _POST array + // We kill this since we're done and we don't want to polute the _POST array unset($_POST[$this->_csrf_token_name]); // Regenerate on every submission? @@ -308,10 +301,9 @@ class CI_Security { * This permits our tests below to work reliably. * We only convert entities that are within tags since * these are the ones that will pose security problems. - * */ $str = preg_replace_callback("/[a-z]+=([\'\"]).*?\\1/si", array($this, '_convert_attribute'), $str); - $str = preg_replace_callback("/<\w+.*?(?=>|<|$)/si", array($this, '_decode_entity'), $str); + $str = preg_replace_callback('/<\w+.*?(?=>|<|$)/si', array($this, '_decode_entity'), $str); // Remove Invisible Characters Again! $str = remove_invisible_characters($str); @@ -326,9 +318,7 @@ class CI_Security { */ $str = str_replace("\t", ' ', $str); - /* - * Capture converted string for later comparison - */ + // Capture converted string for later comparison $converted_string = $str; // Remove Strings that are never allowed @@ -720,12 +710,11 @@ class CI_Security { protected function _filter_attributes($str) { $out = ''; - if (preg_match_all('#\s*[a-z\-]+\s*=\s*(\042|\047)([^\\1]*?)\\1#is', $str, $matches)) { foreach ($matches[0] as $match) { - $out .= preg_replace("#/\*.*?\*/#s", '', $match); + $out .= preg_replace('#/\*.*?\*/#s', '', $match); } } -- cgit v1.2.3-24-g4f1b From 4b13061308301cd307fe5317604265ab934fb046 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 10 Jan 2012 16:09:55 +0200 Subject: Fixed a bug in CI_Lang::load() --- system/core/Lang.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/core/Lang.php b/system/core/Lang.php index 088cb6c9c..c40a6856e 100755 --- a/system/core/Lang.php +++ b/system/core/Lang.php @@ -130,7 +130,7 @@ class CI_Lang { } $this->is_loaded[] = $langfile; - $this->language = $this->language + $lang; + $this->language = array_merge($this->language, $lang); unset($lang); log_message('debug', 'Language file loaded: language/'.$idiom.'/'.$langfile); -- cgit v1.2.3-24-g4f1b From 57f58a27df738408a06307442a9a344414e90016 Mon Sep 17 00:00:00 2001 From: Ronald Beilsma Date: Tue, 10 Jan 2012 15:59:06 +0100 Subject: closedir closes directory handle, not directory path --- system/helpers/file_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php index 9b39b8c20..d76d85691 100644 --- a/system/helpers/file_helper.php +++ b/system/helpers/file_helper.php @@ -205,7 +205,7 @@ if ( ! function_exists('get_filenames')) $_filedata[] = ($include_path == TRUE) ? $source_dir.$file : $file; } } - closedir($source_dir); + closedir($fp); return $_filedata; } -- cgit v1.2.3-24-g4f1b From 92fcffa6c76a2010ee7a2162554b304ba7cf0549 Mon Sep 17 00:00:00 2001 From: Ronald Beilsma Date: Tue, 10 Jan 2012 16:11:00 +0100 Subject: closedir closes directory handle, not directory path --- system/helpers/file_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php index d76d85691..89b2a54db 100644 --- a/system/helpers/file_helper.php +++ b/system/helpers/file_helper.php @@ -259,7 +259,7 @@ if ( ! function_exists('get_dir_file_info')) $_filedata[$file]['relative_path'] = $relative_path; } } - closedir($source_dir); + closedir($fp); return $_filedata; } -- cgit v1.2.3-24-g4f1b From 3b8ad8f6c300b4cec6901e5053495f93e104d267 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 10 Jan 2012 18:09:07 +0200 Subject: Fix a bug in the File helper --- system/helpers/file_helper.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php index 9b39b8c20..2d4b10e37 100644 --- a/system/helpers/file_helper.php +++ b/system/helpers/file_helper.php @@ -196,16 +196,16 @@ if ( ! function_exists('get_filenames')) while (FALSE !== ($file = readdir($fp))) { - if (@is_dir($source_dir.$file) && strncmp($file, '.', 1) !== 0) + if (@is_dir($source_dir.$file) && $file[0] !== '.') { get_filenames($source_dir.$file.DIRECTORY_SEPARATOR, $include_path, TRUE); } - elseif (strncmp($file, '.', 1) !== 0) + elseif ($file[0] !== '.') { $_filedata[] = ($include_path == TRUE) ? $source_dir.$file : $file; } } - closedir($source_dir); + closedir($fp); return $_filedata; } @@ -249,17 +249,17 @@ if ( ! function_exists('get_dir_file_info')) // foreach (scandir($source_dir, 1) as $file) // In addition to being PHP5+, scandir() is simply not as fast while (FALSE !== ($file = readdir($fp))) { - if (@is_dir($source_dir.$file) AND strncmp($file, '.', 1) !== 0 AND $top_level_only === FALSE) + if (@is_dir($source_dir.$file) && $file[0] !== '.' && $top_level_only === FALSE) { get_dir_file_info($source_dir.$file.DIRECTORY_SEPARATOR, $top_level_only, TRUE); } - elseif (strncmp($file, '.', 1) !== 0) + elseif ($file[0] !== '.') { $_filedata[$file] = get_file_info($source_dir.$file); $_filedata[$file]['relative_path'] = $relative_path; } } - closedir($source_dir); + closedir($fp); return $_filedata; } @@ -359,7 +359,7 @@ if ( ! function_exists('get_mime_by_extension')) if ( ! is_array($mimes)) { - if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes.php')) + if (defined('ENVIRONMENT') && is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes.php')) { include(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'); } -- cgit v1.2.3-24-g4f1b From 176b363e534da12a38a75c9e2ba273846dfa35a7 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 10 Jan 2012 18:14:28 +0200 Subject: Fix a bug in system/core/CodeIgniter.php --- system/core/CodeIgniter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php index cb5d439bd..7af3c485d 100755 --- a/system/core/CodeIgniter.php +++ b/system/core/CodeIgniter.php @@ -267,7 +267,7 @@ $method = $RTR->fetch_method(); if ( ! class_exists($class) - OR strpos($method, '_', 1) === 0 + OR strpos($method, '_') === 0 OR in_array(strtolower($method), array_map('strtolower', get_class_methods('CI_Controller'))) ) { -- cgit v1.2.3-24-g4f1b From 8f80bc4f855f78efbcb6344ea29cf67647b6772b Mon Sep 17 00:00:00 2001 From: Ronald Beilsma Date: Thu, 12 Jan 2012 16:41:49 +0100 Subject: array keys should be 0, 1, and 2. key 3 results in error (invalid offset) --- system/libraries/Image_lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index dc7d362ce..a226ae8f8 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -1091,7 +1091,7 @@ class CI_Image_lib { $txt_color = str_split(substr($this->wm_font_color, 1, 6), 2); $txt_color = imagecolorclosest($src_img, hexdec($txt_color[0]), hexdec($txt_color[1]), hexdec($txt_color[2])); $drp_color = str_split(substr($this->wm_shadow_color, 1, 6), 2); - $drp_color = imagecolorclosest($src_img, hexdec($drp_color[0]), hexdec($drp_color[2]), hexdec($drp_color[3])); + $drp_color = imagecolorclosest($src_img, hexdec($drp_color[0]), hexdec($drp_color[1]), hexdec($drp_color[2])); // Add the text to the source image if ($this->wm_use_truetype) -- cgit v1.2.3-24-g4f1b From 7bb95dff569f465ad8887404c2f9d5304a2ff5b3 Mon Sep 17 00:00:00 2001 From: Sean Fisher Date: Mon, 16 Jan 2012 09:23:14 -0500 Subject: APC throws "apc_store() expects parameter 3 to be long, string given". Validates the TTL to an integer. --- system/libraries/Cache/drivers/Cache_apc.php | 1 + 1 file changed, 1 insertion(+) diff --git a/system/libraries/Cache/drivers/Cache_apc.php b/system/libraries/Cache/drivers/Cache_apc.php index 93993d07a..a3dd46978 100644 --- a/system/libraries/Cache/drivers/Cache_apc.php +++ b/system/libraries/Cache/drivers/Cache_apc.php @@ -68,6 +68,7 @@ class CI_Cache_apc extends CI_Driver { */ public function save($id, $data, $ttl = 60) { + $ttl = (int) $ttl; return apc_store($id, array($data, time(), $ttl), $ttl); } -- cgit v1.2.3-24-g4f1b