From 26b9ae2f500da7658074619af9c6dd982b77d0b8 Mon Sep 17 00:00:00 2001
From: Phil Sturgeon
Date: Fri, 15 Jul 2011 15:14:05 -0600
Subject: Was working on this file so PHP5ified the method visibility scopes.
Pointless, but was adding...
---
system/database/DB_active_rec.php | 260 ++++++++++++++++----------------------
1 file changed, 106 insertions(+), 154 deletions(-)
diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php
index 52bad260a..7ddf20d07 100644
--- a/system/database/DB_active_rec.php
+++ b/system/database/DB_active_rec.php
@@ -69,11 +69,10 @@ class CI_DB_active_record extends CI_DB_driver {
*
* Generates the SELECT portion of the query
*
- * @access public
* @param string
* @return object
*/
- function select($select = '*', $escape = NULL)
+ public function select($select = '*', $escape = NULL)
{
if (is_string($select))
{
@@ -107,12 +106,11 @@ class CI_DB_active_record extends CI_DB_driver {
*
* Generates a SELECT MAX(field) portion of a query
*
- * @access public
* @param string the field
* @param string an alias
* @return object
*/
- function select_max($select = '', $alias = '')
+ public function select_max($select = '', $alias = '')
{
return $this->_max_min_avg_sum($select, $alias, 'MAX');
}
@@ -124,12 +122,11 @@ class CI_DB_active_record extends CI_DB_driver {
*
* Generates a SELECT MIN(field) portion of a query
*
- * @access public
* @param string the field
* @param string an alias
* @return object
*/
- function select_min($select = '', $alias = '')
+ public function select_min($select = '', $alias = '')
{
return $this->_max_min_avg_sum($select, $alias, 'MIN');
}
@@ -141,12 +138,11 @@ class CI_DB_active_record extends CI_DB_driver {
*
* Generates a SELECT AVG(field) portion of a query
*
- * @access public
* @param string the field
* @param string an alias
* @return object
*/
- function select_avg($select = '', $alias = '')
+ public function select_avg($select = '', $alias = '')
{
return $this->_max_min_avg_sum($select, $alias, 'AVG');
}
@@ -158,12 +154,11 @@ class CI_DB_active_record extends CI_DB_driver {
*
* Generates a SELECT SUM(field) portion of a query
*
- * @access public
* @param string the field
* @param string an alias
* @return object
*/
- function select_sum($select = '', $alias = '')
+ public function select_sum($select = '', $alias = '')
{
return $this->_max_min_avg_sum($select, $alias, 'SUM');
}
@@ -178,12 +173,11 @@ class CI_DB_active_record extends CI_DB_driver {
* select_avg()
* select_sum()
*
- * @access public
* @param string the field
* @param string an alias
* @return object
*/
- function _max_min_avg_sum($select = '', $alias = '', $type = 'MAX')
+ protected function _max_min_avg_sum($select = '', $alias = '', $type = 'MAX')
{
if ( ! is_string($select) OR $select == '')
{
@@ -220,11 +214,10 @@ class CI_DB_active_record extends CI_DB_driver {
/**
* Determines the alias name based on the table
*
- * @access private
* @param string
* @return string
*/
- function _create_alias_from_table($item)
+ protected function _create_alias_from_table($item)
{
if (strpos($item, '.') !== FALSE)
{
@@ -241,11 +234,10 @@ class CI_DB_active_record extends CI_DB_driver {
*
* Sets a flag which tells the query string compiler to add DISTINCT
*
- * @access public
* @param bool
* @return object
*/
- function distinct($val = TRUE)
+ public function distinct($val = TRUE)
{
$this->ar_distinct = (is_bool($val)) ? $val : TRUE;
return $this;
@@ -258,11 +250,10 @@ class CI_DB_active_record extends CI_DB_driver {
*
* Generates the FROM portion of the query
*
- * @access public
* @param mixed can be a string or array
* @return object
*/
- function from($from)
+ public function from($from)
{
foreach ((array)$from as $val)
{
@@ -311,13 +302,12 @@ class CI_DB_active_record extends CI_DB_driver {
*
* Generates the JOIN portion of the query
*
- * @access public
* @param string
* @param string the join condition
* @param string the type of join
* @return object
*/
- function join($table, $cond, $type = '')
+ public function join($table, $cond, $type = '')
{
if ($type != '')
{
@@ -367,12 +357,11 @@ class CI_DB_active_record extends CI_DB_driver {
* Generates the WHERE portion of the query. Separates
* multiple calls with AND
*
- * @access public
* @param mixed
* @param mixed
* @return object
*/
- function where($key, $value = NULL, $escape = TRUE)
+ public function where($key, $value = NULL, $escape = TRUE)
{
return $this->_where($key, $value, 'AND ', $escape);
}
@@ -385,12 +374,11 @@ class CI_DB_active_record extends CI_DB_driver {
* Generates the WHERE portion of the query. Separates
* multiple calls with OR
*
- * @access public
* @param mixed
* @param mixed
* @return object
*/
- function or_where($key, $value = NULL, $escape = TRUE)
+ public function or_where($key, $value = NULL, $escape = TRUE)
{
return $this->_where($key, $value, 'OR ', $escape);
}
@@ -400,15 +388,14 @@ class CI_DB_active_record extends CI_DB_driver {
/**
* Where
*
- * Called by where() or orwhere()
+ * Called by where() or or_where()
*
- * @access private
* @param mixed
* @param mixed
* @param string
* @return object
*/
- function _where($key, $value = NULL, $type = 'AND ', $escape = NULL)
+ protected function _where($key, $value = NULL, $type = 'AND ', $escape = NULL)
{
if ( ! is_array($key))
{
@@ -471,12 +458,11 @@ class CI_DB_active_record extends CI_DB_driver {
* Generates a WHERE field IN ('item', 'item') SQL query joined with
* AND if appropriate
*
- * @access public
* @param string The field to search
* @param array The values searched on
* @return object
*/
- function where_in($key = NULL, $values = NULL)
+ public function where_in($key = NULL, $values = NULL)
{
return $this->_where_in($key, $values);
}
@@ -489,12 +475,11 @@ class CI_DB_active_record extends CI_DB_driver {
* Generates a WHERE field IN ('item', 'item') SQL query joined with
* OR if appropriate
*
- * @access public
* @param string The field to search
* @param array The values searched on
* @return object
*/
- function or_where_in($key = NULL, $values = NULL)
+ public function or_where_in($key = NULL, $values = NULL)
{
return $this->_where_in($key, $values, FALSE, 'OR ');
}
@@ -507,12 +492,11 @@ class CI_DB_active_record extends CI_DB_driver {
* Generates a WHERE field NOT IN ('item', 'item') SQL query joined
* with AND if appropriate
*
- * @access public
* @param string The field to search
* @param array The values searched on
* @return object
*/
- function where_not_in($key = NULL, $values = NULL)
+ public function where_not_in($key = NULL, $values = NULL)
{
return $this->_where_in($key, $values, TRUE);
}
@@ -525,12 +509,11 @@ class CI_DB_active_record extends CI_DB_driver {
* Generates a WHERE field NOT IN ('item', 'item') SQL query joined
* with OR if appropriate
*
- * @access public
* @param string The field to search
* @param array The values searched on
* @return object
*/
- function or_where_not_in($key = NULL, $values = NULL)
+ public function or_where_not_in($key = NULL, $values = NULL)
{
return $this->_where_in($key, $values, TRUE, 'OR ');
}
@@ -542,14 +525,13 @@ class CI_DB_active_record extends CI_DB_driver {
*
* Called by where_in, where_in_or, where_not_in, where_not_in_or
*
- * @access public
* @param string The field to search
* @param array The values searched on
* @param boolean If the statement would be IN or NOT IN
* @param string
* @return object
*/
- function _where_in($key = NULL, $values = NULL, $not = FALSE, $type = 'AND ')
+ protected function _where_in($key = NULL, $values = NULL, $not = FALSE, $type = 'AND ')
{
if ($key === NULL OR $values === NULL)
{
@@ -592,12 +574,11 @@ class CI_DB_active_record extends CI_DB_driver {
* Generates a %LIKE% portion of the query. Separates
* multiple calls with AND
*
- * @access public
* @param mixed
* @param mixed
* @return object
*/
- function like($field, $match = '', $side = 'both')
+ public function like($field, $match = '', $side = 'both')
{
return $this->_like($field, $match, 'AND ', $side);
}
@@ -610,12 +591,11 @@ class CI_DB_active_record extends CI_DB_driver {
* Generates a NOT LIKE portion of the query. Separates
* multiple calls with AND
*
- * @access public
* @param mixed
* @param mixed
* @return object
*/
- function not_like($field, $match = '', $side = 'both')
+ public function not_like($field, $match = '', $side = 'both')
{
return $this->_like($field, $match, 'AND ', $side, 'NOT');
}
@@ -628,12 +608,11 @@ class CI_DB_active_record extends CI_DB_driver {
* Generates a %LIKE% portion of the query. Separates
* multiple calls with OR
*
- * @access public
* @param mixed
* @param mixed
* @return object
*/
- function or_like($field, $match = '', $side = 'both')
+ public function or_like($field, $match = '', $side = 'both')
{
return $this->_like($field, $match, 'OR ', $side);
}
@@ -646,12 +625,11 @@ class CI_DB_active_record extends CI_DB_driver {
* Generates a NOT LIKE portion of the query. Separates
* multiple calls with OR
*
- * @access public
* @param mixed
* @param mixed
* @return object
*/
- function or_not_like($field, $match = '', $side = 'both')
+ public function or_not_like($field, $match = '', $side = 'both')
{
return $this->_like($field, $match, 'OR ', $side, 'NOT');
}
@@ -663,13 +641,12 @@ class CI_DB_active_record extends CI_DB_driver {
*
* Called by like() or orlike()
*
- * @access private
* @param mixed
* @param mixed
* @param string
* @return object
*/
- function _like($field, $match = '', $type = 'AND ', $side = 'both', $not = '')
+ protected function _like($field, $match = '', $type = 'AND ', $side = 'both', $not = '')
{
if ( ! is_array($field))
{
@@ -719,11 +696,10 @@ class CI_DB_active_record extends CI_DB_driver {
/**
* GROUP BY
*
- * @access public
* @param string
* @return object
*/
- function group_by($by)
+ public function group_by($by)
{
if (is_string($by))
{
@@ -755,12 +731,11 @@ class CI_DB_active_record extends CI_DB_driver {
*
* Separates multiple calls with AND
*
- * @access public
* @param string
* @param string
* @return object
*/
- function having($key, $value = '', $escape = TRUE)
+ public function having($key, $value = '', $escape = TRUE)
{
return $this->_having($key, $value, 'AND ', $escape);
}
@@ -772,12 +747,11 @@ class CI_DB_active_record extends CI_DB_driver {
*
* Separates multiple calls with OR
*
- * @access public
* @param string
* @param string
* @return object
*/
- function or_having($key, $value = '', $escape = TRUE)
+ public function or_having($key, $value = '', $escape = TRUE)
{
return $this->_having($key, $value, 'OR ', $escape);
}
@@ -789,12 +763,11 @@ class CI_DB_active_record extends CI_DB_driver {
*
* Called by having() or or_having()
*
- * @access private
* @param string
* @param string
* @return object
*/
- function _having($key, $value = '', $type = 'AND ', $escape = TRUE)
+ protected function _having($key, $value = '', $type = 'AND ', $escape = TRUE)
{
if ( ! is_array($key))
{
@@ -836,12 +809,11 @@ class CI_DB_active_record extends CI_DB_driver {
/**
* Sets the ORDER BY value
*
- * @access public
* @param string
* @param string direction: asc or desc
* @return object
*/
- function order_by($orderby, $direction = '')
+ public function order_by($orderby, $direction = '')
{
if (strtolower($direction) == 'random')
{
@@ -892,12 +864,11 @@ class CI_DB_active_record extends CI_DB_driver {
/**
* Sets the LIMIT value
*
- * @access public
* @param integer the limit value
* @param integer the offset value
* @return object
*/
- function limit($value, $offset = '')
+ public function limit($value, $offset = '')
{
$this->ar_limit = $value;
@@ -914,11 +885,10 @@ class CI_DB_active_record extends CI_DB_driver {
/**
* Sets the OFFSET value
*
- * @access public
* @param integer the offset value
* @return object
*/
- function offset($offset)
+ public function offset($offset)
{
$this->ar_offset = $offset;
return $this;
@@ -929,13 +899,12 @@ class CI_DB_active_record extends CI_DB_driver {
/**
* The "set" function. Allows key/value pairs to be set for inserting or updating
*
- * @access public
* @param mixed
* @param string
* @param boolean
* @return object
*/
- function set($key, $value = '', $escape = TRUE)
+ public function set($key, $value = '', $escape = TRUE)
{
$key = $this->_object_to_array($key);
@@ -967,13 +936,12 @@ class CI_DB_active_record extends CI_DB_driver {
* Compiles the select statement based on the other functions called
* and runs the query
*
- * @access public
* @param string the table
* @param string the limit clause
* @param string the offset clause
* @return object
*/
- function get($table = '', $limit = null, $offset = null)
+ public function get($table = '', $limit = null, $offset = null)
{
if ($table != '')
{
@@ -999,11 +967,10 @@ class CI_DB_active_record extends CI_DB_driver {
* Generates a platform-specific query string that counts all records
* returned by an Active Record query.
*
- * @access public
* @param string
* @return string
*/
- function count_all_results($table = '')
+ public function count_all_results($table = '')
{
if ($table != '')
{
@@ -1032,13 +999,12 @@ class CI_DB_active_record extends CI_DB_driver {
*
* Allows the where clause, limit and offset to be added directly
*
- * @access public
* @param string the where clause
* @param string the limit clause
* @param string the offset clause
* @return object
*/
- function get_where($table = '', $where = null, $limit = null, $offset = null)
+ public function get_where($table = '', $where = null, $limit = null, $offset = null)
{
if ($table != '')
{
@@ -1069,12 +1035,11 @@ class CI_DB_active_record extends CI_DB_driver {
*
* Compiles batch insert strings and runs the queries
*
- * @access public
* @param string the table to retrieve the results from
* @param array an associative array of insert values
* @return object
*/
- function insert_batch($table = '', $set = NULL)
+ public function insert_batch($table = '', $set = NULL)
{
if ( ! is_null($set))
{
@@ -1127,14 +1092,12 @@ class CI_DB_active_record extends CI_DB_driver {
/**
* The "set_insert_batch" function. Allows key/value pairs to be set for batch inserts
*
- * @access public
* @param mixed
* @param string
* @param boolean
* @return object
*/
-
- function set_insert_batch($key, $value = '', $escape = TRUE)
+ public function set_insert_batch($key, $value = '', $escape = TRUE)
{
$key = $this->_object_to_array_batch($key);
@@ -1189,8 +1152,7 @@ class CI_DB_active_record extends CI_DB_driver {
*
* Compiles an insert string and runs the query
*
- * @access public
- * @param string the table to retrieve the results from
+ * @param string the table to insert data into
* @param array an associative array of insert values
* @return object
*/
@@ -1230,7 +1192,18 @@ class CI_DB_active_record extends CI_DB_driver {
return $this->query($sql);
}
- function replace($table = '', $set = NULL)
+ // --------------------------------------------------------------------
+
+ /**
+ * Replace
+ *
+ * Compiles an replace into string and runs the query
+ *
+ * @param string the table to replace data into
+ * @param array an associative array of insert values
+ * @return object
+ */
+ public function replace($table = '', $set = NULL)
{
if ( ! is_null($set))
{
@@ -1273,13 +1246,12 @@ class CI_DB_active_record extends CI_DB_driver {
*
* Compiles an update string and runs the query
*
- * @access public
* @param string the table to retrieve the results from
* @param array an associative array of update values
* @param mixed the where clause
* @return object
*/
- function update($table = '', $set = NULL, $where = NULL, $limit = NULL)
+ public function update($table = '', $set = NULL, $where = NULL, $limit = NULL)
{
// Combine any cached components with the current statements
$this->_merge_cache();
@@ -1336,13 +1308,12 @@ class CI_DB_active_record extends CI_DB_driver {
*
* Compiles an update string and runs the query
*
- * @access public
* @param string the table to retrieve the results from
* @param array an associative array of update values
* @param string the where key
* @return object
*/
- function update_batch($table = '', $set = NULL, $index = NULL)
+ public function update_batch($table = '', $set = NULL, $index = NULL)
{
// Combine any cached components with the current statements
$this->_merge_cache();
@@ -1402,14 +1373,12 @@ class CI_DB_active_record extends CI_DB_driver {
/**
* The "set_update_batch" function. Allows key/value pairs to be set for batch updating
*
- * @access public
* @param array
* @param string
* @param boolean
* @return object
*/
-
- function set_update_batch($key, $index = '', $escape = TRUE)
+ public function set_update_batch($key, $index = '', $escape = TRUE)
{
$key = $this->_object_to_array_batch($key);
@@ -1462,11 +1431,10 @@ class CI_DB_active_record extends CI_DB_driver {
*
* Compiles a delete string and runs "DELETE FROM table"
*
- * @access public
* @param string the table to empty
* @return object
*/
- function empty_table($table = '')
+ public function empty_table($table = '')
{
if ($table == '')
{
@@ -1502,11 +1470,10 @@ class CI_DB_active_record extends CI_DB_driver {
* If the database does not support the truncate() command
* This function maps to "DELETE FROM table"
*
- * @access public
* @param string the table to truncate
* @return object
*/
- function truncate($table = '')
+ public function truncate($table = '')
{
if ($table == '')
{
@@ -1540,14 +1507,13 @@ class CI_DB_active_record extends CI_DB_driver {
*
* Compiles a delete string and runs the query
*
- * @access public
* @param mixed the table(s) to delete from. String or array
* @param mixed the where clause
* @param mixed the limit clause
* @param boolean
* @return object
*/
- function delete($table = '', $where = '', $limit = NULL, $reset_data = TRUE)
+ public function delete($table = '', $where = '', $limit = NULL, $reset_data = TRUE)
{
// Combine any cached components with the current statements
$this->_merge_cache();
@@ -1617,11 +1583,10 @@ class CI_DB_active_record extends CI_DB_driver {
*
* Prepends a database prefix if one exists in configuration
*
- * @access public
* @param string the table
* @return string
*/
- function dbprefix($table = '')
+ public function dbprefix($table = '')
{
if ($table == '')
{
@@ -1638,11 +1603,10 @@ class CI_DB_active_record extends CI_DB_driver {
*
* Used to track SQL statements written with aliased tables.
*
- * @access private
* @param string The table to inspect
* @return string
*/
- function _track_aliases($table)
+ protected function _track_aliases($table)
{
if (is_array($table))
{
@@ -1685,10 +1649,9 @@ class CI_DB_active_record extends CI_DB_driver {
* Generates a query string based on which functions were used.
* Should not be called directly. The get() function calls it.
*
- * @access private
* @return string
*/
- function _compile_select($select_override = FALSE)
+ protected function _compile_select($select_override = FALSE)
{
// Combine any cached components with the current statements
$this->_merge_cache();
@@ -1826,11 +1789,10 @@ class CI_DB_active_record extends CI_DB_driver {
*
* Takes an object as input and converts the class variables to array key/vals
*
- * @access public
* @param object
* @return array
*/
- function _object_to_array($object)
+ public function _object_to_array($object)
{
if ( ! is_object($object))
{
@@ -1857,11 +1819,10 @@ class CI_DB_active_record extends CI_DB_driver {
*
* Takes an object as input and converts the class variables to array key/vals
*
- * @access public
* @param object
* @return array
*/
- function _object_to_array_batch($object)
+ public function _object_to_array_batch($object)
{
if ( ! is_object($object))
{
@@ -1897,10 +1858,9 @@ class CI_DB_active_record extends CI_DB_driver {
*
* Starts AR caching
*
- * @access public
* @return void
*/
- function start_cache()
+ public function start_cache()
{
$this->ar_caching = TRUE;
}
@@ -1912,10 +1872,9 @@ class CI_DB_active_record extends CI_DB_driver {
*
* Stops AR caching
*
- * @access public
* @return void
*/
- function stop_cache()
+ public function stop_cache()
{
$this->ar_caching = FALSE;
}
@@ -1930,23 +1889,21 @@ class CI_DB_active_record extends CI_DB_driver {
* @access public
* @return void
*/
- function flush_cache()
+ public function flush_cache()
{
- $this->_reset_run(
- array(
- 'ar_cache_select' => array(),
- 'ar_cache_from' => array(),
- 'ar_cache_join' => array(),
- 'ar_cache_where' => array(),
- 'ar_cache_like' => array(),
- 'ar_cache_groupby' => array(),
- 'ar_cache_having' => array(),
- 'ar_cache_orderby' => array(),
- 'ar_cache_set' => array(),
- 'ar_cache_exists' => array(),
- 'ar_cache_no_escape' => array()
- )
- );
+ $this->_reset_run(array(
+ 'ar_cache_select' => array(),
+ 'ar_cache_from' => array(),
+ 'ar_cache_join' => array(),
+ 'ar_cache_where' => array(),
+ 'ar_cache_like' => array(),
+ 'ar_cache_groupby' => array(),
+ 'ar_cache_having' => array(),
+ 'ar_cache_orderby' => array(),
+ 'ar_cache_set' => array(),
+ 'ar_cache_exists' => array(),
+ 'ar_cache_no_escape' => array()
+ ));
}
// --------------------------------------------------------------------
@@ -1957,10 +1914,9 @@ class CI_DB_active_record extends CI_DB_driver {
* When called, this function merges any cached AR arrays with
* locally called ones.
*
- * @access private
* @return void
*/
- function _merge_cache()
+ protected function _merge_cache()
{
if (count($this->ar_cache_exists) == 0)
{
@@ -1995,11 +1951,10 @@ class CI_DB_active_record extends CI_DB_driver {
/**
* Resets the active record values. Called by the get() function
*
- * @access private
* @param array An array of fields to reset
* @return void
*/
- function _reset_run($ar_reset_items)
+ protected function _reset_run($ar_reset_items)
{
foreach ($ar_reset_items as $item => $default_value)
{
@@ -2015,28 +1970,27 @@ class CI_DB_active_record extends CI_DB_driver {
/**
* Resets the active record values. Called by the get() function
*
- * @access private
* @return void
*/
- function _reset_select()
+ protected function _reset_select()
{
$ar_reset_items = array(
- 'ar_select' => array(),
- 'ar_from' => array(),
- 'ar_join' => array(),
- 'ar_where' => array(),
- 'ar_like' => array(),
- 'ar_groupby' => array(),
- 'ar_having' => array(),
- 'ar_orderby' => array(),
- 'ar_wherein' => array(),
- 'ar_aliased_tables' => array(),
- 'ar_no_escape' => array(),
- 'ar_distinct' => FALSE,
- 'ar_limit' => FALSE,
- 'ar_offset' => FALSE,
- 'ar_order' => FALSE,
- );
+ 'ar_select' => array(),
+ 'ar_from' => array(),
+ 'ar_join' => array(),
+ 'ar_where' => array(),
+ 'ar_like' => array(),
+ 'ar_groupby' => array(),
+ 'ar_having' => array(),
+ 'ar_orderby' => array(),
+ 'ar_wherein' => array(),
+ 'ar_aliased_tables' => array(),
+ 'ar_no_escape' => array(),
+ 'ar_distinct' => FALSE,
+ 'ar_limit' => FALSE,
+ 'ar_offset' => FALSE,
+ 'ar_order' => FALSE,
+ );
$this->_reset_run($ar_reset_items);
}
@@ -2048,25 +2002,23 @@ class CI_DB_active_record extends CI_DB_driver {
*
* Called by the insert() update() insert_batch() update_batch() and delete() functions
*
- * @access private
* @return void
*/
- function _reset_write()
+ protected function _reset_write()
{
$ar_reset_items = array(
- 'ar_set' => array(),
- 'ar_from' => array(),
- 'ar_where' => array(),
- 'ar_like' => array(),
- 'ar_orderby' => array(),
- 'ar_keys' => array(),
- 'ar_limit' => FALSE,
- 'ar_order' => FALSE
- );
+ 'ar_set' => array(),
+ 'ar_from' => array(),
+ 'ar_where' => array(),
+ 'ar_like' => array(),
+ 'ar_orderby' => array(),
+ 'ar_keys' => array(),
+ 'ar_limit' => FALSE,
+ 'ar_order' => FALSE
+ );
$this->_reset_run($ar_reset_items);
}
-
}
/* End of file DB_active_rec.php */
--
cgit v1.2.3-24-g4f1b
From 5025929d76172efd6dd3a7b0f4da7611a3df9391 Mon Sep 17 00:00:00 2001
From: Phil Sturgeon
Date: Fri, 15 Jul 2011 15:25:15 -0600
Subject: Fixed conflicted changelog.
---
system/database/DB_active_rec.php | 15 +++++++++++++++
user_guide/changelog.html | 2 ++
user_guide/database/queries.html | 9 +++++++--
3 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php
index 7ddf20d07..bc11ff436 100644
--- a/system/database/DB_active_rec.php
+++ b/system/database/DB_active_rec.php
@@ -1598,6 +1598,21 @@ class CI_DB_active_record extends CI_DB_driver {
// --------------------------------------------------------------------
+ /**
+ * Set DB Prefix
+ *
+ * Set's the DB Prefix to something new without needing to reconnect
+ *
+ * @param string the prefix
+ * @return string
+ */
+ public function set_dbprefix($prefix = '')
+ {
+ return $this->dbprefix = $prefix;
+ }
+
+ // --------------------------------------------------------------------
+
/**
* Track Aliases
*
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index c1ee37fc5..95270febc 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -84,6 +84,8 @@ Change Log
Libraries
- Altered Session to use a longer match against the user_agent string. See upgrade notes if using database sessions.
+ - Added is_unique to the Form Validation library.
+ - Added $this->db->set_dbprefix() to the Database Driver.
diff --git a/user_guide/database/queries.html b/user_guide/database/queries.html
index f9f96803f..4c1ddfe7d 100644
--- a/user_guide/database/queries.html
+++ b/user_guide/database/queries.html
@@ -80,11 +80,16 @@ It DOES NOT return a database result set, nor does it set the query timer, or co
It simply lets you submit a query. Most users will rarely use this function.
-Adding Database prefixes manually
-If you have configured a database prefix and would like to add it in manually for, you can use the following.
+Working with Database prefixes manually
+If you have configured a database prefix and would like to prepend it to a table name for use in a native SQL query for example, then you can use the following:
$this->db->dbprefix('tablename');
// outputs prefix_tablename
+If for any reason you would like to change the prefix programatically without needing to create a new connection, you can use this method:
+$this->db->set_dbprefix('newprefix');
+$this->db->dbprefix('tablename');
+// outputs newprefix_tablename
+
Protecting identifiers
In many databases it is advisable to protect table and field names - for example with backticks in MySQL. Active Record queries are automatically protected, however if you need to manually protect an identifier you can use:
--
cgit v1.2.3-24-g4f1b
From 72038ba6fd2e8196623bf1bd1a38756ad41ce905 Mon Sep 17 00:00:00 2001
From: MarcosCoelho
Date: Mon, 18 Jul 2011 16:12:47 -0300
Subject: sync total items count and total amount price; by sum of quantity of
each item in cart
---
system/libraries/Cart.php | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php
index 7f65b48b9..b2eaa9ad7 100644
--- a/system/libraries/Cart.php
+++ b/system/libraries/Cart.php
@@ -374,6 +374,7 @@ class CI_Cart {
// Lets add up the individual prices and set the cart sub-total
$total = 0;
+ $items = 0;
foreach ($this->_cart_contents as $key => $val)
{
// We make sure the array contains the proper indexes
@@ -383,13 +384,14 @@ class CI_Cart {
}
$total += ($val['price'] * $val['qty']);
+ $items += $val['qty'];
// Set the subtotal
$this->_cart_contents[$key]['subtotal'] = ($this->_cart_contents[$key]['price'] * $this->_cart_contents[$key]['qty']);
}
// Set the cart total and total items.
- $this->_cart_contents['total_items'] = count($this->_cart_contents);
+ $this->_cart_contents['total_items'] = $items;
$this->_cart_contents['cart_total'] = $total;
// Is our cart empty? If so we delete it from the session
--
cgit v1.2.3-24-g4f1b
From e0df07950b101316c07ccec882ae00f930bca0c6 Mon Sep 17 00:00:00 2001
From: Phil Sturgeon
Date: Fri, 22 Jul 2011 16:11:34 -0600
Subject: Fixed conflict in changelog.
---
system/core/Loader.php | 15 +++++++++++++++
user_guide/changelog.html | 2 ++
user_guide/libraries/loader.html | 6 ++++++
3 files changed, 23 insertions(+)
diff --git a/system/core/Loader.php b/system/core/Loader.php
index 721c196cc..7c8b298ac 100644
--- a/system/core/Loader.php
+++ b/system/core/Loader.php
@@ -388,6 +388,21 @@ class CI_Loader {
// --------------------------------------------------------------------
+ /**
+ * Get Variable
+ *
+ * Check if a variable is set and retrieve it.
+ *
+ * @param array
+ * @return void
+ */
+ public function get_var($key)
+ {
+ return isset($this->_ci_cached_vars[$key]) ? $this->_ci_cached_vars[$key] : NULL;
+ }
+
+ // --------------------------------------------------------------------
+
/**
* Load Helper
*
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index 95270febc..81307fe0b 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -86,6 +86,8 @@ Change Log
Altered Session to use a longer match against the user_agent string. See upgrade notes if using database sessions.
Added is_unique to the Form Validation library.
Added $this->db->set_dbprefix() to the Database Driver.
+ Changed $this->cart->insert() in the Cart Library to return the Row ID if a single item was inserted successfully.
+ Added $this->load->get_var() to the Loader library to retrieve global vars set with $this->load->view() and $this->load->vars().
diff --git a/user_guide/libraries/loader.html b/user_guide/libraries/loader.html
index 1d93af5ed..a472730ca 100644
--- a/user_guide/libraries/loader.html
+++ b/user_guide/libraries/loader.html
@@ -175,6 +175,12 @@ and merged into one array for conversion to variables.
+$this->load->get_var($key)
+
+This function checks the associative array of variables available to your views. This is useful if for any reason a var is set in a library or another controller method using $this->load->vars().
+
+
+
$this->load->helper('file_name')
This function loads helper files, where file_name is the name of the file, without the _helper.php extension.
--
cgit v1.2.3-24-g4f1b
From b13a0dd78f0d0449e3ee9eb350ac06594beb3252 Mon Sep 17 00:00:00 2001
From: Eric Barnes
Date: Mon, 18 Jul 2011 00:13:07 -0400
Subject: Fixed issue #199 - Attributes passed as string does not include a
space between it and the opening tag.
---
system/helpers/html_helper.php | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php
index 080f622dd..b64b60650 100644
--- a/system/helpers/html_helper.php
+++ b/system/helpers/html_helper.php
@@ -124,6 +124,10 @@ if ( ! function_exists('_list'))
}
$attributes = $atts;
}
+ elseif (is_string($attributes) AND strlen($attributes) > 0)
+ {
+ $attributes = ' '. $attributes;
+ }
// Write the opening list tag
$out .= "<".$type.$attributes.">\n";
--
cgit v1.2.3-24-g4f1b
From e9ebe463e42d4ab7f7d29f85c87b3f24004a64b8 Mon Sep 17 00:00:00 2001
From: Phil Sturgeon
Date: Sat, 13 Aug 2011 11:23:04 -0600
Subject: Added note for fixed issue #199 in changelog.
---
user_guide/changelog.html | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index 81307fe0b..d2654c44b 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -73,7 +73,7 @@ Change Log
Added Session Class userdata to the output profiler. Additionally, added a show/hide toggle on HTTP Headers, Session Data and Config Variables.
Removed internal usage of the EXT constant.
Visual updates to the welcome_message view file and default error templates. Thanks to danijelb for the pull request.
- Added insert_batch() function to the PostgreSQL database driver. Thanks to epallerols for the patch.
+ Added insert_batch() function to the PostgreSQL database driver. Thanks to epallerols for the patch.
Helpers
@@ -100,6 +100,7 @@ Change Log
Fixed a bug (Reactor #231) where Sessions Library database table example SQL did not contain an index on last_activity. See Upgrade Notes.
Fixed a bug (Reactor #229) where the Sessions Library example SQL in the documentation contained incorrect SQL.
Fixed a bug (Core #340) where when passing in the second parameter to $this->db->select(), column names in subsequent queries would not be properly escaped.
+ Fixed issue #199 - Attributes passed as string does not include a space between it and the opening tag.
Version 2.0.2
--
cgit v1.2.3-24-g4f1b
From 40b28e9139f3486971fe6f13594d3f615a37862c Mon Sep 17 00:00:00 2001
From: Adam Jackett
Date: Sat, 23 Jul 2011 11:45:05 -0400
Subject: Fixed having method to insert quotes.
---
system/database/DB_active_rec.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php
index bc11ff436..0a25b3cb5 100644
--- a/system/database/DB_active_rec.php
+++ b/system/database/DB_active_rec.php
@@ -790,7 +790,7 @@ class CI_DB_active_record extends CI_DB_driver {
if ($v != '')
{
- $v = ' '.$this->escape_str($v);
+ $v = ' '.$this->escape($v);
}
$this->ar_having[] = $prefix.$k.$v;
--
cgit v1.2.3-24-g4f1b
From 32ad584b25b6429b2e4ce2f38177e88a12f2b117 Mon Sep 17 00:00:00 2001
From: Adam Jackett
Date: Sat, 23 Jul 2011 14:35:47 -0400
Subject: Added having() fix to changelog.
---
user_guide/changelog.html | 1 +
1 file changed, 1 insertion(+)
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index d2654c44b..7779a690d 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -88,6 +88,7 @@ Change Log
Added $this->db->set_dbprefix() to the Database Driver.
Changed $this->cart->insert() in the Cart Library to return the Row ID if a single item was inserted successfully.
Added $this->load->get_var() to the Loader library to retrieve global vars set with $this->load->view() and $this->load->vars().
+ Changed $this->db->having() to insert quotes using escape() rather than escape_str().
--
cgit v1.2.3-24-g4f1b
From c5961e7d778d5a9361df4cfbc7da5fc4370d883f Mon Sep 17 00:00:00 2001
From: Adam Jackett
Date: Sat, 23 Jul 2011 09:50:34 -0400
Subject: Fixed mysql and mysqli drivers to set NOT NULL as default for
creating fields. All other drivers were correct.
---
system/database/drivers/mysql/mysql_forge.php | 8 ++++++--
system/database/drivers/mysqli/mysqli_forge.php | 8 ++++++--
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/system/database/drivers/mysql/mysql_forge.php b/system/database/drivers/mysql/mysql_forge.php
index 529ec980d..c1cae136c 100644
--- a/system/database/drivers/mysql/mysql_forge.php
+++ b/system/database/drivers/mysql/mysql_forge.php
@@ -119,9 +119,13 @@ class CI_DB_mysql_forge extends CI_DB_forge {
$sql .= ' DEFAULT \''.$attributes['DEFAULT'].'\'';
}
- if (array_key_exists('NULL', $attributes))
+ if (array_key_exists('NULL', $attributes) && $attributes['NULL'] === TRUE)
{
- $sql .= ($attributes['NULL'] === TRUE) ? ' NULL' : ' NOT NULL';
+ $sql .= ' NULL';
+ }
+ else
+ {
+ $sql .= ' NOT NULL';
}
if (array_key_exists('AUTO_INCREMENT', $attributes) && $attributes['AUTO_INCREMENT'] === TRUE)
diff --git a/system/database/drivers/mysqli/mysqli_forge.php b/system/database/drivers/mysqli/mysqli_forge.php
index d5097335e..260549457 100644
--- a/system/database/drivers/mysqli/mysqli_forge.php
+++ b/system/database/drivers/mysqli/mysqli_forge.php
@@ -104,9 +104,13 @@ class CI_DB_mysqli_forge extends CI_DB_forge {
$sql .= ' DEFAULT \''.$attributes['DEFAULT'].'\'';
}
- if (array_key_exists('NULL', $attributes))
+ if (array_key_exists('NULL', $attributes) && $attributes['NULL'] === TRUE)
{
- $sql .= ($attributes['NULL'] === TRUE) ? ' NULL' : ' NOT NULL';
+ $sql .= ' NULL';
+ }
+ else
+ {
+ $sql .= ' NOT NULL';
}
if (array_key_exists('AUTO_INCREMENT', $attributes) && $attributes['AUTO_INCREMENT'] === TRUE)
--
cgit v1.2.3-24-g4f1b
From 090eb6075eac3a16974f6baed236875ee1dc8a90 Mon Sep 17 00:00:00 2001
From: Adam Jackett
Date: Sat, 23 Jul 2011 11:53:02 -0400
Subject: Merge changelog.
---
user_guide/changelog.html | 2 ++
1 file changed, 2 insertions(+)
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index 7779a690d..f5eb53aa3 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -102,6 +102,8 @@ Change Log
Fixed a bug (Reactor #229) where the Sessions Library example SQL in the documentation contained incorrect SQL.
Fixed a bug (Core #340) where when passing in the second parameter to $this->db->select(), column names in subsequent queries would not be properly escaped.
Fixed issue #199 - Attributes passed as string does not include a space between it and the opening tag.
+ Fixed a bug where the method $this->cart->total_items() from Cart Library now returns the sum of the quantity of all items in the cart instead of your total count.
+ Fixed a bug where not setting 'null' when adding fields in db_forge for mysql and mysqli drivers would default to NULL instead of NOT NULL as the docs suggest.
Version 2.0.2
--
cgit v1.2.3-24-g4f1b
From 76e621786007907192c3e84cbde3e1a12dbf83fb Mon Sep 17 00:00:00 2001
From: Phil Sturgeon
Date: Tue, 9 Aug 2011 16:03:49 -0600
Subject: Fixed conflict in changelog.
---
system/database/DB_active_rec.php | 3 ++-
user_guide/changelog.html | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php
index 0a25b3cb5..2af3553ed 100644
--- a/system/database/DB_active_rec.php
+++ b/system/database/DB_active_rec.php
@@ -1694,7 +1694,8 @@ class CI_DB_active_record extends CI_DB_driver {
// is because until the user calls the from() function we don't know if there are aliases
foreach ($this->ar_select as $key => $val)
{
- $this->ar_select[$key] = $this->_protect_identifiers($val, FALSE, $this->ar_no_escape[$key]);
+ $no_escape = isset($this->ar_no_escape[$key]) ? $this->ar_no_escape[$key] : NULL;
+ $this->ar_select[$key] = $this->_protect_identifiers($val, FALSE, $no_escape);
}
$sql .= implode(', ', $this->ar_select);
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index f5eb53aa3..e6c1425af 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -104,6 +104,7 @@ Change Log
Fixed issue #199 - Attributes passed as string does not include a space between it and the opening tag.
Fixed a bug where the method $this->cart->total_items() from Cart Library now returns the sum of the quantity of all items in the cart instead of your total count.
Fixed a bug where not setting 'null' when adding fields in db_forge for mysql and mysqli drivers would default to NULL instead of NOT NULL as the docs suggest.
+ Fixed a bug where using $this->db->select_max(), $this->db->select_min(), etc could throw notices. Thanks to w43l for the patch.
Version 2.0.2
--
cgit v1.2.3-24-g4f1b
From 99f6c8c4d71714e62a86cee5d2f7fbfa496a3c5a Mon Sep 17 00:00:00 2001
From: Phil Sturgeon
Date: Sat, 13 Aug 2011 10:26:04 -0600
Subject: Improved logic for plural() and singular() as words like "tax" would
become "taxs" and it was tough to code in new rules.
---
system/helpers/inflector_helper.php | 115 +++++++++++++++++++++---------------
1 file changed, 67 insertions(+), 48 deletions(-)
diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php
index c7c113b8a..7b99bc5b4 100644
--- a/system/helpers/inflector_helper.php
+++ b/system/helpers/inflector_helper.php
@@ -41,30 +41,48 @@ if ( ! function_exists('singular'))
{
function singular($str)
{
- $str = trim($str);
- $end = substr($str, -3);
-
- $str = preg_replace('/(.*)?([s|c]h)es/i','$1$2',$str);
-
- if (strtolower($end) == 'ies')
+ $result = strval($str);
+
+ $singular_rules = array(
+ '/(matr)ices$/' => '\1ix',
+ '/(vert|ind)ices$/' => '\1ex',
+ '/^(ox)en/' => '\1',
+ '/(alias)es$/' => '\1',
+ '/([octop|vir])i$/' => '\1us',
+ '/(cris|ax|test)es$/' => '\1is',
+ '/(shoe)s$/' => '\1',
+ '/(o)es$/' => '\1',
+ '/(bus|campus)es$/' => '\1',
+ '/([m|l])ice$/' => '\1ouse',
+ '/(x|ch|ss|sh)es$/' => '\1',
+ '/(m)ovies$/' => '\1\2ovie',
+ '/(s)eries$/' => '\1\2eries',
+ '/([^aeiouy]|qu)ies$/' => '\1y',
+ '/([lr])ves$/' => '\1f',
+ '/(tive)s$/' => '\1',
+ '/(hive)s$/' => '\1',
+ '/([^f])ves$/' => '\1fe',
+ '/(^analy)ses$/' => '\1sis',
+ '/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/' => '\1\2sis',
+ '/([ti])a$/' => '\1um',
+ '/(p)eople$/' => '\1\2erson',
+ '/(m)en$/' => '\1an',
+ '/(s)tatuses$/' => '\1\2tatus',
+ '/(c)hildren$/' => '\1\2hild',
+ '/(n)ews$/' => '\1\2ews',
+ '/([^u])s$/' => '\1',
+ );
+
+ foreach ($singular_rules as $rule => $replacement)
{
- $str = substr($str, 0, strlen($str)-3).(preg_match('/[a-z]/',$end) ? 'y' : 'Y');
- }
- elseif (strtolower($end) == 'ses')
- {
- $str = substr($str, 0, strlen($str)-2);
- }
- else
- {
- $end = strtolower(substr($str, -1));
-
- if ($end == 's')
+ if (preg_match($rule, $result))
{
- $str = substr($str, 0, strlen($str)-1);
+ $result = preg_replace($rule, $replacement, $result);
+ break;
}
}
- return $str;
+ return $result;
}
}
@@ -83,40 +101,41 @@ if ( ! function_exists('singular'))
if ( ! function_exists('plural'))
{
function plural($str, $force = FALSE)
- {
- $str = trim($str);
- $end = substr($str, -1);
-
- if (preg_match('/y/i',$end))
- {
- // Y preceded by vowel => regular plural
- $vowels = array('a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U');
- $str = in_array(substr($str, -2, 1), $vowels) ? $str.'s' : substr($str, 0, -1).'ies';
- }
- elseif (preg_match('/h/i',$end))
- {
- if(preg_match('/^[c|s]h$/i',substr($str, -2)))
- {
- $str .= 'es';
- }
- else
- {
- $str .= 's';
- }
- }
- elseif (preg_match('/s/i',$end))
+ {
+ $result = strval($str);
+
+ $plural_rules = array(
+ '/^(ox)$/' => '\1\2en', // ox
+ '/([m|l])ouse$/' => '\1ice', // mouse, louse
+ '/(matr|vert|ind)ix|ex$/' => '\1ices', // matrix, vertex, index
+ '/(x|ch|ss|sh)$/' => '\1es', // search, switch, fix, box, process, address
+ '/([^aeiouy]|qu)y$/' => '\1ies', // query, ability, agency
+ '/(hive)$/' => '\1s', // archive, hive
+ '/(?:([^f])fe|([lr])f)$/' => '\1\2ves', // half, safe, wife
+ '/sis$/' => 'ses', // basis, diagnosis
+ '/([ti])um$/' => '\1a', // datum, medium
+ '/(p)erson$/' => '\1eople', // person, salesperson
+ '/(m)an$/' => '\1en', // man, woman, spokesman
+ '/(c)hild$/' => '\1hildren', // child
+ '/(buffal|tomat)o$/' => '\1\2oes', // buffalo, tomato
+ '/(bu|campu)s$/' => '\1\2ses', // bus, campus
+ '/(alias|status|virus)/' => '\1es', // alias
+ '/(octop)us$/' => '\1i', // octopus
+ '/(ax|cris|test)is$/' => '\1es', // axis, crisis
+ '/s$/' => 's', // no change (compatibility)
+ '/$/' => 's',
+ );
+
+ foreach ($plural_rules as $rule => $replacement)
{
- if ($force == TRUE)
+ if (preg_match($rule, $result))
{
- $str .= 'es';
+ $result = preg_replace($rule, $replacement, $result);
+ break;
}
}
- else
- {
- $str .= 's';
- }
- return $str;
+ return $result;
}
}
--
cgit v1.2.3-24-g4f1b
From fe1d45a023b08753f4c5f1d908d54ae842277558 Mon Sep 17 00:00:00 2001
From: Phil Sturgeon
Date: Sat, 13 Aug 2011 11:06:57 -0600
Subject: Fixed conflicts.
---
system/core/Input.php | 2 +-
system/core/URI.php | 2 +-
user_guide/changelog.html | 1 +
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/system/core/Input.php b/system/core/Input.php
index dc7612e64..cfbef942d 100644
--- a/system/core/Input.php
+++ b/system/core/Input.php
@@ -672,7 +672,7 @@ class CI_Input {
*/
public function is_cli_request()
{
- return (bool) defined('STDIN');
+ return (php_sapi_name() == 'cli') or defined('STDIN');
}
}
diff --git a/system/core/URI.php b/system/core/URI.php
index d56548654..20f0f006b 100644
--- a/system/core/URI.php
+++ b/system/core/URI.php
@@ -62,7 +62,7 @@ class CI_URI {
if (strtoupper($this->config->item('uri_protocol')) == 'AUTO')
{
// Is the request coming from the command line?
- if (defined('STDIN'))
+ if (php_sapi_name() == 'cli' or defined('STDIN'))
{
$this->_set_uri_string($this->_parse_cli_args());
return;
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index e6c1425af..9bebb7044 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -105,6 +105,7 @@ Change Log
Fixed a bug where the method $this->cart->total_items() from Cart Library now returns the sum of the quantity of all items in the cart instead of your total count.
Fixed a bug where not setting 'null' when adding fields in db_forge for mysql and mysqli drivers would default to NULL instead of NOT NULL as the docs suggest.
Fixed a bug where using $this->db->select_max(), $this->db->select_min(), etc could throw notices. Thanks to w43l for the patch.
+ Replace checks for STDIN with php_sapi_name() == 'cli' which on the whole is more reliable. This should get parameters in crontab working.
Version 2.0.2
--
cgit v1.2.3-24-g4f1b
From dd9b763ef18808637680237d78d8698799ccf8fa Mon Sep 17 00:00:00 2001
From: Phil Sturgeon
Date: Wed, 10 Aug 2011 09:00:13 -0600
Subject: Fixed conflicts.
---
application/config/mimes.php | 2 +-
user_guide/changelog.html | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/application/config/mimes.php b/application/config/mimes.php
index 8065794ff..82767d7c8 100644
--- a/application/config/mimes.php
+++ b/application/config/mimes.php
@@ -10,7 +10,7 @@
$mimes = array( 'hqx' => 'application/mac-binhex40',
'cpt' => 'application/mac-compactpro',
- 'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel'),
+ 'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel'),
'bin' => 'application/macbinary',
'dms' => 'application/octet-stream',
'lha' => 'application/octet-stream',
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index 9bebb7044..783c9d3d1 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -74,6 +74,8 @@ Change Log
Removed internal usage of the EXT constant.
Visual updates to the welcome_message view file and default error templates. Thanks to danijelb for the pull request.
Added insert_batch() function to the PostgreSQL database driver. Thanks to epallerols for the patch.
+ Added "application/x-csv" to mimes.php.
+
Helpers
--
cgit v1.2.3-24-g4f1b
From 9d887b32a1fe998cbb0307a5e678ac3ba5076a1e Mon Sep 17 00:00:00 2001
From: Phil Sturgeon
Date: Wed, 10 Aug 2011 08:06:37 -0600
Subject: Fixed conflicts in changelog.
---
system/libraries/Email.php | 2 +-
user_guide/changelog.html | 8 +++++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index cd89f8f3d..03eccea09 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -395,7 +395,7 @@ class CI_Email {
public function attach($filename, $disposition = 'attachment')
{
$this->_attach_name[] = $filename;
- $this->_attach_type[] = $this->_mime_types(next(explode('.', basename($filename))));
+ $this->_attach_type[] = $this->_mime_types(pathinfo($filename, PATHINFO_EXTENSION));
$this->_attach_disp[] = $disposition; // Can also be 'inline' Not sure if it matters
return $this;
}
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index 783c9d3d1..5d5767b74 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -75,7 +75,7 @@ Change Log
Visual updates to the welcome_message view file and default error templates. Thanks to danijelb for the pull request.
Added insert_batch() function to the PostgreSQL database driver. Thanks to epallerols for the patch.
Added "application/x-csv" to mimes.php.
-
+ Fixed a bug where Email library attachments with a "." in the name would using invalid MIME-types.
Helpers
@@ -105,9 +105,15 @@ Change Log
Fixed a bug (Core #340) where when passing in the second parameter to $this->db->select(), column names in subsequent queries would not be properly escaped.
Fixed issue #199 - Attributes passed as string does not include a space between it and the opening tag.
Fixed a bug where the method $this->cart->total_items() from Cart Library now returns the sum of the quantity of all items in the cart instead of your total count.
+<<<<<<< HEAD
Fixed a bug where not setting 'null' when adding fields in db_forge for mysql and mysqli drivers would default to NULL instead of NOT NULL as the docs suggest.
Fixed a bug where using $this->db->select_max(), $this->db->select_min(), etc could throw notices. Thanks to w43l for the patch.
Replace checks for STDIN with php_sapi_name() == 'cli' which on the whole is more reliable. This should get parameters in crontab working.
+=======
+ Fixed a bug where not setting 'null' when adding fields in db_forge for mysql and mysqli drivers would default to NULL instead of NOT NULL as the docs suggest.
+ Fixed a bug where using $this->db->select_max(), $this->db->select_min(), etc could throw notices. Thanks to w43l for the patch.
+ Fixed a bug where Email library attachments with a "." in the name would using invalid MIME-types.
+>>>>>>> 0aaf42b... Fixed a bug where Email library attachments with a . in the name would using invalid MIME-types.
Version 2.0.2
--
cgit v1.2.3-24-g4f1b
From 4c76272593d82f45761c24917e69b42983f26171 Mon Sep 17 00:00:00 2001
From: Phil Sturgeon
Date: Sat, 13 Aug 2011 11:31:22 -0600
Subject: Bumped the version number. Can somebody with a working find and
replace fix up the docs?
---
system/core/CodeIgniter.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php
index 03b25ab9e..94fecb5c0 100644
--- a/system/core/CodeIgniter.php
+++ b/system/core/CodeIgniter.php
@@ -32,7 +32,7 @@
* Define the CodeIgniter Version
* ------------------------------------------------------
*/
- define('CI_VERSION', '2.0.2');
+ define('CI_VERSION', '2.0.3');
/*
* ------------------------------------------------------
--
cgit v1.2.3-24-g4f1b