summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--application/config/migration.php29
-rw-r--r--application/views/welcome_message.php2
-rw-r--r--readme.md92
-rwxr-xr-xsystem/core/Input.php40
-rw-r--r--system/database/DB_active_rec.php4
-rw-r--r--system/database/drivers/oci8/oci8_driver.php6
-rw-r--r--system/helpers/string_helper.php9
-rw-r--r--system/libraries/Cache/drivers/Cache_file.php11
-rw-r--r--system/libraries/Email.php1
-rw-r--r--system/libraries/Form_validation.php2
-rw-r--r--system/libraries/Migration.php29
-rw-r--r--system/libraries/Profiler.php2
-rw-r--r--system/libraries/Session.php3
-rw-r--r--user_guide/changelog.html24
-rw-r--r--user_guide/database/active_record.html43
-rw-r--r--user_guide/database/results.html4
-rw-r--r--user_guide/database/utilities.html7
-rw-r--r--user_guide/general/cli.html6
-rw-r--r--user_guide/helpers/form_helper.html12
-rw-r--r--user_guide/helpers/string_helper.html8
-rw-r--r--user_guide/installation/downloads.html8
-rw-r--r--user_guide/installation/index.html6
-rw-r--r--user_guide/installation/upgrade_201.html4
-rw-r--r--user_guide/installation/upgrading.html1
-rw-r--r--user_guide/libraries/loader.html4
-rw-r--r--user_guide/libraries/output.html14
-rw-r--r--user_guide/libraries/user_agent.html4
27 files changed, 283 insertions, 92 deletions
diff --git a/application/config/migration.php b/application/config/migration.php
index dba870010..1f532f170 100644
--- a/application/config/migration.php
+++ b/application/config/migration.php
@@ -11,6 +11,35 @@
*/
$config['migration_enabled'] = FALSE;
+/*
+|--------------------------------------------------------------------------
+| Migrations table
+|--------------------------------------------------------------------------
+|
+| This is the name of the table that will store the current migrations state.
+| When migrations runs it will store in a database table which migration
+| level the system is at. It then compares the migration level in the this
+| table to the $config['migration_version'] if they are not the same it
+| will migrate up. This must be set.
+|
+*/
+$config['migration_table'] = 'migrations';
+
+
+/*
+|--------------------------------------------------------------------------
+| Auto Migrate To Latest
+|--------------------------------------------------------------------------
+|
+| If this is set to TRUE when you load the migrations class and have
+| $config['migration_enabled'] set to TRUE the system will auto migrate
+| to your latest migration (whatever $config['migration_version'] is
+| set to). This way you do not have to call migrations anywhere else
+| in your code to have the latest migration.
+|
+*/
+$config['migration_auto_latest'] = FALSE;
+
/*
|--------------------------------------------------------------------------
diff --git a/application/views/welcome_message.php b/application/views/welcome_message.php
index 0bf5a8d2e..d906bc8d7 100644
--- a/application/views/welcome_message.php
+++ b/application/views/welcome_message.php
@@ -81,7 +81,7 @@
<p>If you are exploring CodeIgniter for the very first time, you should start by reading the <a href="user_guide/">User Guide</a>.</p>
</div>
- <p class="footer">Page rendered in <strong>{elapsed_time}</strong> seconds</p>
+ <p class="footer">Page rendered in <strong>{elapsed_time}</strong> seconds. <?php echo (ENVIRONMENT == 'development') ? 'CodeIgniter Version <strong>' . CI_VERSION . '</strong>' : '' ?></p>
</div>
</body>
diff --git a/readme.md b/readme.md
index 7919465d6..b6a88ea7a 100644
--- a/readme.md
+++ b/readme.md
@@ -2,10 +2,98 @@
CodeIgniter is an Application Development Framework - a toolkit - for people who build web sites using PHP. Its goal is to enable you to develop projects much faster than you could if you were writing code from scratch, by providing a rich set of libraries for commonly needed tasks, as well as a simple interface and logical structure to access these libraries. CodeIgniter lets you creatively focus on your project by minimizing the amount of code needed for a given task.
-# Resources
+## Release Information
+
+This repo contains in development code for future releases. To download the latest stable release please visit the [CodeIgniter Downloads](http://codeigniter.com/downloads/) page.
+
+## Changelog and New Features
+
+You can find a list of all changes for each release in the [user guide](https://github.com/EllisLab/CodeIgniter/blob/develop/user_guide/changelog.html).
+
+## Server Requirements
+
+* PHP version 5.1.6 or newer.
+
+## Installation
+
+Please see the installation section of the [CodeIgniter User Guide](http://codeigniter.com/user_guide/installation/index.html)
+
+## Contributing
+
+CodeIgniter is a community driven project and accepts contributions of code and documentation from the community. These contributions are made in the form of Issues or [Pull Requests](http://help.github.com/send-pull-requests/) on the [EllisLab CodeIgniter repository](https://github.com/EllisLab/CodeIgniter) on GitHub.
+
+Issues are a quick way to point out a bug. If you find a bug or documentation error in CodeIgniter then please check a few things first:
+
+
+ There is not already an open Issue
+ The issue has already been fixed (check the develop branch, or look for closed Issues)
+ Is it something really obvious that you fix it yourself?
+
+Reporting issues is helpful but an even better approach is to send a Pull Request, which is done by “Forking” the main repository and committing to your own copy. This will require you to use the version control system called Git.
+
+Guidelines
+----------
+
+Before we look into how, here are the guidelines. If your Pull Requests fail to pass these guidelines it will be declined and you will need to re-submit when you’ve made the changes. This might sound a bit tough, but it is required for us to maintain quality of the code-base.
+
+PHP Style: All code must meet the [Style Guide](http://codeigniter.com/user_guide/general/styleguide.html), which is essentially the [Allman indent style](http://en.wikipedia.org/wiki/Indent_style#Allman_style), underscores and readable operators. This makes certain that all code is the same format as the existing code and means it will be as readable as possible.
+
+Documentation: If you change anything that requires a change to documentation then you will need to add it. New classes, methods, parameters, changing default values, etc are all things that will require a change to documentation. The change-log must also be updated for every change. Also PHPDoc blocks must be maintained.
+
+Compatibility: CodeIgniter is compatible with PHP 5.1.6 so all code supplied must stick to this requirement. If PHP 5.2 or 5.3 functions or features are used then there must be a fallback for PHP 5.1.6.
+
+Branching: CodeIgniter uses the [Git-Flow](http://nvie.com/posts/a-successful-git-branching-model/) branching model which requires all pull requests to be sent to the “develop” branch. This is where the next planned version will be developed. The “master” branch will always contain the latest stable version and is kept clean so a “hotfix” (e.g: an emergency security patch) can be applied to master to create a new version, without worrying about other features holding it up. For this reason all commits need to be made to “develop” and any sent to “master” will be closed automatically. If you have multiple changes to submit, please place all changes into their own branch on your fork.
+
+One thing at a time: A pull request should only contain one change. That does not mean only one commit, but one change - however many commits it took. The reason for this is that if you change X and Y but send a pull request for both at the same time, we might really want X but disagree with Y, meaning we cannot merge the request. Using the Git-Flow branching model you can create new branches for both of these features and send two requests.
+
+How-to Guide
+------------
+
+There are two ways to make changes, the easy way and the hard way. Either way you will need to [create a GitHub account](https://github.com/signup/free).
+
+Easy way
+GitHub allows in-line editing of files for making simple typo changes and quick-fixes. This is not the best way as you are unable to test the code works. If you do this you could be introducing syntax errors, etc, but for a Git-phobic user this is good for a quick-fix.
+
+Hard way
+The best way to contribute is to “clone” your fork of CodeIgniter to your development area. That sounds like some jargon, but “forking” on GitHub means “making a copy of that repo to your account” and “cloning” means “copying that code to your environment so you can work on it”.
+
+ Set up Git (Windows, Mac & Linux)
+ Go to the CodeIgniter repo
+ Fork it
+ Clone your CodeIgniter repo: git@github.com:<your-name>/CodeIgniter.git
+ Checkout the “develop” branch At this point you are ready to start making changes.
+ Fix existing bugs on the Issue tracker after taking a look to see nobody else is working on them.
+ Commit the files
+ Push your develop branch to your fork
+ Send a pull request http://help.github.com/send-pull-requests/
+
+The Reactor Engineers will now be alerted about the change and at least one of the team will respond. If your change fails to meet the guidelines it will be bounced, or feedback will be provided to help you improve it.
+
+Once the Reactor Engineer handling your pull request is happy with it they will post it to the internal EllisLab discussion area to be double checked by the other Engineers and EllisLab developers. If nobody has a problem with the change then it will be merged into develop and will be part of the next release.
+Keeping your fork up-to-date
+
+Unlike systems like Subversion, Git can have multiple remotes. A remote is the name for a URL of a Git repository. By default your fork will have a remote named “origin” which points to your fork, but you can add another remote named “codeigniter” which points to git://github.com/EllisLab/CodeIgniter.git. This is a read-only remote but you can pull from this develop branch to update your own.
+
+If you are using command-line you can do the following:
+
+ git remote add codeigniter git://github.com/EllisLab/CodeIgniter.git
+ git pull codeigniter develop
+ git push origin develop
+
+Now your fork is up to date. This should be done regularly, or before you send a pull request at least.
+
+## License
+
+Please see the [license agreement](http://codeigniter.com/user_guide/license.html)
+
+## Resources
* [User Guide](http://codeigniter.com/user_guide/)
* [Community Forums](http://codeigniter.com/forums/)
* [User Voice](http://codeigniter.uservoice.com/forums/40508-codeigniter-reactor)
* [Community Wiki](http://codeigniter.com/wiki/)
- * [Community IRC](http://codeigniter.com/irc/) \ No newline at end of file
+ * [Community IRC](http://codeigniter.com/irc/)
+
+## Acknowledgement
+
+The EllisLab team and The Reactor Engineers would like to thank all the contributors to the CodeIgniter project and you, the CodeIgniter user.
diff --git a/system/core/Input.php b/system/core/Input.php
index 0dc2c4550..f39371fb0 100755
--- a/system/core/Input.php
+++ b/system/core/Input.php
@@ -110,13 +110,13 @@ class CI_Input {
*
* This is a helper function to retrieve values from global arrays
*
- * @access private
+ * @access protected
* @param array
* @param string
* @param bool
* @return string
*/
- function _fetch_from_array(&$array, $index = '', $xss_clean = FALSE)
+ protected function _fetch_from_array(&$array, $index = '', $xss_clean = FALSE)
{
if ( ! isset($array[$index]))
{
@@ -141,7 +141,7 @@ class CI_Input {
* @param bool
* @return string
*/
- function get($index = NULL, $xss_clean = FALSE)
+ public function get($index = NULL, $xss_clean = FALSE)
{
// Check if a field has been provided
if ($index === NULL AND ! empty($_GET))
@@ -169,7 +169,7 @@ class CI_Input {
* @param bool
* @return string
*/
- function post($index = NULL, $xss_clean = FALSE)
+ public function post($index = NULL, $xss_clean = FALSE)
{
// Check if a field has been provided
if ($index === NULL AND ! empty($_POST))
@@ -198,7 +198,7 @@ class CI_Input {
* @param bool XSS cleaning
* @return string
*/
- function get_post($index = '', $xss_clean = FALSE)
+ public function get_post($index = '', $xss_clean = FALSE)
{
if ( ! isset($_POST[$index]) )
{
@@ -220,7 +220,7 @@ class CI_Input {
* @param bool
* @return string
*/
- function cookie($index = '', $xss_clean = FALSE)
+ public function cookie($index = '', $xss_clean = FALSE)
{
return $this->_fetch_from_array($_COOKIE, $index, $xss_clean);
}
@@ -243,7 +243,7 @@ class CI_Input {
* @param bool true makes the cookie secure
* @return void
*/
- function set_cookie($name = '', $value = '', $expire = '', $domain = '', $path = '/', $prefix = '', $secure = FALSE)
+ public function set_cookie($name = '', $value = '', $expire = '', $domain = '', $path = '/', $prefix = '', $secure = FALSE)
{
if (is_array($name))
{
@@ -296,7 +296,7 @@ class CI_Input {
* @param bool
* @return string
*/
- function server($index = '', $xss_clean = FALSE)
+ public function server($index = '', $xss_clean = FALSE)
{
return $this->_fetch_from_array($_SERVER, $index, $xss_clean);
}
@@ -309,7 +309,7 @@ class CI_Input {
* @access public
* @return string
*/
- function ip_address()
+ public function ip_address()
{
if ($this->ip_address !== FALSE)
{
@@ -369,10 +369,16 @@ class CI_Input {
*
* @access public
* @param string
- * @return string
+ * @return bool
*/
- function valid_ip($ip)
+ public function valid_ip($ip)
{
+ // if php version >= 5.2, use filter_var to check validate ip.
+ if (function_exists('filter_var'))
+ {
+ return (bool) filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4);
+ }
+
$ip_segments = explode('.', $ip);
// Always 4 segments needed
@@ -407,7 +413,7 @@ class CI_Input {
* @access public
* @return string
*/
- function user_agent()
+ public function user_agent()
{
if ($this->user_agent !== FALSE)
{
@@ -435,7 +441,7 @@ class CI_Input {
* @access private
* @return void
*/
- function _sanitize_globals()
+ private function _sanitize_globals()
{
// It would be "wrong" to unset any of these GLOBALS.
$protected = array('_SERVER', '_GET', '_POST', '_FILES', '_REQUEST',
@@ -536,7 +542,7 @@ class CI_Input {
* @param string
* @return string
*/
- function _clean_input_data($str)
+ private function _clean_input_data($str)
{
if (is_array($str))
{
@@ -594,7 +600,7 @@ class CI_Input {
* @param string
* @return string
*/
- function _clean_input_keys($str)
+ private function _clean_input_keys($str)
{
if ( ! preg_match("/^[a-z0-9:_\/-]+$/i", $str))
{
@@ -618,6 +624,7 @@ class CI_Input {
* In Apache, you can simply call apache_request_headers(), however for
* people running other webservers the function is undefined.
*
+ * @access public
* @param bool XSS cleaning
*
* @return array
@@ -661,6 +668,7 @@ class CI_Input {
*
* Returns the value of a single member of the headers class member
*
+ * @access public
* @param string array key for $this->headers
* @param boolean XSS Clean or not
* @return mixed FALSE on failure, string on success
@@ -692,6 +700,7 @@ class CI_Input {
*
* Test to see if a request contains the HTTP_X_REQUESTED_WITH header
*
+ * @access public
* @return boolean
*/
public function is_ajax_request()
@@ -706,6 +715,7 @@ class CI_Input {
*
* Test to see if a request was made from the command line
*
+ * @access public
* @return boolean
*/
public function is_cli_request()
diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php
index 89766e304..7162e2ac5 100644
--- a/system/database/DB_active_rec.php
+++ b/system/database/DB_active_rec.php
@@ -872,11 +872,11 @@ class CI_DB_active_record extends CI_DB_driver {
* @param integer the offset value
* @return object
*/
- public function limit($value, $offset = '')
+ public function limit($value, $offset = NULL)
{
$this->ar_limit = (int) $value;
- if ($offset != '')
+ if ( ! is_null($offset))
{
$this->ar_offset = (int) $offset;
}
diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php
index d4adfd528..d4c27fa43 100644
--- a/system/database/drivers/oci8/oci8_driver.php
+++ b/system/database/drivers/oci8/oci8_driver.php
@@ -79,7 +79,7 @@ class CI_DB_oci8_driver extends CI_DB {
*/
function db_connect()
{
- return @ocilogon($this->username, $this->password, $this->hostname);
+ return @ocilogon($this->username, $this->password, $this->hostname, $this->char_set);
}
// --------------------------------------------------------------------
@@ -92,7 +92,7 @@ class CI_DB_oci8_driver extends CI_DB {
*/
function db_pconnect()
{
- return @ociplogon($this->username, $this->password, $this->hostname);
+ return @ociplogon($this->username, $this->password, $this->hostname, $this->char_set);
}
// --------------------------------------------------------------------
@@ -136,7 +136,7 @@ class CI_DB_oci8_driver extends CI_DB {
*/
function db_set_charset($charset, $collation)
{
- // @todo - add support if needed
+ // this is done upon connect
return TRUE;
}
diff --git a/system/helpers/string_helper.php b/system/helpers/string_helper.php
index 9fa69f46c..dd8ffaddb 100644
--- a/system/helpers/string_helper.php
+++ b/system/helpers/string_helper.php
@@ -215,12 +215,9 @@ if ( ! function_exists('random_string'))
case 'nozero' : $pool = '123456789';
break;
}
-
- $str = '';
- for ($i=0; $i < $len; $i++)
- {
- $str .= substr($pool, mt_rand(0, strlen($pool) -1), 1);
- }
+
+ $str = substr(str_shuffle(str_repeat($pool, ceil($len/strlen($pool)))),0,$len);
+
return $str;
break;
case 'unique' :
diff --git a/system/libraries/Cache/drivers/Cache_file.php b/system/libraries/Cache/drivers/Cache_file.php
index 6c37e7005..2a89faf09 100644
--- a/system/libraries/Cache/drivers/Cache_file.php
+++ b/system/libraries/Cache/drivers/Cache_file.php
@@ -107,7 +107,14 @@ class CI_Cache_file extends CI_Driver {
*/
public function delete($id)
{
- return unlink($this->_cache_path.$id);
+ if (file_exists($this->_cache_path.$id))
+ {
+ return unlink($this->_cache_path.$id);
+ }
+ else
+ {
+ return FALSE;
+ }
}
// ------------------------------------------------------------------------
@@ -192,4 +199,4 @@ class CI_Cache_file extends CI_Driver {
// End Class
/* End of file Cache_file.php */
-/* Location: ./system/libraries/Cache/drivers/Cache_file.php */ \ No newline at end of file
+/* Location: ./system/libraries/Cache/drivers/Cache_file.php */
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index 28a3d17b4..c8cb8549e 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -138,6 +138,7 @@ class CI_Email {
* Initialize the Email Data
*
* @access public
+ * @param bool
* @return void
*/
public function clear($clear_attachments = FALSE)
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index a34809e05..c78583f4f 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -1079,7 +1079,7 @@ class CI_Form_validation {
*
* @access public
* @param string
- * @return string
+ * @return bool
*/
public function valid_ip($ip)
{
diff --git a/system/libraries/Migration.php b/system/libraries/Migration.php
index 3734e18f5..840cefe08 100644
--- a/system/libraries/Migration.php
+++ b/system/libraries/Migration.php
@@ -32,7 +32,9 @@ class CI_Migration {
protected $_migration_enabled = FALSE;
protected $_migration_path = NULL;
protected $_migration_version = 0;
-
+ protected $_migration_table = 'migrations';
+ protected $_migration_auto_latest = FALSE;
+
protected $_error_string = '';
public function __construct($config = array())
@@ -68,16 +70,31 @@ class CI_Migration {
// They'll probably be using dbforge
$this->load->dbforge();
+ // Make sure the migration table name was set.
+ if (empty($this->_migration_table))
+ {
+ show_error('Migrations configuration file (migration.php) must have "migration_table" set.');
+ }
+
// If the migrations table is missing, make it
- if ( ! $this->db->table_exists('migrations'))
+ if ( ! $this->db->table_exists($this->_migration_table))
{
$this->dbforge->add_field(array(
'version' => array('type' => 'INT', 'constraint' => 3),
));
- $this->dbforge->create_table('migrations', TRUE);
+ $this->dbforge->create_table($this->_migration_table, TRUE);
- $this->db->insert('migrations', array('version' => 0));
+ $this->db->insert($this->_migration_table, array('version' => 0));
+ }
+
+ // Do we auto migrate to the latest migration?
+ if ( $this->_migration_auto_latest == TRUE )
+ {
+ if ( ! $this->latest() )
+ {
+ show_error($this->error_string());
+ }
}
}
@@ -299,7 +316,7 @@ class CI_Migration {
*/
protected function _get_version()
{
- $row = $this->db->get('migrations')->row();
+ $row = $this->db->get($this->_migration_table)->row();
return $row ? $row->version : 0;
}
@@ -314,7 +331,7 @@ class CI_Migration {
*/
protected function _update_version($migrations)
{
- return $this->db->update('migrations', array(
+ return $this->db->update($this->_migration_table, array(
'version' => $migrations
));
}
diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php
index 330acce73..ac58129a9 100644
--- a/system/libraries/Profiler.php
+++ b/system/libraries/Profiler.php
@@ -506,7 +506,7 @@ class CI_Profiler {
foreach ($this->CI->session->all_userdata() as $key => $val)
{
- if (is_array($val))
+ if (is_array($val) || is_object($val))
{
$val = print_r($val, TRUE);
}
diff --git a/system/libraries/Session.php b/system/libraries/Session.php
index 2c8a80163..8ee08c5b2 100644
--- a/system/libraries/Session.php
+++ b/system/libraries/Session.php
@@ -317,7 +317,8 @@ class CI_Session {
'session_id' => md5(uniqid($sessid, TRUE)),
'ip_address' => $this->CI->input->ip_address(),
'user_agent' => substr($this->CI->input->user_agent(), 0, 120),
- 'last_activity' => $this->now
+ 'last_activity' => $this->now,
+ 'user_data' => ''
);
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index ad4f6c703..b9c1b6094 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -70,13 +70,18 @@ Change Log
<li>Callback validation rules can now accept parameters like any other validation rule.</li>
<li>Ability to log certain error types, not all under a threshold.</li>
<li>Added html_escape() to <a href="general/common_functions.html">Common functions</a> to escape HTML output for preventing XSS.</li>
+ <li>Added support for pem,p10,p12,p7a,p7c,p7m,p7r,p7s,crt,crl,der,kdb,rsa,cer,sst,csr Certs to mimes.php.</li>
+ <li>Added support pgp,gpg to mimes.php.</li>
+ <li>Added support 3gp, 3g2, mp4, wmv, f4v, vlc Video files to mimes.php.</li>
+ <li>Added support m4a, aac, m4u, xspf, au, ac3, flac, ogg Audio files to mimes.php.</li>
</ul>
</li>
<li>Helpers
<ul>
<li>Added <samp>increment_string()</samp> to <a href="helpers/string_helper.html">String Helper</a> to turn "foo" into "foo-1" or "foo-1" into "foo-2".</li>
- <li>Altered form helper - made action on form_open_multipart helper function call optional. Fixes (#65)</li>
+ <li>Altered form helper - made action on form_open_multipart helper function call optional. Fixes (#65)</li>
<li><samp>url_title()</samp> will now trim extra dashes from beginning and end.</li>
+ <li>Improved speed of <a href="helpers/string_helper.html">String Helper</a>'s <b>random_string()</b> method</li>
</ul>
</li>
<li>Database
@@ -97,6 +102,7 @@ Change Log
<li>Added max_filename_increment config setting for Upload library.</li>
<li><samp>CI_Loader::_ci_autoloader()</samp> is now a protected method.</li>
<li>Added <kbd>is_unique</kbd> to the <a href="libraries/form_validation.html">Form Validation library</a>.</li>
+ <li>Modified valid_ip() to use PHP's filter_var() when possible (>= PHP 5.2) in the <a href="libraries/form_validation.html">Form Validation</a> library.</li>
<li>Added <kbd>$config['use_page_numbers']</kbd> to the <a href="libraries/pagination.html">Pagination library</a>, which enables real page numbers in the URI.</li>
</ul>
</li>
@@ -109,18 +115,21 @@ Change Log
<h3>Bug fixes for 2.1.0</h3>
<ul>
+ <li class="reactor">Unlink raised an error if cache file did not exist when you try to delete it.</li>
<li class="reactor">Fixed #378 Robots identified as regular browsers by the User Agent class.</li>
<li class="reactor">If a config class was loaded first then a library with the same name is loaded, the config would be ignored.</li>
<li class="reactor">Fixed a bug (Reactor #19) where 1) the 404_override route was being ignored in some cases, and 2) auto-loaded libraries were not available to the 404_override controller when a controller existed but the requested method did not.</li>
<li class="rector">Fixed a bug (Reactor #89) where MySQL export would fail if the table had hyphens or other non alphanumeric/underscore characters.</li>
- <li class="reactor">Fixed a bug (#200) where MySQL queries would be malformed after calling <samp>count_all()</samp> then <samp>db->get()</samp></li>
- <li class="reactor">Fixed bug #105 that stopped query errors from being logged unless database debugging was enabled</li>
- <li>Fixed a bug (#181) where a mis-spelling was in the form validation language file.</li>
+ <li class="reactor">Fixed a bug (#200) where MySQL queries would be malformed after calling <samp>count_all()</samp> then <samp>db->get()</samp></li>
+ <li class="reactor">Fixed bug #105 that stopped query errors from being logged unless database debugging was enabled</li>
+ <li>Fixed a bug (#181) where a mis-spelling was in the form validation language file.</li>
<li>Fixed a bug (#160) - Removed unneeded array copy in the file cache driver.</li>
<li>Fixed a bug (#150) - <samp>field_data()</samp> now correctly returns column length.</li>
<li>Fixed a bug (#8) - <samp>load_class()</samp> now looks for core classes in <samp>APPPATH</samp> first, allowing them to be replaced.</li>
<li>Fixed a bug (#24) - ODBC database driver called incorrect parent in __construct().</li>
<li>Fixed a bug (#85) - OCI8 (Oracle) database escape_str() function did not escape correct.</li>
+ <li>Fixed a bug (#344) - Using schema found in <a href="libraries/sessions.html">Saving Session Data to a Database</a>, system would throw error "user_data does not have a default value" when deleting then creating a session.</li>
+ <li>Fixed a bug (#112) - OCI8 (Oracle) driver didn't pass the configured database character set when connecting.</li>
</ul>
<h2>Version 2.0.3</h2>
@@ -142,11 +151,6 @@ Change Log
<li class="reactor">Added "application/x-csv" to mimes.php.</li>
<li class="reactor">Added CSRF protection URI whitelisting.</li>
<li>Fixed a bug where <a href="libraries/email.html">Email library</a> attachments with a "." in the name would using invalid MIME-types.</li>
- <li>Added support for pem,p10,p12,p7a,p7c,p7m,p7r,p7s,crt,crl,der,kdb,rsa,cer,sst,csr Certs to mimes.php.</li>
- <li>Added support pgp,gpg to mimes.php.</li>
- <li>Added support 3gp, 3g2, mp4, wmv, f4v, vlc Video files to mimes.php.</li>
- <li>Added support m4a, aac, m4u, xspf, au, ac3, flac, ogg Audio files to mimes.php.</li>
-
</ul>
</li>
<li>Helpers
@@ -178,7 +182,7 @@ Change Log
<li class="reactor">Fixed issue #199 - Attributes passed as string does not include a space between it and the opening tag.</li>
<li class="reactor">Fixed a bug where the method <kbd>$this->cart->total_items()</kbd> from <a href="libraries/cart.html">Cart Library</a> now returns the sum of the quantity of all items in the cart instead of your total count.</li>
<li class="reactor">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.</li>
- <li class="reactor">Fixed a bug where using <kbd>$this->db->select_max()</kdb>, <kbd>$this->db->select_min()</kdb>, etc could throw notices. Thanks to w43l for the patch.</li>
+ <li class="reactor">Fixed a bug where using <kbd>$this->db->select_max()</kbd>, <kbd>$this->db->select_min()</kbd>, etc could throw notices. Thanks to w43l for the patch.</li>
<li class="reactor">Replace checks for STDIN with php_sapi_name() == 'cli' which on the whole is more reliable. This should get parameters in crontab working.</li>
</ul>
diff --git a/user_guide/database/active_record.html b/user_guide/database/active_record.html
index 0f09e78c3..70aecbdb5 100644
--- a/user_guide/database/active_record.html
+++ b/user_guide/database/active_record.html
@@ -530,7 +530,7 @@ $this->db->insert('mytable', $object);
<strong>array</strong> or an <strong>object</strong> to the function. Here is an example using an array:</p>
<code>
-$data = array(<br/>
+$data = array(<br />
&nbsp;&nbsp;&nbsp;array(<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'title' => 'My title' ,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'name' => 'My Name' ,<br />
@@ -540,10 +540,10 @@ $data = array(<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'title' => 'Another title' ,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'name' => 'Another Name' ,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'date' => 'Another date'<br />
-&nbsp;&nbsp;&nbsp;)<br/>
+&nbsp;&nbsp;&nbsp;)<br />
);<br />
<br />
-$this->db->update_batch('mytable', $data);
+$this->db->insert_batch('mytable', $data);
<br /><br />
// Produces: INSERT INTO mytable (title, name, date) VALUES ('My title', 'My name', 'My date'), ('Another title', 'Another name', 'Another date')</code>
@@ -666,6 +666,41 @@ You can optionally pass this information directly into the update function as a
<p>You may also use the <dfn>$this->db->set()</dfn> function described above when performing updates.</p>
+<h2>$this->db->update_batch();</h2>
+<p>Generates an update string based on the data you supply, and runs the query. You can either pass an
+<strong>array</strong> or an <strong>object</strong> to the function. Here is an example using an array:</p>
+
+<code>
+$data = array(<br/>
+&nbsp;&nbsp;&nbsp;array(<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'title' => 'My title' ,<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'name' => 'My Name 2' ,<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'date' => 'My date 2'<br />
+&nbsp;&nbsp;&nbsp;),<br />
+&nbsp;&nbsp;&nbsp;array(<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'title' => 'Another title' ,<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'name' => 'Another Name 2' ,<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'date' => 'Another date 2'<br />
+&nbsp;&nbsp;&nbsp;)<br/>
+);<br />
+<br />
+$this->db->update_batch('mytable', $data, 'title');
+<br /><br />
+// Produces: <br />
+// UPDATE `mytable` SET `name` = CASE<br />
+// WHEN `title` = 'My title' THEN 'My Name 2'<br />
+// WHEN `title` = 'Another title' THEN 'Another Name 2'<br />
+// ELSE `name` END,<br />
+// `date` = CASE <br />
+// WHEN `title` = 'My title' THEN 'My date 2'<br />
+// WHEN `title` = 'Another title' THEN 'Another date 2'<br />
+// ELSE `date` END<br />
+// WHERE `title` IN ('My title','Another title')</code>
+
+<p>The first parameter will contain the table name, the second is an associative array of values, the third parameter is the where key.</p>
+
+<p class="important"><strong>Note:</strong> All values are escaped automatically producing safer queries.</p>
+
<a name="delete">&nbsp;</a>
<h1>Deleting Data</h1>
@@ -783,4 +818,4 @@ Next Topic:&nbsp;&nbsp;<a href="transactions.html">Transactions</a>
</div>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/user_guide/database/results.html b/user_guide/database/results.html
index ec5f97762..a47e335cb 100644
--- a/user_guide/database/results.html
+++ b/user_guide/database/results.html
@@ -105,8 +105,8 @@ Query Results
<br />
foreach ($query->result('User') as $user)<br />
{<br />
- &nbsp;&nbsp;&nbsp;echo $row->name; // call attributes<br />
- &nbsp;&nbsp;&nbsp;echo $row->reverse_name(); // or methods defined on the 'User' class<br />
+ &nbsp;&nbsp;&nbsp;echo $user->name; // call attributes<br />
+ &nbsp;&nbsp;&nbsp;echo $user->reverse_name(); // or methods defined on the 'User' class<br />
}
</code>
diff --git a/user_guide/database/utilities.html b/user_guide/database/utilities.html
index 8231c7e78..c80e3d106 100644
--- a/user_guide/database/utilities.html
+++ b/user_guide/database/utilities.html
@@ -183,14 +183,15 @@ $query = $this->db->query("SELECT * FROM mytable");<br />
echo $this->dbutil->csv_from_result($query);
</code>
-<p>The second and third parameters allows you to
-set the delimiter and newline character. By default tabs are used as the delimiter and "\n" is used as a new line. Example:</p>
+<p>The second, third, and fourth parameters allow you to
+set the delimiter, newline, and enclosure characters respectively. By default tabs are used as the delimiter, "\n" is used as a new line, and a double-quote is used as the enclosure. Example:</p>
<code>
$delimiter = ",";<br />
$newline = "\r\n";<br />
+$enclosure = '"';<br />
<br />
-echo $this->dbutil->csv_from_result($query, $delimiter, $newline);
+echo $this->dbutil->csv_from_result($query, $delimiter, $newline, $enclosure);
</code>
<p><strong>Important:</strong>&nbsp; This function will NOT write the CSV file for you. It simply creates the CSV layout.
diff --git a/user_guide/general/cli.html b/user_guide/general/cli.html
index befc9994a..4e9bf8709 100644
--- a/user_guide/general/cli.html
+++ b/user_guide/general/cli.html
@@ -83,7 +83,7 @@ Running via the CLI
<ul>
<li>Run your cron-jobs without needing to use wget or curl</li>
- <li>Make your cron-jobs inaccessible from being loaded in the URL by checking for <kbd>IS_CLI</kbd></li>
+ <li>Make your cron-jobs inaccessible from being loaded in the URL by checking for <kbd>$this->input->is_cli_request()</kbd></li>
<li>Make interactive "tasks" that can do things like set permissions, prune cache folders, run backups, etc.</li>
<li>Integrate with other applications in other languages. For example, a random C++ script could call one command and run code in your models!</li>
</ul>
@@ -114,7 +114,7 @@ class Tools extends CI_Controller {
<p>Instead, we are going to open Terminal in Mac/Lunix or go to Run > "cmd" in Windows and navigate to our CodeIgniter project.</p>
<blockquote>
- $ cd /path/to/project;<br/>
+ $ cd /path/to/project;<br />
$ php index.php tools message
</blockquote>
@@ -147,4 +147,4 @@ Next Topic:&nbsp;&nbsp;<a href="reserved_names.html">Reserved Names</a></p>
</div>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/user_guide/helpers/form_helper.html b/user_guide/helpers/form_helper.html
index dd935ebd9..511eeab89 100644
--- a/user_guide/helpers/form_helper.html
+++ b/user_guide/helpers/form_helper.html
@@ -84,7 +84,7 @@ in the event your URLs ever change.</p>
<p>The above example would create a form that points to your base URL plus the "email/send" URI segments, like this:</p>
-<code>&lt;form method="post" accept-charset="utf-8" action="http:/example.com/index.php/email/send" /></code>
+<code>&lt;form method="post" accept-charset="utf-8" action="http://example.com/index.php/email/send" /></code>
<h4>Adding Attributes</h4>
@@ -97,7 +97,7 @@ echo form_open('email/send', $attributes);</code>
<p>The above example would create a form similar to this:</p>
-<code>&lt;form method="post" accept-charset="utf-8" action="http:/example.com/index.php/email/send" &nbsp;class="email" &nbsp;id="myform" /></code>
+<code>&lt;form method="post" accept-charset="utf-8" action="http://example.com/index.php/email/send" &nbsp;class="email" &nbsp;id="myform" /></code>
<h4>Adding Hidden Input Fields</h4>
@@ -110,7 +110,7 @@ echo form_open('email/send', '', $hidden);</code>
<p>The above example would create a form similar to this:</p>
-<code>&lt;form method="post" accept-charset="utf-8" action="http:/example.com/index.php/email/send"><br />
+<code>&lt;form method="post" accept-charset="utf-8" action="http://example.com/index.php/email/send"><br />
&lt;input type="hidden" name="username" value="Joe" /><br />
&lt;input type="hidden" name="member_id" value="234" /></code>
@@ -180,12 +180,12 @@ echo form_input('username', 'johndoe', $js);</code>
<h2>form_password()</h2>
<p>This function is identical in all respects to the <dfn>form_input()</dfn> function above
-except that is sets it as a "password" type.</p>
+except that it uses the "password" input type.</p>
<h2>form_upload()</h2>
<p>This function is identical in all respects to the <dfn>form_input()</dfn> function above
-except that is sets it as a "file" type, allowing it to be used to upload files.</p>
+except that it uses the "file" input type, allowing it to be used to upload files.</p>
<h2>form_textarea()</h2>
@@ -318,7 +318,7 @@ fourth parameter:</p>
<h2>form_radio()</h2>
-<p>This function is identical in all respects to the <dfn>form_checkbox()</dfn> function above except that is sets it as a "radio" type.</p>
+<p>This function is identical in all respects to the <dfn>form_checkbox()</dfn> function above except that it uses the "radio" input type.</p>
<h2>form_submit()</h2>
diff --git a/user_guide/helpers/string_helper.html b/user_guide/helpers/string_helper.html
index 314124037..ebdbd3ab2 100644
--- a/user_guide/helpers/string_helper.html
+++ b/user_guide/helpers/string_helper.html
@@ -96,9 +96,9 @@ String Helper
<p>Usage example:</p>
-<code>echo increment_string('file', '_'); // "file_1"<br/>
-echo increment_string('file', '-', 2); // "file-2"<br/>
-echo increment_string('file-4'); // "file-5"<br/></code>
+<code>echo increment_string('file', '_'); // "file_1"<br />
+echo increment_string('file', '-', 2); // "file-2"<br />
+echo increment_string('file-4'); // "file-5"<br /></code>
<h2>alternator()</h2>
@@ -186,4 +186,4 @@ Next Topic:&nbsp;&nbsp;<a href="text_helper.html">Text Helper</a>
</div>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/user_guide/installation/downloads.html b/user_guide/installation/downloads.html
index 539fbc170..bb18f1de2 100644
--- a/user_guide/installation/downloads.html
+++ b/user_guide/installation/downloads.html
@@ -88,14 +88,14 @@ Downloading CodeIgniter
-<h1 id="hg">Mercurial Server</h1>
-<p><a href="http://mercurial.selenic.com">Mercurial</a> is a distributed version control system.</p>
+<h1 id="git">Git Server</h1>
+<p><a href="http://git-scm.com/about">Git</a> is a distributed version control system.</p>
- <p>Public Hg access is available at <a href="http://bitbucket.org/ellislab/codeigniter-reactor/">BitBucket</a>.
+ <p>Public Git access is available at <a href="https://github.com/EllisLab/CodeIgniter">GitHub</a>.
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.</p>
- <p>Beginning with version 1.6.1, stable tags are also available via BitBucket, simply select the version from the Tags dropdown.</p>
+ <p>Beginning with version 2.0.3, stable tags are also available via GitHub, simply select the version from the Tags dropdown.</p>
</div>
<!-- END CONTENT -->
diff --git a/user_guide/installation/index.html b/user_guide/installation/index.html
index 84338e2e6..ad66ad7a6 100644
--- a/user_guide/installation/index.html
+++ b/user_guide/installation/index.html
@@ -67,14 +67,14 @@ Installation Instructions
</ol>
<p>If you wish to increase security by hiding the location of your CodeIgniter files you can rename the <dfn>system</dfn> and <dfn>application</dfn> folders
-to something more private. If you do rename them, you must open your main <kbd>index.php</kbd> file and set the <samp>$system_folder</samp> and <samp>$application_folder</samp>
+to something more private. If you do rename them, you must open your main <kbd>index.php</kbd> file and set the <samp>$system_path</samp> and <samp>$application_folder</samp>
variables at the top of the file with the new name you've chosen.</p>
<p>For the best security, both the <dfn>system</dfn> and any <dfn>application</dfn> folders should be placed above web root so that they are not directly accessible via a browser. By default, .htaccess files are included in each folder to help prevent direct access, but it is best to remove them from public access entirely in case the web server configuration changes or doesn't abide by the .htaccess.</p>
<p>If you would like to keep your views public it is also possible to move the <dfn>views</dfn> folder out of your application folder.</p>
-<p>After moving them, open your main <kdb>index.php</kbd> file and set the <samp>$system_folder</samp>, <samp>$application_folder</samp> and <samp>$view_folder</samp> variables, preferably with a full path, e.g. '<dfn>/www/MyUser/system</dfn>'.</p>
+<p>After moving them, open your main <kdb>index.php</kbd> file and set the <samp>$system_path</samp>, <samp>$application_folder</samp> and <samp>$view_folder</samp> variables, preferably with a full path, e.g. '<dfn>/www/MyUser/system</dfn>'.</p>
<p>
One additional measure to take in production environments is to disable
@@ -107,4 +107,4 @@ Next Topic:&nbsp;&nbsp;<a href="upgrading.html">Upgrading from a Previous Versio
</div>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/user_guide/installation/upgrade_201.html b/user_guide/installation/upgrade_201.html
index 036ef7c05..7ae29b824 100644
--- a/user_guide/installation/upgrade_201.html
+++ b/user_guide/installation/upgrade_201.html
@@ -83,7 +83,7 @@ Upgrading from 2.0.0 to 2.0.1
<p>to use either a / or <kbd>base_url()</kbd>:</p>
-<code>echo form_open('/'); //&lt;form action="http://example.com/index.php/" method="post" accept-charset="utf-8"><br/>
+<code>echo form_open('/'); //&lt;form action="http://example.com/index.php/" method="post" accept-charset="utf-8"><br />
echo form_open(base_url()); //&lt;form action="http://example.com/" method="post" accept-charset="utf-8"></code>
</div>
@@ -102,4 +102,4 @@ Next Topic:&nbsp;&nbsp;<a href="troubleshooting.html">Troubleshooting</a>
</div>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/user_guide/installation/upgrading.html b/user_guide/installation/upgrading.html
index 58a45ee9d..0f4a29bfd 100644
--- a/user_guide/installation/upgrading.html
+++ b/user_guide/installation/upgrading.html
@@ -60,6 +60,7 @@ Upgrading from a Previous Version
<p>Please read the upgrade notes corresponding to the version you are upgrading from.</p>
<ul>
+ <li><a href="upgrade_210.html">Upgrading from 2.0.3 to 2.1.0</a></li>
<li><a href="upgrade_203.html">Upgrading from 2.0.2 to 2.0.3</a></li>
<li><a href="upgrade_202.html">Upgrading from 2.0.1 to 2.0.2</a></li>
<li><a href="upgrade_201.html">Upgrading from 2.0 to 2.0.1</a></li>
diff --git a/user_guide/libraries/loader.html b/user_guide/libraries/loader.html
index af27176ad..98864a700 100644
--- a/user_guide/libraries/loader.html
+++ b/user_guide/libraries/loader.html
@@ -241,9 +241,9 @@ $this->load->library('foo_bar');</code>
<p>In this instance, it is possible for view naming collisions within packages to occur, and possibly the incorrect package being loaded. To ensure against this, set an optional second parameter of <var>FALSE</var> when calling <samp>add_package_path()</samp>.</p>
<code>
-$this->load->add_package_path(APPPATH.'my_app', TRUE);<br>
+$this->load->add_package_path(APPPATH.'my_app', FALSE);<br>
$this->load->view('my_app_index'); // Loads<br>
-$this->load->view('welcome_message'); // Will not load the default welcome_message b/c the second param to add_package_path is TRUE<br>
+$this->load->view('welcome_message'); // Will not load the default welcome_message b/c the second param to add_package_path is FALSE<br>
<br>
// Reset things<br>
$this->load->remove_package_path(APPPATH.'my_app');<br>
diff --git a/user_guide/libraries/output.html b/user_guide/libraries/output.html
index 7361d7961..64ba482ce 100644
--- a/user_guide/libraries/output.html
+++ b/user_guide/libraries/output.html
@@ -82,12 +82,12 @@ For example, if you build a page in one of your controller functions, don't set
<p>Permits you to set the mime-type of your page so you can serve JSON data, JPEG's, XML, etc easily.</p>
-<code>$this->output<br/>
-&nbsp;&nbsp;&nbsp;&nbsp;->set_content_type('application/json')<br/>
-&nbsp;&nbsp;&nbsp;&nbsp;->set_output(json_encode(array('foo' => 'bar')));<br/>
-<br/>
-$this->output<br/>
-&nbsp;&nbsp;&nbsp;&nbsp;->set_content_type('jpeg') // You could also use ".jpeg" which will have the full stop removed before looking in config/mimes.php<br/>
+<code>$this->output<br />
+&nbsp;&nbsp;&nbsp;&nbsp;->set_content_type('application/json')<br />
+&nbsp;&nbsp;&nbsp;&nbsp;->set_output(json_encode(array('foo' => 'bar')));<br />
+<br />
+$this->output<br />
+&nbsp;&nbsp;&nbsp;&nbsp;->set_content_type('jpeg') // You could also use ".jpeg" which will have the full stop removed before looking in config/mimes.php<br />
&nbsp;&nbsp;&nbsp;&nbsp;->set_output(file_get_contents('files/something.jpg'));</code>
<p><strong>Important:</strong> Make sure any non-mime string you pass to this method exists in config/mimes.php or it will have no effect.</p>
@@ -174,4 +174,4 @@ Next Topic:&nbsp;&nbsp;<a href="pagination.html">Pagination Class</a>
</div>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/user_guide/libraries/user_agent.html b/user_guide/libraries/user_agent.html
index e1d3640d3..d6641c883 100644
--- a/user_guide/libraries/user_agent.html
+++ b/user_guide/libraries/user_agent.html
@@ -133,7 +133,7 @@ You can find this list in <dfn>application/config/user_agents.php</dfn> if you w
else if ($this->agent->is_mobile())<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;$this->load->view('mobile/home');<br />
-}<br/>
+}<br />
else<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;$this->load->view('web/home');<br />
@@ -223,4 +223,4 @@ Next Topic:&nbsp;&nbsp;<a href="xmlrpc.html">XML-RPC Class</a>
</div>
</body>
-</html> \ No newline at end of file
+</html>