From c1a66512eacc76968cbf01e2ee37c3c65584b1f0 Mon Sep 17 00:00:00 2001
From: Repox
Date: Mon, 23 Apr 2012 13:14:27 +0200
Subject: Corrected the migration_missing_down_method language string
---
system/language/english/migration_lang.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/system/language/english/migration_lang.php b/system/language/english/migration_lang.php
index 4763ca243..f17530f00 100644
--- a/system/language/english/migration_lang.php
+++ b/system/language/english/migration_lang.php
@@ -5,7 +5,7 @@ $lang['migration_not_found'] = "This migration could not be found.";
$lang['migration_multiple_version'] = "This are multiple migrations with the same version number: %d.";
$lang['migration_class_doesnt_exist'] = "The migration class \"%s\" could not be found.";
$lang['migration_missing_up_method'] = "The migration class \"%s\" is missing an 'up' method.";
-$lang['migration_missing_down_method'] = "The migration class \"%s\" is missing an 'up' method.";
+$lang['migration_missing_down_method'] = "The migration class \"%s\" is missing an 'down' method.";
$lang['migration_invalid_filename'] = "Migration \"%s\" has an invalid filename.";
--
cgit v1.2.3-24-g4f1b
From 5335bc317f07f12c0f0bae5ac9189f75fcad0f1c Mon Sep 17 00:00:00 2001
From: Wes Baker
Date: Tue, 24 Apr 2012 15:17:14 -0400
Subject: Updating XSS cleaning to better handle base64 encoded attributes.
---
system/core/Security.php | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/system/core/Security.php b/system/core/Security.php
index ac39ce97b..65746637b 100755
--- a/system/core/Security.php
+++ b/system/core/Security.php
@@ -99,7 +99,8 @@ class CI_Security {
'javascript\s*:',
'expression\s*(\(|&\#40;)', // CSS and IE
'vbscript\s*:', // IE, surprise!
- 'Redirect\s+302'
+ 'Redirect\s+302',
+ "([\"'])?data\s*:[^\\1]*?base64[^\\1]*?,[^\\1]*?\\1?"
);
public function __construct()
@@ -362,7 +363,7 @@ class CI_Security {
* These words are compacted back to their correct state.
*/
$words = array(
- 'javascript', 'expression', 'vbscript', 'script',
+ 'javascript', 'expression', 'vbscript', 'script', 'base64',
'applet', 'alert', 'document', 'write', 'cookie', 'window'
);
@@ -602,10 +603,11 @@ class CI_Security {
$attribs = array();
// find occurrences of illegal attribute strings without quotes
- preg_match_all('/('.implode('|', $evil_attributes).')\s*=\s*([^\s]*)/is', $str, $matches, PREG_SET_ORDER);
+ preg_match_all('/('.implode('|', $evil_attributes).')\s*=\s*([^\s>]*)/is', $str, $matches, PREG_SET_ORDER);
foreach ($matches as $attr)
{
+
$attribs[] = preg_quote($attr[0], '/');
}
@@ -620,7 +622,7 @@ class CI_Security {
// replace illegal attribute strings that are inside an html tag
if (count($attribs) > 0)
{
- $str = preg_replace('/<(\/?[^><]+?)([^A-Za-z\-])('.implode('|', $attribs).')([\s><])([><]*)/i', '<$1$2$4$5', $str, -1, $count);
+ $str = preg_replace("/<(\/?[^><]+?)([^A-Za-z<>\-])(.*?)(".implode('|', $attribs).")(.*?)([\s><])([><]*)/i", '<$1 $3$5$6$7', $str, -1, $count);
}
} while ($count);
@@ -661,7 +663,7 @@ class CI_Security {
protected function _js_link_removal($match)
{
return str_replace($match[1],
- preg_replace('#href=.*?(alert\(|alert&\#40;|javascript\:|livescript\:|mocha\:|charset\=|window\.|document\.|\.cookie|
-EOF;
- }
-}
-
/* End of file smiley_helper.php */
/* Location: ./system/helpers/smiley_helper.php */
\ No newline at end of file
diff --git a/system/helpers/string_helper.php b/system/helpers/string_helper.php
index aed35c157..b42799a8e 100644
--- a/system/helpers/string_helper.php
+++ b/system/helpers/string_helper.php
@@ -37,22 +37,22 @@
// ------------------------------------------------------------------------
-/**
- * Trim Slashes
- *
- * Removes any leading/trailing slashes from a string:
- *
- * /this/that/theother/
- *
- * becomes:
- *
- * this/that/theother
- *
- * @param string
- * @return string
- */
if ( ! function_exists('trim_slashes'))
{
+ /**
+ * Trim Slashes
+ *
+ * Removes any leading/trailing slashes from a string:
+ *
+ * /this/that/theother/
+ *
+ * becomes:
+ *
+ * this/that/theother
+ *
+ * @param string
+ * @return string
+ */
function trim_slashes($str)
{
return trim($str, '/');
@@ -61,16 +61,16 @@ if ( ! function_exists('trim_slashes'))
// ------------------------------------------------------------------------
-/**
- * Strip Slashes
- *
- * Removes slashes contained in a string or in an array
- *
- * @param mixed string or array
- * @return mixed string or array
- */
if ( ! function_exists('strip_slashes'))
{
+ /**
+ * Strip Slashes
+ *
+ * Removes slashes contained in a string or in an array
+ *
+ * @param mixed string or array
+ * @return mixed string or array
+ */
function strip_slashes($str)
{
if (is_array($str))
@@ -91,16 +91,16 @@ if ( ! function_exists('strip_slashes'))
// ------------------------------------------------------------------------
-/**
- * Strip Quotes
- *
- * Removes single and double quotes from a string
- *
- * @param string
- * @return string
- */
if ( ! function_exists('strip_quotes'))
{
+ /**
+ * Strip Quotes
+ *
+ * Removes single and double quotes from a string
+ *
+ * @param string
+ * @return string
+ */
function strip_quotes($str)
{
return str_replace(array('"', "'"), '', $str);
@@ -109,16 +109,16 @@ if ( ! function_exists('strip_quotes'))
// ------------------------------------------------------------------------
-/**
- * Quotes to Entities
- *
- * Converts single and double quotes to entities
- *
- * @param string
- * @return string
- */
if ( ! function_exists('quotes_to_entities'))
{
+ /**
+ * Quotes to Entities
+ *
+ * Converts single and double quotes to entities
+ *
+ * @param string
+ * @return string
+ */
function quotes_to_entities($str)
{
return str_replace(array("\'","\"","'",'"'), array("'",""","'","""), $str);
@@ -127,23 +127,23 @@ if ( ! function_exists('quotes_to_entities'))
// ------------------------------------------------------------------------
-/**
- * Reduce Double Slashes
- *
- * Converts double slashes in a string to a single slash,
- * except those found in http://
- *
- * http://www.some-site.com//index.php
- *
- * becomes:
- *
- * http://www.some-site.com/index.php
- *
- * @param string
- * @return string
- */
if ( ! function_exists('reduce_double_slashes'))
{
+ /**
+ * Reduce Double Slashes
+ *
+ * Converts double slashes in a string to a single slash,
+ * except those found in http://
+ *
+ * http://www.some-site.com//index.php
+ *
+ * becomes:
+ *
+ * http://www.some-site.com/index.php
+ *
+ * @param string
+ * @return string
+ */
function reduce_double_slashes($str)
{
return preg_replace('#(^|[^:])//+#', '\\1/', $str);
@@ -152,24 +152,24 @@ if ( ! function_exists('reduce_double_slashes'))
// ------------------------------------------------------------------------
-/**
- * Reduce Multiples
- *
- * Reduces multiple instances of a particular character. Example:
- *
- * Fred, Bill,, Joe, Jimmy
- *
- * becomes:
- *
- * Fred, Bill, Joe, Jimmy
- *
- * @param string
- * @param string the character you wish to reduce
- * @param bool TRUE/FALSE - whether to trim the character from the beginning/end
- * @return string
- */
if ( ! function_exists('reduce_multiples'))
{
+ /**
+ * Reduce Multiples
+ *
+ * Reduces multiple instances of a particular character. Example:
+ *
+ * Fred, Bill,, Joe, Jimmy
+ *
+ * becomes:
+ *
+ * Fred, Bill, Joe, Jimmy
+ *
+ * @param string
+ * @param string the character you wish to reduce
+ * @param bool TRUE/FALSE - whether to trim the character from the beginning/end
+ * @return string
+ */
function reduce_multiples($str, $character = ',', $trim = FALSE)
{
$str = preg_replace('#'.preg_quote($character, '#').'{2,}#', $character, $str);
@@ -185,17 +185,17 @@ if ( ! function_exists('reduce_multiples'))
// ------------------------------------------------------------------------
-/**
- * Create a Random String
- *
- * Useful for generating passwords or hashes.
- *
- * @param string type of random string. basic, alpha, alunum, numeric, nozero, unique, md5, encrypt and sha1
- * @param int number of characters
- * @return string
- */
if ( ! function_exists('random_string'))
{
+ /**
+ * Create a Random String
+ *
+ * Useful for generating passwords or hashes.
+ *
+ * @param string type of random string. basic, alpha, alunum, numeric, nozero, unique, md5, encrypt and sha1
+ * @param int number of characters
+ * @return string
+ */
function random_string($type = 'alnum', $len = 8)
{
switch($type)
@@ -242,16 +242,16 @@ if ( ! function_exists('random_string'))
// ------------------------------------------------------------------------
-/**
- * Add's _1 to a string or increment the ending number to allow _2, _3, etc
- *
- * @param string required
- * @param string What should the duplicate number be appended with
- * @param string Which number should be used for the first dupe increment
- * @return string
- */
if ( ! function_exists('increment_string'))
{
+ /**
+ * Add's _1 to a string or increment the ending number to allow _2, _3, etc
+ *
+ * @param string required
+ * @param string What should the duplicate number be appended with
+ * @param string Which number should be used for the first dupe increment
+ * @return string
+ */
function increment_string($str, $separator = '_', $first = 1)
{
preg_match('/(.+)'.$separator.'([0-9]+)$/', $str, $match);
@@ -262,17 +262,17 @@ if ( ! function_exists('increment_string'))
// ------------------------------------------------------------------------
-/**
- * Alternator
- *
- * Allows strings to be alternated. See docs...
- *
- * @param string (as many parameters as needed)
- * @return string
- */
if ( ! function_exists('alternator'))
{
- function alternator()
+ /**
+ * Alternator
+ *
+ * Allows strings to be alternated. See docs...
+ *
+ * @param string (as many parameters as needed)
+ * @return string
+ */
+ function alternator($args)
{
static $i;
@@ -288,15 +288,15 @@ if ( ! function_exists('alternator'))
// ------------------------------------------------------------------------
-/**
- * Repeater function
- *
- * @param string
- * @param int number of repeats
- * @return string
- */
if ( ! function_exists('repeater'))
{
+ /**
+ * Repeater function
+ *
+ * @param string
+ * @param int number of repeats
+ * @return string
+ */
function repeater($data, $num = 1)
{
return ($num > 0) ? str_repeat($data, $num) : '';
diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php
index cc501c334..f53b06b93 100644
--- a/system/helpers/text_helper.php
+++ b/system/helpers/text_helper.php
@@ -37,18 +37,18 @@
// ------------------------------------------------------------------------
-/**
- * Word Limiter
- *
- * Limits a string to X number of words.
- *
- * @param string
- * @param int
- * @param string the end character. Usually an ellipsis
- * @return string
- */
if ( ! function_exists('word_limiter'))
{
+ /**
+ * Word Limiter
+ *
+ * Limits a string to X number of words.
+ *
+ * @param string
+ * @param int
+ * @param string the end character. Usually an ellipsis
+ * @return string
+ */
function word_limiter($str, $limit = 100, $end_char = '…')
{
if (trim($str) == '')
@@ -69,19 +69,19 @@ if ( ! function_exists('word_limiter'))
// ------------------------------------------------------------------------
-/**
- * Character Limiter
- *
- * Limits the string based on the character count. Preserves complete words
- * so the character count may not be exactly as specified.
- *
- * @param string
- * @param int
- * @param string the end character. Usually an ellipsis
- * @return string
- */
if ( ! function_exists('character_limiter'))
{
+ /**
+ * Character Limiter
+ *
+ * Limits the string based on the character count. Preserves complete words
+ * so the character count may not be exactly as specified.
+ *
+ * @param string
+ * @param int
+ * @param string the end character. Usually an ellipsis
+ * @return string
+ */
function character_limiter($str, $n = 500, $end_char = '…')
{
if (strlen($str) < $n)
@@ -112,16 +112,16 @@ if ( ! function_exists('character_limiter'))
// ------------------------------------------------------------------------
-/**
- * High ASCII to Entities
- *
- * Converts High ascii text and MS Word special characters to character entities
- *
- * @param string
- * @return string
- */
if ( ! function_exists('ascii_to_entities'))
{
+ /**
+ * High ASCII to Entities
+ *
+ * Converts High ascii text and MS Word special characters to character entities
+ *
+ * @param string
+ * @return string
+ */
function ascii_to_entities($str)
{
$count = 1;
@@ -172,17 +172,17 @@ if ( ! function_exists('ascii_to_entities'))
// ------------------------------------------------------------------------
-/**
- * Entities to ASCII
- *
- * Converts character entities back to ASCII
- *
- * @param string
- * @param bool
- * @return string
- */
if ( ! function_exists('entities_to_ascii'))
{
+ /**
+ * Entities to ASCII
+ *
+ * Converts character entities back to ASCII
+ *
+ * @param string
+ * @param bool
+ * @return string
+ */
function entities_to_ascii($str, $all = TRUE)
{
if (preg_match_all('/\(\d+)\;/', $str, $matches))
@@ -227,20 +227,20 @@ if ( ! function_exists('entities_to_ascii'))
// ------------------------------------------------------------------------
-/**
- * Word Censoring Function
- *
- * Supply a string and an array of disallowed words and any
- * matched words will be converted to #### or to the replacement
- * word you've submitted.
- *
- * @param string the text string
- * @param string the array of censoered words
- * @param string the optional replacement value
- * @return string
- */
if ( ! function_exists('word_censor'))
{
+ /**
+ * Word Censoring Function
+ *
+ * Supply a string and an array of disallowed words and any
+ * matched words will be converted to #### or to the replacement
+ * word you've submitted.
+ *
+ * @param string the text string
+ * @param string the array of censoered words
+ * @param string the optional replacement value
+ * @return string
+ */
function word_censor($str, $censored, $replacement = '')
{
if ( ! is_array($censored))
@@ -274,16 +274,16 @@ if ( ! function_exists('word_censor'))
// ------------------------------------------------------------------------
-/**
- * Code Highlighter
- *
- * Colorizes code strings
- *
- * @param string the text string
- * @return string
- */
if ( ! function_exists('highlight_code'))
{
+ /**
+ * Code Highlighter
+ *
+ * Colorizes code strings
+ *
+ * @param string the text string
+ * @return string
+ */
function highlight_code($str)
{
// The highlight string function encodes and highlights
@@ -317,19 +317,19 @@ if ( ! function_exists('highlight_code'))
// ------------------------------------------------------------------------
-/**
- * Phrase Highlighter
- *
- * Highlights a phrase within a text string
- *
- * @param string the text string
- * @param string the phrase you'd like to highlight
- * @param string the openging tag to precede the phrase with
- * @param string the closing tag to end the phrase with
- * @return string
- */
if ( ! function_exists('highlight_phrase'))
{
+ /**
+ * Phrase Highlighter
+ *
+ * Highlights a phrase within a text string
+ *
+ * @param string the text string
+ * @param string the phrase you'd like to highlight
+ * @param string the openging tag to precede the phrase with
+ * @param string the closing tag to end the phrase with
+ * @return string
+ */
function highlight_phrase($str, $phrase, $tag_open = '', $tag_close = '')
{
if ($str == '')
@@ -348,14 +348,14 @@ if ( ! function_exists('highlight_phrase'))
// ------------------------------------------------------------------------
-/**
- * Convert Accented Foreign Characters to ASCII
- *
- * @param string the text string
- * @return string
- */
if ( ! function_exists('convert_accented_characters'))
{
+ /**
+ * Convert Accented Foreign Characters to ASCII
+ *
+ * @param string the text string
+ * @return string
+ */
function convert_accented_characters($str)
{
if (defined('ENVIRONMENT') && is_file(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars.php'))
@@ -378,19 +378,19 @@ if ( ! function_exists('convert_accented_characters'))
// ------------------------------------------------------------------------
-/**
- * Word Wrap
- *
- * Wraps text at the specified character. Maintains the integrity of words.
- * Anything placed between {unwrap}{/unwrap} will not be word wrapped, nor
- * will URLs.
- *
- * @param string the text string
- * @param int the number of characters to wrap at
- * @return string
- */
if ( ! function_exists('word_wrap'))
{
+ /**
+ * Word Wrap
+ *
+ * Wraps text at the specified character. Maintains the integrity of words.
+ * Anything placed between {unwrap}{/unwrap} will not be word wrapped, nor
+ * will URLs.
+ *
+ * @param string the text string
+ * @param int the number of characters to wrap at
+ * @return string
+ */
function word_wrap($str, $charlim = '76')
{
// Se the character limit
@@ -481,19 +481,19 @@ if ( ! function_exists('word_wrap'))
// ------------------------------------------------------------------------
-/**
- * Ellipsize String
- *
- * This function will strip tags from a string, split it at its max_length and ellipsize
- *
- * @param string string to ellipsize
- * @param int max length of string
- * @param mixed int (1|0) or float, .5, .2, etc for position to split
- * @param string ellipsis ; Default '...'
- * @return string ellipsized string
- */
if ( ! function_exists('ellipsize'))
{
+ /**
+ * Ellipsize String
+ *
+ * This function will strip tags from a string, split it at its max_length and ellipsize
+ *
+ * @param string string to ellipsize
+ * @param int max length of string
+ * @param mixed int (1|0) or float, .5, .2, etc for position to split
+ * @param string ellipsis ; Default '...'
+ * @return string ellipsized string
+ */
function ellipsize($str, $max_length, $position = 1, $ellipsis = '…')
{
// Strip tags
diff --git a/system/helpers/typography_helper.php b/system/helpers/typography_helper.php
index 7a3db5d6b..af9d16a89 100644
--- a/system/helpers/typography_helper.php
+++ b/system/helpers/typography_helper.php
@@ -37,14 +37,14 @@
// ------------------------------------------------------------------------
-/**
- * Convert newlines to HTML line breaks except within PRE tags
- *
- * @param string
- * @return string
- */
if ( ! function_exists('nl2br_except_pre'))
{
+ /**
+ * Convert newlines to HTML line breaks except within PRE tags
+ *
+ * @param string
+ * @return string
+ */
function nl2br_except_pre($str)
{
$CI =& get_instance();
@@ -55,16 +55,16 @@ if ( ! function_exists('nl2br_except_pre'))
// ------------------------------------------------------------------------
-/**
- * Auto Typography Wrapper Function
- *
- * @param string
- * @param bool whether to allow javascript event handlers
- * @param bool whether to reduce multiple instances of double newlines to two
- * @return string
- */
if ( ! function_exists('auto_typography'))
{
+ /**
+ * Auto Typography Wrapper Function
+ *
+ * @param string
+ * @param bool whether to allow javascript event handlers
+ * @param bool whether to reduce multiple instances of double newlines to two
+ * @return string
+ */
function auto_typography($str, $strip_js_event_handlers = TRUE, $reduce_linebreaks = FALSE)
{
$CI =& get_instance();
@@ -73,20 +73,19 @@ if ( ! function_exists('auto_typography'))
}
}
-
// --------------------------------------------------------------------
-/**
- * HTML Entities Decode
- *
- * This function is a replacement for html_entity_decode()
- *
- * @param string
- * @param string
- * @return string
- */
if ( ! function_exists('entity_decode'))
{
+ /**
+ * HTML Entities Decode
+ *
+ * This function is a replacement for html_entity_decode()
+ *
+ * @param string
+ * @param string
+ * @return string
+ */
function entity_decode($str, $charset = NULL)
{
global $SEC;
diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php
index 5576c2748..fa685645a 100644
--- a/system/helpers/url_helper.php
+++ b/system/helpers/url_helper.php
@@ -37,17 +37,17 @@
// ------------------------------------------------------------------------
-/**
- * Site URL
- *
- * Create a local URL based on your basepath. Segments can be passed via the
- * first parameter either as a string or an array.
- *
- * @param string
- * @return string
- */
if ( ! function_exists('site_url'))
{
+ /**
+ * Site URL
+ *
+ * Create a local URL based on your basepath. Segments can be passed via the
+ * first parameter either as a string or an array.
+ *
+ * @param string
+ * @return string
+ */
function site_url($uri = '')
{
$CI =& get_instance();
@@ -57,18 +57,18 @@ if ( ! function_exists('site_url'))
// ------------------------------------------------------------------------
-/**
- * Base URL
- *
- * Create a local URL based on your basepath.
- * Segments can be passed in as a string or an array, same as site_url
- * or a URL to a file can be passed in, e.g. to an image file.
- *
- * @param string
- * @return string
- */
if ( ! function_exists('base_url'))
{
+ /**
+ * Base URL
+ *
+ * Create a local URL based on your basepath.
+ * Segments can be passed in as a string or an array, same as site_url
+ * or a URL to a file can be passed in, e.g. to an image file.
+ *
+ * @param string
+ * @return string
+ */
function base_url($uri = '')
{
$CI =& get_instance();
@@ -78,16 +78,16 @@ if ( ! function_exists('base_url'))
// ------------------------------------------------------------------------
-/**
- * Current URL
- *
- * Returns the full URL (including segments) of the page where this
- * function is placed
- *
- * @return string
- */
if ( ! function_exists('current_url'))
{
+ /**
+ * Current URL
+ *
+ * Returns the full URL (including segments) of the page where this
+ * function is placed
+ *
+ * @return string
+ */
function current_url()
{
$CI =& get_instance();
@@ -96,15 +96,16 @@ if ( ! function_exists('current_url'))
}
// ------------------------------------------------------------------------
-/**
- * URL String
- *
- * Returns the URI segments.
- *
- * @return string
- */
+
if ( ! function_exists('uri_string'))
{
+ /**
+ * URL String
+ *
+ * Returns the URI segments.
+ *
+ * @return string
+ */
function uri_string()
{
$CI =& get_instance();
@@ -114,15 +115,15 @@ if ( ! function_exists('uri_string'))
// ------------------------------------------------------------------------
-/**
- * Index page
- *
- * Returns the "index_page" from your config file
- *
- * @return string
- */
if ( ! function_exists('index_page'))
{
+ /**
+ * Index page
+ *
+ * Returns the "index_page" from your config file
+ *
+ * @return string
+ */
function index_page()
{
$CI =& get_instance();
@@ -132,18 +133,18 @@ if ( ! function_exists('index_page'))
// ------------------------------------------------------------------------
-/**
- * Anchor Link
- *
- * Creates an anchor based on the local URL.
- *
- * @param string the URL
- * @param string the link title
- * @param mixed any attributes
- * @return string
- */
if ( ! function_exists('anchor'))
{
+ /**
+ * Anchor Link
+ *
+ * Creates an anchor based on the local URL.
+ *
+ * @param string the URL
+ * @param string the link title
+ * @param mixed any attributes
+ * @return string
+ */
function anchor($uri = '', $title = '', $attributes = '')
{
$title = (string) $title;
@@ -173,19 +174,19 @@ if ( ! function_exists('anchor'))
// ------------------------------------------------------------------------
-/**
- * Anchor Link - Pop-up version
- *
- * Creates an anchor based on the local URL. The link
- * opens a new window based on the attributes specified.
- *
- * @param string the URL
- * @param string the link title
- * @param mixed any attributes
- * @return string
- */
if ( ! function_exists('anchor_popup'))
{
+ /**
+ * Anchor Link - Pop-up version
+ *
+ * Creates an anchor based on the local URL. The link
+ * opens a new window based on the attributes specified.
+ *
+ * @param string the URL
+ * @param string the link title
+ * @param mixed any attributes
+ * @return string
+ */
function anchor_popup($uri = '', $title = '', $attributes = FALSE)
{
$title = (string) $title;
@@ -223,16 +224,16 @@ if ( ! function_exists('anchor_popup'))
// ------------------------------------------------------------------------
-/**
- * Mailto Link
- *
- * @param string the email address
- * @param string the link title
- * @param mixed any attributes
- * @return string
- */
if ( ! function_exists('mailto'))
{
+ /**
+ * Mailto Link
+ *
+ * @param string the email address
+ * @param string the link title
+ * @param mixed any attributes
+ * @return string
+ */
function mailto($email, $title = '', $attributes = '')
{
$title = (string) $title;
@@ -248,18 +249,18 @@ if ( ! function_exists('mailto'))
// ------------------------------------------------------------------------
-/**
- * Encoded Mailto Link
- *
- * Create a spam-protected mailto link written in Javascript
- *
- * @param string the email address
- * @param string the link title
- * @param mixed any attributes
- * @return string
- */
if ( ! function_exists('safe_mailto'))
{
+ /**
+ * Encoded Mailto Link
+ *
+ * Create a spam-protected mailto link written in Javascript
+ *
+ * @param string the email address
+ * @param string the link title
+ * @param mixed any attributes
+ * @return string
+ */
function safe_mailto($email, $title = '', $attributes = '')
{
$title = (string) $title;
@@ -357,21 +358,21 @@ if ( ! function_exists('safe_mailto'))
// ------------------------------------------------------------------------
-/**
- * Auto-linker
- *
- * Automatically links URL and Email addresses.
- * Note: There's a bit of extra code here to deal with
- * URLs or emails that end in a period. We'll strip these
- * off and add them after the link.
- *
- * @param string the string
- * @param string the type: email, url, or both
- * @param bool whether to create pop-up links
- * @return string
- */
if ( ! function_exists('auto_link'))
{
+ /**
+ * Auto-linker
+ *
+ * Automatically links URL and Email addresses.
+ * Note: There's a bit of extra code here to deal with
+ * URLs or emails that end in a period. We'll strip these
+ * off and add them after the link.
+ *
+ * @param string the string
+ * @param string the type: email, url, or both
+ * @param bool whether to create pop-up links
+ * @return string
+ */
function auto_link($str, $type = 'both', $popup = FALSE)
{
if ($type !== 'email' && preg_match_all('#(^|\s|\(|\b)((http(s?)://)|(www\.))(\w+[^\s\)\<]+)#i', $str, $matches))
@@ -423,16 +424,16 @@ if ( ! function_exists('auto_link'))
// ------------------------------------------------------------------------
-/**
- * Prep URL
- *
- * Simply adds the http:// part if no scheme is included
- *
- * @param string the URL
- * @return string
- */
if ( ! function_exists('prep_url'))
{
+ /**
+ * Prep URL
+ *
+ * Simply adds the http:// part if no scheme is included
+ *
+ * @param string the URL
+ * @return string
+ */
function prep_url($str = '')
{
if ($str === 'http://' OR $str == '')
@@ -453,20 +454,20 @@ if ( ! function_exists('prep_url'))
// ------------------------------------------------------------------------
-/**
- * Create URL Title
- *
- * Takes a "title" string as input and creates a
- * human-friendly URL string with a "separator" string
- * as the word separator.
- *
- * @param string the string
- * @param string the separator
- * @param bool
- * @return string
- */
if ( ! function_exists('url_title'))
{
+ /**
+ * Create URL Title
+ *
+ * Takes a "title" string as input and creates a
+ * human-friendly URL string with a "separator" string
+ * as the word separator.
+ *
+ * @param string the string
+ * @param string the separator
+ * @param bool
+ * @return string
+ */
function url_title($str, $separator = '-', $lowercase = FALSE)
{
if ($separator === 'dash')
@@ -504,19 +505,20 @@ if ( ! function_exists('url_title'))
// ------------------------------------------------------------------------
-/**
- * Header Redirect
- *
- * Header redirect in two flavors
- * For very fine grained control over headers, you could use the Output
- * Library's set_header() function.
- *
- * @param string the URL
- * @param string the method: location or refresh
- * @return string
- */
if ( ! function_exists('redirect'))
{
+ /**
+ * Header Redirect
+ *
+ * Header redirect in two flavors
+ * For very fine grained control over headers, you could use the Output
+ * Library's set_header() function.
+ *
+ * @param string the URL
+ * @param string the method: location or refresh
+ * @param int
+ * @return string
+ */
function redirect($uri = '', $method = 'auto', $http_response_code = 302)
{
if ( ! preg_match('#^https?://#i', $uri))
@@ -545,17 +547,17 @@ if ( ! function_exists('redirect'))
// ------------------------------------------------------------------------
-/**
- * Parse out the attributes
- *
- * Some of the functions use this
- *
- * @param array
- * @param bool
- * @return string
- */
if ( ! function_exists('_parse_attributes'))
{
+ /**
+ * Parse out the attributes
+ *
+ * Some of the functions use this
+ *
+ * @param array
+ * @param bool
+ * @return string
+ */
function _parse_attributes($attributes, $javascript = FALSE)
{
if (is_string($attributes))
diff --git a/system/helpers/xml_helper.php b/system/helpers/xml_helper.php
index 67fd34b97..958c633dd 100644
--- a/system/helpers/xml_helper.php
+++ b/system/helpers/xml_helper.php
@@ -37,15 +37,15 @@
// ------------------------------------------------------------------------
-/**
- * Convert Reserved XML characters to Entities
- *
- * @param string
- * @param bool
- * @return string
- */
if ( ! function_exists('xml_convert'))
{
+ /**
+ * Convert Reserved XML characters to Entities
+ *
+ * @param string
+ * @param bool
+ * @return string
+ */
function xml_convert($str, $protect_all = FALSE)
{
$temp = '__TEMP_AMPERSANDS__';
--
cgit v1.2.3-24-g4f1b
From 3110a0a3cc6b25985acc251799ca9cc97f92ce03 Mon Sep 17 00:00:00 2001
From: Phil Sturgeon
Date: Wed, 2 May 2012 11:37:31 +0100
Subject: Added a phpDocumenter config file
Allows API documentation to be built very easily. Wether or not
CodeIgniter will support property docblocks or not is currently in
question, but at least everything else will show up.
---
phpdoc.dist.xml | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
create mode 100644 phpdoc.dist.xml
diff --git a/phpdoc.dist.xml b/phpdoc.dist.xml
new file mode 100644
index 000000000..f1fcc6225
--- /dev/null
+++ b/phpdoc.dist.xml
@@ -0,0 +1,25 @@
+
+
+ CodeIgniter v3.0.0 API
+
+ ./api/
+
+
+ ./api/
+
+
+ .
+ ./application/*
+ ./tests/*
+ ./user_guide_src/*
+ ./views/*
+
+
+
+ warn
+
+ ./api/log/{DATE}.log
+ ./api/{DATE}.errors.log
+
+
+
\ No newline at end of file
--
cgit v1.2.3-24-g4f1b
From 81aa94bbb533737c19a705d5b8864bd47fbab85c Mon Sep 17 00:00:00 2001
From: Phil Sturgeon
Date: Wed, 2 May 2012 11:40:46 +0100
Subject: Reverted rui_string change.
This had knock-on effects as can be seen in #1306. Issue #122 has been
reopend until it is fixed properly.
---
system/core/Router.php | 5 +----
system/core/URI.php | 4 ++--
user_guide_src/source/changelog.rst | 2 ++
3 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/system/core/Router.php b/system/core/Router.php
index fe9909b06..9314052fe 100755
--- a/system/core/Router.php
+++ b/system/core/Router.php
@@ -242,12 +242,9 @@ class CI_Router {
$segments[1] = 'index';
}
- // This is being routed to a file in a sub directory
- $this->directory and array_unshift($segments, trim($this->directory, '/'));
-
// Update our "routed" segment array to contain the segments.
// Note: If there is no custom routing, this array will be
- // identical to $this->uri->segments
+ // identical to $this->uri->segments
$this->uri->rsegments = $segments;
}
diff --git a/system/core/URI.php b/system/core/URI.php
index 705575a0c..cf82c5838 100755
--- a/system/core/URI.php
+++ b/system/core/URI.php
@@ -645,10 +645,10 @@ class CI_URI {
*/
public function ruri_string()
{
- return implode('/', $this->rsegment_array());
+ return '/'.implode('/', $this->rsegment_array());
}
}
/* End of file URI.php */
-/* Location: ./system/core/URI.php */
\ No newline at end of file
+/* Location: ./system/core/URI.php */
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index bdb418f86..95e32f793 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -204,6 +204,7 @@ Bug fixes for 3.0
- Fixed a bug (#23, #1238) - delete_all() in the `Database Caching Library ` used to delete .htaccess and index.html files, which is a potential security risk.
- Fixed a bug in :doc:`Trackback Library ` method validate_url() where it didn't actually do anything, due to input not being passed by reference.
- Fixed a bug (#11, #183, #863) - CI_Form_validation::_execute() silently continued to the next rule, if a rule method/function is not found.
+<<<<<<< HEAD
- Fixed a bug (#122) Where routed uri string was being reported incorrectly in sub-directories
- Fixed a bug (#1242) - read_dir() in the :doc:`Zip Library ` wasn't compatible with Windows.
- Fixed a bug (#306) - ODBC driver didn't have an _insert_batch() method, which resulted in fatal error being triggered when insert_batch() is used with it.
@@ -214,6 +215,7 @@ Bug fixes for 3.0
- Fixed a bug in SQLSRV's delete() method where like() and limit() conditions were ignored.
- Fixed a bug (#1265) - Database connections were always closed, regardless of the 'pconnect' option value.
- Fixed a bug (#128) - :doc:`Language Library ` did not correctly keep track of loaded language files.
+- Fixed a bug (#1242) Added Windows path compatibility to function read_dir of ZIP library
Version 2.1.1
=============
--
cgit v1.2.3-24-g4f1b
From ee04a913dfd78d394a0e09f01655df0870369512 Mon Sep 17 00:00:00 2001
From: Andrey Andreev
Date: Wed, 2 May 2012 13:41:23 +0300
Subject: Changelog fix
---
user_guide_src/source/changelog.rst | 1 -
1 file changed, 1 deletion(-)
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 95e32f793..bbbe6f718 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -204,7 +204,6 @@ Bug fixes for 3.0
- Fixed a bug (#23, #1238) - delete_all() in the `Database Caching Library ` used to delete .htaccess and index.html files, which is a potential security risk.
- Fixed a bug in :doc:`Trackback Library ` method validate_url() where it didn't actually do anything, due to input not being passed by reference.
- Fixed a bug (#11, #183, #863) - CI_Form_validation::_execute() silently continued to the next rule, if a rule method/function is not found.
-<<<<<<< HEAD
- Fixed a bug (#122) Where routed uri string was being reported incorrectly in sub-directories
- Fixed a bug (#1242) - read_dir() in the :doc:`Zip Library ` wasn't compatible with Windows.
- Fixed a bug (#306) - ODBC driver didn't have an _insert_batch() method, which resulted in fatal error being triggered when insert_batch() is used with it.
--
cgit v1.2.3-24-g4f1b
From c821a587dce2da70bab3f5955f2b40c6a3c194f5 Mon Sep 17 00:00:00 2001
From: Timothy Warren
Date: Wed, 2 May 2012 10:37:01 -0400
Subject: Fix phpdoc config file
---
phpdoc.dist.xml | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/phpdoc.dist.xml b/phpdoc.dist.xml
index f1fcc6225..6dc58c259 100644
--- a/phpdoc.dist.xml
+++ b/phpdoc.dist.xml
@@ -8,11 +8,7 @@
./api/
- .
- ./application/*
- ./tests/*
- ./user_guide_src/*
- ./views/*
+ ./system
--
cgit v1.2.3-24-g4f1b
From 2d51c08027382cc10692188ccb68789daf2f2083 Mon Sep 17 00:00:00 2001
From: George Petsagourakis
Date: Wed, 2 May 2012 20:29:04 +0300
Subject: Fixing some typos.
---
system/libraries/Form_validation.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index a52cad5ff..5547c6a69 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -1005,7 +1005,7 @@ class CI_Form_validation {
return (MB_ENABLED === TRUE)
? ($val <= mb_strlen($str))
- : ($val <= strlen(str));
+ : ($val <= strlen($str));
}
// --------------------------------------------------------------------
--
cgit v1.2.3-24-g4f1b
From 306b378525a13d9c5d1a7f0d6d50c2f263f22a04 Mon Sep 17 00:00:00 2001
From: George Petsagourakis
Date: Wed, 2 May 2012 20:31:08 +0300
Subject: Fixing some typos in the xmlrpc class. Also, fputs is an alias for
fwrite.
---
system/libraries/Xmlrpc.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php
index 7009deacc..0d2533855 100644
--- a/system/libraries/Xmlrpc.php
+++ b/system/libraries/Xmlrpc.php
@@ -436,7 +436,7 @@ class XML_RPC_Client extends CI_Xmlrpc
*/
public function sendPayload($msg)
{
- $fp = @fsockopen($this->server, $this->port,$this->errno, $this->errstr, $this->timeout);
+ $fp = @fsockopen($this->server, $this->port,$this->errno, $this->errstring, $this->timeout);
if ( ! is_resource($fp))
{
@@ -458,7 +458,7 @@ class XML_RPC_Client extends CI_Xmlrpc
.'Content-Length: '.strlen($msg->payload).$r.$r
.$msg->payload;
- if ( ! fputs($fp, $op, strlen($op)))
+ if ( ! fwrite($fp, $op, strlen($op)))
{
error_log($this->xmlrpcstr['http_error']);
return new XML_RPC_Response(0, $this->xmlrpcerr['http_error'], $this->xmlrpcstr['http_error']);
@@ -1076,7 +1076,7 @@ class XML_RPC_Message extends CI_Xmlrpc
// we have an I4/INT
// we must check that only 0123456789- are characters here
$this->xh[$the_parser]['value'] = preg_match('/^[+-]?[0-9\t ]+$/', $this->xh[$the_parser]['ac'])
- ? (int) $this->xh[$the_parset]['ac']
+ ? (int) $this->xh[$the_parser]['ac']
: 'ERROR_NON_NUMERIC_FOUND';
}
$this->xh[$the_parser]['ac'] = '';
--
cgit v1.2.3-24-g4f1b
From 190c6bb125447f83793d9437f1bea28feada910a Mon Sep 17 00:00:00 2001
From: Taufan Aditya
Date: Thu, 3 May 2012 12:13:39 +0700
Subject: Cleaning up
---
tests/codeigniter/database/query_builder/insert_test.php | 5 ++---
tests/codeigniter/database/query_builder/select_test.php | 16 ++++++++--------
2 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/tests/codeigniter/database/query_builder/insert_test.php b/tests/codeigniter/database/query_builder/insert_test.php
index 53ce23c19..8ba60e242 100644
--- a/tests/codeigniter/database/query_builder/insert_test.php
+++ b/tests/codeigniter/database/query_builder/insert_test.php
@@ -30,11 +30,10 @@ class Insert_test extends CI_TestCase {
// Do normal insert
$this->assertTrue($this->db->insert('job', $job_data));
- $jobs = $this->db->get('job')->result_array();
- $job1 = $jobs[0];
+ $job1 = $this->db->get('job')->row();
// Check the result
- $this->assertEquals('Grocery Sales', $job1['name']);
+ $this->assertEquals('Grocery Sales', $job1->name);
}
diff --git a/tests/codeigniter/database/query_builder/select_test.php b/tests/codeigniter/database/query_builder/select_test.php
index dbf432a7c..0d299ed16 100644
--- a/tests/codeigniter/database/query_builder/select_test.php
+++ b/tests/codeigniter/database/query_builder/select_test.php
@@ -41,10 +41,10 @@ class Select_test extends CI_TestCase {
{
$job_min = $this->db->select_min('id')
->get('job')
- ->result_array();
+ ->row();
// Minimum id was 1
- $this->assertEquals('1', $job_min[0]['id']);
+ $this->assertEquals('1', $job_min->id);
}
// ------------------------------------------------------------------------
@@ -56,10 +56,10 @@ class Select_test extends CI_TestCase {
{
$job_max = $this->db->select_max('id')
->get('job')
- ->result_array();
+ ->row();
// Maximum id was 4
- $this->assertEquals('4', $job_max[0]['id']);
+ $this->assertEquals('4', $job_max->id);
}
// ------------------------------------------------------------------------
@@ -71,10 +71,10 @@ class Select_test extends CI_TestCase {
{
$job_avg = $this->db->select_avg('id')
->get('job')
- ->result_array();
+ ->row();
// Average should be 2.5
- $this->assertEquals('2.5', $job_avg[0]['id']);
+ $this->assertEquals('2.5', $job_avg->id);
}
// ------------------------------------------------------------------------
@@ -86,10 +86,10 @@ class Select_test extends CI_TestCase {
{
$job_sum = $this->db->select_sum('id')
->get('job')
- ->result_array();
+ ->row();
// Sum of ids should be 10
- $this->assertEquals('10', $job_sum[0]['id']);
+ $this->assertEquals('10', $job_sum->id);
}
}
\ No newline at end of file
--
cgit v1.2.3-24-g4f1b
From 6e131cbd0a5243f29a5ad9f56c80715e534e4267 Mon Sep 17 00:00:00 2001
From: Taufan Aditya
Date: Thu, 3 May 2012 12:14:19 +0700
Subject: FROM clause API code-coverage
---
.../database/query_builder/from_test.php | 51 ++++++++++++++++++++++
1 file changed, 51 insertions(+)
create mode 100644 tests/codeigniter/database/query_builder/from_test.php
diff --git a/tests/codeigniter/database/query_builder/from_test.php b/tests/codeigniter/database/query_builder/from_test.php
new file mode 100644
index 000000000..95ae4dfdb
--- /dev/null
+++ b/tests/codeigniter/database/query_builder/from_test.php
@@ -0,0 +1,51 @@
+db = Mock_Database_Schema_Skeleton::init(DB_DRIVER);
+
+ Mock_Database_Schema_Skeleton::create_tables();
+ Mock_Database_Schema_Skeleton::create_data();
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
+ * @see ./mocks/schema/skeleton.php
+ */
+ public function test_from_simple()
+ {
+ $jobs = $this->db->from('job')
+ ->get()
+ ->result_array();
+
+ // Check items
+ $this->assertEquals(4, count($jobs));
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
+ * @see ./mocks/schema/skeleton.php
+ */
+ public function test_from_with_where()
+ {
+ $job1 = $this->db->from('job')
+ ->where('id', 1)
+ ->get()
+ ->row();
+
+ // Check the result
+ $this->assertEquals('1', $job1->id);
+ $this->assertEquals('Developer', $job1->name);
+ $this->assertEquals('Awesome job, but sometimes makes you bored', $job1->description);
+ }
+
+}
\ No newline at end of file
--
cgit v1.2.3-24-g4f1b
From 17f799e1017d1688a2890a1ba78e4f53d80af77e Mon Sep 17 00:00:00 2001
From: Taufan Aditya
Date: Thu, 3 May 2012 15:15:40 +0700
Subject: Add user entity into schema skeleton
---
tests/mocks/database/schema/skeleton.php | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/tests/mocks/database/schema/skeleton.php b/tests/mocks/database/schema/skeleton.php
index a3d5bac65..fbd533bfb 100644
--- a/tests/mocks/database/schema/skeleton.php
+++ b/tests/mocks/database/schema/skeleton.php
@@ -50,6 +50,24 @@ class Mock_Database_Schema_Skeleton {
*/
public static function create_tables()
{
+ // User Table
+ static::$forge->add_field(array(
+ 'id' => array(
+ 'type' => 'INTEGER',
+ 'constraint' => 3,
+ ),
+ 'name' => array(
+ 'type' => 'VARCHAR',
+ 'constraint' => 40,
+ ),
+ 'email' => array(
+ 'type' => 'VARCHAR',
+ 'constraint' => 100,
+ ),
+ ));
+ static::$forge->add_key('id', TRUE);
+ static::$forge->create_table('user', (strpos(static::$driver, 'pgsql') === FALSE));
+
// Job Table
static::$forge->add_field(array(
'id' => array(
@@ -77,6 +95,12 @@ class Mock_Database_Schema_Skeleton {
{
// Job Data
$data = array(
+ 'user' => array(
+ array('id' => 1, 'name' => 'Derek Jones', 'email' => 'derek@world.com'),
+ array('id' => 2, 'name' => 'Ahmadinejad', 'email' => 'ahmadinejad@world.com'),
+ array('id' => 3, 'name' => 'Richard A Causey', 'email' => 'richard@world.com'),
+ array('id' => 4, 'name' => 'Chris Martin', 'email' => 'chris@world.com'),
+ )
'job' => array(
array('id' => 1, 'name' => 'Developer', 'description' => 'Awesome job, but sometimes makes you bored'),
array('id' => 2, 'name' => 'Politician', 'description' => 'This is not really a job'),
--
cgit v1.2.3-24-g4f1b
From f074dff71f136860102a6042dccd3ff6db02d9f4 Mon Sep 17 00:00:00 2001
From: ThallisPHP
Date: Thu, 3 May 2012 16:01:46 -0300
Subject: Update system/libraries/Cart.php - To enable integrity when using
associative arrays
---
system/libraries/Cart.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php
index eee123584..9f258beb3 100644
--- a/system/libraries/Cart.php
+++ b/system/libraries/Cart.php
@@ -244,7 +244,7 @@ class CI_Cart {
// This becomes the unique "row ID"
if (isset($items['options']) && count($items['options']) > 0)
{
- $rowid = md5($items['id'].implode('', $items['options']));
+ $rowid = md5($items['id'].serialize($items['options']));
}
else
{
--
cgit v1.2.3-24-g4f1b
From d6b41bb2659f959da01aee0ddb38bb4bce6cd4b6 Mon Sep 17 00:00:00 2001
From: Taufan Aditya
Date: Fri, 4 May 2012 15:05:22 +0700
Subject: JOIN clause API code-coverage
---
.../database/query_builder/join_test.php | 38 ++++++++++++++++++++++
tests/mocks/database/schema/skeleton.php | 2 +-
2 files changed, 39 insertions(+), 1 deletion(-)
create mode 100644 tests/codeigniter/database/query_builder/join_test.php
diff --git a/tests/codeigniter/database/query_builder/join_test.php b/tests/codeigniter/database/query_builder/join_test.php
new file mode 100644
index 000000000..e05329d67
--- /dev/null
+++ b/tests/codeigniter/database/query_builder/join_test.php
@@ -0,0 +1,38 @@
+db = Mock_Database_Schema_Skeleton::init(DB_DRIVER);
+
+ Mock_Database_Schema_Skeleton::create_tables();
+ Mock_Database_Schema_Skeleton::create_data();
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
+ * @see ./mocks/schema/skeleton.php
+ */
+ public function test_join_simple()
+ {
+ $job_user = $this->db->select('job.id as job_id, job.name as job_name, user.id as user_id, user.name as user_name')
+ ->from('job')
+ ->join('user', 'user.id = job.id')
+ ->get()
+ ->result_array();
+
+ // Check the result
+ $this->assertEquals('1', $job_user[0]['job_id']);
+ $this->assertEquals('1', $job_user[0]['user_id']);
+ $this->assertEquals('Derek Jones', $job_user[0]['user_name']);
+ $this->assertEquals('Developer', $job_user[0]['job_name']);
+ }
+
+}
\ No newline at end of file
diff --git a/tests/mocks/database/schema/skeleton.php b/tests/mocks/database/schema/skeleton.php
index fbd533bfb..9ebd6e85f 100644
--- a/tests/mocks/database/schema/skeleton.php
+++ b/tests/mocks/database/schema/skeleton.php
@@ -100,7 +100,7 @@ class Mock_Database_Schema_Skeleton {
array('id' => 2, 'name' => 'Ahmadinejad', 'email' => 'ahmadinejad@world.com'),
array('id' => 3, 'name' => 'Richard A Causey', 'email' => 'richard@world.com'),
array('id' => 4, 'name' => 'Chris Martin', 'email' => 'chris@world.com'),
- )
+ ),
'job' => array(
array('id' => 1, 'name' => 'Developer', 'description' => 'Awesome job, but sometimes makes you bored'),
array('id' => 2, 'name' => 'Politician', 'description' => 'This is not really a job'),
--
cgit v1.2.3-24-g4f1b
From 12f5475e2b279d1c2361ad5fc85bc2ba0d0f9033 Mon Sep 17 00:00:00 2001
From: Taufan Aditya
Date: Fri, 4 May 2012 15:46:39 +0700
Subject: WHERE clause API code-coverage
---
.../database/query_builder/where_test.php | 144 +++++++++++++++++++++
1 file changed, 144 insertions(+)
create mode 100644 tests/codeigniter/database/query_builder/where_test.php
diff --git a/tests/codeigniter/database/query_builder/where_test.php b/tests/codeigniter/database/query_builder/where_test.php
new file mode 100644
index 000000000..607eaa076
--- /dev/null
+++ b/tests/codeigniter/database/query_builder/where_test.php
@@ -0,0 +1,144 @@
+db = Mock_Database_Schema_Skeleton::init(DB_DRIVER);
+
+ Mock_Database_Schema_Skeleton::create_tables();
+ Mock_Database_Schema_Skeleton::create_data();
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
+ * @see ./mocks/schema/skeleton.php
+ */
+ public function test_where_simple_key_value()
+ {
+ $job1 = $this->db->where('id', 1)
+ ->get('job')
+ ->row();
+
+ // Check the result
+ $this->assertEquals('1', $job1->id);
+ $this->assertEquals('Developer', $job1->name);
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
+ * @see ./mocks/schema/skeleton.php
+ */
+ public function test_where_custom_key_value()
+ {
+ $jobs = $this->db->where('id !=', 1)
+ ->get('job')
+ ->result_array();
+
+ // Check the result
+ $this->assertEquals(3, count($jobs));
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
+ * @see ./mocks/schema/skeleton.php
+ */
+ public function test_where_associative_array()
+ {
+ $where = array('id >' => 2, 'name !=' => 'Accountant');
+ $jobs = $this->db->where($where)
+ ->get('job')
+ ->result_array();
+
+ // Check the result
+ $this->assertEquals(1, count($jobs));
+
+ // Should be Musician
+ $job = current($jobs);
+
+ $this->assertEquals('Musician', $job['name']);
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
+ * @see ./mocks/schema/skeleton.php
+ */
+ public function test_where_custom_string()
+ {
+ $where = "id > 2 AND name != 'Accountant'";
+ $jobs = $this->db->where($where)
+ ->get('job')
+ ->result_array();
+
+ // Check the result
+ $this->assertEquals(1, count($jobs));
+
+ // Should be Musician
+ $job = current($jobs);
+
+ $this->assertEquals('Musician', $job['name']);
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
+ * @see ./mocks/schema/skeleton.php
+ */
+ public function test_where_or()
+ {
+ $jobs = $this->db->where('name !=', 'Accountant')
+ ->or_where('id >', 3)
+ ->get('job')
+ ->result_array();
+
+ // Check the result
+ $this->assertEquals(3, count($jobs));
+ $this->assertEquals('Developer', $jobs[0]['name']);
+ $this->assertEquals('Politician', $jobs[1]['name']);
+ $this->assertEquals('Musician', $jobs[2]['name']);
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
+ * @see ./mocks/schema/skeleton.php
+ */
+ public function test_where_in()
+ {
+ $jobs = $this->db->where_in('name', array('Politician', 'Accountant'))
+ ->get('job')
+ ->result_array();
+
+ // Check the result
+ $this->assertEquals(2, count($jobs));
+ $this->assertEquals('Politician', $jobs[0]['name']);
+ $this->assertEquals('Accountant', $jobs[1]['name']);
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
+ * @see ./mocks/schema/skeleton.php
+ */
+ public function test_where_not_in()
+ {
+ $jobs = $this->db->where_not_in('name', array('Politician', 'Accountant'))
+ ->get('job')
+ ->result_array();
+
+ // Check the result
+ $this->assertEquals(2, count($jobs));
+ $this->assertEquals('Developer', $jobs[0]['name']);
+ $this->assertEquals('Musician', $jobs[1]['name']);
+ }
+
+}
\ No newline at end of file
--
cgit v1.2.3-24-g4f1b
From f78018ec6b081518e4be24934448862a31bda9f8 Mon Sep 17 00:00:00 2001
From: Taufan Aditya
Date: Fri, 4 May 2012 15:53:55 +0700
Subject: LIKE clause API code-coverage
---
.../database/query_builder/like_test.php | 90 ++++++++++++++++++++++
1 file changed, 90 insertions(+)
create mode 100644 tests/codeigniter/database/query_builder/like_test.php
diff --git a/tests/codeigniter/database/query_builder/like_test.php b/tests/codeigniter/database/query_builder/like_test.php
new file mode 100644
index 000000000..df98c713f
--- /dev/null
+++ b/tests/codeigniter/database/query_builder/like_test.php
@@ -0,0 +1,90 @@
+db = Mock_Database_Schema_Skeleton::init(DB_DRIVER);
+
+ Mock_Database_Schema_Skeleton::create_tables();
+ Mock_Database_Schema_Skeleton::create_data();
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
+ * @see ./mocks/schema/skeleton.php
+ */
+ public function test_like()
+ {
+ $job1 = $this->db->like('name', 'veloper')
+ ->get('job')
+ ->row();
+
+ // Check the result
+ $this->assertEquals('1', $job1->id);
+ $this->assertEquals('Developer', $job1->name);
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
+ * @see ./mocks/schema/skeleton.php
+ */
+ public function test_or_like()
+ {
+ $jobs = $this->db->like('name', 'ian')
+ ->or_like('name', 'veloper')
+ ->get('job')
+ ->result_array();
+
+ // Check the result
+ $this->assertEquals(3, count($jobs));
+ $this->assertEquals('Developer', $jobs[0]['name']);
+ $this->assertEquals('Politician', $jobs[1]['name']);
+ $this->assertEquals('Musician', $jobs[2]['name']);
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
+ * @see ./mocks/schema/skeleton.php
+ */
+ public function test_not_like()
+ {
+ $jobs = $this->db->not_like('name', 'veloper')
+ ->get('job')
+ ->result_array();
+
+ // Check the result
+ $this->assertEquals(3, count($jobs));
+ $this->assertEquals('Politician', $jobs[0]['name']);
+ $this->assertEquals('Accountant', $jobs[1]['name']);
+ $this->assertEquals('Musician', $jobs[2]['name']);
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
+ * @see ./mocks/schema/skeleton.php
+ */
+ public function test_or_not_like()
+ {
+ $jobs = $this->db->like('name', 'an')
+ ->or_not_like('name', 'veloper')
+ ->get('job')
+ ->result_array();
+
+ // Check the result
+ $this->assertEquals(3, count($jobs));
+ $this->assertEquals('Politician', $jobs[0]['name']);
+ $this->assertEquals('Accountant', $jobs[1]['name']);
+ $this->assertEquals('Musician', $jobs[2]['name']);
+ }
+
+}
\ No newline at end of file
--
cgit v1.2.3-24-g4f1b
From 4c316b6bdfa970e98127ea280fcc77ff1288190f Mon Sep 17 00:00:00 2001
From: Michiel Vugteveen
Date: Fri, 4 May 2012 11:32:48 +0200
Subject: unset userdata
---
system/libraries/Session.php | 45 +++++++++++++++++++++++---------------------
1 file changed, 24 insertions(+), 21 deletions(-)
diff --git a/system/libraries/Session.php b/system/libraries/Session.php
index 3fa446d84..3195f0a91 100644
--- a/system/libraries/Session.php
+++ b/system/libraries/Session.php
@@ -36,146 +36,146 @@
*/
class CI_Session {
- /**
+ /**
* Whether to encrypt the session cookie
*
* @var bool
*/
public $sess_encrypt_cookie = FALSE;
-
+
/**
* Whether to use to the database for session storage
*
* @var bool
*/
public $sess_use_database = FALSE;
-
+
/**
* Name of the database table in which to store sessions
*
* @var string
*/
public $sess_table_name = '';
-
+
/**
* Length of time (in seconds) for sessions to expire
*
* @var int
*/
public $sess_expiration = 7200;
-
+
/**
* Whether to kill session on close of browser window
*
* @var bool
*/
public $sess_expire_on_close = FALSE;
-
+
/**
* Whether to match session on ip address
*
* @var bool
*/
public $sess_match_ip = FALSE;
-
+
/**
* Whether to match session on user-agent
*
* @var bool
*/
public $sess_match_useragent = TRUE;
-
+
/**
* Name of session cookie
*
* @var string
*/
public $sess_cookie_name = 'ci_session';
-
+
/**
* Session cookie prefix
*
* @var string
*/
public $cookie_prefix = '';
-
+
/**
* Session cookie path
*
* @var string
*/
public $cookie_path = '';
-
+
/**
* Session cookie domain
*
* @var string
*/
public $cookie_domain = '';
-
+
/**
* Whether to set the cookie only on HTTPS connections
*
* @var bool
*/
public $cookie_secure = FALSE;
-
+
/**
* Whether cookie should be allowed only to be sent by the server
*
* @var bool
*/
public $cookie_httponly = FALSE;
-
+
/**
* Interval at which to update session
*
* @var int
*/
public $sess_time_to_update = 300;
-
+
/**
* Key with which to encrypt the session cookie
*
* @var string
*/
public $encryption_key = '';
-
+
/**
* String to indicate flash data cookies
*
* @var string
*/
public $flashdata_key = 'flash';
-
+
/**
* Function to use to get the current time
*
* @var string
*/
public $time_reference = 'time';
-
+
/**
* Probablity level of garbage collection of old sessions
*
* @var int
*/
public $gc_probability = 5;
-
+
/**
* Session data
*
* @var array
*/
public $userdata = array();
-
+
/**
* Reference to CodeIgniter instance
*
* @var object
*/
public $CI;
-
+
/**
* Current time
*
@@ -570,6 +570,9 @@ class CI_Session {
$this->cookie_domain,
0
);
+
+ // Kill session data
+ $this->userdata = array();
}
// --------------------------------------------------------------------
--
cgit v1.2.3-24-g4f1b
From 0e18f625e10a8d8ba57c58c8597875c342cfa3e6 Mon Sep 17 00:00:00 2001
From: Michiel Vugteveen
Date: Fri, 4 May 2012 11:41:32 +0200
Subject: changelog entry
---
user_guide_src/source/changelog.rst | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index bbbe6f718..a70531901 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -55,7 +55,7 @@ Release Date: Not Released
- Database
- - Renamed the Active Record class to Query Builder to remove confusion with
+ - Renamed the Active Record class to Query Builder to remove confusion with
the Active Record design pattern
- Added new :doc:`Query Builder ` methods that return
- Added the ability to insert objects with insert_batch() in :doc:`Query Builder `.
@@ -215,6 +215,7 @@ Bug fixes for 3.0
- Fixed a bug (#1265) - Database connections were always closed, regardless of the 'pconnect' option value.
- Fixed a bug (#128) - :doc:`Language Library ` did not correctly keep track of loaded language files.
- Fixed a bug (#1242) Added Windows path compatibility to function read_dir of ZIP library
+- Fixed a bug (#1314) sess_destroy() did not destroy userdata.
Version 2.1.1
=============
--
cgit v1.2.3-24-g4f1b
From 4e607b00b2c56b7fdcc5f1d1a290be2363c74a46 Mon Sep 17 00:00:00 2001
From: Taufan Aditya
Date: Fri, 4 May 2012 19:22:48 +0700
Subject: GROUP BY clause API code-coverage
---
.travis.yml | 3 +-
.../database/query_builder/group_test.php | 37 ++++++++++++++++++++++
2 files changed, 39 insertions(+), 1 deletion(-)
create mode 100644 tests/codeigniter/database/query_builder/group_test.php
diff --git a/.travis.yml b/.travis.yml
index 97ea0422d..971f62f38 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -25,4 +25,5 @@ script: phpunit --configuration tests/travis/$DB.phpunit.xml
branches:
only:
- develop
- - master
\ No newline at end of file
+ - master
+ - db-tests
\ No newline at end of file
diff --git a/tests/codeigniter/database/query_builder/group_test.php b/tests/codeigniter/database/query_builder/group_test.php
new file mode 100644
index 000000000..ddb2d0d6a
--- /dev/null
+++ b/tests/codeigniter/database/query_builder/group_test.php
@@ -0,0 +1,37 @@
+db = Mock_Database_Schema_Skeleton::init(DB_DRIVER);
+
+ Mock_Database_Schema_Skeleton::create_tables();
+ Mock_Database_Schema_Skeleton::create_data();
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
+ * @see ./mocks/schema/skeleton.php
+ */
+ public function test_group_by()
+ {
+ $jobs = $this->db->select('name')
+ ->from('job')
+ ->group_by('name HAVING SUM(id) > 2')
+ ->get()
+ ->result_array();
+
+ // Check the result
+ $this->assertEquals(2, count($jobs));
+ $this->assertEquals('Accountant', $jobs[0]['name']);
+ $this->assertEquals('Musician', $jobs[1]['name']);
+ }
+
+}
\ No newline at end of file
--
cgit v1.2.3-24-g4f1b
From f7377abee2ef1e165a362edc9a1c650373a002ca Mon Sep 17 00:00:00 2001
From: Taufan Aditya
Date: Fri, 4 May 2012 19:42:24 +0700
Subject: Trace error
---
.../database/query_builder/group_test.php | 8 ++++----
tests/mocks/database/ci_test.sqlite | Bin 17408 -> 19456 bytes
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/tests/codeigniter/database/query_builder/group_test.php b/tests/codeigniter/database/query_builder/group_test.php
index ddb2d0d6a..dd248ae9a 100644
--- a/tests/codeigniter/database/query_builder/group_test.php
+++ b/tests/codeigniter/database/query_builder/group_test.php
@@ -22,16 +22,16 @@ class Group_test extends CI_TestCase {
*/
public function test_group_by()
{
- $jobs = $this->db->select('name')
+ $jobs = $this->db->select('job.name as job_name, job.id as job_id')
->from('job')
- ->group_by('name HAVING SUM(id) > 2')
+ ->group_by('job_name HAVING SUM(job_id) > 2')
->get()
->result_array();
// Check the result
$this->assertEquals(2, count($jobs));
- $this->assertEquals('Accountant', $jobs[0]['name']);
- $this->assertEquals('Musician', $jobs[1]['name']);
+ $this->assertEquals('Accountant', $jobs[0]['job_name']);
+ $this->assertEquals('Musician', $jobs[1]['job_name']);
}
}
\ No newline at end of file
diff --git a/tests/mocks/database/ci_test.sqlite b/tests/mocks/database/ci_test.sqlite
index 86d868af2..e4128b23f 100755
Binary files a/tests/mocks/database/ci_test.sqlite and b/tests/mocks/database/ci_test.sqlite differ
--
cgit v1.2.3-24-g4f1b
From 1afd479059c3d6f7c46aa0c36aa56cfba7f94226 Mon Sep 17 00:00:00 2001
From: Taufan Aditya
Date: Fri, 4 May 2012 20:34:30 +0700
Subject: HAVING clause API code-coverage
---
.../database/query_builder/group_test.php | 24 +++++++++++++++++----
tests/mocks/database/ci_test.sqlite | Bin 19456 -> 19456 bytes
tests/mocks/database/schema/skeleton.php | 12 +++++++----
3 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/tests/codeigniter/database/query_builder/group_test.php b/tests/codeigniter/database/query_builder/group_test.php
index dd248ae9a..7d8abc33f 100644
--- a/tests/codeigniter/database/query_builder/group_test.php
+++ b/tests/codeigniter/database/query_builder/group_test.php
@@ -22,16 +22,32 @@ class Group_test extends CI_TestCase {
*/
public function test_group_by()
{
- $jobs = $this->db->select('job.name as job_name, job.id as job_id')
+ $jobs = $this->db->select('name')
->from('job')
- ->group_by('job_name HAVING SUM(job_id) > 2')
+ ->group_by('name')
+ ->get()
+ ->result_array();
+
+ // Check the result
+ $this->assertEquals(4, count($jobs));
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
+ * @see ./mocks/schema/skeleton.php
+ */
+ public function test_having_by()
+ {
+ $jobs = $this->db->select('name')
+ ->from('job')
+ ->group_by('name')
+ ->having('SUM(id) > 2')
->get()
->result_array();
// Check the result
$this->assertEquals(2, count($jobs));
- $this->assertEquals('Accountant', $jobs[0]['job_name']);
- $this->assertEquals('Musician', $jobs[1]['job_name']);
}
}
\ No newline at end of file
diff --git a/tests/mocks/database/ci_test.sqlite b/tests/mocks/database/ci_test.sqlite
index e4128b23f..d48e3317f 100755
Binary files a/tests/mocks/database/ci_test.sqlite and b/tests/mocks/database/ci_test.sqlite differ
diff --git a/tests/mocks/database/schema/skeleton.php b/tests/mocks/database/schema/skeleton.php
index 9ebd6e85f..671336cc4 100644
--- a/tests/mocks/database/schema/skeleton.php
+++ b/tests/mocks/database/schema/skeleton.php
@@ -64,6 +64,10 @@ class Mock_Database_Schema_Skeleton {
'type' => 'VARCHAR',
'constraint' => 100,
),
+ 'country' => array(
+ 'type' => 'VARCHAR',
+ 'constraint' => 40,
+ ),
));
static::$forge->add_key('id', TRUE);
static::$forge->create_table('user', (strpos(static::$driver, 'pgsql') === FALSE));
@@ -96,10 +100,10 @@ class Mock_Database_Schema_Skeleton {
// Job Data
$data = array(
'user' => array(
- array('id' => 1, 'name' => 'Derek Jones', 'email' => 'derek@world.com'),
- array('id' => 2, 'name' => 'Ahmadinejad', 'email' => 'ahmadinejad@world.com'),
- array('id' => 3, 'name' => 'Richard A Causey', 'email' => 'richard@world.com'),
- array('id' => 4, 'name' => 'Chris Martin', 'email' => 'chris@world.com'),
+ array('id' => 1, 'name' => 'Derek Jones', 'email' => 'derek@world.com', 'country' => 'US'),
+ array('id' => 2, 'name' => 'Ahmadinejad', 'email' => 'ahmadinejad@world.com', 'country' => 'Iran'),
+ array('id' => 3, 'name' => 'Richard A Causey', 'email' => 'richard@world.com', 'country' => 'US'),
+ array('id' => 4, 'name' => 'Chris Martin', 'email' => 'chris@world.com', 'country' => 'UK'),
),
'job' => array(
array('id' => 1, 'name' => 'Developer', 'description' => 'Awesome job, but sometimes makes you bored'),
--
cgit v1.2.3-24-g4f1b
From 44d8d881b401238661d81fc9db10482604b4cf43 Mon Sep 17 00:00:00 2001
From: Taufan Aditya
Date: Fri, 4 May 2012 20:43:45 +0700
Subject: DISTINCT clause API code-coverage
---
.../database/query_builder/distinct_test.php | 34 ++++++++++++++++++++++
1 file changed, 34 insertions(+)
create mode 100644 tests/codeigniter/database/query_builder/distinct_test.php
diff --git a/tests/codeigniter/database/query_builder/distinct_test.php b/tests/codeigniter/database/query_builder/distinct_test.php
new file mode 100644
index 000000000..925eadb19
--- /dev/null
+++ b/tests/codeigniter/database/query_builder/distinct_test.php
@@ -0,0 +1,34 @@
+db = Mock_Database_Schema_Skeleton::init(DB_DRIVER);
+
+ Mock_Database_Schema_Skeleton::create_tables();
+ Mock_Database_Schema_Skeleton::create_data();
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
+ * @see ./mocks/schema/skeleton.php
+ */
+ public function test_distinct()
+ {
+ $users = $this->db->select('country')
+ ->distinct()
+ ->get('user')
+ ->result_array();
+
+ // Check the result
+ $this->assertEquals(3, count($users));
+ }
+
+}
\ No newline at end of file
--
cgit v1.2.3-24-g4f1b
From 8ca31f34c855c783689198f0d352e6efec352b4d Mon Sep 17 00:00:00 2001
From: Taufan Aditya
Date: Fri, 4 May 2012 23:57:46 +0700
Subject: PDO SQLite bug fixed, for result_object
---
system/database/drivers/pdo/pdo_result.php | 19 +++++++------------
tests/mocks/database/ci_test.sqlite | Bin 19456 -> 19456 bytes
2 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/system/database/drivers/pdo/pdo_result.php b/system/database/drivers/pdo/pdo_result.php
index 19aee1dfc..0b8937cc5 100644
--- a/system/database/drivers/pdo/pdo_result.php
+++ b/system/database/drivers/pdo/pdo_result.php
@@ -84,19 +84,14 @@ class CI_DB_pdo_result extends CI_DB_result {
// Define the output
$output = array('assoc', 'object');
+ // Initial value
+ $this->result_assoc = array() and $this->result_object = array();
+
// Fetch the result
- foreach ($output as $type)
+ while ($row = $this->_fetch_assoc())
{
- // Define the method and handler
- $res_method = '_fetch_'.$type;
- $res_handler = 'result_'.$type;
-
- $this->$res_handler = array();
-
- while ($row = $this->$res_method())
- {
- $this->{$res_handler}[] = $row;
- }
+ $this->result_assoc[] = $row;
+ $this->result_object[] = (object) $row;
}
// Save this as buffer and marked the fetch flag
@@ -249,7 +244,7 @@ class CI_DB_pdo_result extends CI_DB_result {
*/
protected function _fetch_object()
{
- return $this->result_id->fetchObject();
+ return $this->result_id->fetch(PDO::FETCH_OBJ);
}
}
diff --git a/tests/mocks/database/ci_test.sqlite b/tests/mocks/database/ci_test.sqlite
index d48e3317f..23a3de2a4 100755
Binary files a/tests/mocks/database/ci_test.sqlite and b/tests/mocks/database/ci_test.sqlite differ
--
cgit v1.2.3-24-g4f1b
From d2d329a99f60bebc36eebc1c7b3c1a94b9789b49 Mon Sep 17 00:00:00 2001
From: Taufan Aditya
Date: Sat, 5 May 2012 00:33:04 +0700
Subject: ORDER BY clause API code-coverage
---
.../database/query_builder/order_test.php | 55 ++++++++++++++++++++++
1 file changed, 55 insertions(+)
create mode 100644 tests/codeigniter/database/query_builder/order_test.php
diff --git a/tests/codeigniter/database/query_builder/order_test.php b/tests/codeigniter/database/query_builder/order_test.php
new file mode 100644
index 000000000..01aa1c2b4
--- /dev/null
+++ b/tests/codeigniter/database/query_builder/order_test.php
@@ -0,0 +1,55 @@
+db = Mock_Database_Schema_Skeleton::init(DB_DRIVER);
+
+ Mock_Database_Schema_Skeleton::create_tables();
+ Mock_Database_Schema_Skeleton::create_data();
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
+ * @see ./mocks/schema/skeleton.php
+ */
+ public function test_order_ascending()
+ {
+ $jobs = $this->db->order_by('name', 'asc')
+ ->get('job')
+ ->result_array();
+
+ // Check the result
+ $this->assertEquals(4, count($jobs));
+ $this->assertEquals('Accountant', $jobs[0]['name']);
+ $this->assertEquals('Developer', $jobs[1]['name']);
+ $this->assertEquals('Musician', $jobs[2]['name']);
+ $this->assertEquals('Politician', $jobs[3]['name']);
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
+ * @see ./mocks/schema/skeleton.php
+ */
+ public function test_order_descending()
+ {
+ $jobs = $this->db->order_by('name', 'desc')
+ ->get('job')
+ ->result_array();
+
+ // Check the result
+ $this->assertEquals(4, count($jobs));
+ $this->assertEquals('Politician', $jobs[0]['name']);
+ $this->assertEquals('Musician', $jobs[1]['name']);
+ $this->assertEquals('Developer', $jobs[2]['name']);
+ $this->assertEquals('Accountant', $jobs[3]['name']);
+ }
+}
\ No newline at end of file
--
cgit v1.2.3-24-g4f1b
From be6fb4271ce723376930507dbe534f91344f26c7 Mon Sep 17 00:00:00 2001
From: Taufan Aditya
Date: Sat, 5 May 2012 00:35:41 +0700
Subject: LIMIT clause API code-coverage
---
.../database/query_builder/limit_test.php | 49 ++++++++++++++++++++++
1 file changed, 49 insertions(+)
create mode 100644 tests/codeigniter/database/query_builder/limit_test.php
diff --git a/tests/codeigniter/database/query_builder/limit_test.php b/tests/codeigniter/database/query_builder/limit_test.php
new file mode 100644
index 000000000..704f3b651
--- /dev/null
+++ b/tests/codeigniter/database/query_builder/limit_test.php
@@ -0,0 +1,49 @@
+db = Mock_Database_Schema_Skeleton::init(DB_DRIVER);
+
+ Mock_Database_Schema_Skeleton::create_tables();
+ Mock_Database_Schema_Skeleton::create_data();
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
+ * @see ./mocks/schema/skeleton.php
+ */
+ public function test_limit()
+ {
+ $jobs = $this->db->limit(2)
+ ->get('job')
+ ->result_array();
+
+ // Check the result
+ $this->assertEquals(2, count($jobs));
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
+ * @see ./mocks/schema/skeleton.php
+ */
+ public function test_limit_and_offset()
+ {
+ $jobs = $this->db->limit(2, 2)
+ ->get('job')
+ ->result_array();
+
+ // Check the result
+ $this->assertEquals(2, count($jobs));
+ $this->assertEquals('Accountant', $jobs[0]['name']);
+ $this->assertEquals('Musician', $jobs[1]['name']);
+ }
+}
\ No newline at end of file
--
cgit v1.2.3-24-g4f1b
From c386b2a363c289afcfa07eea081050e35c1e86d8 Mon Sep 17 00:00:00 2001
From: Taufan Aditya
Date: Sat, 5 May 2012 00:42:02 +0700
Subject: count code-coverage
---
.../database/query_builder/count_test.php | 44 ++++++++++++++++++++++
1 file changed, 44 insertions(+)
create mode 100644 tests/codeigniter/database/query_builder/count_test.php
diff --git a/tests/codeigniter/database/query_builder/count_test.php b/tests/codeigniter/database/query_builder/count_test.php
new file mode 100644
index 000000000..5e691692d
--- /dev/null
+++ b/tests/codeigniter/database/query_builder/count_test.php
@@ -0,0 +1,44 @@
+db = Mock_Database_Schema_Skeleton::init(DB_DRIVER);
+
+ Mock_Database_Schema_Skeleton::create_tables();
+ Mock_Database_Schema_Skeleton::create_data();
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
+ * @see ./mocks/schema/skeleton.php
+ */
+ public function test_count_all()
+ {
+ $job_count = $this->db->count_all('job');
+
+ // Check the result
+ $this->assertEquals(4, $job_count);
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
+ * @see ./mocks/schema/skeleton.php
+ */
+ public function test_count_all_results()
+ {
+ $job_count = $this->db->like('name', 'ian')
+ ->count_all_results('job');
+
+ // Check the result
+ $this->assertEquals(2, $job_count);
+ }
+}
\ No newline at end of file
--
cgit v1.2.3-24-g4f1b
From 9ec507badf60952750e76b5d83da54874dd19119 Mon Sep 17 00:00:00 2001
From: Taufan Aditya
Date: Sat, 5 May 2012 00:55:39 +0700
Subject: UPDATE and SET clause code-coverage
---
.../database/query_builder/update_test.php | 71 ++++++++++++++++++++++
1 file changed, 71 insertions(+)
create mode 100644 tests/codeigniter/database/query_builder/update_test.php
diff --git a/tests/codeigniter/database/query_builder/update_test.php b/tests/codeigniter/database/query_builder/update_test.php
new file mode 100644
index 000000000..f5bbffd4f
--- /dev/null
+++ b/tests/codeigniter/database/query_builder/update_test.php
@@ -0,0 +1,71 @@
+db = Mock_Database_Schema_Skeleton::init(DB_DRIVER);
+
+ Mock_Database_Schema_Skeleton::create_tables();
+ Mock_Database_Schema_Skeleton::create_data();
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
+ * @see ./mocks/schema/skeleton.php
+ */
+ public function test_update()
+ {
+ // Check initial record
+ $job1 = $this->db->where('id', 1)
+ ->get('job')
+ ->row();
+
+ $this->assertEquals('Developer', $job1->name);
+
+ // Do the update
+ $job_data = array('name' => 'Programmer');
+
+ $this->db->where('id', 1)
+ ->update('job', $job_data);
+
+ // Check updated record
+ $job1 = $this->db->where('id', 1)
+ ->get('job')
+ ->row();
+
+ $this->assertEquals('Programmer', $job1->name);
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
+ * @see ./mocks/schema/skeleton.php
+ */
+ public function test_update_with_set()
+ {
+ // Check initial record
+ $job1 = $this->db->where('id', 4)
+ ->get('job')
+ ->row();
+
+ $this->assertEquals('Musician', $job1->name);
+
+ // Do the update
+ $this->db->set('name', 'Vocalist');
+ $this->db->update('job', NULL, 'id = 4');
+
+ // Check updated record
+ $job1 = $this->db->where('id', 4)
+ ->get('job')
+ ->row();
+
+ $this->assertEquals('Vocalist', $job1->name);
+ }
+}
\ No newline at end of file
--
cgit v1.2.3-24-g4f1b
From 6657cc1672f3f466655b1e476028b9d46a16bd1c Mon Sep 17 00:00:00 2001
From: Taufan Aditya
Date: Sat, 5 May 2012 01:06:41 +0700
Subject: DELETE code-coverage
---
.../database/query_builder/delete_test.php | 72 ++++++++++++++++++++++
1 file changed, 72 insertions(+)
create mode 100644 tests/codeigniter/database/query_builder/delete_test.php
diff --git a/tests/codeigniter/database/query_builder/delete_test.php b/tests/codeigniter/database/query_builder/delete_test.php
new file mode 100644
index 000000000..84ea7616f
--- /dev/null
+++ b/tests/codeigniter/database/query_builder/delete_test.php
@@ -0,0 +1,72 @@
+db = Mock_Database_Schema_Skeleton::init(DB_DRIVER);
+
+ Mock_Database_Schema_Skeleton::create_tables();
+ Mock_Database_Schema_Skeleton::create_data();
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
+ * @see ./mocks/schema/skeleton.php
+ */
+ public function test_delete()
+ {
+ // Check initial record
+ $job1 = $this->db->where('id', 1)
+ ->get('job')
+ ->row();
+
+ $this->assertEquals('Developer', $job1->name);
+
+ // Do the delete
+ $this->db->delete('job', array('id' => 1));
+
+ // Check the record
+ $job1 = $this->db->where('id', 1)
+ ->get('job');
+
+ $this->assertEmpty($job1->result_array());
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
+ * @see ./mocks/schema/skeleton.php
+ */
+ public function test_delete_several_tables()
+ {
+ // Check initial record
+ $user4 = $this->db->where('id', 4)
+ ->get('user')
+ ->row();
+
+ $job4 = $this->db->where('id', 4)
+ ->get('job')
+ ->row();
+
+ $this->assertEquals('Musician', $job4->name);
+ $this->assertEquals('Chris Martin', $user4->name);
+
+ // Do the delete
+ $this->db->delete(array('job', 'user'), array('id' => 4));
+
+ // Check the record
+ $job4 = $this->db->where('id', 4)->get('job');
+ $user4 = $this->db->where('id', 4)->get('user');
+
+ $this->assertEmpty($job4->result_array());
+ $this->assertEmpty($user4->result_array());
+ }
+
+}
\ No newline at end of file
--
cgit v1.2.3-24-g4f1b
From 85859b212e480e2e1a59aae50c759367d6794ecd Mon Sep 17 00:00:00 2001
From: Taufan Aditya
Date: Sat, 5 May 2012 01:26:51 +0700
Subject: empty table API code-coverage
---
.../database/query_builder/empty_test.php | 39 ++++++++++++++++++++++
1 file changed, 39 insertions(+)
create mode 100644 tests/codeigniter/database/query_builder/empty_test.php
diff --git a/tests/codeigniter/database/query_builder/empty_test.php b/tests/codeigniter/database/query_builder/empty_test.php
new file mode 100644
index 000000000..d1f56285f
--- /dev/null
+++ b/tests/codeigniter/database/query_builder/empty_test.php
@@ -0,0 +1,39 @@
+db = Mock_Database_Schema_Skeleton::init(DB_DRIVER);
+
+ Mock_Database_Schema_Skeleton::create_tables();
+ Mock_Database_Schema_Skeleton::create_data();
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
+ * @see ./mocks/schema/skeleton.php
+ */
+ public function test_empty_table()
+ {
+ // Check initial record
+ $jobs = $this->db->get('job')->result_array();
+
+ $this->assertEquals(4, count($jobs));
+
+ // Do the empty
+ $this->db->empty_table('job');
+
+ // Check the record
+ $jobs = $this->db->get('job');
+
+ $this->assertEmpty($jobs->result_array());
+ }
+
+}
\ No newline at end of file
--
cgit v1.2.3-24-g4f1b
From 39f35fde6d023433e98904105f55f305483b6b5e Mon Sep 17 00:00:00 2001
From: Taufan Aditya
Date: Sat, 5 May 2012 01:29:13 +0700
Subject: TRUNCATE code-coverage
---
.../database/query_builder/truncate_test.php | 61 ++++++++++++++++++++++
1 file changed, 61 insertions(+)
create mode 100644 tests/codeigniter/database/query_builder/truncate_test.php
diff --git a/tests/codeigniter/database/query_builder/truncate_test.php b/tests/codeigniter/database/query_builder/truncate_test.php
new file mode 100644
index 000000000..2a9c8a91e
--- /dev/null
+++ b/tests/codeigniter/database/query_builder/truncate_test.php
@@ -0,0 +1,61 @@
+db = Mock_Database_Schema_Skeleton::init(DB_DRIVER);
+
+ Mock_Database_Schema_Skeleton::create_tables();
+ Mock_Database_Schema_Skeleton::create_data();
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
+ * @see ./mocks/schema/skeleton.php
+ */
+ public function test_truncate()
+ {
+ // Check initial record
+ $jobs = $this->db->get('job')->result_array();
+
+ $this->assertEquals(4, count($jobs));
+
+ // Do the empty
+ $this->db->truncate('job');
+
+ // Check the record
+ $jobs = $this->db->get('job');
+
+ $this->assertEmpty($jobs->result_array());
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
+ * @see ./mocks/schema/skeleton.php
+ */
+ public function test_truncate_with_from()
+ {
+ // Check initial record
+ $users = $this->db->get('user')->result_array();
+
+ $this->assertEquals(4, count($users));
+
+ // Do the empty
+ $this->db->from('user')
+ ->truncate();
+
+ // Check the record
+ $users = $this->db->get('user');
+
+ $this->assertEmpty($users->result_array());
+ }
+
+}
\ No newline at end of file
--
cgit v1.2.3-24-g4f1b
From 51a7c0b98df29205d39bb404c2bcd12bfb4ed4cb Mon Sep 17 00:00:00 2001
From: Taufan Aditya
Date: Sat, 5 May 2012 01:43:08 +0700
Subject: Clean up
---
tests/README.md | 6 ------
tests/codeigniter/Setup_test.php | 10 +++++-----
tests/travis/mysql.phpunit.xml | 6 +-----
tests/travis/pdo/mysql.phpunit.xml | 4 ----
tests/travis/pdo/pgsql.phpunit.xml | 6 +-----
tests/travis/pdo/sqlite.phpunit.xml | 6 +-----
tests/travis/pgsql.phpunit.xml | 6 +-----
tests/travis/sqlite.phpunit.xml | 6 +-----
8 files changed, 10 insertions(+), 40 deletions(-)
diff --git a/tests/README.md b/tests/README.md
index 6d83c34d8..b46f344cb 100644
--- a/tests/README.md
+++ b/tests/README.md
@@ -2,12 +2,6 @@
Status : [![Build Status](https://secure.travis-ci.org/EllisLab/CodeIgniter.png?branch=feature/unit-tests)](http://travis-ci.org/EllisLab/CodeIgniter)
-*Do not merge to default until these issues have been addressed*
-
-- Clean up naming conventions
-- Figure out config stuff
-- Figure out database testing
-
### Introduction:
This is the preliminary CodeIgniter testing documentation. It
diff --git a/tests/codeigniter/Setup_test.php b/tests/codeigniter/Setup_test.php
index 550245f2f..b48e32bfb 100644
--- a/tests/codeigniter/Setup_test.php
+++ b/tests/codeigniter/Setup_test.php
@@ -2,12 +2,12 @@
class Setup_test extends PHPUnit_Framework_TestCase {
- function test_nonsense()
+ function test_bootstrap_constants()
{
- $this->markTestIncomplete('not implemented');
- // ensure that our bootstrapped test environment
- // is a good representation of an isolated CI install
- //die('here');
+ $this->assertTrue(defined('PROJECT_BASE'));
+ $this->assertTrue(defined('BASEPATH'));
+ $this->assertTrue(defined('APPPATH'));
+ $this->assertTrue(defined('VIEWPATH'));
}
}
\ No newline at end of file
diff --git a/tests/travis/mysql.phpunit.xml b/tests/travis/mysql.phpunit.xml
index e9556f758..c5fcf1335 100644
--- a/tests/travis/mysql.phpunit.xml
+++ b/tests/travis/mysql.phpunit.xml
@@ -14,11 +14,7 @@
- ../codeigniter/Setup_test.php
- ../codeigniter/core
- ../codeigniter/helpers
- ../codeigniter/libraries
- ../codeigniter/database
+ ../codeigniter
diff --git a/tests/travis/pdo/mysql.phpunit.xml b/tests/travis/pdo/mysql.phpunit.xml
index 69eece24f..f6fcc1c39 100644
--- a/tests/travis/pdo/mysql.phpunit.xml
+++ b/tests/travis/pdo/mysql.phpunit.xml
@@ -14,10 +14,6 @@
- ../../codeigniter/Setup_test.php
- ../../codeigniter/core
- ../../codeigniter/helpers
- ../../codeigniter/libraries../../codeigniter/database
diff --git a/tests/travis/pdo/pgsql.phpunit.xml b/tests/travis/pdo/pgsql.phpunit.xml
index e68c3e028..6a23227db 100644
--- a/tests/travis/pdo/pgsql.phpunit.xml
+++ b/tests/travis/pdo/pgsql.phpunit.xml
@@ -14,11 +14,7 @@
- ../../codeigniter/Setup_test.php
- ../../codeigniter/core
- ../../codeigniter/helpers
- ../../codeigniter/libraries
- ../../codeigniter/database
+ ../../codeigniter
diff --git a/tests/travis/pdo/sqlite.phpunit.xml b/tests/travis/pdo/sqlite.phpunit.xml
index 1871f6221..b85b7308a 100644
--- a/tests/travis/pdo/sqlite.phpunit.xml
+++ b/tests/travis/pdo/sqlite.phpunit.xml
@@ -14,11 +14,7 @@
- ../../codeigniter/Setup_test.php
- ../../codeigniter/core
- ../../codeigniter/helpers
- ../../codeigniter/libraries
- ../../codeigniter/database
+ ../../codeigniter
diff --git a/tests/travis/pgsql.phpunit.xml b/tests/travis/pgsql.phpunit.xml
index ad8aeded2..78b6046cf 100644
--- a/tests/travis/pgsql.phpunit.xml
+++ b/tests/travis/pgsql.phpunit.xml
@@ -14,11 +14,7 @@
- ../codeigniter/Setup_test.php
- ../codeigniter/core
- ../codeigniter/helpers
- ../codeigniter/libraries
- ../codeigniter/database
+ ../codeigniter
diff --git a/tests/travis/sqlite.phpunit.xml b/tests/travis/sqlite.phpunit.xml
index 628370e93..46e3d5073 100644
--- a/tests/travis/sqlite.phpunit.xml
+++ b/tests/travis/sqlite.phpunit.xml
@@ -14,11 +14,7 @@
- ../codeigniter/Setup_test.php
- ../codeigniter/core
- ../codeigniter/helpers
- ../codeigniter/libraries
- ../codeigniter/database
+ ../codeigniter
--
cgit v1.2.3-24-g4f1b
From 82196b945e291c65fdb66b35e3205f786ce8e921 Mon Sep 17 00:00:00 2001
From: Taufan Aditya
Date: Sat, 5 May 2012 01:52:47 +0700
Subject: Remove temporary branch from travis whitelist
---
.travis.yml | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 971f62f38..97ea0422d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -25,5 +25,4 @@ script: phpunit --configuration tests/travis/$DB.phpunit.xml
branches:
only:
- develop
- - master
- - db-tests
\ No newline at end of file
+ - master
\ No newline at end of file
--
cgit v1.2.3-24-g4f1b
From d4fb95ff19666f178b9f84850d122ff07fe193b9 Mon Sep 17 00:00:00 2001
From: Cusco
Date: Sat, 5 May 2012 03:22:24 +0800
Subject: Update system/database/drivers/interbase/interbase_utility.php
---
system/database/drivers/interbase/interbase_utility.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/system/database/drivers/interbase/interbase_utility.php b/system/database/drivers/interbase/interbase_utility.php
index 1b92af9b6..164211836 100644
--- a/system/database/drivers/interbase/interbase_utility.php
+++ b/system/database/drivers/interbase/interbase_utility.php
@@ -42,7 +42,7 @@ class CI_DB_interbase_utility extends CI_DB_utility {
* @param string $filename
* @return mixed
*/
- protected function backup($filename)
+ protected function _backup($filename)
{
if ($service = ibase_service_attach($this->db->hostname, $this->db->username, $this->db->password))
{
--
cgit v1.2.3-24-g4f1b
From bb2c83bddbf51c42815be3de60eab24fd87ae392 Mon Sep 17 00:00:00 2001
From: Wes Baker
Date: Fri, 4 May 2012 18:44:24 -0400
Subject: Added a return false if an image doesn't pass XSS cleaning to prevent
file_get_contents from returning a NULL and passing through unscathed.
---
system/libraries/Upload.php | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php
index 8ad67050d..4a4a66f73 100644
--- a/system/libraries/Upload.php
+++ b/system/libraries/Upload.php
@@ -850,6 +850,10 @@ class CI_Upload {
{
return TRUE; // its an image, no "triggers" detected in the first 256 bytes, we're good
}
+ else
+ {
+ return FALSE;
+ }
}
if (($data = @file_get_contents($file)) === FALSE)
@@ -1099,4 +1103,4 @@ class CI_Upload {
}
/* End of file Upload.php */
-/* Location: ./system/libraries/Upload.php */
\ No newline at end of file
+/* Location: ./system/libraries/Upload.php */
--
cgit v1.2.3-24-g4f1b
From 43ef706d3684af7efa02c21db02ca150c9b424a9 Mon Sep 17 00:00:00 2001
From: dixy
Date: Sat, 5 May 2012 18:26:54 +0200
Subject: Remove -webkit prefix for box-shadow
---
application/errors/error_404.php | 2 +-
application/errors/error_db.php | 2 +-
application/errors/error_general.php | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/application/errors/error_404.php b/application/errors/error_404.php
index 746032956..c19bedfcd 100644
--- a/application/errors/error_404.php
+++ b/application/errors/error_404.php
@@ -72,7 +72,7 @@ code {
#container {
margin: 10px;
border: 1px solid #D0D0D0;
- -webkit-box-shadow: 0 0 8px #D0D0D0;
+ box-shadow: 0 0 8px #D0D0D0;
}
p {
diff --git a/application/errors/error_db.php b/application/errors/error_db.php
index eb3a75260..3b244e094 100644
--- a/application/errors/error_db.php
+++ b/application/errors/error_db.php
@@ -72,7 +72,7 @@ code {
#container {
margin: 10px;
border: 1px solid #D0D0D0;
- -webkit-box-shadow: 0 0 8px #D0D0D0;
+ box-shadow: 0 0 8px #D0D0D0;
}
p {
diff --git a/application/errors/error_general.php b/application/errors/error_general.php
index 59896e1ea..c88afe168 100644
--- a/application/errors/error_general.php
+++ b/application/errors/error_general.php
@@ -72,7 +72,7 @@ code {
#container {
margin: 10px;
border: 1px solid #D0D0D0;
- -webkit-box-shadow: 0 0 8px #D0D0D0;
+ box-shadow: 0 0 8px #D0D0D0;
}
p {
--
cgit v1.2.3-24-g4f1b
From e463c4d71c2fdcc224e70f7576582220ae64e3d7 Mon Sep 17 00:00:00 2001
From: Wes Baker
Date: Fri, 4 May 2012 18:44:24 -0400
Subject: Added a return false if an image doesn't pass XSS cleaning to prevent
file_get_contents from returning a NULL and passing through unscathed.
---
system/libraries/Upload.php | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php
index b0490de30..0e5d73b19 100644
--- a/system/libraries/Upload.php
+++ b/system/libraries/Upload.php
@@ -868,6 +868,10 @@ class CI_Upload {
{
return TRUE; // its an image, no "triggers" detected in the first 256 bytes, we're good
}
+ else
+ {
+ return FALSE;
+ }
}
if (($data = @file_get_contents($file)) === FALSE)
--
cgit v1.2.3-24-g4f1b
From cdcceecba73dd9f54665f531d15c12f5c9679738 Mon Sep 17 00:00:00 2001
From: Andrey Andreev
Date: Wed, 9 May 2012 11:23:30 +0300
Subject: Fix issue #1342
---
system/libraries/Form_validation.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index 5547c6a69..73f607be8 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -448,7 +448,7 @@ class CI_Form_validation {
{
$this->_field_data[$field]['postdata'] = $this->_reduce_array($validation_array, $row['keys']);
}
- elseif ( ! empty($validation_array[$field]))
+ elseif (isset($validation_array[$field]))
{
$this->_field_data[$field]['postdata'] = $validation_array[$field];
}
--
cgit v1.2.3-24-g4f1b
From d41f423528b21d97ff0eb268e10947b257f5a90e Mon Sep 17 00:00:00 2001
From: Soesapto Joeni Hantoro
Date: Fri, 11 May 2012 11:00:42 +0700
Subject: Generate better conditions statement on boolean field type. Actually
boolean field type need TRUE or FALSE value. Common DBMS (e.g., MySQL) can
substite this value with 1 or 0, but it can't be implemented on PostgreSQL.
So, its better to use TRUE or FALSE value for boolean field type.
---
system/database/DB_query_builder.php | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php
index d0af66de1..969a25acb 100644
--- a/system/database/DB_query_builder.php
+++ b/system/database/DB_query_builder.php
@@ -432,7 +432,21 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
$k .= ' IS NULL';
}
- if ( ! is_null($v))
+ if ( is_bool($v))
+ {
+ if ($escape === TRUE)
+ {
+ $k = $this->protect_identifiers($k, FALSE, $escape);
+
+ $v = ' '.($v ? 'TRUE' : 'FALSE');
+ }
+
+ if ( ! $this->_has_operator($k))
+ {
+ $k .= ' =';
+ }
+ }
+ else if ( ! is_null($v))
{
if ($escape === TRUE)
{
--
cgit v1.2.3-24-g4f1b
From b01d96f65a78528323b3917eec31c4ed8b58eb7b Mon Sep 17 00:00:00 2001
From: Soesapto Joeni Hantoro
Date: Fri, 11 May 2012 11:18:38 +0700
Subject: simpler script, add boolean handling on DB_driver/escape
---
system/database/DB_query_builder.php | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php
index 969a25acb..8fa67ea06 100644
--- a/system/database/DB_query_builder.php
+++ b/system/database/DB_query_builder.php
@@ -432,26 +432,16 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
$k .= ' IS NULL';
}
- if ( is_bool($v))
+ if ( ! is_null($v))
{
if ($escape === TRUE)
{
$k = $this->protect_identifiers($k, FALSE, $escape);
-
- $v = ' '.($v ? 'TRUE' : 'FALSE');
+ $v = ' '.$this->escape($v);
}
-
- if ( ! $this->_has_operator($k))
+ else if (is_bool($v))
{
- $k .= ' =';
- }
- }
- else if ( ! is_null($v))
- {
- if ($escape === TRUE)
- {
- $k = $this->protect_identifiers($k, FALSE, $escape);
- $v = ' '.$this->escape($v);
+ $v = ' '.($v ? 'TRUE' : 'FALSE');
}
if ( ! $this->_has_operator($k))
--
cgit v1.2.3-24-g4f1b
From 938c7ef59991ed12b8634b292e2f8fc9fa385264 Mon Sep 17 00:00:00 2001
From: Soesapto Joeni Hantoro
Date: Fri, 11 May 2012 11:21:43 +0700
Subject: Escaping boolean data type, some DBMS (e.g., postgre) need it
---
system/database/DB_driver.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index ef77b594e..09513e267 100644
--- a/system/database/DB_driver.php
+++ b/system/database/DB_driver.php
@@ -696,7 +696,7 @@ abstract class CI_DB_driver {
}
elseif (is_bool($str))
{
- return ($str === FALSE) ? 0 : 1;
+ return ($str === FALSE) ? "FALSE" : "TRUE";
}
elseif (is_null($str))
{
--
cgit v1.2.3-24-g4f1b
From ca7d822f224033196e0e327944a01f319c90f37f Mon Sep 17 00:00:00 2001
From: Andrey Andreev
Date: Fri, 11 May 2012 10:59:09 +0300
Subject: User_agent library improvements
---
application/config/user_agents.php | 147 +++++++++++++++++++-----------------
system/libraries/User_agent.php | 24 +++---
user_guide_src/source/changelog.rst | 2 +-
3 files changed, 89 insertions(+), 84 deletions(-)
diff --git a/application/config/user_agents.php b/application/config/user_agents.php
index 60f256e01..72d74dbc7 100644
--- a/application/config/user_agents.php
+++ b/application/config/user_agents.php
@@ -36,7 +36,7 @@
|
*/
-$platforms = array (
+$platforms = array(
'windows nt 6.1' => 'Windows 7',
'windows nt 6.0' => 'Windows Vista',
'windows nt 5.2' => 'Windows 2003',
@@ -51,6 +51,11 @@ $platforms = array (
'windows 95' => 'Windows 95',
'win95' => 'Windows 95',
'windows' => 'Unknown Windows OS',
+ 'android' => 'Android',
+ 'blackberry' => 'BlackBerry',
+ 'iphone' => 'iOS',
+ 'ipad' => 'iOS',
+ 'ipod' => 'iOS',
'os x' => 'Mac OS X',
'ppc mac' => 'Power PC Mac',
'freebsd' => 'FreeBSD',
@@ -117,84 +122,84 @@ $mobiles = array(
// 'motorola' => 'Motorola'
// Phones and Manufacturers
- 'motorola' => "Motorola",
- 'nokia' => "Nokia",
- 'palm' => "Palm",
- 'iphone' => "Apple iPhone",
- 'ipad' => "iPad",
- 'ipod' => "Apple iPod Touch",
- 'sony' => "Sony Ericsson",
- 'ericsson' => "Sony Ericsson",
- 'blackberry' => "BlackBerry",
- 'cocoon' => "O2 Cocoon",
- 'blazer' => "Treo",
- 'lg' => "LG",
- 'amoi' => "Amoi",
- 'xda' => "XDA",
- 'mda' => "MDA",
- 'vario' => "Vario",
- 'htc' => "HTC",
- 'samsung' => "Samsung",
- 'sharp' => "Sharp",
- 'sie-' => "Siemens",
- 'alcatel' => "Alcatel",
- 'benq' => "BenQ",
- 'ipaq' => "HP iPaq",
- 'mot-' => "Motorola",
- 'playstation portable' => "PlayStation Portable",
- 'hiptop' => "Danger Hiptop",
- 'nec-' => "NEC",
- 'panasonic' => "Panasonic",
- 'philips' => "Philips",
- 'sagem' => "Sagem",
- 'sanyo' => "Sanyo",
- 'spv' => "SPV",
- 'zte' => "ZTE",
- 'sendo' => "Sendo",
- 'dsi' => "Nintendo DSi",
- 'ds' => "Nintendo DS",
- 'wii' => "Nintendo Wii",
- '3ds' => "Nintendo 3DS",
- 'open web' => "Open Web",
- 'openweb' => "OpenWeb",
+ 'motorola' => 'Motorola',
+ 'nokia' => 'Nokia',
+ 'palm' => 'Palm',
+ 'iphone' => 'Apple iPhone',
+ 'ipad' => 'iPad',
+ 'ipod' => 'Apple iPod Touch',
+ 'sony' => 'Sony Ericsson',
+ 'ericsson' => 'Sony Ericsson',
+ 'blackberry' => 'BlackBerry',
+ 'cocoon' => 'O2 Cocoon',
+ 'blazer' => 'Treo',
+ 'lg' => 'LG',
+ 'amoi' => 'Amoi',
+ 'xda' => 'XDA',
+ 'mda' => 'MDA',
+ 'vario' => 'Vario',
+ 'htc' => 'HTC',
+ 'samsung' => 'Samsung',
+ 'sharp' => 'Sharp',
+ 'sie-' => 'Siemens',
+ 'alcatel' => 'Alcatel',
+ 'benq' => 'BenQ',
+ 'ipaq' => 'HP iPaq',
+ 'mot-' => 'Motorola',
+ 'playstation portable' => 'PlayStation Portable',
+ 'hiptop' => 'Danger Hiptop',
+ 'nec-' => 'NEC',
+ 'panasonic' => 'Panasonic',
+ 'philips' => 'Philips',
+ 'sagem' => 'Sagem',
+ 'sanyo' => 'Sanyo',
+ 'spv' => 'SPV',
+ 'zte' => 'ZTE',
+ 'sendo' => 'Sendo',
+ 'dsi' => 'Nintendo DSi',
+ 'ds' => 'Nintendo DS',
+ 'wii' => 'Nintendo Wii',
+ '3ds' => 'Nintendo 3DS',
+ 'open web' => 'Open Web',
+ 'openweb' => 'OpenWeb',
// Operating Systems
- 'android' => "Android",
- 'symbian' => "Symbian",
- 'SymbianOS' => "SymbianOS",
- 'elaine' => "Palm",
- 'palm' => "Palm",
- 'series60' => "Symbian S60",
- 'windows ce' => "Windows CE",
+ 'android' => 'Android',
+ 'symbian' => 'Symbian',
+ 'SymbianOS' => 'SymbianOS',
+ 'elaine' => 'Palm',
+ 'palm' => 'Palm',
+ 'series60' => 'Symbian S60',
+ 'windows ce' => 'Windows CE',
// Browsers
- 'obigo' => "Obigo",
- 'netfront' => "Netfront Browser",
- 'openwave' => "Openwave Browser",
- 'mobilexplorer' => "Mobile Explorer",
- 'operamini' => "Opera Mini",
- 'opera mini' => "Opera Mini",
- 'opera mobi' => "Opera Mobile",
+ 'obigo' => 'Obigo',
+ 'netfront' => 'Netfront Browser',
+ 'openwave' => 'Openwave Browser',
+ 'mobilexplorer' => 'Mobile Explorer',
+ 'operamini' => 'Opera Mini',
+ 'opera mini' => 'Opera Mini',
+ 'opera mobi' => 'Opera Mobile',
// Other
- 'digital paths' => "Digital Paths",
- 'avantgo' => "AvantGo",
- 'xiino' => "Xiino",
- 'novarra' => "Novarra Transcoder",
- 'vodafone' => "Vodafone",
- 'docomo' => "NTT DoCoMo",
- 'o2' => "O2",
+ 'digital paths' => 'Digital Paths',
+ 'avantgo' => 'AvantGo',
+ 'xiino' => 'Xiino',
+ 'novarra' => 'Novarra Transcoder',
+ 'vodafone' => 'Vodafone',
+ 'docomo' => 'NTT DoCoMo',
+ 'o2' => 'O2',
// Fallback
- 'mobile' => "Generic Mobile",
- 'wireless' => "Generic Mobile",
- 'j2me' => "Generic Mobile",
- 'midp' => "Generic Mobile",
- 'cldc' => "Generic Mobile",
- 'up.link' => "Generic Mobile",
- 'up.browser' => "Generic Mobile",
- 'smartphone' => "Generic Mobile",
- 'cellphone' => "Generic Mobile"
+ 'mobile' => 'Generic Mobile',
+ 'wireless' => 'Generic Mobile',
+ 'j2me' => 'Generic Mobile',
+ 'midp' => 'Generic Mobile',
+ 'cldc' => 'Generic Mobile',
+ 'up.link' => 'Generic Mobile',
+ 'up.browser' => 'Generic Mobile',
+ 'smartphone' => 'Generic Mobile',
+ 'cellphone' => 'Generic Mobile'
);
// There are hundreds of bots but these are the most common.
diff --git a/system/libraries/User_agent.php b/system/libraries/User_agent.php
index 0ac605fa4..ff596f04b 100644
--- a/system/libraries/User_agent.php
+++ b/system/libraries/User_agent.php
@@ -51,14 +51,14 @@ class CI_User_agent {
* @var bool
*/
public $is_browser = FALSE;
-
+
/**
* Flag for if the user-agent is a robot
*
* @var bool
*/
public $is_robot = FALSE;
-
+
/**
* Flag for if the user-agent is a mobile browser
*
@@ -72,7 +72,7 @@ class CI_User_agent {
* @var array
*/
public $languages = array();
-
+
/**
* Character sets accepted by the current user agent
*
@@ -86,21 +86,21 @@ class CI_User_agent {
* @var array
*/
public $platforms = array();
-
+
/**
* List of browsers to compare against current user agent
*
* @var array
*/
public $browsers = array();
-
+
/**
* List of mobile browsers to compare against current user agent
*
* @var array
*/
public $mobiles = array();
-
+
/**
* List of robots to compare against current user agent
*
@@ -114,28 +114,28 @@ class CI_User_agent {
* @var string
*/
public $platform = '';
-
+
/**
* Current user-agent browser
*
* @var string
*/
public $browser = '';
-
+
/**
* Current user-agent version
*
* @var string
*/
public $version = '';
-
+
/**
* Current user-agent mobile name
*
* @var string
*/
public $mobile = '';
-
+
/**
* Current user-agent robot name
*
@@ -330,7 +330,7 @@ class CI_User_agent {
{
foreach ($this->mobiles as $key => $val)
{
- if (FALSE !== (strpos(strtolower($this->agent), $key)))
+ if (FALSE !== (stripos($this->agent, $key)))
{
$this->is_mobile = TRUE;
$this->mobile = $val;
@@ -604,7 +604,7 @@ class CI_User_agent {
/**
* Test for a particular character set
*
- * @param string $charset
+ * @param string $charset
* @return bool
*/
public function accept_charset($charset = 'utf-8')
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index a70531901..4756eb3f5 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -22,7 +22,7 @@ Release Date: Not Released
- PHP 5.1.6 is no longer supported. CodeIgniter now requires PHP 5.2.4.
- Added an optional backtrace to php-error template.
- Added Android to the list of user agents.
- - Added Windows 7 to the list of user platforms.
+ - Added Windows 7, Android, Blackberry and iOS to the list of user platforms.
- Ability to log certain error types, not all under a threshold.
- Added support for pem, p10, p12, p7a, p7c, p7m, p7r, p7s, crt, crl, der, kdb, rsa, cer, sst, csr Certs to mimes.php.
- Added support for pgp and gpg to mimes.php.
--
cgit v1.2.3-24-g4f1b
From 585cf67a98d8a31f584c13a319310ca7561d572c Mon Sep 17 00:00:00 2001
From: Andrey Andreev
Date: Fri, 11 May 2012 11:55:15 +0300
Subject: Remove a duplicate mobile user agent entry
---
application/config/user_agents.php | 1 -
1 file changed, 1 deletion(-)
diff --git a/application/config/user_agents.php b/application/config/user_agents.php
index 72d74dbc7..76114616b 100644
--- a/application/config/user_agents.php
+++ b/application/config/user_agents.php
@@ -168,7 +168,6 @@ $mobiles = array(
'symbian' => 'Symbian',
'SymbianOS' => 'SymbianOS',
'elaine' => 'Palm',
- 'palm' => 'Palm',
'series60' => 'Symbian S60',
'windows ce' => 'Windows CE',
--
cgit v1.2.3-24-g4f1b
From 46d53fb8799eb2f84798f0e7a5f57b065c2482e2 Mon Sep 17 00:00:00 2001
From: Andrey Andreev
Date: Fri, 11 May 2012 13:42:24 +0300
Subject: Fix issue #1349
---
system/libraries/Upload.php | 2 +-
user_guide_src/source/changelog.rst | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php
index 4a4a66f73..24d4bd4d0 100644
--- a/system/libraries/Upload.php
+++ b/system/libraries/Upload.php
@@ -725,7 +725,7 @@ class CI_Upload {
public function get_extension($filename)
{
$x = explode('.', $filename);
- return '.'.end($x);
+ return (count($x) !== 1) ? '.'.end($x) : '';
}
// --------------------------------------------------------------------
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 4756eb3f5..d457a3fbc 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -214,8 +214,9 @@ Bug fixes for 3.0
- Fixed a bug in SQLSRV's delete() method where like() and limit() conditions were ignored.
- Fixed a bug (#1265) - Database connections were always closed, regardless of the 'pconnect' option value.
- Fixed a bug (#128) - :doc:`Language Library ` did not correctly keep track of loaded language files.
-- Fixed a bug (#1242) Added Windows path compatibility to function read_dir of ZIP library
-- Fixed a bug (#1314) sess_destroy() did not destroy userdata.
+- Fixed a bug (#1242) - Added Windows path compatibility to function read_dir of ZIP library
+- Fixed a bug (#1314) - sess_destroy() did not destroy userdata.
+- Fixed a bug (#1349) - get_extension() in the `File Uploading Library ` returned the original filename when it didn't have an actual extension.
Version 2.1.1
=============
--
cgit v1.2.3-24-g4f1b
From fff6c2a3caa1ce14e58fcb3ee0d937d17985eea1 Mon Sep 17 00:00:00 2001
From: Andrey Andreev
Date: Sun, 13 May 2012 22:15:23 +0300
Subject: Improve the solution for issue #1342
---
system/libraries/Form_validation.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index 73f607be8..c396580be 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -448,7 +448,7 @@ class CI_Form_validation {
{
$this->_field_data[$field]['postdata'] = $this->_reduce_array($validation_array, $row['keys']);
}
- elseif (isset($validation_array[$field]))
+ elseif (isset($validation_array[$field]) && $validation_array[$field] !== '')
{
$this->_field_data[$field]['postdata'] = $validation_array[$field];
}
--
cgit v1.2.3-24-g4f1b
From 66c982e8fa8fb0261394b63b25a3817503263d17 Mon Sep 17 00:00:00 2001
From: Thanasis Polychronakis
Date: Mon, 14 May 2012 21:31:04 +0300
Subject: Load base config first, then environment's config
---
system/core/Common.php | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/system/core/Common.php b/system/core/Common.php
index 78aa6e874..01b0d8673 100644
--- a/system/core/Common.php
+++ b/system/core/Common.php
@@ -231,21 +231,21 @@ if ( ! function_exists('get_config'))
return $_config[0];
}
- // Is the config file in the environment folder?
- if ( ! defined('ENVIRONMENT') OR ! file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/config.php'))
- {
- $file_path = APPPATH.'config/config.php';
+ $file_path = APPPATH.'config/config.php';
+ $found = false;
+ if (file_exists($file_path)) {
+ $found = true;
+ require($file_path);
}
- // Fetch the config file
- if ( ! file_exists($file_path))
+ // Is the config file in the environment folder?
+ if (defined(ENVIRONMENT) && file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/config.php'))
{
- set_status_header(503);
+ require($file_path);
+ } else if (!$found) {
exit('The configuration file does not exist.');
}
- require($file_path);
-
// Does the $config array exist in the file?
if ( ! isset($config) OR ! is_array($config))
{
--
cgit v1.2.3-24-g4f1b
From 09069ddcecde9a0c66e41087e816567d420eb750 Mon Sep 17 00:00:00 2001
From: Timothy Warren
Date: Mon, 14 May 2012 15:21:33 -0400
Subject: Move errors to views folder
---
application/errors/error_404.php | 89 ------------------------------
application/errors/error_db.php | 89 ------------------------------
application/errors/error_general.php | 89 ------------------------------
application/errors/error_php.php | 55 ------------------
application/errors/index.html | 10 ----
application/views/errors/error_404.php | 89 ++++++++++++++++++++++++++++++
application/views/errors/error_db.php | 89 ++++++++++++++++++++++++++++++
application/views/errors/error_general.php | 89 ++++++++++++++++++++++++++++++
application/views/errors/error_php.php | 55 ++++++++++++++++++
application/views/errors/index.html | 10 ++++
system/core/Exceptions.php | 4 +-
11 files changed, 334 insertions(+), 334 deletions(-)
delete mode 100644 application/errors/error_404.php
delete mode 100644 application/errors/error_db.php
delete mode 100644 application/errors/error_general.php
delete mode 100644 application/errors/error_php.php
delete mode 100644 application/errors/index.html
create mode 100644 application/views/errors/error_404.php
create mode 100644 application/views/errors/error_db.php
create mode 100644 application/views/errors/error_general.php
create mode 100644 application/views/errors/error_php.php
create mode 100644 application/views/errors/index.html
diff --git a/application/errors/error_404.php b/application/errors/error_404.php
deleted file mode 100644
index c19bedfcd..000000000
--- a/application/errors/error_404.php
+++ /dev/null
@@ -1,89 +0,0 @@
-
-
-
-
-404 Page Not Found
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/application/errors/error_db.php b/application/errors/error_db.php
deleted file mode 100644
index 3b244e094..000000000
--- a/application/errors/error_db.php
+++ /dev/null
@@ -1,89 +0,0 @@
-
-
-
-
-Database Error
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/application/errors/error_general.php b/application/errors/error_general.php
deleted file mode 100644
index c88afe168..000000000
--- a/application/errors/error_general.php
+++ /dev/null
@@ -1,89 +0,0 @@
-
-
-
-
-Error
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/application/errors/error_php.php b/application/errors/error_php.php
deleted file mode 100644
index 3855720de..000000000
--- a/application/errors/error_php.php
+++ /dev/null
@@ -1,55 +0,0 @@
-
-
-
-
-
A PHP Error was encountered
-
-
Severity:
-
Message:
-
Filename:
-
Line Number:
-
-
-
-
Backtrace:
-
-
-
-
- File:
- Line:
- Function:
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/application/errors/index.html b/application/errors/index.html
deleted file mode 100644
index c942a79ce..000000000
--- a/application/errors/index.html
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
- 403 Forbidden
-
-
-
-
Directory access is forbidden.
-
-
-
\ No newline at end of file
diff --git a/application/views/errors/error_404.php b/application/views/errors/error_404.php
new file mode 100644
index 000000000..c19bedfcd
--- /dev/null
+++ b/application/views/errors/error_404.php
@@ -0,0 +1,89 @@
+
+
+
+
+404 Page Not Found
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/application/views/errors/error_db.php b/application/views/errors/error_db.php
new file mode 100644
index 000000000..3b244e094
--- /dev/null
+++ b/application/views/errors/error_db.php
@@ -0,0 +1,89 @@
+
+
+
+
+Database Error
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/application/views/errors/error_general.php b/application/views/errors/error_general.php
new file mode 100644
index 000000000..c88afe168
--- /dev/null
+++ b/application/views/errors/error_general.php
@@ -0,0 +1,89 @@
+
+
+
+
+Error
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/application/views/errors/error_php.php b/application/views/errors/error_php.php
new file mode 100644
index 000000000..3855720de
--- /dev/null
+++ b/application/views/errors/error_php.php
@@ -0,0 +1,55 @@
+
+
+
+
+
A PHP Error was encountered
+
+
Severity:
+
Message:
+
Filename:
+
Line Number:
+
+
+
+
Backtrace:
+
+
+
+
+ File:
+ Line:
+ Function:
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/application/views/errors/index.html b/application/views/errors/index.html
new file mode 100644
index 000000000..c942a79ce
--- /dev/null
+++ b/application/views/errors/index.html
@@ -0,0 +1,10 @@
+
+
+ 403 Forbidden
+
+
+
+
Directory access is forbidden.
+
+
+
\ No newline at end of file
diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php
index 2e9f0c766..f9618044e 100755
--- a/system/core/Exceptions.php
+++ b/system/core/Exceptions.php
@@ -141,7 +141,7 @@ class CI_Exceptions {
ob_end_flush();
}
ob_start();
- include(APPPATH.'errors/'.$template.'.php');
+ include(APPPATH.'views/errors/'.$template.'.php');
$buffer = ob_get_contents();
ob_end_clean();
return $buffer;
@@ -175,7 +175,7 @@ class CI_Exceptions {
ob_end_flush();
}
ob_start();
- include(APPPATH.'errors/'.'error_php.php');
+ include(APPPATH.'views/errors/error_php.php');
$buffer = ob_get_contents();
ob_end_clean();
echo $buffer;
--
cgit v1.2.3-24-g4f1b
From f25b9295557f9d5fda1e0b2342964f17e26a390e Mon Sep 17 00:00:00 2001
From: Soesapto Joeni Hantoro
Date: Tue, 15 May 2012 08:10:31 +0700
Subject: Escaping boolean data type on postgre
---
system/database/drivers/postgre/postgre_driver.php | 101 +++++++++++++++++++++
1 file changed, 101 insertions(+)
diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php
index 84bf768ee..915763ad7 100644
--- a/system/database/drivers/postgre/postgre_driver.php
+++ b/system/database/drivers/postgre/postgre_driver.php
@@ -310,6 +310,35 @@ class CI_DB_postgre_driver extends CI_DB {
// --------------------------------------------------------------------
+ /**
+ * "Smart" Escape String
+ *
+ * Escapes data based on type
+ * Sets boolean and null types
+ *
+ * @param string
+ * @return mixed
+ */
+ public function escape($str)
+ {
+ if (is_string($str) OR method_exists($str, '__toString'))
+ {
+ return "'".$this->escape_str($str)."'";
+ }
+ elseif (is_bool($str))
+ {
+ return $str ? "TRUE" : "FALSE";
+ }
+ elseif (is_null($str))
+ {
+ return 'NULL';
+ }
+
+ return $str;
+ }
+
+ // --------------------------------------------------------------------
+
/**
* Affected Rows
*
@@ -557,6 +586,78 @@ class CI_DB_postgre_driver extends CI_DB {
// --------------------------------------------------------------------
+ /**
+ * Where
+ *
+ * Called by where() or or_where()
+ *
+ * @param mixed
+ * @param mixed
+ * @param string
+ * @return object
+ *
+ */
+ protected function _where($key, $value = NULL, $type = 'AND ', $escape = NULL)
+ {
+ $type = $this->_group_get_type($type);
+
+ if ( ! is_array($key))
+ {
+ $key = array($key => $value);
+ }
+
+ // If the escape value was not set will will base it on the global setting
+ if ( ! is_bool($escape))
+ {
+ $escape = $this->_protect_identifiers;
+ }
+
+ foreach ($key as $k => $v)
+ {
+ $prefix = (count($this->qb_where) === 0 && count($this->qb_cache_where) === 0) ? '' : $type;
+
+ if (is_null($v) && ! $this->_has_operator($k))
+ {
+ // value appears not to have been set, assign the test to IS NULL
+ $k .= ' IS NULL';
+ }
+
+ if ( ! is_null($v))
+ {
+ if ($escape === TRUE)
+ {
+ $k = $this->protect_identifiers($k, FALSE, $escape);
+ $v = ' '.$this->escape($v);
+ }
+ else if (is_bool($v))
+ {
+ $v = ' '.($v ? 'TRUE' : 'FALSE');
+ }
+
+ if ( ! $this->_has_operator($k))
+ {
+ $k .= ' = ';
+ }
+ }
+ else
+ {
+ $k = $this->protect_identifiers($k, FALSE, $escape);
+ }
+
+ $this->qb_where[] = $prefix.$k.$v;
+ if ($this->qb_caching === TRUE)
+ {
+ $this->qb_cache_where[] = $prefix.$k.$v;
+ $this->qb_cache_exists[] = 'where';
+ }
+
+ }
+
+ return $this;
+ }
+
+ // --------------------------------------------------------------------
+
/**
* Close DB Connection
*
--
cgit v1.2.3-24-g4f1b
From 68fe7935a391b20dcf0cbdde9c1b49c697a6443b Mon Sep 17 00:00:00 2001
From: Soesapto Joeni Hantoro
Date: Tue, 15 May 2012 08:19:29 +0700
Subject: Rollback changes, move it to postgre_driver
---
system/database/DB_driver.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index 09513e267..ef77b594e 100644
--- a/system/database/DB_driver.php
+++ b/system/database/DB_driver.php
@@ -696,7 +696,7 @@ abstract class CI_DB_driver {
}
elseif (is_bool($str))
{
- return ($str === FALSE) ? "FALSE" : "TRUE";
+ return ($str === FALSE) ? 0 : 1;
}
elseif (is_null($str))
{
--
cgit v1.2.3-24-g4f1b
From f79bdda8d823495b1f6524bd0cafb985860b7331 Mon Sep 17 00:00:00 2001
From: Soesapto Joeni Hantoro
Date: Tue, 15 May 2012 08:20:24 +0700
Subject: Rollback changes, move it to postgre_driver
---
system/database/DB_query_builder.php | 4 ----
1 file changed, 4 deletions(-)
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php
index 8fa67ea06..d0af66de1 100644
--- a/system/database/DB_query_builder.php
+++ b/system/database/DB_query_builder.php
@@ -439,10 +439,6 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
$k = $this->protect_identifiers($k, FALSE, $escape);
$v = ' '.$this->escape($v);
}
- else if (is_bool($v))
- {
- $v = ' '.($v ? 'TRUE' : 'FALSE');
- }
if ( ! $this->_has_operator($k))
{
--
cgit v1.2.3-24-g4f1b
From d2574db779d97f2a1ff8351b5a7c31c028601e17 Mon Sep 17 00:00:00 2001
From: Soesapto Joeni Hantoro
Date: Tue, 15 May 2012 16:28:16 +0700
Subject: Escaping boolean data type for postgre
---
system/database/drivers/postgre/postgre_driver.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php
index 915763ad7..4b2fb7a9e 100644
--- a/system/database/drivers/postgre/postgre_driver.php
+++ b/system/database/drivers/postgre/postgre_driver.php
@@ -327,7 +327,7 @@ class CI_DB_postgre_driver extends CI_DB {
}
elseif (is_bool($str))
{
- return $str ? "TRUE" : "FALSE";
+ return ($str) ? 'TRUE' : 'FALSE';
}
elseif (is_null($str))
{
@@ -629,7 +629,7 @@ class CI_DB_postgre_driver extends CI_DB {
$k = $this->protect_identifiers($k, FALSE, $escape);
$v = ' '.$this->escape($v);
}
- else if (is_bool($v))
+ elseif (is_bool($v))
{
$v = ' '.($v ? 'TRUE' : 'FALSE');
}
--
cgit v1.2.3-24-g4f1b
From 5963db71348a06c14b38e7ce998df4249d4fd45a Mon Sep 17 00:00:00 2001
From: Soesapto Joeni Hantoro
Date: Tue, 15 May 2012 16:31:18 +0700
Subject: escaping boolean data type for postgre change log
---
user_guide_src/source/changelog.rst | 1 +
1 file changed, 1 insertion(+)
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index a70531901..77c7e2ca4 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -100,6 +100,7 @@ Release Date: Not Released
- Added PDO support for create_database(), drop_database and drop_table() in :doc:`Database Forge `.
- Added MSSQL, SQLSRV support for optimize_table() in :doc:`Database Utility `.
- Improved CUBRID support for list_databases() in :doc:`Database Utility ` (until now only the currently used database was returned).
+ - Added escaping boolean data type for PosgreSQL
- Libraries
--
cgit v1.2.3-24-g4f1b
From dabeaa11ca2076935e5091e0f9e90ff9c4593962 Mon Sep 17 00:00:00 2001
From: Soesapto Joeni Hantoro
Date: Tue, 15 May 2012 16:37:46 +0700
Subject: Escaping boolean data type for postgre
---
system/database/drivers/postgre/postgre_driver.php | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php
index 4b2fb7a9e..670eb549d 100644
--- a/system/database/drivers/postgre/postgre_driver.php
+++ b/system/database/drivers/postgre/postgre_driver.php
@@ -321,20 +321,12 @@ class CI_DB_postgre_driver extends CI_DB {
*/
public function escape($str)
{
- if (is_string($str) OR method_exists($str, '__toString'))
- {
- return "'".$this->escape_str($str)."'";
- }
- elseif (is_bool($str))
+ if (is_bool($str))
{
return ($str) ? 'TRUE' : 'FALSE';
}
- elseif (is_null($str))
- {
- return 'NULL';
- }
- return $str;
+ return parent::escape($str);
}
// --------------------------------------------------------------------
--
cgit v1.2.3-24-g4f1b
From 242925bc084e4d606d5f34bdb49bdf9f5235ec32 Mon Sep 17 00:00:00 2001
From: Andrey Andreev
Date: Tue, 15 May 2012 13:03:51 +0300
Subject: Minor changes on the pull #1355 additions
---
system/database/drivers/postgre/postgre_driver.php | 8 ++++----
user_guide_src/source/changelog.rst | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php
index 670eb549d..17bd37b38 100644
--- a/system/database/drivers/postgre/postgre_driver.php
+++ b/system/database/drivers/postgre/postgre_driver.php
@@ -328,7 +328,7 @@ class CI_DB_postgre_driver extends CI_DB {
return parent::escape($str);
}
-
+
// --------------------------------------------------------------------
/**
@@ -623,7 +623,7 @@ class CI_DB_postgre_driver extends CI_DB {
}
elseif (is_bool($v))
{
- $v = ' '.($v ? 'TRUE' : 'FALSE');
+ $v = ($v ? ' TRUE' : ' FALSE');
}
if ( ! $this->_has_operator($k))
@@ -647,7 +647,7 @@ class CI_DB_postgre_driver extends CI_DB {
return $this;
}
-
+
// --------------------------------------------------------------------
/**
@@ -664,4 +664,4 @@ class CI_DB_postgre_driver extends CI_DB {
}
/* End of file postgre_driver.php */
-/* Location: ./system/database/drivers/postgre/postgre_driver.php */
+/* Location: ./system/database/drivers/postgre/postgre_driver.php */
\ No newline at end of file
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 2f2ebce98..d33a6a635 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -77,6 +77,7 @@ Release Date: Not Released
- pg_version() is now used to get the database version number, when possible.
- Added db_set_charset() support.
- Added _optimize_table() support for the :doc:`Database Utility Class ` (rebuilds table indexes).
+ - Added boolean data type support in escape().
- Added a constructor to the DB_result class and moved all driver-specific properties and logic out of the base DB_driver class to allow better abstraction.
- Removed limit() and order_by() support for UPDATE and DELETE queries in PostgreSQL driver. Postgres does not support those features.
- Removed protect_identifiers() and renamed internal method _protect_identifiers() to it instead - it was just an alias.
@@ -100,7 +101,6 @@ Release Date: Not Released
- Added PDO support for create_database(), drop_database and drop_table() in :doc:`Database Forge `.
- Added MSSQL, SQLSRV support for optimize_table() in :doc:`Database Utility `.
- Improved CUBRID support for list_databases() in :doc:`Database Utility ` (until now only the currently used database was returned).
- - Added escaping boolean data type for PosgreSQL
- Libraries
--
cgit v1.2.3-24-g4f1b
From 570e77cd78e0c704b032c3e7702372ca63d5ddaa Mon Sep 17 00:00:00 2001
From: Taufan Aditya
Date: Tue, 15 May 2012 18:47:24 +0700
Subject: Benchmark code-coverage
---
tests/codeigniter/core/Benchmark_test.php | 42 +++++++++++++++++++++++++++++++
tests/mocks/core/benchmark.php | 3 +++
2 files changed, 45 insertions(+)
create mode 100644 tests/codeigniter/core/Benchmark_test.php
create mode 100644 tests/mocks/core/benchmark.php
diff --git a/tests/codeigniter/core/Benchmark_test.php b/tests/codeigniter/core/Benchmark_test.php
new file mode 100644
index 000000000..2790b582e
--- /dev/null
+++ b/tests/codeigniter/core/Benchmark_test.php
@@ -0,0 +1,42 @@
+benchmark = new Mock_Core_Benchmark();
+ }
+
+ // --------------------------------------------------------------------
+
+ public function test_mark()
+ {
+ $this->assertEmpty($this->benchmark->marker);
+
+ $this->benchmark->mark('code_start');
+
+ $this->assertEquals(1, count($this->benchmark->marker));
+ $this->assertArrayHasKey('code_start', $this->benchmark->marker);
+ }
+
+ // --------------------------------------------------------------------
+
+ public function test_elapsed_time()
+ {
+ $this->assertEquals('{elapsed_time}', $this->benchmark->elapsed_time());
+ $this->assertEmpty($this->benchmark->elapsed_time('undefined_point'));
+
+ $this->benchmark->mark('code_start');
+ sleep(1);
+ $this->benchmark->mark('code_end');
+
+ $this->assertEquals('1.00', $this->benchmark->elapsed_time('code_start', 'code_end', 3));
+ }
+
+ // --------------------------------------------------------------------
+
+ public function test_memory_usage()
+ {
+ $this->assertEquals('{memory_usage}', $this->benchmark->memory_usage());
+ }
+}
\ No newline at end of file
diff --git a/tests/mocks/core/benchmark.php b/tests/mocks/core/benchmark.php
new file mode 100644
index 000000000..d92be21db
--- /dev/null
+++ b/tests/mocks/core/benchmark.php
@@ -0,0 +1,3 @@
+
Date: Tue, 15 May 2012 18:48:45 +0700
Subject: Clean up autoloader annotation
---
tests/mocks/autoloader.php | 1 -
1 file changed, 1 deletion(-)
diff --git a/tests/mocks/autoloader.php b/tests/mocks/autoloader.php
index f1bdb5d6f..92c9bea59 100644
--- a/tests/mocks/autoloader.php
+++ b/tests/mocks/autoloader.php
@@ -6,7 +6,6 @@
//
// Prototype :
//
-// include_once('Mock_Core_Loader') // Will load ./mocks/core/loader.php
// $mock_table = new Mock_Libraries_Table(); // Will load ./mocks/libraries/table.php
// $mock_database_driver = new Mock_Database_Driver(); // Will load ./mocks/database/driver.php
// and so on...
--
cgit v1.2.3-24-g4f1b
From 8af88f3f729b7bcfd2a106f858b5445deafe5ed0 Mon Sep 17 00:00:00 2001
From: Taufan Aditya
Date: Tue, 15 May 2012 21:52:53 +0700
Subject: Security Code coverage
---
tests/Bootstrap.php | 3 ++
tests/codeigniter/core/Security_test.php | 79 ++++++++++++++++++++++++++++++++
tests/mocks/core/security.php | 27 +++++++++++
tests/mocks/libraries/table.php | 2 +-
4 files changed, 110 insertions(+), 1 deletion(-)
create mode 100644 tests/codeigniter/core/Security_test.php
create mode 100644 tests/mocks/core/security.php
diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php
index 9f89d1be8..2bec364ef 100644
--- a/tests/Bootstrap.php
+++ b/tests/Bootstrap.php
@@ -12,6 +12,9 @@ define('BASEPATH', PROJECT_BASE.'system/');
define('APPPATH', PROJECT_BASE.'application/');
define('VIEWPATH', PROJECT_BASE.'');
+// Set cookie for security test
+$_COOKIE['ci_csrf_cookie'] = md5(uniqid(rand(), TRUE));
+
// Prep our test environment
require_once 'vfsStream/vfsStream.php';
include_once $dir.'/mocks/core/common.php';
diff --git a/tests/codeigniter/core/Security_test.php b/tests/codeigniter/core/Security_test.php
new file mode 100644
index 000000000..c3b526965
--- /dev/null
+++ b/tests/codeigniter/core/Security_test.php
@@ -0,0 +1,79 @@
+ci_set_config('csrf_protection', TRUE);
+ $this->ci_set_config('csrf_token_name', 'ci_csrf_token');
+ // @see : ./Bootstrap.php Line 16
+ $this->ci_set_config('csrf_cookie_name', 'ci_csrf_cookie');
+ $this->ci_set_config('csrf_expire', 7200);
+ $this->ci_set_config('csrf_regenerate', TRUE);
+ $this->ci_set_config('csrf_exclude_uris', array());
+
+ $this->ci_set_config('cookie_prefix', "");
+ $this->ci_set_config('cookie_domain', "");
+ $this->ci_set_config('cookie_path', "/");
+ $this->ci_set_config('cookie_secure', FALSE);
+ $this->ci_set_config('cookie_httponly', FALSE);
+
+ $this->security = new Mock_Core_Security();
+ }
+
+ // --------------------------------------------------------------------
+
+ public function test_csrf_verify()
+ {
+ $_SERVER['REQUEST_METHOD'] = 'GET';
+
+ $this->assertInstanceOf('CI_Security', $this->security->csrf_verify());
+ }
+
+ // --------------------------------------------------------------------
+
+ public function test_csrf_verify_invalid()
+ {
+ // Without issuing $_POST[csrf_token_name], this request will triggering CSRF error
+ $_SERVER['REQUEST_METHOD'] = 'POST';
+
+ $this->setExpectedException('RuntimeException', 'CI Error: The action you have requested is not allowed');
+
+ $this->security->csrf_verify();
+ }
+
+ // --------------------------------------------------------------------
+
+ public function test_csrf_verify_valid()
+ {
+ $_SERVER['REQUEST_METHOD'] = 'POST';
+ $_POST[$this->security->csrf_token_name] = $this->security->csrf_hash;
+
+ $this->assertInstanceOf('CI_Security', $this->security->csrf_verify());
+ }
+
+ // --------------------------------------------------------------------
+
+ public function test_get_csrf_hash()
+ {
+ $this->assertEquals($this->security->csrf_hash, $this->security->get_csrf_hash());
+ }
+
+ // --------------------------------------------------------------------
+
+ public function test_get_csrf_token_name()
+ {
+ $this->assertEquals('ci_csrf_token', $this->security->get_csrf_token_name());
+ }
+
+ // --------------------------------------------------------------------
+
+ public function test_xss_clean()
+ {
+ $harm_string = "Hello, i try to your site";
+
+ $harmless_string = $this->security->xss_clean($harm_string);
+
+ $this->assertEquals("Hello, i try to [removed]alert('Hack');[removed] your site", $harmless_string);
+ }
+}
\ No newline at end of file
diff --git a/tests/mocks/core/security.php b/tests/mocks/core/security.php
new file mode 100644
index 000000000..de8e44710
--- /dev/null
+++ b/tests/mocks/core/security.php
@@ -0,0 +1,27 @@
+{'_'.$property}) ? $this->{'_'.$property} : NULL;
+ }
+
+ // Overide inaccesible protected method
+ public function __call($method, $params)
+ {
+ if (is_callable(array($this, '_'.$method)))
+ {
+ return call_user_func_array(array($this, '_'.$method), $params);
+ }
+
+ throw new BadMethodCallException('Method '.$method.' was not found');
+ }
+
+}
\ No newline at end of file
diff --git a/tests/mocks/libraries/table.php b/tests/mocks/libraries/table.php
index 1a6ff8d35..97fbb30bd 100644
--- a/tests/mocks/libraries/table.php
+++ b/tests/mocks/libraries/table.php
@@ -2,7 +2,7 @@
class Mock_Libraries_Table extends CI_Table {
- // Overide inaccesible private or protected method
+ // Overide inaccesible protected method
public function __call($method, $params)
{
if (is_callable(array($this, '_'.$method)))
--
cgit v1.2.3-24-g4f1b
From d40a545e9e7e4dc222d58fe46fe23f3691f043ee Mon Sep 17 00:00:00 2001
From: Taufan Aditya
Date: Tue, 15 May 2012 22:00:14 +0700
Subject: Comment block for explanation
---
tests/mocks/core/security.php | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tests/mocks/core/security.php b/tests/mocks/core/security.php
index de8e44710..c5269fbc5 100644
--- a/tests/mocks/core/security.php
+++ b/tests/mocks/core/security.php
@@ -4,6 +4,9 @@ class Mock_Core_Security extends CI_Security {
public function csrf_set_cookie()
{
+ // We cannot set cookie in CLI mode, so for csrf test, who rely on $_COOKIE,
+ // we superseded set_cookie with directly set the cookie variable,
+ // @see : ./Bootstrap.php, line 16
return $this;
}
--
cgit v1.2.3-24-g4f1b
From 7756af5df0a53930019e9fd7b828504f0c2c5427 Mon Sep 17 00:00:00 2001
From: Taufan Aditya
Date: Tue, 15 May 2012 23:57:05 +0700
Subject: Input class code-coverage
---
tests/Bootstrap.php | 3 -
tests/codeigniter/core/Input_test.php | 144 +++++++++++++++++++++++++++++++
tests/codeigniter/core/Security_test.php | 14 +--
tests/mocks/core/input.php | 31 +++++++
tests/mocks/core/security.php | 2 +-
tests/mocks/core/utf8.php | 27 ++++++
6 files changed, 207 insertions(+), 14 deletions(-)
create mode 100644 tests/codeigniter/core/Input_test.php
create mode 100644 tests/mocks/core/input.php
create mode 100644 tests/mocks/core/utf8.php
diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php
index 2bec364ef..9f89d1be8 100644
--- a/tests/Bootstrap.php
+++ b/tests/Bootstrap.php
@@ -12,9 +12,6 @@ define('BASEPATH', PROJECT_BASE.'system/');
define('APPPATH', PROJECT_BASE.'application/');
define('VIEWPATH', PROJECT_BASE.'');
-// Set cookie for security test
-$_COOKIE['ci_csrf_cookie'] = md5(uniqid(rand(), TRUE));
-
// Prep our test environment
require_once 'vfsStream/vfsStream.php';
include_once $dir.'/mocks/core/common.php';
diff --git a/tests/codeigniter/core/Input_test.php b/tests/codeigniter/core/Input_test.php
new file mode 100644
index 000000000..fd0576e38
--- /dev/null
+++ b/tests/codeigniter/core/Input_test.php
@@ -0,0 +1,144 @@
+ci_set_config('allow_get_array', TRUE);
+ $this->ci_set_config('global_xss_filtering', FALSE);
+ $this->ci_set_config('csrf_protection', FALSE);
+
+ $security = new Mock_Core_Security();
+ $utf8 = new Mock_Core_Utf8();
+
+ $this->input = new Mock_Core_Input($security, $utf8);
+ }
+
+ // --------------------------------------------------------------------
+
+ public function test_get_not_exists()
+ {
+ $this->assertEmpty($this->input->get());
+ $this->assertEmpty($this->input->get('foo'));
+
+ $this->assertTrue( ! $this->input->get());
+ $this->assertTrue( ! $this->input->get('foo'));
+
+ $this->assertTrue($this->input->get() == FALSE);
+ $this->assertTrue($this->input->get('foo') == FALSE);
+
+ $this->assertTrue($this->input->get() === FALSE);
+ $this->assertTrue($this->input->get('foo') === FALSE);
+ }
+
+ // --------------------------------------------------------------------
+
+ public function test_get_exist()
+ {
+ $_SERVER['REQUEST_METHOD'] = 'GET';
+ $_GET['foo'] = 'bar';
+
+ $this->assertArrayHasKey('foo', $this->input->get());
+ $this->assertEquals('bar', $this->input->get('foo'));
+ }
+
+ // --------------------------------------------------------------------
+
+ public function test_get_exist_with_xss_clean()
+ {
+ $_SERVER['REQUEST_METHOD'] = 'GET';
+ $_GET['harm'] = "Hello, i try to your site";
+
+ $this->assertArrayHasKey('harm', $this->input->get());
+ $this->assertEquals("Hello, i try to your site", $this->input->get('harm'));
+ $this->assertEquals("Hello, i try to [removed]alert('Hack');[removed] your site", $this->input->get('harm', TRUE));
+ }
+
+ // --------------------------------------------------------------------
+
+ public function test_post_not_exists()
+ {
+ $this->assertEmpty($this->input->post());
+ $this->assertEmpty($this->input->post('foo'));
+
+ $this->assertTrue( ! $this->input->post());
+ $this->assertTrue( ! $this->input->post('foo'));
+
+ $this->assertTrue($this->input->post() == FALSE);
+ $this->assertTrue($this->input->post('foo') == FALSE);
+
+ $this->assertTrue($this->input->post() === FALSE);
+ $this->assertTrue($this->input->post('foo') === FALSE);
+ }
+
+ // --------------------------------------------------------------------
+
+ public function test_post_exist()
+ {
+ $_SERVER['REQUEST_METHOD'] = 'POST';
+ $_POST['foo'] = 'bar';
+
+ $this->assertArrayHasKey('foo', $this->input->post());
+ $this->assertEquals('bar', $this->input->post('foo'));
+ }
+
+ // --------------------------------------------------------------------
+
+ public function test_post_exist_with_xss_clean()
+ {
+ $_SERVER['REQUEST_METHOD'] = 'POST';
+ $_POST['harm'] = "Hello, i try to your site";
+
+ $this->assertArrayHasKey('harm', $this->input->post());
+ $this->assertEquals("Hello, i try to your site", $this->input->post('harm'));
+ $this->assertEquals("Hello, i try to [removed]alert('Hack');[removed] your site", $this->input->post('harm', TRUE));
+ }
+
+ // --------------------------------------------------------------------
+
+ public function test_get_post()
+ {
+ $_SERVER['REQUEST_METHOD'] = 'POST';
+ $_POST['foo'] = 'bar';
+
+ $this->assertEquals('bar', $this->input->get_post('foo'));
+ }
+
+ // --------------------------------------------------------------------
+
+ public function test_cookie()
+ {
+ $_COOKIE['foo'] = 'bar';
+
+ $this->assertEquals('bar', $this->input->cookie('foo'));
+ }
+
+ // --------------------------------------------------------------------
+
+ public function test_server()
+ {
+ $this->assertEquals('GET', $this->input->server('REQUEST_METHOD'));
+ }
+
+ // --------------------------------------------------------------------
+
+ public function test_fetch_from_array()
+ {
+ $data = array(
+ 'foo' => 'bar',
+ 'harm' => 'Hello, i try to your site',
+ );
+
+ $foo = $this->input->fetch_from_array($data, 'foo');
+ $harm = $this->input->fetch_from_array($data, 'harm');
+ $harmless = $this->input->fetch_from_array($data, 'harm', TRUE);
+
+ $this->assertEquals('bar', $foo);
+ $this->assertEquals("Hello, i try to your site", $harm);
+ $this->assertEquals("Hello, i try to [removed]alert('Hack');[removed] your site", $harmless);
+ }
+}
\ No newline at end of file
diff --git a/tests/codeigniter/core/Security_test.php b/tests/codeigniter/core/Security_test.php
index c3b526965..1796ba74d 100644
--- a/tests/codeigniter/core/Security_test.php
+++ b/tests/codeigniter/core/Security_test.php
@@ -4,19 +4,13 @@ class Security_test extends CI_TestCase {
public function set_up()
{
+ // Set cookie for security test
+ $_COOKIE['ci_csrf_cookie'] = md5(uniqid(rand(), TRUE));
+
+ // Set config for Security class
$this->ci_set_config('csrf_protection', TRUE);
$this->ci_set_config('csrf_token_name', 'ci_csrf_token');
- // @see : ./Bootstrap.php Line 16
$this->ci_set_config('csrf_cookie_name', 'ci_csrf_cookie');
- $this->ci_set_config('csrf_expire', 7200);
- $this->ci_set_config('csrf_regenerate', TRUE);
- $this->ci_set_config('csrf_exclude_uris', array());
-
- $this->ci_set_config('cookie_prefix', "");
- $this->ci_set_config('cookie_domain', "");
- $this->ci_set_config('cookie_path', "/");
- $this->ci_set_config('cookie_secure', FALSE);
- $this->ci_set_config('cookie_httponly', FALSE);
$this->security = new Mock_Core_Security();
}
diff --git a/tests/mocks/core/input.php b/tests/mocks/core/input.php
new file mode 100644
index 000000000..8a337d2ef
--- /dev/null
+++ b/tests/mocks/core/input.php
@@ -0,0 +1,31 @@
+_allow_get_array = (config_item('allow_get_array') === TRUE);
+ $this->_enable_xss = (config_item('global_xss_filtering') === TRUE);
+ $this->_enable_csrf = (config_item('csrf_protection') === TRUE);
+
+ // Assign Security and Utf8 classes
+ $this->security = $security;
+ $this->uni = $utf8;
+
+ // Sanitize global arrays
+ $this->_sanitize_globals();
+ }
+
+ public function fetch_from_array($array, $index = '', $xss_clean = FALSE)
+ {
+ return parent::_fetch_from_array($array, $index, $xss_clean);
+ }
+
+}
\ No newline at end of file
diff --git a/tests/mocks/core/security.php b/tests/mocks/core/security.php
index c5269fbc5..d7ea0e6bd 100644
--- a/tests/mocks/core/security.php
+++ b/tests/mocks/core/security.php
@@ -6,7 +6,7 @@ class Mock_Core_Security extends CI_Security {
{
// We cannot set cookie in CLI mode, so for csrf test, who rely on $_COOKIE,
// we superseded set_cookie with directly set the cookie variable,
- // @see : ./Bootstrap.php, line 16
+ // @see : ./tests/codeigniter/core/Security_test.php, line 8
return $this;
}
diff --git a/tests/mocks/core/utf8.php b/tests/mocks/core/utf8.php
new file mode 100644
index 000000000..b77d717e7
--- /dev/null
+++ b/tests/mocks/core/utf8.php
@@ -0,0 +1,27 @@
+
Date: Wed, 16 May 2012 00:08:05 +0700
Subject: Remove unused hardcoded reference from *phpunit.xml files
---
tests/travis/mysql.phpunit.xml | 2 --
tests/travis/pdo/mysql.phpunit.xml | 4 +---
tests/travis/pdo/pgsql.phpunit.xml | 2 --
tests/travis/pdo/sqlite.phpunit.xml | 2 --
tests/travis/pgsql.phpunit.xml | 2 --
tests/travis/sqlite.phpunit.xml | 2 --
6 files changed, 1 insertion(+), 13 deletions(-)
diff --git a/tests/travis/mysql.phpunit.xml b/tests/travis/mysql.phpunit.xml
index c5fcf1335..1792ae38d 100644
--- a/tests/travis/mysql.phpunit.xml
+++ b/tests/travis/mysql.phpunit.xml
@@ -21,8 +21,6 @@
PEAR_INSTALL_DIRPHP_LIBDIR
- PROJECT_BASE.'tests'
- '../../system/core/CodeIgniter.php'
\ No newline at end of file
diff --git a/tests/travis/pdo/mysql.phpunit.xml b/tests/travis/pdo/mysql.phpunit.xml
index f6fcc1c39..602030d4e 100644
--- a/tests/travis/pdo/mysql.phpunit.xml
+++ b/tests/travis/pdo/mysql.phpunit.xml
@@ -14,15 +14,13 @@
- ../../codeigniter/database
+ ../../codeigniterPEAR_INSTALL_DIRPHP_LIBDIR
- PROJECT_BASE.'tests'
- '../../../system/core/CodeIgniter.php'
\ No newline at end of file
diff --git a/tests/travis/pdo/pgsql.phpunit.xml b/tests/travis/pdo/pgsql.phpunit.xml
index 6a23227db..77e1493c6 100644
--- a/tests/travis/pdo/pgsql.phpunit.xml
+++ b/tests/travis/pdo/pgsql.phpunit.xml
@@ -21,8 +21,6 @@
PEAR_INSTALL_DIRPHP_LIBDIR
- PROJECT_BASE.'tests'
- '../../../system/core/CodeIgniter.php'
\ No newline at end of file
diff --git a/tests/travis/pdo/sqlite.phpunit.xml b/tests/travis/pdo/sqlite.phpunit.xml
index b85b7308a..cdccef017 100644
--- a/tests/travis/pdo/sqlite.phpunit.xml
+++ b/tests/travis/pdo/sqlite.phpunit.xml
@@ -21,8 +21,6 @@
PEAR_INSTALL_DIRPHP_LIBDIR
- PROJECT_BASE.'tests'
- '../../../system/core/CodeIgniter.php'
\ No newline at end of file
diff --git a/tests/travis/pgsql.phpunit.xml b/tests/travis/pgsql.phpunit.xml
index 78b6046cf..dfc1bff1c 100644
--- a/tests/travis/pgsql.phpunit.xml
+++ b/tests/travis/pgsql.phpunit.xml
@@ -21,8 +21,6 @@
PEAR_INSTALL_DIRPHP_LIBDIR
- PROJECT_BASE.'tests'
- '../../system/core/CodeIgniter.php'
\ No newline at end of file
diff --git a/tests/travis/sqlite.phpunit.xml b/tests/travis/sqlite.phpunit.xml
index 46e3d5073..3223da5e7 100644
--- a/tests/travis/sqlite.phpunit.xml
+++ b/tests/travis/sqlite.phpunit.xml
@@ -21,8 +21,6 @@
PEAR_INSTALL_DIRPHP_LIBDIR
- PROJECT_BASE.'tests'
- '../../system/core/CodeIgniter.php'
\ No newline at end of file
--
cgit v1.2.3-24-g4f1b
From 04d4091dfa551475998c351e09858e5ebdcf4482 Mon Sep 17 00:00:00 2001
From: Alan Jenkins
Date: Mon, 30 Apr 2012 16:04:43 +0100
Subject: fix backtrace filtering
The backtrace was filtered to remove CI system files,
but the filter was buggy. It would also filter out
application files which happened to contain the string "system"...
or ALL files, if the application directory is under /system/
(Perhaps the latter comes as a surprise, but it's explicitly
mentioned in index.php and ).
Instead, we should test whether the file is underneath BASEPATH
(using realpath() to make sure we have the same sort of slashes).
---
application/errors/error_php.php | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/application/errors/error_php.php b/application/errors/error_php.php
index 3855720de..b76dc8a9e 100644
--- a/application/errors/error_php.php
+++ b/application/errors/error_php.php
@@ -40,12 +40,15 @@
Backtrace:
-
+
+
File:
Line:
Function:
+
--
cgit v1.2.3-24-g4f1b
From 2ed226bd5ed19754c2fb28d4b98ac5423741f039 Mon Sep 17 00:00:00 2001
From: Timothy Warren
Date: Wed, 16 May 2012 08:37:32 -0400
Subject: Add note in the upgrade guide to move errors folder
---
user_guide_src/source/installation/upgrade_300.rst | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/user_guide_src/source/installation/upgrade_300.rst b/user_guide_src/source/installation/upgrade_300.rst
index e434e8d45..63c4227dc 100644
--- a/user_guide_src/source/installation/upgrade_300.rst
+++ b/user_guide_src/source/installation/upgrade_300.rst
@@ -40,4 +40,9 @@ need to rename the `$active_record` variable to `$query_builder`.
$active_group = 'default';
// $active_record = TRUE;
- $query_builder = TRUE;
\ No newline at end of file
+ $query_builder = TRUE;
+
+Step 5: Move your errors folder
+===============================
+
+In version 3.0.0, the errors folder has been moved from "application/errors" to "application/views/errors".
\ No newline at end of file
--
cgit v1.2.3-24-g4f1b
From 09a1b5e7fb3c930aa9a50e246236227a499b5d28 Mon Sep 17 00:00:00 2001
From: Taufan Aditya
Date: Wed, 16 May 2012 22:18:00 +0700
Subject: Reduce decimal points, since there is a micro differencess on runtime
and update travis status
---
tests/README.md | 2 +-
tests/codeigniter/core/Benchmark_test.php | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/README.md b/tests/README.md
index b46f344cb..c8fc608e8 100644
--- a/tests/README.md
+++ b/tests/README.md
@@ -1,6 +1,6 @@
# CodeIgniter Unit Tests #
-Status : [![Build Status](https://secure.travis-ci.org/EllisLab/CodeIgniter.png?branch=feature/unit-tests)](http://travis-ci.org/EllisLab/CodeIgniter)
+Status : [![Build Status](https://secure.travis-ci.org/EllisLab/CodeIgniter.png?branch=develop)](http://travis-ci.org/EllisLab/CodeIgniter)
### Introduction:
diff --git a/tests/codeigniter/core/Benchmark_test.php b/tests/codeigniter/core/Benchmark_test.php
index 2790b582e..109b38821 100644
--- a/tests/codeigniter/core/Benchmark_test.php
+++ b/tests/codeigniter/core/Benchmark_test.php
@@ -29,8 +29,8 @@ class Benchmark_test extends CI_TestCase {
$this->benchmark->mark('code_start');
sleep(1);
$this->benchmark->mark('code_end');
-
- $this->assertEquals('1.00', $this->benchmark->elapsed_time('code_start', 'code_end', 3));
+
+ $this->assertEquals('1.0', $this->benchmark->elapsed_time('code_start', 'code_end', 1));
}
// --------------------------------------------------------------------
--
cgit v1.2.3-24-g4f1b
From 94e74bf0f8ae82a28c70fe1a3cb76a01f6c50fd8 Mon Sep 17 00:00:00 2001
From: Alan Jenkins
Date: Wed, 16 May 2012 17:20:56 +0100
Subject: If we want E_STRICT, don't suppress it!
15be8fc "Changed the 'development' environment default error
reporting to included E_STRICT"
Not present in any tagged release, so
no need for -stable or a changlelog entry.
---
system/core/Common.php | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/system/core/Common.php b/system/core/Common.php
index 78aa6e874..ec94c528b 100644
--- a/system/core/Common.php
+++ b/system/core/Common.php
@@ -487,16 +487,6 @@ if ( ! function_exists('_exception_handler'))
*/
function _exception_handler($severity, $message, $filepath, $line)
{
- // We don't bother with "strict" notices since they tend to fill up
- // the log file with excess information that isn't normally very helpful.
- // For example, if you are running PHP 5 and you use version 4 style
- // class functions (without prefixes like "public", "private", etc.)
- // you'll get notices telling you that these have been deprecated.
- if ($severity == E_STRICT)
- {
- return;
- }
-
$_error =& load_class('Exceptions', 'core');
// Should we display the error? We'll get the current error_reporting
--
cgit v1.2.3-24-g4f1b
From e2c374fc474f91cc1c04aaae68e15cef6984f494 Mon Sep 17 00:00:00 2001
From: Alexander Hofstede
Date: Thu, 17 May 2012 00:28:08 +0200
Subject: Check cookie against md5 regex.
Otherwise, cookie can contain arbitrary injected code that gets sent
back directly to the browser.
---
system/core/Security.php | 2 +-
user_guide/changelog.html | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/system/core/Security.php b/system/core/Security.php
index a3e227437..6f5ac1ed8 100755
--- a/system/core/Security.php
+++ b/system/core/Security.php
@@ -848,7 +848,7 @@ class CI_Security {
// each page load since a page could contain embedded
// sub-pages causing this feature to fail
if (isset($_COOKIE[$this->_csrf_cookie_name]) &&
- $_COOKIE[$this->_csrf_cookie_name] != '')
+ preg_match('#^[0-9a-f]{32}$#iS', $_COOKIE[$this->_csrf_cookie_name]) === 1)
{
return $this->_csrf_hash = $_COOKIE[$this->_csrf_cookie_name];
}
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index 613c4e65d..38275955b 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -85,6 +85,7 @@ Change Log
Fixed a bug - CI_Upload::_file_mime_type() could've failed if mime_content_type() is used for the detection and returns FALSE.
Fixed a bug (#538) - Windows paths were ignored when using the Image Manipulation Class to create a new file.
Fixed a bug - When database caching was enabled, $this->db->query() checked the cache before binding variables which resulted in cached queries never being found.
+
Fixed a bug - CSRF cookie value was allowed to be any (non-empty) string before being written to the output, making code injection a risk.
Fixed a bug - CI_Upload::_file_mime_type() could've failed if mime_content_type() is used for the detection and returns FALSE.
Fixed a bug (#538) - Windows paths were ignored when using the Image Manipulation Class to create a new file.
Fixed a bug - When database caching was enabled, $this->db->query() checked the cache before binding variables which resulted in cached queries never being found.
-
Fixed a bug - CSRF cookie value was allowed to be any (non-empty) string before being written to the output, making code injection a risk.
+
Fixed a bug - CSRF cookie value was allowed to be any (non-empty) string before being written to the output, making code injection a risk.
Fixed a bug - CI_Upload::_file_mime_type() could've failed if mime_content_type() is used for the detection and returns FALSE.
Fixed a bug (#538) - Windows paths were ignored when using the Image Manipulation Class to create a new file.
Fixed a bug - When database caching was enabled, $this->db->query() checked the cache before binding variables which resulted in cached queries never being found.
-
Fixed a bug - CSRF cookie value was allowed to be any (non-empty) string before being written to the output, making code injection a risk.
+
Fixed a bug - CSRF cookie value was allowed to be any (non-empty) string before being written to the output, making code injection a risk.
--
cgit v1.2.3-24-g4f1b
From 8f04c69fe65ddc2604425eaee811b50a909d905f Mon Sep 17 00:00:00 2001
From: Alexander Hofstede
Date: Thu, 17 May 2012 10:52:44 +0200
Subject: Use tabs for indenting
---
user_guide/changelog.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index 38275955b..55fbceeaf 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -85,7 +85,7 @@ Change Log
Fixed a bug - CI_Upload::_file_mime_type() could've failed if mime_content_type() is used for the detection and returns FALSE.
Fixed a bug (#538) - Windows paths were ignored when using the Image Manipulation Class to create a new file.
Fixed a bug - When database caching was enabled, $this->db->query() checked the cache before binding variables which resulted in cached queries never being found.
-
Fixed a bug - CSRF cookie value was allowed to be any (non-empty) string before being written to the output, making code injection a risk.
+
Fixed a bug - CSRF cookie value was allowed to be any (non-empty) string before being written to the output, making code injection a risk.
--
cgit v1.2.3-24-g4f1b
From 92ebfb65ac044f5c2e6d88fba137253854cf1b94 Mon Sep 17 00:00:00 2001
From: Andrey Andreev
Date: Thu, 17 May 2012 12:49:24 +0300
Subject: Cleanup the core classes
---
system/core/Benchmark.php | 6 ++--
system/core/CodeIgniter.php | 2 +-
system/core/Common.php | 6 ++--
system/core/Config.php | 27 +++++++++---------
system/core/Controller.php | 7 +++--
system/core/Exceptions.php | 12 ++++----
system/core/Hooks.php | 6 ++--
system/core/Input.php | 31 ++++++++++-----------
system/core/Loader.php | 35 +++++++++++------------
system/core/Model.php | 3 ++
system/core/Output.php | 18 ++++++------
system/core/Router.php | 25 ++++++++---------
system/core/Security.php | 18 ++++++------
system/core/URI.php | 67 ++++++++++++++++++++++-----------------------
system/core/Utf8.php | 4 ++-
15 files changed, 135 insertions(+), 132 deletions(-)
diff --git a/system/core/Benchmark.php b/system/core/Benchmark.php
index c17e95a19..bb630f40b 100755
--- a/system/core/Benchmark.php
+++ b/system/core/Benchmark.php
@@ -25,13 +25,11 @@
* @filesource
*/
-// ------------------------------------------------------------------------
-
/**
* CodeIgniter Benchmark Class
*
* This class enables you to mark points and calculate the time difference
- * between them. Memory consumption can also be displayed.
+ * between them. Memory consumption can also be displayed.
*
* @package CodeIgniter
* @subpackage Libraries
@@ -119,4 +117,4 @@ class CI_Benchmark {
}
/* End of file Benchmark.php */
-/* Location: ./system/core/Benchmark.php */
+/* Location: ./system/core/Benchmark.php */
\ No newline at end of file
diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php
index 349f9f2d0..00db6e13a 100755
--- a/system/core/CodeIgniter.php
+++ b/system/core/CodeIgniter.php
@@ -31,7 +31,7 @@
* Loads the base classes and executes the request.
*
* @package CodeIgniter
- * @subpackage codeigniter
+ * @subpackage CodeIgniter
* @category Front-controller
* @author EllisLab Dev Team
* @link http://codeigniter.com/user_guide/
diff --git a/system/core/Common.php b/system/core/Common.php
index 78aa6e874..8b897776f 100644
--- a/system/core/Common.php
+++ b/system/core/Common.php
@@ -31,7 +31,7 @@
* Loads the base classes and executes the request.
*
* @package CodeIgniter
- * @subpackage codeigniter
+ * @subpackage CodeIgniter
* @category Common Functions
* @author EllisLab Dev Team
* @link http://codeigniter.com/user_guide/
@@ -57,7 +57,7 @@ if ( ! function_exists('is_php'))
if ( ! isset($_is_php[$version]))
{
- $_is_php[$version] = (version_compare(PHP_VERSION, $version) < 0) ? FALSE : TRUE;
+ $_is_php[$version] = (version_compare(PHP_VERSION, $version) >= 0);
}
return $_is_php[$version];
@@ -506,7 +506,7 @@ if ( ! function_exists('_exception_handler'))
$_error->show_php_error($severity, $message, $filepath, $line);
}
- // Should we log the error? No? We're done...
+ // Should we log the error? No? We're done...
if (config_item('log_threshold') == 0)
{
return;
diff --git a/system/core/Config.php b/system/core/Config.php
index 9cebe6c86..c07ffa591 100755
--- a/system/core/Config.php
+++ b/system/core/Config.php
@@ -25,8 +25,6 @@
* @filesource
*/
-// ------------------------------------------------------------------------
-
/**
* CodeIgniter Config Class
*
@@ -46,14 +44,14 @@ class CI_Config {
* @var array
*/
public $config = array();
-
+
/**
* List of all loaded config files
*
* @var array
*/
public $is_loaded = array();
-
+
/**
* List of paths to search when trying to load a config file.
* This must be public as it's used by the Loader class.
@@ -77,9 +75,9 @@ class CI_Config {
{
if (isset($_SERVER['HTTP_HOST']))
{
- $base_url = ! empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off' ? 'https' : 'http';
- $base_url .= '://'. $_SERVER['HTTP_HOST']
- . str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
+ $base_url = ( ! empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') ? 'https' : 'http';
+ $base_url .= '://'.$_SERVER['HTTP_HOST']
+ .str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
}
else
{
@@ -96,9 +94,9 @@ class CI_Config {
* Load Config File
*
* @param string the config file name
- * @param boolean if configuration values should be loaded into their own section
- * @param boolean true if errors should just return false, false if an error message should be displayed
- * @return boolean if the file was loaded correctly
+ * @param bool if configuration values should be loaded into their own section
+ * @param bool true if errors should just return false, false if an error message should be displayed
+ * @return bool if the file was loaded correctly
*/
public function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE)
{
@@ -254,8 +252,8 @@ class CI_Config {
* Base URL
* Returns base_url [. uri_string]
*
- * @param string $uri
- * @return string
+ * @param string $uri
+ * @return string
*/
public function base_url($uri = '')
{
@@ -267,8 +265,8 @@ class CI_Config {
/**
* Build URI string for use in Config::site_url() and Config::base_url()
*
- * @param mixed $uri
- * @return string
+ * @param mixed $uri
+ * @return string
*/
protected function _uri_string($uri)
{
@@ -345,6 +343,7 @@ class CI_Config {
}
}
}
+
}
/* End of file Config.php */
diff --git a/system/core/Controller.php b/system/core/Controller.php
index 1f69146d0..491414807 100644
--- a/system/core/Controller.php
+++ b/system/core/Controller.php
@@ -48,6 +48,8 @@ class CI_Controller {
/**
* Set up controller properties and methods
+ *
+ * @return void
*/
public function __construct()
{
@@ -67,14 +69,15 @@ class CI_Controller {
}
/**
- * Return the CI object
+ * Return the CI object
*
- * @return object
+ * @return object
*/
public static function &get_instance()
{
return self::$instance;
}
+
}
/* End of file Controller.php */
diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php
index 2e9f0c766..965a717ad 100755
--- a/system/core/Exceptions.php
+++ b/system/core/Exceptions.php
@@ -65,6 +65,8 @@ class CI_Exceptions {
/**
* Initialize execption class
+ *
+ * @return void
*/
public function __construct()
{
@@ -87,7 +89,7 @@ class CI_Exceptions {
*/
public function log_exception($severity, $message, $filepath, $line)
{
- $severity = ( ! isset($this->levels[$severity])) ? $severity : $this->levels[$severity];
+ $severity = isset($this->levels[$severity]) ? $this->levels[$severity] : $severity;
log_message('error', 'Severity: '.$severity.' --> '.$message. ' '.$filepath.' '.$line, TRUE);
}
@@ -127,14 +129,14 @@ class CI_Exceptions {
* @param string the heading
* @param string the message
* @param string the template name
- * @param int the status code
+ * @param int the status code
* @return string
*/
public function show_error($heading, $message, $template = 'error_general', $status_code = 500)
{
set_status_header($status_code);
- $message = '
Before performing an update you should take your site offline by replacing the index.php file with a static one.
+
+
Step 1: Update your CodeIgniter files
+
+
Replace all files and directories in your "system" folder and replace your index.php file. If any modifications were made to your index.php they will need to be made fresh in this new one.
+
+
Note: If you have any custom developed files in these folders please make copies of them first.
+
+
Step 2: Replace config/mimes.php
+
+
This config file has been updated to contain more user mime-types, please copy it to application/config/mimes.php.
@@ -89,7 +89,7 @@ minimizing the amount of code needed for a given task.
diff --git a/user_guide/installation/downloads.html b/user_guide/installation/downloads.html
index 14c65edd0..12252ad47 100644
--- a/user_guide/installation/downloads.html
+++ b/user_guide/installation/downloads.html
@@ -28,7 +28,7 @@
Public Git access is available at GitHub.
- Please note that while every effort is made to keep this code base functional, we cannot guarantee the functionality of code taken
- from the tip.
+
Public Git access is available at GitHub.
+ Please note that while every effort is made to keep this code base functional, we cannot guarantee the functionality of code taken
+ from the tip.
+
+
Beginning with version 2.0.3, stable tags are also available via GitHub, simply select the version from the Tags dropdown.
-
Beginning with version 2.0.3, stable tags are also available via GitHub, simply select the version from the Tags dropdown.