From 6700b93c4d7a16e7288e4e2cd3223093926666ea Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 24 Sep 2011 14:25:33 +0300 Subject: Added _file_mime_type() method to system/libraries/Upload.php in order to fix a possible MIME-type injection (issue #60) --- system/libraries/Upload.php | 68 +++++++++++++++++++++++++++++++++++++++++++-- user_guide/changelog.html | 5 +++- 2 files changed, 70 insertions(+), 3 deletions(-) diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php index 3177424c4..93f763ed9 100644 --- a/system/libraries/Upload.php +++ b/system/libraries/Upload.php @@ -196,7 +196,8 @@ class CI_Upload { // Set the uploaded data as class variables $this->file_temp = $_FILES[$field]['tmp_name']; $this->file_size = $_FILES[$field]['size']; - $this->file_type = preg_replace("/^(.+?);.*$/", "\\1", $_FILES[$field]['type']); + $this->_file_mime_type($_FILES[$field]); + $this->file_type = preg_replace("/^(.+?);.*$/", "\\1", $this->file_type); $this->file_type = strtolower(trim(stripslashes($this->file_type), '"')); $this->file_name = $this->_prep_filename($_FILES[$field]['name']); $this->file_ext = $this->get_extension($this->file_name); @@ -1006,8 +1007,71 @@ class CI_Upload { // -------------------------------------------------------------------- + /** + * File MIME type + * + * Detects the (actual) MIME type of the uploaded file, if possible. + * The input array is expected to be $_FILES[$field] + * + * @param array + * @return void + */ + protected function _file_mime_type($file) + { + $file_type = ''; + + // Use if the Fileinfo extension, if available (only versions above 5.3 support the FILEINFO_MIME_TYPE flag) + if ( (float) substr(phpversion(), 0, 3) >= 5.3 && function_exists('finfo_file')) + { + $finfo = new finfo(FILEINFO_MIME_TYPE); + if ($finfo !== FALSE) // This is possible, if there is no magic MIME database file found on the system + { + $file_type = $finfo->file($file['tmp_name']); + + /* According to the comments section of the PHP manual page, + * it is possible that this function returns an empty string + * for some files (e.g. if they don't exist in the magic MIME database. + */ + if (strlen($file_type) > 1) + { + $this->file_type = $file_info; + return; + } + } + } + + // Fall back to the deprecated mime_content_type(), if available + if (function_exists('mime_content_type')) + { + $this->file_type = @mime_content_type($file['tmp_name']); + return; + } + + /* This is an ugly hack, but UNIX-type systems provide a native way to detect the file type, + * which is still more secure than depending on the value of $_FILES[$field]['type']. + * + * Notes: + * - a 'W' in the substr() expression bellow, would mean that we're using Windows + * - many system admins would disable the exec() function due to security concerns, hence the function_exists() check + */ + if (substr(PHP_OS, 0, 1) !== 'W' && function_exists('exec')) + { + $output = array(); + @exec('file --brief --mime-type ' . escapeshellarg($file['tmp_path']), $output, $return_code); + if ($return_code === 0 && strlen($output[0]) > 0) // A return status code != 0 would mean failed execution + { + $this->file_type = rtrim($output[0]); + return; + } + } + + $this->file_type = $file['type']; + } + + // -------------------------------------------------------------------- + } // END Upload Class /* End of file Upload.php */ -/* Location: ./system/libraries/Upload.php */ \ No newline at end of file +/* Location: ./system/libraries/Upload.php */ diff --git a/user_guide/changelog.html b/user_guide/changelog.html index 88b4363ea..e44e2f707 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -70,7 +70,10 @@ Change Log
  • Helpers
  • Database -- cgit v1.2.3-24-g4f1b From 6a12d8faba9dcb4f321700c86d047f7b6a4f1780 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 24 Sep 2011 14:35:10 +0300 Subject: Remove an unnecessary variable initialization --- system/libraries/Upload.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php index 93f763ed9..04abc9ac6 100644 --- a/system/libraries/Upload.php +++ b/system/libraries/Upload.php @@ -1018,8 +1018,6 @@ class CI_Upload { */ protected function _file_mime_type($file) { - $file_type = ''; - // Use if the Fileinfo extension, if available (only versions above 5.3 support the FILEINFO_MIME_TYPE flag) if ( (float) substr(phpversion(), 0, 3) >= 5.3 && function_exists('finfo_file')) { -- cgit v1.2.3-24-g4f1b From 7bfb95b9c329a7905a20f9ebfeacccac7ffd7e41 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 24 Sep 2011 14:45:44 +0300 Subject: Fix alignment with tabs instead of spaces --- system/libraries/Upload.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php index 04abc9ac6..fd9c8b3e8 100644 --- a/system/libraries/Upload.php +++ b/system/libraries/Upload.php @@ -1058,7 +1058,7 @@ class CI_Upload { @exec('file --brief --mime-type ' . escapeshellarg($file['tmp_path']), $output, $return_code); if ($return_code === 0 && strlen($output[0]) > 0) // A return status code != 0 would mean failed execution { - $this->file_type = rtrim($output[0]); + $this->file_type = rtrim($output[0]); return; } } -- cgit v1.2.3-24-g4f1b From f1649bf567aa769b283bb0b74ed8aee5b44a704b Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 24 Sep 2011 22:59:37 +0300 Subject: Fix an erroneus variable name and a typo in comments --- system/libraries/Upload.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php index fd9c8b3e8..a0f3e76bb 100644 --- a/system/libraries/Upload.php +++ b/system/libraries/Upload.php @@ -1028,11 +1028,11 @@ class CI_Upload { /* According to the comments section of the PHP manual page, * it is possible that this function returns an empty string - * for some files (e.g. if they don't exist in the magic MIME database. + * for some files (e.g. if they don't exist in the magic MIME database) */ if (strlen($file_type) > 1) { - $this->file_type = $file_info; + $this->file_type = $file_type; return; } } -- cgit v1.2.3-24-g4f1b From dcfee7103408416329c42f376d23fb3c88d4cffc Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 4 Oct 2011 18:18:21 +0300 Subject: CI_Upload::_file_mime_type --- user_guide/changelog.html | 1 + 1 file changed, 1 insertion(+) diff --git a/user_guide/changelog.html b/user_guide/changelog.html index e44e2f707..b4bd8bb7f 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -98,6 +98,7 @@ Change Log
  • If a config class was loaded first then a library with the same name is loaded, the config would be ignored.
  • 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.
  • Fixed a bug (Reactor #89) where MySQL export would fail if the table had hyphens or other non alphanumeric/underscore characters.
  • +
  • Fixed a bug (#60) - Added _file_mime_type() method to the File Uploading Library in order to fix a possible MIME-type injection (also fixes bug #394).
  • Version 2.0.3

    -- cgit v1.2.3-24-g4f1b From c5efd10679a7b7b4010cd6cc30bd976d3fe8c1ef Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 4 Oct 2011 18:27:32 +0300 Subject: Change Windows OS detection approach --- system/libraries/Upload.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php index a0f3e76bb..05511b5d3 100644 --- a/system/libraries/Upload.php +++ b/system/libraries/Upload.php @@ -1052,7 +1052,7 @@ class CI_Upload { * - a 'W' in the substr() expression bellow, would mean that we're using Windows * - many system admins would disable the exec() function due to security concerns, hence the function_exists() check */ - if (substr(PHP_OS, 0, 1) !== 'W' && function_exists('exec')) + if (DIRECTORY_SEPARATOR !== '\\' && function_exists('exec')) { $output = array(); @exec('file --brief --mime-type ' . escapeshellarg($file['tmp_path']), $output, $return_code); -- cgit v1.2.3-24-g4f1b From b7263d152a3c29751e39fd74972707f62f51ca72 Mon Sep 17 00:00:00 2001 From: Mark Huot Date: Fri, 23 Sep 2011 08:20:29 -0400 Subject: resolve a difference between the two memcache set method parameters --- system/libraries/Cache/drivers/Cache_memcached.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/system/libraries/Cache/drivers/Cache_memcached.php b/system/libraries/Cache/drivers/Cache_memcached.php index ec2fd216a..fc586e025 100644 --- a/system/libraries/Cache/drivers/Cache_memcached.php +++ b/system/libraries/Cache/drivers/Cache_memcached.php @@ -64,7 +64,16 @@ class CI_Cache_memcached extends CI_Driver { */ public function save($id, $data, $ttl = 60) { - return $this->_memcached->add($id, array($data, time(), $ttl), $ttl); + if (get_class($this->_memcached) == 'Memcached') + { + return $this->_memcached->set($id, array($data, time(), $ttl), $ttl); + } + else if (get_class($this->_memcached) == 'Memcache') + { + return $this->_memcached->set($id, array($data, time(), $ttl), 0, $ttl); + } + + return FALSE; } // ------------------------------------------------------------------------ -- cgit v1.2.3-24-g4f1b From e13aa67f3e8275d672dc08f21a3992e94bbe3038 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Fri, 7 Oct 2011 14:40:15 +0800 Subject: Fix #537 issue: replace new wav mimetype --- application/config/mimes.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/application/config/mimes.php b/application/config/mimes.php index 82767d7c8..f00e5b6ed 100644 --- a/application/config/mimes.php +++ b/application/config/mimes.php @@ -65,8 +65,8 @@ $mimes = array( 'hqx' => 'application/mac-binhex40', 'rpm' => 'audio/x-pn-realaudio-plugin', 'ra' => 'audio/x-realaudio', 'rv' => 'video/vnd.rn-realvideo', - 'wav' => 'audio/x-wav', - 'bmp' => 'image/bmp', + 'wav' => array('audio/x-wav', 'audio/wave', 'audio/wav'), + 'bmp' => array('image/bmp', 'image/x-windows-bmp'), 'gif' => 'image/gif', 'jpeg' => array('image/jpeg', 'image/pjpeg'), 'jpg' => array('image/jpeg', 'image/pjpeg'), @@ -103,4 +103,4 @@ $mimes = array( 'hqx' => 'application/mac-binhex40', /* End of file mimes.php */ -/* Location: ./application/config/mimes.php */ \ No newline at end of file +/* Location: ./application/config/mimes.php */ -- cgit v1.2.3-24-g4f1b From 08b0a1cb53f0c3b54a2bf7f8ac0f8b2cd5d8f0ff Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Wed, 26 Oct 2011 23:39:38 +0100 Subject: Added changelog entry for bugfix. --- user_guide/changelog.html | 135 +++++++++++++++++++++++----------------------- 1 file changed, 68 insertions(+), 67 deletions(-) diff --git a/user_guide/changelog.html b/user_guide/changelog.html index b4bd8bb7f..dc1a1f366 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -59,13 +59,13 @@ Change Log

    The Reactor Marker indicates items that were contributed to CodeIgniter via CodeIgniter Reactor.

    -

    Version 2.1.0 (planned)

    -

    Release Date: Not Released

    +

    Version 2.1.0

    +

    Release Date: November 01, 2011

    • General Changes
        -
      • Callback validation rules can now accept parameters like any other validation rule.
      • +
      • Callback validation rules can now accept parameters like any other validation rule.
    • Helpers @@ -78,27 +78,28 @@ Change Log
    • Database
        -
      • Added a CUBRID driver to the Database Driver. Thanks to the CUBRID team for supplying this patch.
      • -
      • Typecast limit and offset in the Database Driver to integers to avoid possible injection.
      • +
      • Added a CUBRID driver to the Database Driver. Thanks to the CUBRID team for supplying this patch.
      • +
      • Typecast limit and offset in the Database Driver to integers to avoid possible injection.
    • Libraries
        -
      • Changed $this->cart->insert() in the Cart Library to return the Row ID if a single item was inserted successfully.
      • -
      • Added support to set an optional parameter in your callback rules of validation using the Form Validation Library.
      • -
      • Added a Migration Library to assist with applying incremental updates to your database schema.
      • -
      • Driver children can be located in any package path.
      • +
      • Changed $this->cart->insert() in the Cart Library to return the Row ID if a single item was inserted successfully.
      • +
      • Added support to set an optional parameter in your callback rules of validation using the Form Validation Library.
      • +
      • Added a Migration Library to assist with applying incremental updates to your database schema.
      • +
      • Driver children can be located in any package path.

    Bug fixes for 2.1.0

      -
    • Fixed #378 Robots identified as regular browsers by the User Agent class.
    • -
    • If a config class was loaded first then a library with the same name is loaded, the config would be ignored.
    • -
    • 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.
    • +
    • Fixed #378 Robots identified as regular browsers by the User Agent class.
    • +
    • If a config class was loaded first then a library with the same name is loaded, the config would be ignored.
    • +
    • 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.
    • Fixed a bug (Reactor #89) where MySQL export would fail if the table had hyphens or other non alphanumeric/underscore characters.
    • Fixed a bug (#60) - Added _file_mime_type() method to the File Uploading Library in order to fix a possible MIME-type injection (also fixes bug #394).
    • +
    • Fixed a bug (#537) - Support for all wav type in browser.

    Version 2.0.3

    @@ -116,43 +117,43 @@ 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 "application/x-csv" to mimes.php.
  • +
  • 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
    • Added an optional third parameter to heading() which allows adding html attributes to the rendered heading tag.
    • -
    • form_open() now only adds a hidden (Cross-site Reference Forgery) protection field when the form's action is internal and is set to the post method. (Reactor #165)
    • -
    • Re-worked plural() and singular() functions in the Inflector helper to support considerably more words.
    • +
    • form_open() now only adds a hidden (Cross-site Reference Forgery) protection field when the form's action is internal and is set to the post method. (Reactor #165)
    • +
    • Re-worked plural() and singular() functions in the Inflector helper to support considerably more words.
  • 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.
    • -
    • 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().
    • +
    • 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().
    • +
    • Changed $this->db->having() to insert quotes using escape() rather than escape_str().
  • Bug fixes for 2.0.3

      -
    • Added ENVIRONMENT to reserved constants. (Reactor #196)
    • -
    • Changed server check to ensure SCRIPT_NAME is defined. (Reactor #57)
    • -
    • Removed APPPATH.'third_party' from the packages autoloader to negate needless file stats if no packages exist or if the developer does not load any other packages by default.
    • +
    • Added ENVIRONMENT to reserved constants. (Reactor #196)
    • +
    • Changed server check to ensure SCRIPT_NAME is defined. (Reactor #57)
    • +
    • Removed APPPATH.'third_party' from the packages autoloader to negate needless file stats if no packages exist or if the developer does not load any other packages by default.
    • 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.
    • -
    • 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.
    • +
    • 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.
    • +
    • 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

    @@ -164,36 +165,36 @@ Hg Tag: v2.0.2

    • The Security library was moved to the core and is now loaded automatically. Please remove your loading calls.
    • The CI_SHA class is now deprecated. All supported versions of PHP provide a sha1() function.
    • -
    • constants.php will now be loaded from the environment folder if available.
    • -
    • Added language key error logging
    • -
    • Made Environment Support optional. Comment out or delete the constant to stop environment checks.
    • -
    • Added Environment Support for Hooks.
    • -
    • Added CI_ Prefix to the Cache driver.
    • -
    • Added CLI usage documentation.
    • +
    • constants.php will now be loaded from the environment folder if available.
    • +
    • Added language key error logging
    • +
    • Made Environment Support optional. Comment out or delete the constant to stop environment checks.
    • +
    • Added Environment Support for Hooks.
    • +
    • Added CI_ Prefix to the Cache driver.
    • +
    • Added CLI usage documentation.
  • Helpers
    • Removed the previously deprecated dohash() from the Security helper; use do_hash() instead.
    • -
    • Changed the 'plural' function so that it doesn't ruin the captalization of your string. It also take into consideration acronyms which are all caps.
    • +
    • Changed the 'plural' function so that it doesn't ruin the captalization of your string. It also take into consideration acronyms which are all caps.
  • Database
      -
    • $this->db->count_all_results() will now return an integer instead of a string.
    • +
    • $this->db->count_all_results() will now return an integer instead of a string.
  • Bug fixes for 2.0.2

      -
    • Fixed a bug (Reactor #145) where the Output Library had parse_exec_vars set to protected.
    • -
    • Fixed a bug (Reactor #80) where is_really_writable would create an empty file when on Windows or with safe_mode enabled.
    • -
    • Fixed various bugs with User Guide.
    • -
    • Added is_cli_request() method to documentation for Input class.
    • -
    • Added form_validation_lang entries for decimal, less_than and greater_than.
    • -
    • Fixed issue #153 Escape Str Bug in MSSQL driver.
    • -
    • Fixed issue #172 Google Chrome 11 posts incorrectly when action is empty.
    • +
    • Fixed a bug (Reactor #145) where the Output Library had parse_exec_vars set to protected.
    • +
    • Fixed a bug (Reactor #80) where is_really_writable would create an empty file when on Windows or with safe_mode enabled.
    • +
    • Fixed various bugs with User Guide.
    • +
    • Added is_cli_request() method to documentation for Input class.
    • +
    • Added form_validation_lang entries for decimal, less_than and greater_than.
    • +
    • Fixed issue #153 Escape Str Bug in MSSQL driver.
    • +
    • Fixed issue #172 Google Chrome 11 posts incorrectly when action is empty.
    @@ -205,34 +206,34 @@ Hg Tag: v2.0.1

  • General changes
    • Added $config['cookie_secure'] to the config file to allow requiring a secure (HTTPS) in order to set cookies.
    • -
    • Added the constant CI_CORE to help differentiate between Core: TRUE and Reactor: FALSE.
    • -
    • Added an ENVIRONMENT constant in index.php, which affects PHP error reporting settings, and optionally, +
    • Added the constant CI_CORE to help differentiate between Core: TRUE and Reactor: FALSE.
    • +
    • Added an ENVIRONMENT constant in index.php, which affects PHP error reporting settings, and optionally, which configuration files are loaded (see below). Read more on the Handling Environments page.
    • -
    • Added support for environment-specific configuration files.
    • +
    • Added support for environment-specific configuration files.
  • Libraries
      -
    • Added decimal, less_than and greater_than rules to the Form validation Class.
    • -
    • Input Class methods post() and get() will now return a full array if the first argument is not provided.
    • -
    • Secure cookies can now be made with the set_cookie() helper and Input Class method.
    • -
    • Added set_content_type() to Output Class to set the output Content-Type HTTP header based on a MIME Type or a config/mimes.php array key.
    • -
    • Output Class will now support method chaining.
    • +
    • Added decimal, less_than and greater_than rules to the Form validation Class.
    • +
    • Input Class methods post() and get() will now return a full array if the first argument is not provided.
    • +
    • Secure cookies can now be made with the set_cookie() helper and Input Class method.
    • +
    • Added set_content_type() to Output Class to set the output Content-Type HTTP header based on a MIME Type or a config/mimes.php array key.
    • +
    • Output Class will now support method chaining.
  • Helpers
      -
    • Changed the logic for form_open() in Form helper. If no value is passed it will submit to the current URL.
    • +
    • Changed the logic for form_open() in Form helper. If no value is passed it will submit to the current URL.
  • Bug fixes for 2.0.1

      -
    • CLI requests can now be run from any folder, not just when CD'ed next to index.php.
    • -
    • Fixed issue #41: Added audio/mp3 mime type to mp3.
    • -
    • Fixed a bug (Core #329) where the file caching driver referenced the incorrect cache directory.
    • -
    • Fixed a bug (Reactor #69) where the SHA1 library was named incorrectly.
    • +
    • CLI requests can now be run from any folder, not just when CD'ed next to index.php.
    • +
    • Fixed issue #41: Added audio/mp3 mime type to mp3.
    • +
    • Fixed a bug (Core #329) where the file caching driver referenced the incorrect cache directory.
    • +
    • Fixed a bug (Reactor #69) where the SHA1 library was named incorrectly.

    Version 2.0.0

    @@ -246,7 +247,7 @@ Hg Tag: v2.0.0

  • Scaffolding, having been deprecated for a number of versions, has been removed.
  • Plugins have been removed, in favor of Helpers. The CAPTCHA plugin has been converted to a Helper and documented. The JavaScript calendar plugin was removed due to the ready availability of great JavaScript calendars, particularly with jQuery.
  • Added new special Library type: Drivers.
  • -
  • Added full query-string support. See the config file for details.
  • +
  • Added full query-string support. See the config file for details.
  • Moved the application folder outside of the system folder.
  • Moved system/cache and system/logs directories to the application directory.
  • Added routing overrides to the main index.php file, enabling the normal routing to be overridden on a per "index" file basis.
  • @@ -256,15 +257,15 @@ Hg Tag: v2.0.0

  • In-development code is now hosted at BitBucket.
  • Removed the deprecated Validation Class.
  • Added CI_ Prefix to all core classes.
  • -
  • Package paths can now be set in application/config/autoload.php.
  • -
  • Upload library file_name can now be set without an extension, the extension will be taken from the uploaded file instead of the given name.
  • -
  • In Database Forge the name can be omitted from $this->dbforge->modify_column()'s 2nd param if you aren't changing the name.
  • -
  • $config['base_url'] is now empty by default and will guess what it should be.
  • -
  • Enabled full Command Line Interface compatibility with config['uri_protocol'] = 'CLI';.
  • +
  • Package paths can now be set in application/config/autoload.php.
  • +
  • Upload library file_name can now be set without an extension, the extension will be taken from the uploaded file instead of the given name.
  • +
  • In Database Forge the name can be omitted from $this->dbforge->modify_column()'s 2nd param if you aren't changing the name.
  • +
  • $config['base_url'] is now empty by default and will guess what it should be.
  • +
  • Enabled full Command Line Interface compatibility with config['uri_protocol'] = 'CLI';.
  • Libraries
      -
    • Added a Cache driver with APC, memcached, and file-based support.
    • +
    • Added a Cache driver with APC, memcached, and file-based support.
    • Added $prefix, $suffix and $first_url properties to Pagination library.
    • Added the ability to suppress first, previous, next, last, and page links by setting their values to FALSE in the Pagination library.
    • Added Security library, which now contains the xss_clean function, filename_security function and other security related functions.
    • @@ -295,8 +296,8 @@ Hg Tag: v2.0.0

    • Altered Form_Validation library to allow for method chaining on set_rules(), set_message() and set_error_delimiters() functions.
    • Altered Email Library to allow for method chaining.
    • Added request_headers(), get_request_header() and is_ajax_request() to the input class.
    • -
    • Altered User agent library so that is_browser(), is_mobile() and is_robot() can optionally check for a specific browser or mobile device.
    • -
    • Altered Input library so that post() and get() will return all POST and GET items (respectively) if there are no parameters passed in.
    • +
    • Altered User agent library so that is_browser(), is_mobile() and is_robot() can optionally check for a specific browser or mobile device.
    • +
    • Altered Input library so that post() and get() will return all POST and GET items (respectively) if there are no parameters passed in.
  • Database @@ -358,7 +359,7 @@ Hg Tag: v2.0.0

    Bug fixes for 2.0.0

      -
    • Fixed a bug where you could not change the User-Agent when sending email.
    • +
    • Fixed a bug where you could not change the User-Agent when sending email.
    • Fixed a bug where the Output class would send incorrect cached output for controllers implementing their own _output() method.
    • Fixed a bug where a failed query would not have a saved query execution time causing errors in the Profiler
    • Fixed a bug that was writing log entries when multiple identical helpers and plugins were loaded.
    • -- cgit v1.2.3-24-g4f1b From 24f325c079d33a456f15311442ed21b437df1ea7 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Fri, 7 Oct 2011 10:03:01 -0400 Subject: if statment code style update --- system/database/drivers/pdo/pdo_driver.php | 792 +++++++++++++++++++++++++++++ 1 file changed, 792 insertions(+) create mode 100644 system/database/drivers/pdo/pdo_driver.php diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php new file mode 100644 index 000000000..19e069b06 --- /dev/null +++ b/system/database/drivers/pdo/pdo_driver.php @@ -0,0 +1,792 @@ +hostname, 'mysql') !== FALSE) + { + $this->_like_escape_str = ''; + $this->_like_escape_chr = ''; + } + else if (strpos($this->hostname, 'odbc') !== FALSE) + { + $this->_like_escape_str = " {escape '%s'} "; + $this->_like_escape_chr = '!'; + } + else + { + $this->_like_escape_str = " ESCAPE '%s' "; + $this->_like_escape_chr = '!'; + } + + $this->hostname = $this->hostname . ";dbname=".$this->database; + $this->trans_enabled = FALSE; + + $this->_random_keyword = ' RND('.time().')'; // database specific random keyword + } + + /** + * Non-persistent database connection + * + * @access private called by the base class + * @return resource + */ + function db_connect() + { + return new PDO($this->hostname,$this->username,$this->password, array( + PDO::ATTR_ERRMODE => PDO::ERRMODE_SILENT + )); + } + + // -------------------------------------------------------------------- + + /** + * Persistent database connection + * + * @access private called by the base class + * @return resource + */ + function db_pconnect() + { + return new PDO($this->hostname,$this->username,$this->password, array( + PDO::ATTR_ERRMODE => PDO::ERRMODE_SILENT, + PDO::ATTR_PERSISTENT => true + )); + } + + // -------------------------------------------------------------------- + + /** + * Reconnect + * + * Keep / reestablish the db connection if no queries have been + * sent for a length of time exceeding the server's idle timeout + * + * @access public + * @return void + */ + function reconnect() + { + if ($this->db->db_debug) + { + return $this->db->display_error('db_unsuported_feature'); + } + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Select the database + * + * @access private called by the base class + * @return resource + */ + function db_select() + { + // Not needed for PDO + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Set client character set + * + * @access public + * @param string + * @param string + * @return resource + */ + function db_set_charset($charset, $collation) + { + // @todo - add support if needed + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Version number query string + * + * @access public + * @return string + */ + function _version() + { + return $this->conn_id->getAttribute(PDO::ATTR_CLIENT_VERSION); + } + + // -------------------------------------------------------------------- + + /** + * Execute the query + * + * @access private called by the base class + * @param string an SQL query + * @return object + */ + function _execute($sql) + { + $sql = $this->_prep_query($sql); + $result_id = $this->conn_id->query($sql); + + if (is_object($result_id)) + { + $this->affect_rows = $result_id->rowCount(); + } + else + { + $this->affect_rows = 0; + } + + return $result_id; + } + + // -------------------------------------------------------------------- + + /** + * Prep the query + * + * If needed, each database adapter can prep the query string + * + * @access private called by execute() + * @param string an SQL query + * @return string + */ + function _prep_query($sql) + { + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * Begin Transaction + * + * @access public + * @return bool + */ + function trans_begin($test_mode = FALSE) + { + if ( ! $this->trans_enabled) + { + return TRUE; + } + + // When transactions are nested we only begin/commit/rollback the outermost ones + if ($this->_trans_depth > 0) + { + return TRUE; + } + + // Reset the transaction failure flag. + // If the $test_mode flag is set to TRUE transactions will be rolled back + // even if the queries produce a successful result. + $this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE; + + return $this->conn_id->beginTransaction(); + } + + // -------------------------------------------------------------------- + + /** + * Commit Transaction + * + * @access public + * @return bool + */ + function trans_commit() + { + if ( ! $this->trans_enabled) + { + return TRUE; + } + + // When transactions are nested we only begin/commit/rollback the outermost ones + if ($this->_trans_depth > 0) + { + return TRUE; + } + + $ret = $this->conn->commit(); + return $ret; + } + + // -------------------------------------------------------------------- + + /** + * Rollback Transaction + * + * @access public + * @return bool + */ + function trans_rollback() + { + if ( ! $this->trans_enabled) + { + return TRUE; + } + + // When transactions are nested we only begin/commit/rollback the outermost ones + if ($this->_trans_depth > 0) + { + return TRUE; + } + + $ret = $this->conn_id->rollBack(); + return $ret; + } + + // -------------------------------------------------------------------- + + /** + * Escape String + * + * @access public + * @param string + * @param bool whether or not the string will be used in a LIKE condition + * @return string + */ + function escape_str($str, $like = FALSE) + { + if (is_array($str)) + { + foreach ($str as $key => $val) + { + $str[$key] = $this->escape_str($val, $like); + } + + return $str; + } + + //Escape the string + $str = $this->conn_id->quote($str); + + //If there are duplicated quotes, trim them away + if (strpos($str, "'") === 0) + { + $str = substr($str, 1, -1); + } + + // escape LIKE condition wildcards + if ($like === TRUE) + { + $str = str_replace( array('%', '_', $this->_like_escape_chr), + array($this->_like_escape_chr.'%', $this->_like_escape_chr.'_', $this->_like_escape_chr.$this->_like_escape_chr), + $str); + } + + return $str; + } + + // -------------------------------------------------------------------- + + /** + * Affected Rows + * + * @access public + * @return integer + */ + function affected_rows() + { + return $this->affect_rows; + } + + // -------------------------------------------------------------------- + + /** + * Insert ID + * + * @access public + * @return integer + */ + function insert_id($name=NULL) + { + //Convenience method for postgres insertid + if (strpos($this->hostname, 'pgsql') !== FALSE) + { + $v = $this->_version(); + + $table = func_num_args() > 0 ? func_get_arg(0) : NULL; + + if ($table == NULL && $v >= '8.1') + { + $sql='SELECT LASTVAL() as ins_id'; + } + $query = $this->query($sql); + $row = $query->row(); + return $row->ins_id; + } + else + { + return $this->conn_id->lastInsertId($name); + } + } + + // -------------------------------------------------------------------- + + /** + * "Count All" query + * + * Generates a platform-specific query string that counts all records in + * the specified database + * + * @access public + * @param string + * @return string + */ + function count_all($table = '') + { + if ($table == '') + { + return 0; + } + + $query = $this->query($this->_count_string . $this->_protect_identifiers('numrows') . " FROM " . $this->_protect_identifiers($table, TRUE, NULL, FALSE)); + + if ($query->num_rows() == 0) + { + return 0; + } + + $row = $query->row(); + $this->_reset_select(); + return (int) $row->numrows; + } + + // -------------------------------------------------------------------- + + /** + * Show table query + * + * Generates a platform-specific query string so that the table names can be fetched + * + * @access private + * @param boolean + * @return string + */ + function _list_tables($prefix_limit = FALSE) + { + $sql = "SHOW TABLES FROM `".$this->database."`"; + + if ($prefix_limit !== FALSE AND $this->dbprefix != '') + { + //$sql .= " LIKE '".$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_chr); + return FALSE; // not currently supported + } + + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * Show column query + * + * Generates a platform-specific query string so that the column names can be fetched + * + * @access public + * @param string the table name + * @return string + */ + function _list_columns($table = '') + { + return "SHOW COLUMNS FROM ".$table; + } + + // -------------------------------------------------------------------- + + /** + * Field data query + * + * Generates a platform-specific query so that the column data can be retrieved + * + * @access public + * @param string the table name + * @return object + */ + function _field_data($table) + { + return "SELECT TOP 1 FROM ".$table; + } + + // -------------------------------------------------------------------- + + /** + * The error message string + * + * @access private + * @return string + */ + function _error_message() + { + $error_array = $this->conn_id->errorInfo(); + return $error_array[2]; + } + + // -------------------------------------------------------------------- + + /** + * The error message number + * + * @access private + * @return integer + */ + function _error_number() + { + return $this->conn_id->errorCode(); + } + + // -------------------------------------------------------------------- + + /** + * Escape the SQL Identifiers + * + * This function escapes column and table names + * + * @access private + * @param string + * @return string + */ + function _escape_identifiers($item) + { + if ($this->_escape_char == '') + { + return $item; + } + + foreach ($this->_reserved_identifiers as $id) + { + if (strpos($item, '.'.$id) !== FALSE) + { + $str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item); + + // remove duplicates if the user already included the escape + return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str); + } + } + + if (strpos($item, '.') !== FALSE) + { + $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char; + + } + else + { + $str = $this->_escape_char.$item.$this->_escape_char; + } + + // remove duplicates if the user already included the escape + return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str); + } + + // -------------------------------------------------------------------- + + /** + * From Tables + * + * This function implicitly groups FROM tables so there is no confusion + * about operator precedence in harmony with SQL standards + * + * @access public + * @param type + * @return type + */ + function _from_tables($tables) + { + if ( ! is_array($tables)) + { + $tables = array($tables); + } + + return (count($tables) == 1) ? $tables[0] : '('.implode(', ', $tables).')'; + } + + // -------------------------------------------------------------------- + + /** + * Insert statement + * + * Generates a platform-specific insert string from the supplied data + * + * @access public + * @param string the table name + * @param array the insert keys + * @param array the insert values + * @return string + */ + function _insert($table, $keys, $values) + { + return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")"; + } + + // -------------------------------------------------------------------- + + /** + * Insert_batch statement + * + * Generates a platform-specific insert string from the supplied data + * + * @access public + * @param string the table name + * @param array the insert keys + * @param array the insert values + * @return string + */ + function _insert_batch($table, $keys, $values) + { + return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES ".implode(', ', $values); + } + + // -------------------------------------------------------------------- + + /** + * Update statement + * + * Generates a platform-specific update string from the supplied data + * + * @access public + * @param string the table name + * @param array the update data + * @param array the where clause + * @param array the orderby clause + * @param array the limit clause + * @return string + */ + function _update($table, $values, $where, $orderby = array(), $limit = FALSE) + { + foreach ($values as $key => $val) + { + $valstr[] = $key." = ".$val; + } + + $limit = ( ! $limit) ? '' : ' LIMIT '.$limit; + + $orderby = (count($orderby) >= 1)?' ORDER BY '.implode(", ", $orderby):''; + + $sql = "UPDATE ".$table." SET ".implode(', ', $valstr); + + $sql .= ($where != '' AND count($where) >=1) ? " WHERE ".implode(" ", $where) : ''; + + $sql .= $orderby.$limit; + + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * Update_Batch statement + * + * Generates a platform-specific batch update string from the supplied data + * + * @access public + * @param string the table name + * @param array the update data + * @param array the where clause + * @return string + */ + function _update_batch($table, $values, $index, $where = NULL) + { + $ids = array(); + $where = ($where != '' AND count($where) >=1) ? implode(" ", $where).' AND ' : ''; + + foreach ($values as $key => $val) + { + $ids[] = $val[$index]; + + foreach (array_keys($val) as $field) + { + if ($field != $index) + { + $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field]; + } + } + } + + $sql = "UPDATE ".$table." SET "; + $cases = ''; + + foreach ($final as $k => $v) + { + $cases .= $k.' = CASE '."\n"; + foreach ($v as $row) + { + $cases .= $row."\n"; + } + + $cases .= 'ELSE '.$k.' END, '; + } + + $sql .= substr($cases, 0, -2); + + $sql .= ' WHERE '.$where.$index.' IN ('.implode(',', $ids).')'; + + return $sql; + } + + + // -------------------------------------------------------------------- + + /** + * Truncate statement + * + * Generates a platform-specific truncate string from the supplied data + * If the database does not support the truncate() command + * This function maps to "DELETE FROM table" + * + * @access public + * @param string the table name + * @return string + */ + function _truncate($table) + { + return $this->_delete($table); + } + + // -------------------------------------------------------------------- + + /** + * Delete statement + * + * Generates a platform-specific delete string from the supplied data + * + * @access public + * @param string the table name + * @param array the where clause + * @param string the limit clause + * @return string + */ + function _delete($table, $where = array(), $like = array(), $limit = FALSE) + { + $conditions = ''; + + if (count($where) > 0 OR count($like) > 0) + { + $conditions = "\nWHERE "; + $conditions .= implode("\n", $this->ar_where); + + if (count($where) > 0 && count($like) > 0) + { + $conditions .= " AND "; + } + $conditions .= implode("\n", $like); + } + + $limit = ( ! $limit) ? '' : ' LIMIT '.$limit; + + return "DELETE FROM ".$table.$conditions.$limit; + } + + // -------------------------------------------------------------------- + + /** + * Limit string + * + * Generates a platform-specific LIMIT clause + * + * @access public + * @param string the sql query string + * @param integer the number of rows to limit the query to + * @param integer the offset value + * @return string + */ + function _limit($sql, $limit, $offset) + { + if (strpos($this->hostname, 'cubrid') !== FALSE || strpos($this->hostname, 'sqlite') !== FALSE) + { + if ($offset == 0) + { + $offset = ''; + } + else + { + $offset .= ", "; + } + + return $sql."LIMIT ".$offset.$limit; + } + else + { + $sql .= "LIMIT ".$limit; + + if ($offset > 0) + { + $sql .= " OFFSET ".$offset; + } + + return $sql; + } + } + + // -------------------------------------------------------------------- + + /** + * Close DB Connection + * + * @access public + * @param resource + * @return void + */ + function _close($conn_id) + { + $this->conn_id = null; + } + + +} + + + +/* End of file pdo_driver.php */ +/* Location: ./system/database/drivers/pdo/pdo_driver.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 6f531dc364553975a8ea4dce85927a09f6628902 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Mon, 10 Oct 2011 10:10:46 -0400 Subject: Converted database constructors to PHP5 type --- system/database/DB_cache.php | 2 +- system/database/DB_driver.php | 4 ++-- system/database/DB_forge.php | 2 +- system/database/DB_utility.php | 2 +- system/database/drivers/odbc/odbc_driver.php | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index 3bf065ca5..ad1c28d72 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -33,7 +33,7 @@ class CI_DB_Cache { * Grabs the CI super object instance so we can access it. * */ - function CI_DB_Cache(&$db) + function __construct(&$db) { // Assign the main CI object to $this->CI // and load the file helper since we use it a lot diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index f3e824daa..3680b85c2 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -78,7 +78,7 @@ class CI_DB_driver { * * @param array */ - function CI_DB_driver($params) + function __construct($params) { if (is_array($params)) { @@ -1387,4 +1387,4 @@ class CI_DB_driver { /* End of file DB_driver.php */ -/* Location: ./system/database/DB_driver.php */ \ No newline at end of file +/* Location: ./system/database/DB_driver.php */ diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php index 0dd29c238..6bc40411b 100644 --- a/system/database/DB_forge.php +++ b/system/database/DB_forge.php @@ -35,7 +35,7 @@ class CI_DB_forge { * Grabs the CI super object instance so we can access it. * */ - function CI_DB_forge() + function __construct() { // Assign the main database object to $this->db $CI =& get_instance(); diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php index a5f174f0a..52196b7ce 100644 --- a/system/database/DB_utility.php +++ b/system/database/DB_utility.php @@ -33,7 +33,7 @@ class CI_DB_utility extends CI_DB_forge { * Grabs the CI super object instance so we can access it. * */ - function CI_DB_utility() + function __construct() { // Assign the main database object to $this->db $CI =& get_instance(); diff --git a/system/database/drivers/odbc/odbc_driver.php b/system/database/drivers/odbc/odbc_driver.php index 81e0d7cf2..6e4ba896f 100644 --- a/system/database/drivers/odbc/odbc_driver.php +++ b/system/database/drivers/odbc/odbc_driver.php @@ -48,9 +48,9 @@ class CI_DB_odbc_driver extends CI_DB { var $_random_keyword; - function CI_DB_odbc_driver($params) + function __construct($params) { - parent::CI_DB($params); + parent::__construct($params); $this->_random_keyword = ' RND('.time().')'; // database specific random keyword } -- cgit v1.2.3-24-g4f1b From f27bcf350d18048d91d8a607520d19f0c8e11f41 Mon Sep 17 00:00:00 2001 From: Joël Cox Date: Mon, 22 Aug 2011 22:29:06 +0200 Subject: Cleanly applied patch of the user guide tutorial by Kenny and me. --- user_guide/nav/nav.js | 11 +- user_guide/toc.html | 8 + user_guide/tutorial/conclusion.html | 91 +++++++++++ user_guide/tutorial/create_news_items.html | 181 +++++++++++++++++++++ user_guide/tutorial/hard_coded_pages.html | 159 +++++++++++++++++++ user_guide/tutorial/introduction.html | 92 +++++++++++ user_guide/tutorial/news_section.html | 242 +++++++++++++++++++++++++++++ user_guide/tutorial/static_pages.html | 206 ++++++++++++++++++++++++ 8 files changed, 989 insertions(+), 1 deletion(-) create mode 100644 user_guide/tutorial/conclusion.html create mode 100644 user_guide/tutorial/create_news_items.html create mode 100644 user_guide/tutorial/hard_coded_pages.html create mode 100644 user_guide/tutorial/introduction.html create mode 100644 user_guide/tutorial/news_section.html create mode 100644 user_guide/tutorial/static_pages.html diff --git a/user_guide/nav/nav.js b/user_guide/nav/nav.js index b44994d4d..b57851a6c 100644 --- a/user_guide/nav/nav.js +++ b/user_guide/nav/nav.js @@ -37,7 +37,16 @@ function create_menu(basepath) '
    • Model-View-Controller
    • ' + '
    • Architectural Goals
    • ' + '
    ' + - + + '

    Tutorial

    ' + + '' + + '' + '

    General Topics

    ' + diff --git a/user_guide/toc.html b/user_guide/toc.html index 033114873..aedea4464 100644 --- a/user_guide/toc.html +++ b/user_guide/toc.html @@ -89,6 +89,14 @@ Table of Contents
  • Architectural Goals
  • +

    Tutorial

    + diff --git a/user_guide/tutorial/conclusion.html b/user_guide/tutorial/conclusion.html new file mode 100644 index 000000000..f0a22956d --- /dev/null +++ b/user_guide/tutorial/conclusion.html @@ -0,0 +1,91 @@ + + + + + +CodeIgniter Features : CodeIgniter User Guide + + + + + + + + + + + + + + + + + + + + + +
    + + + + + +

    CodeIgniter User Guide Version 2.0.2

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

    Tutorial - Conclusion

    + +

    This tutorial did not cover all of the things you might expect of a full-fledged content management system, but it introduced you to the more important topics of routing, writing controllers, and models. We hope this tutorial gave you an insight into some of CodeIgniter's basic design patterns, which you can expand upon.

    + +

    Now that you've completed this tutorial, we recommend you check out the rest of the documentation. CodeIgniter is often praised because of its comprehensive documentation. Use this to your advantage and read the "Introduction" and "General Topics" sections thoroughly. You should read the class and helper references when needed.

    + +

    Every intermediate PHP programmer should be able to get the hang of CodeIgniter within a few days.

    + +

    If you still have questions about the framework or your own CodeIgniter code, you can:

    + + +
    + + + + + + + \ No newline at end of file diff --git a/user_guide/tutorial/create_news_items.html b/user_guide/tutorial/create_news_items.html new file mode 100644 index 000000000..66cfc6fdd --- /dev/null +++ b/user_guide/tutorial/create_news_items.html @@ -0,0 +1,181 @@ + + + + + +CodeIgniter Features : CodeIgniter User Guide + + + + + + + + + + + + + + + + + + + + + +
    + + + + + +

    CodeIgniter User Guide Version 2.0.2

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

    Tutorial - Create news items

    + +

    You now know how you can read data from a database using CodeIgnite, but you haven't written any information to the database yet. In this section you'll expand your news controller and model created earlier to include this functionality.

    + +

    Create a form

    + +

    To input data into the database you need to create a form where you can input the information to be stored. This means you'll be needing a form with two fields, one for the title and one for the text. You'll derive the slug from our title in the model. Create the new view at application/views/news/create.php.

    + + + +

    There are only two things here that probably look unfamiliar to you: the form_open() function and the validation_errors() function.

    + +

    The first function is provided by the form helper and renders the form element and adds extra functionality, like adding a hidden CSFR prevention field. The latter is used to report errors related to from validation.

    + +

    Go back to your news controller. You're going to do two things here, check whether the form was submitted and whether the submitted data passed the validation rules. You'll use the form validation library to do this.

    + +
    +function create()
    +{
    +	$this->load->helper('form');
    +	$this->load->library('form_validation');
    +	
    +	$data['title'] = 'Create a news item';
    +	
    +	$this->form_validation->set_rules('title', 'Title', 'required');
    +	$this->form_validation->set_rules('text', 'text', 'required');
    +	
    +	if ($this->form_validation->run() === FALSE)
    +	{
    +		$this->load->view('templates/header', $data);	
    +		$this->load->view('news/create');
    +		$this->load->view('templates/footer');
    +		
    +	}
    +	else
    +	{
    +		$this->news_model->set_news();
    +		$this->load->view('news/success');
    +	}
    +	
    +}
    +
    + +

    The code above adds a lot of functionality. The first few lines load the form helper and the form validation library. After that, rules for the form validation are set. The set_rules() method takes three arguments; the name of the input field, the name to be used in error messages, and the rule. In this case the title and text fields are required.

    + +

    CodeIgniter has a powerful form validation library as demonstrated above. You can read more about this library here.

    + +

    Continuing down, you can see a condition that checks whether the form validation ran successfully. If it did not, the form is displayed, if it was submitted and passed all the rules, the model is called. After this, a view is loaded to display a success message. Create a view at application/view/news/success.php and write a success message.

    + +

    Model

    + +

    The only thing that remains is writing a method that writes the data to the database. You'll use the Active Record class to insert the information and use the input library to get the posted data. Open up the model created earlier and add the following:

    + +
    +function set_news()
    +{
    +	$this->load->helper('url');
    +	
    +	$slug = url_title($this->input->post('title'), 'dash', TRUE);
    +	
    +	$data = array(
    +		'title' => $this->input->post('title'),
    +		'slug' => $slug,
    +		'text' => $this->input->post('text')
    +	);
    +	
    +	return $this->db->insert('news', $data);
    +	
    +}
    +
    + +

    This new method takes care of inserting the news item into the database. The third line contains a new function, url_title(). This function - provided by the URL helper - strips down the string you pass it, replacing all spaces by dashes (-) and makes sure everything is in lowercase characters. This leaves you with a nice slug, perfect for creating URIs.

    + +

    Let's continue with preparing the record that is going to be inserted later, inside the $data array. Each element corresponds with a column in the database table created earlier. You might notice a new method here, namely the post() method from the input library. This method makes sure the data is sanitized, protecting you from nasty attacks from others. The input library is loaded by default. At last, you insert our $data array into our database.

    + +

    Routing

    + +

    Before you can start adding news items into your CodeIgniter application you have to add an extra rule to config/routes.php file. Make sure your file contains the following. This makes sure CodeIgniter sees 'update' as a method instead of a news item's slug.

    + +
    +$route['news/create'] = 'news/create';
    +$route['news/(:any)'] = 'news/view/$1';
    +$route['news'] = 'news';
    +$route['(:any)'] = 'pages/view/$1';
    +$route['default_controller'] = 'pages/view';
    +
    + +

    Now point your browser to your local development environment where you installed CodeIgniter and add index.php/news/create to the URL. Congratulations, you just created your first CodeIgniter application! Add some news and check out the different pages you made.

    + +
    + + + + + + + \ No newline at end of file diff --git a/user_guide/tutorial/hard_coded_pages.html b/user_guide/tutorial/hard_coded_pages.html new file mode 100644 index 000000000..6201ed081 --- /dev/null +++ b/user_guide/tutorial/hard_coded_pages.html @@ -0,0 +1,159 @@ + + + + + +CodeIgniter Features : CodeIgniter User Guide + + + + + + + + + + + + + + + + + + + + + +
    + + + + + +

    CodeIgniter User Guide Version 2.0.2

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

    Tutorial - Hard coded pages

    + +

    The first thing we're going to do is setting up a controller to handle our hard coded pages. A controller is a class with a collection of methods that represent the different actions you can perform on a certain object. In our case, we want to be able to view a page.

    + +

    Note: This tutorial assumes you've downloaded CodeIgniter and installed the framework in your development environment.

    + +

    Create a file at application/controllers/pages.php with the following code.

    + + + +

    If you're familiar with PHP classes you see that we create a Pages class with a view method that accepts one parameter, $page. Another interesting observation is that the Pages class is extending the CI_Controller class. This means that the new Pages class can access the methods and variables defined in the CI_Controller class. When you look at this class in system/core/controller.php you can see this class is doing something really important; assigning an instance from the CodeIgniter super object to the $this object. In most of your code, $this is the object you will use to interact with the framework.

    + +

    Now we've created our first method, it is time to do some basic templating. For this tutorial, we will be creating two views to acts as our footer and header. Let's create our header at application/views/templates/header.php and ad the following code.

    + + + +

    Our header doesn't do anything exciting. It contains the basic HTML code that we will want to display before loading the main view. You can also see that we echo the $title variable, which we didn't define. We will set this variable in the Pages controller a bit later. Let's go ahead and create a footer at application/views/templates/footer.php that includes the following code.

    + + + +

    Adding logic to the controller

    + +

    Now we've set up the basics so we can finally do some real programming. Earlier we set up our controller with a view method. Because we don't want to write a separate method for every page, we made the view method accept one parameter, the name of the page. These hard coded pages will be located in application/views/pages/. Create two files in this directory named home.php and about.php and put in some HTML content.

    + +

    In order to load these pages we'll have to check whether these page actually exists. When the page does exist, we load the view for that pages, including the header and footer and display it to the user. If it doesn't, we show a "404 Page not found" error.

    + + + +

    The first thing we do is checking whether the page we're looking for does actually exist. We use PHP's native file_exists() to do this check and pass the path where the file is supposed to be. Next is the function show_404(), a CodeIgniter function that renders the default error page and sets the appropriate HTTP headers.

    + +

    In the header template you saw we were using the $title variable to customize our page title. This is where we define the title, but instead of assigning the value to a variable, we assign it to the title element in the $data array. The last thing we need to do is loading the views in the order we want them to be displayed. We also pass the $data array to the header view to make its elements available in the header view file.

    + +

    Routing

    + +

    Actually, our controller is already functioning. Point your browser to index.php/pages/view to see your homepage. When you visit index.php/pages/view/about you will see the about page, again including your header and footer. Now we're going to get rid of the pages/view part in our URI. As you may have seen, CodeIgniter does its routing by the class, method and parameter, separated by slashes.

    + +

    Open the routing file located at application/config/routes.php and add the following two lines. Remove all other code that sets any element in the $route array.

    + + + +

    CodeIgniter reads its routing rules from top to bottom and routes the request to the first matching rule. These routes are stored in the $route array where the keys represent the incoming request and the value the path to the method, as described above.

    + +

    The first rule in our $routes array matches every request - using the wildcard operator (:any) - and passes the value to the view method of the pages class we created earlier. The default controller route makes sure every request to the root goes to the view method as well, which has the first parameter set to 'home' by default.

    + +
    + + + + + + + \ No newline at end of file diff --git a/user_guide/tutorial/introduction.html b/user_guide/tutorial/introduction.html new file mode 100644 index 000000000..cb91f4856 --- /dev/null +++ b/user_guide/tutorial/introduction.html @@ -0,0 +1,92 @@ + + + + + +CodeIgniter Features : CodeIgniter User Guide + + + + + + + + + + + + + + + + + + + + + +
    + + + + + +

    CodeIgniter User Guide Version 2.0.2

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

    Tutorial − Introduction

    + +

    This tutorial is intended to introduce you to the CodeIgniter framework and the basic principles of MVC architecture. + It will show you how a basic CodeIgniter application is constructed in step-by-step fashion. +

    + +

    In this tutorial, you will be creating a basic news application. You will begin by writing the code that can load static pages. Next, you will create a news section that reads news items from a database. Finally, you'll add a form to create news items in the database.

    + +

    This tutorial will primarily focus on:

    +
      +
    • Model-View-Controller basics
    • +
    • Routing basics
    • +
    • Form validation
    • +
    • Performing basic database queries using "Active Record"
    • +
    + +
    + + + + + + + \ No newline at end of file diff --git a/user_guide/tutorial/news_section.html b/user_guide/tutorial/news_section.html new file mode 100644 index 000000000..d0f64e0c9 --- /dev/null +++ b/user_guide/tutorial/news_section.html @@ -0,0 +1,242 @@ + + + + + +CodeIgniter Features : CodeIgniter User Guide + + + + + + + + + + + + + + + + + + + + + +
    + + + + + +

    CodeIgniter User Guide Version 2.0.2

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

    Tutorial − News section

    + +

    In the last section, we went over some basic concepts of the framework by writing a class that includes static pages. We cleaned up the URI by adding custom routing rules. Now it's time to introduce dynamic content and start using a database.

    + +

    Setting up your model

    + +

    Instead of writing database operations right in the controller, queries should be placed in a model, so they can easily be reused later. Models are the place where you retrieve, insert, and update information in your database or other data stores. They represent your data.

    + +

    Open up the application/models directory and create a new file called news_model.php and add the following code. Make sure you've configured your database properly as described here.

    + +
    +<?php
    +class News_model extends CI_Model {
    +
    +	function __construct()
    +	{
    +		$this->load->database();
    +
    +	}
    +}
    +
    + +

    This code looks similar to the controller code that was used earlier. It creates a new model by extending CI_Model and loads the database library. This will make the database class available through the $this->db object.

    + +

    Before querying the database, a database schema has to be created. Connect to your database and run the SQL command below. Also add some seed records.

    + +
    +CREATE TABLE news (
    +	id int(11) NOT NULL AUTO_INCREMENT,
    +	title varchar(128) NOT NULL,
    +	slug varchar(128) NOT NULL,
    +	text text NOT NULL,
    +	PRIMARY KEY (id),
    +	KEY slug (slug)
    +);
    +
    + +

    Now that the database and a model have been set up, you'll need a method to get all of our posts from our database. To do this, the database abstraction layer that is included with CodeIgniter — ActiveRecord — is used. This makes it possible to write your 'queries' once and make them work on all supported database systems. Add the following code to your model.

    + +
    +function get_news($slug = FALSE)
    +{
    +	if ($slug === FALSE)
    +	{
    +		$query = $this->db->get('news');
    +		return $query->result_array();
    +
    +	}
    +	else
    +	{
    +		$query = $this->db->get_where('news', array('slug' => $slug));
    +		return $query->row_array();
    +
    +	}
    +
    +}
    +
    + +

    With this code you can perform two different queries. You can get all news records, or get a news item by its slug. You might have noticed that the $slug variable wasn't sanitized before running the query; Active Record does this for you.

    + +

    Display the news

    + +

    Now that the queries are written, the model should be tied to the views that are going to display the news items to the user. This could be done in our pages controller created earlier, but for the sake of clarity, a new "news" controller is defined. Create the new controller at application/controllers/news.php.

    + +
    +<?php
    +class News extends CI_Controller{
    +
    +	function __construct()
    +	{
    +		parent::__construct();
    +		$this->load->model('news_model');
    +
    +	}
    +
    +	function index()
    +	{
    +		$data['news'] = $this->news_model->get_news();
    +
    +	}
    +
    +	function view($slug)
    +	{
    +		$data['news'] = $this->news_model->get_news($slug);
    +
    +	}
    +
    +}
    +
    + +

    Looking at the code, you may see some similarity with the files we created earlier. First, the "__construct" method: it calls the constructor of its parent class (CI_Controller) and loads the model, so it can be used in all other methods in this controller.

    + +

    Next, there are two methods to view all news items and one for a specific news item. You can see that the $slug variable is passed to the model's method in the second method. The model is using this slug to identify the news item to be returned.

    + +

    Now the data is retrieved by the controller through our model, but nothing is displayed yet. The next thing to do is passing this data to the views.

    + +
    +function index()
    +{
    +	$data['news'] = $this->news_model->get_news();
    +	$data['title'] = 'News archive';
    +
    +	$this->load->view('templates/header', $data);
    +	$this->load->view('news/index', $data);
    +	$this->load->view('templates/footer');
    +
    +}
    +
    + +

    The code above gets all news records from the model and assigns it to a variable. The value for the title is also assigned to the $data['title'] element and all data is passed to the views. You now need to create a view to render the news items. Create application/views/news/index.php and add the next piece of code.

    + +
    +<?php foreach ($news as $news_item): ?>
    +
    +    <h2><?php echo $news_item['title'] ?></h2>
    +    <div id="main">
    +        <?php echo $news_item['text'] ?>
    +    </div>
    +    <p><a href="news/<?php echo $news_item['slug'] ?>">View article</a></p>
    +
    +<?php endforeach ?>
    +
    + +

    Here, each news item is looped and displayed to the user. You can see we wrote our template in PHP mixed with HTML. If you prefer to use a template language, you can use CodeIgniter's Template Parser class or a third party parser.

    + +

    The news overview page is now done, but a page to display individual news items is still absent. The model created earlier is made in such way that it can easily be used for this functionality. You only need to add some code to the controller and create a new view. Go back to the news controller and add the following lines to the file.

    + +
    +function view($slug)
    +{
    +	$data['news_item'] = $this->news_model->get_news($slug);
    +
    +	if (empty($data['news_item']))
    +	{
    +		show_404();
    +	}
    +
    +	$data['title'] = $data['news_item']['title'];
    +
    +	$this->load->view('templates/header', $data);
    +	$this->load->view('news/view', $data);
    +	$this->load->view('templates/footer');
    +
    +}
    +
    + +

    Instead of calling the get_news() method without a parameter, the $slug variable is passed, so it will return the specific news item. The only things left to do is create the corresponding view at application/views/news/view.php. Put the following code in this file.

    + +
    +<?php
    +echo '<h2>' . $news_item['title'] . '</h2>';
    +echo $news_item['text'];
    +
    + +

    Routing

    +

    Because of the wildcard routing rule created earlier, you need need an extra route to view the controller that you just made. Modify your routing file (application/config/routes.php) so it looks as follows. This makes sure the requests reaches the news controller instead of going directly to the pages controller. The first line routes URI's with a slug to the view method in the news controller.

    + +
    +$route['news/(:any)'] = 'news/view/$1';
    +$route['news'] = 'news';
    +$route['(:any)'] = 'pages/view/$1';
    +$route['default_controller'] = 'pages/view';
    +
    + +

    Point your browser to your document root, followed by index.php/news and watch your news page.

    + +
    + + + + + + + \ No newline at end of file diff --git a/user_guide/tutorial/static_pages.html b/user_guide/tutorial/static_pages.html new file mode 100644 index 000000000..69e5b7446 --- /dev/null +++ b/user_guide/tutorial/static_pages.html @@ -0,0 +1,206 @@ + + + + + +CodeIgniter Features : CodeIgniter User Guide + + + + + + + + + + + + + + + + + + + + + +
    + + + + + +

    CodeIgniter User Guide Version 2.0.2

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

    Tutorial − Static pages

    + +

    Note: This tutorial assumes you've downloaded CodeIgniter and installed the framework in your development environment.

    + +

    The first thing you're going to do is set up a controller to handle static pages. +A controller is simply a class that helps delegate work. It is the glue of your +web application.

    + +

    For example, when a call is made to: http://example.com/news/latest/10 We might imagine +that there is a controller named "news". The method being called on news +would be "latest". The news method's job could be to grab 10 +news items, and render them on the page. Very often in MVC, you'll see URL +patterns that match: http://example.com/[controller-class]/[controller-method]/[arguments] +As URL schemes become more complex, this may change. But for now, this is all we will need to know.

    + +

    Create a file at application/controllers/pages.php with the following code.

    + + + +

    You have created a class named "pages", with a view method that accepts one argument named $page. +The pages class is extending the CI_Controller class. +This means that the new pages class can access the methods and variables defined in the CI_Controller class +(system/core/Controller.php).

    + +

    The controller is what will become the center of every request to your web application. +In very technical CodeIgniter discussions, it may be referred to as the super object. +Like any php class, you refer to it within your controllers as $this. +Referring to $this is how you will load libraries, views, and generally +command the framework.

    + +

    Now you've created your first method, it's time to make some basic page templates. +We will be creating two "views" (page templates) that act as our page footer and header.

    + +

    Create the header at application/views/templates/header.php and add the following code.

    + + + +

    The header contains the basic HTML code that you'll want to display before loading the main view, together with a heading. +It will also output the $title variable, which we'll define later in the controller. +Now create a footer at application/views/templates/footer.php that includes the following code:

    + + + +

    Adding logic to the controller

    + +

    Earlier you set up a controller with a view() method. The method accepts one parameter, which is the name of the page to be loaded. +The static page templates will be located in the application/views/pages/ directory.

    + +

    In that directory, create two files named home.php and about.php. +Within those files, type some text − anything you'd like − and save them. +If you like to be particularly un-original, try "Hello World!".

    + +

    In order to load those pages, you'll have to check whether the requested page actually exists:

    + +
    +function view($page = 'home')
    +{
    +			
    +	if ( ! file_exists('application/views/pages/' . $page . EXT))
    +	{
    +		// Whoops, we don't have a page for that!
    +		show_404();
    +	}
    +	
    +	$data['title'] = ucfirst($page); // Capitalize the first letter
    +	
    +	$this->load->view('templates/header', $data);
    +	$this->load->view('pages/' . $page, $data);
    +	$this->load->view('templates/footer', $data);
    +	
    +}	
    +
    + +

    Now, when the page does exist, it is loaded, including the header and footer, and displayed to the user. If the page doesn't exist, a "404 Page not found" error is shown.

    + +

    The first line in this method checks whether the page actually exists. PHP's native file_exists() function is used to check whether the file is where it's expected to be. show_404() is a built-in CodeIgniter function that renders the default error page.

    + +

    In the header template, the $title variable was used to customize the page title. The value of title is defined in this method, but instead of assigning the value to a variable, it is assigned to the title element in the $data array.

    + +

    The last thing that has to be done is loading the views in the order they should be displayed. +The second parameter in the view() method is used to pass values to the view. Each value in the $data array is assigned to a variable with the name of its key. So the value of $data['title'] in the controller is equivalent to $title in the view.

    + +

    Routing

    + +

    The controller is now functioning! Point your browser to [your-site-url]index.php/pages/view to see your page. When you visit index.php/pages/view/about you'll see the about page, again including the header and footer.

    + +

    Using custom routing rules, you have the power to map any URI to any controller and method, and break free from the normal convention: +http://example.com/[controller-class]/[controller-method]/[arguments]

    + +

    Let's do that. Open the routing file located at application/config/routes.php and add the following two lines. Remove all other code that sets any element in the $route array.

    + +
    +$route['default_controller'] = 'pages';
    +$route['(:any)'] = 'pages/view/$1';
    +
    + +

    CodeIgniter reads its routing rules from top to bottom and routes the request to the first matching rule. Each rule is a regular expression +(left-side) mapped to a controller and method name separated by slashes (right-side). +When a request comes in, CodeIgniter looks for the first match, and calls the appropriate controller and method, possibly with arguments.

    + +

    More information about routing can be found in the URI Routing documentation.

    + +

    Here, the second rule in the $routes array matches any request using the wildcard string (:any). +and passes the parameter to the view() method of the pages class.

    + +

    Now visit index.php/about. Did it get routed correctly to the view() method +in the pages controller? Awesome!

    + +
    + + + + + + + \ No newline at end of file -- cgit v1.2.3-24-g4f1b From b430ecd00aaa80c63734b508c82501bec3a0b703 Mon Sep 17 00:00:00 2001 From: Joël Cox Date: Tue, 23 Aug 2011 14:54:42 +0200 Subject: Bumped the version number, corrected spelling mistakes (thanks @chrisberthe) and added links to the tutorial pages in the introduction. --- user_guide/tutorial/conclusion.html | 4 ++-- user_guide/tutorial/create_news_items.html | 6 +++--- user_guide/tutorial/introduction.html | 17 +++++++++++++---- user_guide/tutorial/news_section.html | 4 ++-- user_guide/tutorial/static_pages.html | 2 +- 5 files changed, 21 insertions(+), 12 deletions(-) diff --git a/user_guide/tutorial/conclusion.html b/user_guide/tutorial/conclusion.html index f0a22956d..f3bdaad1d 100644 --- a/user_guide/tutorial/conclusion.html +++ b/user_guide/tutorial/conclusion.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.0.2

    CodeIgniter User Guide Version 2.0.3

    @@ -43,7 +43,7 @@ CodeIgniter Home  ›  User Guide Home  ›  Tutorial  ›  -Features +Conclusion
    Search User Guide   
    diff --git a/user_guide/tutorial/create_news_items.html b/user_guide/tutorial/create_news_items.html index 66cfc6fdd..a25917930 100644 --- a/user_guide/tutorial/create_news_items.html +++ b/user_guide/tutorial/create_news_items.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.0.2

    CodeIgniter User Guide Version 2.0.3

    @@ -85,7 +85,7 @@ Create news items

    There are only two things here that probably look unfamiliar to you: the form_open() function and the validation_errors() function.

    -

    The first function is provided by the form helper and renders the form element and adds extra functionality, like adding a hidden CSFR prevention field. The latter is used to report errors related to from validation.

    +

    The first function is provided by the form helper and renders the form element and adds extra functionality, like adding a hidden CSFR prevention field. The latter is used to report errors related to form validation.

    Go back to your news controller. You're going to do two things here, check whether the form was submitted and whether the submitted data passed the validation rules. You'll use the form validation library to do this.

    @@ -150,7 +150,7 @@ function set_news()

    Routing

    -

    Before you can start adding news items into your CodeIgniter application you have to add an extra rule to config/routes.php file. Make sure your file contains the following. This makes sure CodeIgniter sees 'update' as a method instead of a news item's slug.

    +

    Before you can start adding news items into your CodeIgniter application you have to add an extra rule to config/routes.php file. Make sure your file contains the following. This makes sure CodeIgniter sees 'create' as a method instead of a news item's slug.

     $route['news/create'] = 'news/create';
    diff --git a/user_guide/tutorial/introduction.html b/user_guide/tutorial/introduction.html
    index cb91f4856..78fd00b61 100644
    --- a/user_guide/tutorial/introduction.html
    +++ b/user_guide/tutorial/introduction.html
    @@ -28,7 +28,7 @@
     
    - +

    CodeIgniter User Guide Version 2.0.2

    CodeIgniter User Guide Version 2.0.3

    @@ -59,9 +59,7 @@ Introduction

    Tutorial − Introduction

    -

    This tutorial is intended to introduce you to the CodeIgniter framework and the basic principles of MVC architecture. - It will show you how a basic CodeIgniter application is constructed in step-by-step fashion. -

    +

    This tutorial is intended to introduce you to the CodeIgniter framework and the basic principles of MVC architecture. It will show you how a basic CodeIgniter application is constructed in step-by-step fashion.

    In this tutorial, you will be creating a basic news application. You will begin by writing the code that can load static pages. Next, you will create a news section that reads news items from a database. Finally, you'll add a form to create news items in the database.

    @@ -73,6 +71,17 @@ Introduction
  • Performing basic database queries using "Active Record"
  • +

    The entire tutorial is split up over several pages, each explaining a small part of the functionality of the CodeIgniter framework. You'll go through the following pages:

    +
      +
    • Introduction, this page, which gives you an overview of what to expect.
    • +
    • Static pages, which will teach you the basics of controllers, views and routing.
    • +
    • News section, where you'll start using models and will be doing some basic database operations.
    • +
    • Create news items, which will introduce more advanced database operations and form validation.
    • +
    • Conclusion, which will give you some pointers on further reading and other resources.
    • +
    + +

    Enjoy your exploration of the CodeIgniter framework.

    +
    diff --git a/user_guide/tutorial/news_section.html b/user_guide/tutorial/news_section.html index d0f64e0c9..8d8899968 100644 --- a/user_guide/tutorial/news_section.html +++ b/user_guide/tutorial/news_section.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.0.2

    CodeIgniter User Guide Version 2.0.3

    @@ -94,7 +94,7 @@ CREATE TABLE news ( );
    -

    Now that the database and a model have been set up, you'll need a method to get all of our posts from our database. To do this, the database abstraction layer that is included with CodeIgniter — ActiveRecord — is used. This makes it possible to write your 'queries' once and make them work on all supported database systems. Add the following code to your model.

    +

    Now that the database and a model have been set up, you'll need a method to get all of our posts from our database. To do this, the database abstraction layer that is included with CodeIgniter — Active Record — is used. This makes it possible to write your 'queries' once and make them work on all supported database systems. Add the following code to your model.

     function get_news($slug = FALSE)
    diff --git a/user_guide/tutorial/static_pages.html b/user_guide/tutorial/static_pages.html
    index 69e5b7446..d5eec43da 100644
    --- a/user_guide/tutorial/static_pages.html
    +++ b/user_guide/tutorial/static_pages.html
    @@ -28,7 +28,7 @@
     
    - +

    CodeIgniter User Guide Version 2.0.2

    CodeIgniter User Guide Version 2.0.3

    -- cgit v1.2.3-24-g4f1b From d5141d2008abbf709c30463797df16d3291e3c9c Mon Sep 17 00:00:00 2001 From: Joël Cox Date: Tue, 23 Aug 2011 15:27:38 +0200 Subject: Removed EXT constant and excessive else statement. --- user_guide/tutorial/news_section.html | 9 +++------ user_guide/tutorial/static_pages.html | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/user_guide/tutorial/news_section.html b/user_guide/tutorial/news_section.html index 8d8899968..191f0e1eb 100644 --- a/user_guide/tutorial/news_section.html +++ b/user_guide/tutorial/news_section.html @@ -105,12 +105,9 @@ function get_news($slug = FALSE) return $query->result_array(); } - else - { - $query = $this->db->get_where('news', array('slug' => $slug)); - return $query->row_array(); - - } + + $query = $this->db->get_where('news', array('slug' => $slug)); + return $query->row_array(); }
    diff --git a/user_guide/tutorial/static_pages.html b/user_guide/tutorial/static_pages.html index d5eec43da..bf52f4543 100644 --- a/user_guide/tutorial/static_pages.html +++ b/user_guide/tutorial/static_pages.html @@ -137,7 +137,7 @@ If you like to be particularly un-original, try "Hello World!".

    function view($page = 'home') { - if ( ! file_exists('application/views/pages/' . $page . EXT)) + if ( ! file_exists('application/views/pages/' . $page . '.php')) { // Whoops, we don't have a page for that! show_404(); -- cgit v1.2.3-24-g4f1b From 5cbced2f3899726241b7a3a83e47a92fb01dbf83 Mon Sep 17 00:00:00 2001 From: Joël Cox Date: Tue, 23 Aug 2011 16:21:33 +0200 Subject: Forgot to save after bumping version number in hard_coded_pages.html. --- user_guide/tutorial/hard_coded_pages.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide/tutorial/hard_coded_pages.html b/user_guide/tutorial/hard_coded_pages.html index 6201ed081..e83f1ec80 100644 --- a/user_guide/tutorial/hard_coded_pages.html +++ b/user_guide/tutorial/hard_coded_pages.html @@ -28,7 +28,7 @@
    - +

    CodeIgniter User Guide Version 2.0.2

    CodeIgniter User Guide Version 2.0.3

    -- cgit v1.2.3-24-g4f1b From 7bd6335c77cfc5fec9e7e788d45d110c1b09ffd1 Mon Sep 17 00:00:00 2001 From: Joël Cox Date: Sat, 27 Aug 2011 20:21:19 +0200 Subject: Renamed introduction to index and small code style fixes (patch by @ericbarnes). --- user_guide/nav/nav.js | 2 +- user_guide/toc.html | 2 +- user_guide/tutorial/conclusion.html | 2 +- user_guide/tutorial/create_news_items.html | 8 +-- user_guide/tutorial/hard_coded_pages.html | 7 +- user_guide/tutorial/index.html | 101 +++++++++++++++++++++++++++++ user_guide/tutorial/introduction.html | 101 ----------------------------- user_guide/tutorial/news_section.html | 29 +++------ user_guide/tutorial/static_pages.html | 16 ++--- 9 files changed, 128 insertions(+), 140 deletions(-) create mode 100644 user_guide/tutorial/index.html delete mode 100644 user_guide/tutorial/introduction.html diff --git a/user_guide/nav/nav.js b/user_guide/nav/nav.js index b57851a6c..bc668ec27 100644 --- a/user_guide/nav/nav.js +++ b/user_guide/nav/nav.js @@ -40,7 +40,7 @@ function create_menu(basepath) '

    Tutorial

    ' + '
      ' + - '
    • Introduction
    • ' + + '
    • Introduction
    • ' + '
    • Static pages
    • ' + '
    • News section
    • ' + '
    • Create news items
    • ' + diff --git a/user_guide/toc.html b/user_guide/toc.html index aedea4464..bd6aaf510 100644 --- a/user_guide/toc.html +++ b/user_guide/toc.html @@ -91,7 +91,7 @@ Table of Contents

      Tutorial

        -
      • Introduction
      • +
      • Introduction
      • Static pages
      • News section
      • Create news items
      • diff --git a/user_guide/tutorial/conclusion.html b/user_guide/tutorial/conclusion.html index f3bdaad1d..ccf89175f 100644 --- a/user_guide/tutorial/conclusion.html +++ b/user_guide/tutorial/conclusion.html @@ -42,7 +42,7 @@ CodeIgniter Home  ›  User Guide Home  ›  -Tutorial  ›  +Tutorial  ›  Conclusion
        Search User Guide   
        diff --git a/user_guide/tutorial/create_news_items.html b/user_guide/tutorial/create_news_items.html index a25917930..48c82c799 100644 --- a/user_guide/tutorial/create_news_items.html +++ b/user_guide/tutorial/create_news_items.html @@ -42,7 +42,7 @@ CodeIgniter Home  ›  User Guide Home  ›  -Tutorial  ›  +Tutorial  ›  Create news items
        Search User Guide   
        @@ -90,7 +90,7 @@ Create news items

        Go back to your news controller. You're going to do two things here, check whether the form was submitted and whether the submitted data passed the validation rules. You'll use the form validation library to do this.

        -function create()
        +public function create()
         {
         	$this->load->helper('form');
         	$this->load->library('form_validation');
        @@ -112,7 +112,6 @@ function create()
         		$this->news_model->set_news();
         		$this->load->view('news/success');
         	}
        -	
         }
         
        @@ -127,7 +126,7 @@ function create()

        The only thing that remains is writing a method that writes the data to the database. You'll use the Active Record class to insert the information and use the input library to get the posted data. Open up the model created earlier and add the following:

        -function set_news()
        +public function set_news()
         {
         	$this->load->helper('url');
         	
        @@ -140,7 +139,6 @@ function set_news()
         	);
         	
         	return $this->db->insert('news', $data);
        -	
         }
         
        diff --git a/user_guide/tutorial/hard_coded_pages.html b/user_guide/tutorial/hard_coded_pages.html index e83f1ec80..408634a78 100644 --- a/user_guide/tutorial/hard_coded_pages.html +++ b/user_guide/tutorial/hard_coded_pages.html @@ -68,7 +68,7 @@ Features <?php class Pages extends CI_Controller { - function view($page = 'home') + public function view($page = 'home') { } @@ -104,7 +104,7 @@ class Pages extends CI_Controller {

        In order to load these pages we'll have to check whether these page actually exists. When the page does exist, we load the view for that pages, including the header and footer and display it to the user. If it doesn't, we show a "404 Page not found" error.

        diff --git a/user_guide/tutorial/index.html b/user_guide/tutorial/index.html new file mode 100644 index 000000000..4f665fe0a --- /dev/null +++ b/user_guide/tutorial/index.html @@ -0,0 +1,101 @@ + + + + + +CodeIgniter Features : CodeIgniter User Guide + + + + + + + + + + + + + + + + + + + + + +
        + + + + + +

        CodeIgniter User Guide Version 2.0.3

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

        Tutorial − Introduction

        + +

        This tutorial is intended to introduce you to the CodeIgniter framework and the basic principles of MVC architecture. It will show you how a basic CodeIgniter application is constructed in step-by-step fashion.

        + +

        In this tutorial, you will be creating a basic news application. You will begin by writing the code that can load static pages. Next, you will create a news section that reads news items from a database. Finally, you'll add a form to create news items in the database.

        + +

        This tutorial will primarily focus on:

        +
          +
        • Model-View-Controller basics
        • +
        • Routing basics
        • +
        • Form validation
        • +
        • Performing basic database queries using "Active Record"
        • +
        + +

        The entire tutorial is split up over several pages, each explaining a small part of the functionality of the CodeIgniter framework. You'll go through the following pages:

        +
          +
        • Introduction, this page, which gives you an overview of what to expect.
        • +
        • Static pages, which will teach you the basics of controllers, views and routing.
        • +
        • News section, where you'll start using models and will be doing some basic database operations.
        • +
        • Create news items, which will introduce more advanced database operations and form validation.
        • +
        • Conclusion, which will give you some pointers on further reading and other resources.
        • +
        + +

        Enjoy your exploration of the CodeIgniter framework.

        + +
        + + + + + + + \ No newline at end of file diff --git a/user_guide/tutorial/introduction.html b/user_guide/tutorial/introduction.html deleted file mode 100644 index 78fd00b61..000000000 --- a/user_guide/tutorial/introduction.html +++ /dev/null @@ -1,101 +0,0 @@ - - - - - -CodeIgniter Features : CodeIgniter User Guide - - - - - - - - - - - - - - - - - - - - - -
        - - - - - -

        CodeIgniter User Guide Version 2.0.3

        -
        - - - - - - - - - -
        - - -
        - - - -
        - - -

        Tutorial − Introduction

        - -

        This tutorial is intended to introduce you to the CodeIgniter framework and the basic principles of MVC architecture. It will show you how a basic CodeIgniter application is constructed in step-by-step fashion.

        - -

        In this tutorial, you will be creating a basic news application. You will begin by writing the code that can load static pages. Next, you will create a news section that reads news items from a database. Finally, you'll add a form to create news items in the database.

        - -

        This tutorial will primarily focus on:

        -
          -
        • Model-View-Controller basics
        • -
        • Routing basics
        • -
        • Form validation
        • -
        • Performing basic database queries using "Active Record"
        • -
        - -

        The entire tutorial is split up over several pages, each explaining a small part of the functionality of the CodeIgniter framework. You'll go through the following pages:

        -
          -
        • Introduction, this page, which gives you an overview of what to expect.
        • -
        • Static pages, which will teach you the basics of controllers, views and routing.
        • -
        • News section, where you'll start using models and will be doing some basic database operations.
        • -
        • Create news items, which will introduce more advanced database operations and form validation.
        • -
        • Conclusion, which will give you some pointers on further reading and other resources.
        • -
        - -

        Enjoy your exploration of the CodeIgniter framework.

        - -
        - - - - - - - \ No newline at end of file diff --git a/user_guide/tutorial/news_section.html b/user_guide/tutorial/news_section.html index 191f0e1eb..b2d883184 100644 --- a/user_guide/tutorial/news_section.html +++ b/user_guide/tutorial/news_section.html @@ -42,7 +42,7 @@ CodeIgniter Home  ›  User Guide Home  ›  -Tutorial  ›  +Tutorial  ›  News section
        Search User Guide   
        @@ -71,10 +71,9 @@ News section <?php class News_model extends CI_Model { - function __construct() + public function __construct() { $this->load->database(); - } } @@ -97,18 +96,16 @@ CREATE TABLE news (

        Now that the database and a model have been set up, you'll need a method to get all of our posts from our database. To do this, the database abstraction layer that is included with CodeIgniter — Active Record — is used. This makes it possible to write your 'queries' once and make them work on all supported database systems. Add the following code to your model.

        -function get_news($slug = FALSE)
        +public function get_news($slug = FALSE)
         {
         	if ($slug === FALSE)
         	{
         		$query = $this->db->get('news');
         		return $query->result_array();
        -
         	}
         	
         	$query = $this->db->get_where('news', array('slug' => $slug));
         	return $query->row_array();
        -
         }
         
        @@ -120,27 +117,23 @@ function get_news($slug = FALSE)
         <?php
        -class News extends CI_Controller{
        +class News extends CI_Controller {
         
        -	function __construct()
        +	public function __construct()
         	{
         		parent::__construct();
         		$this->load->model('news_model');
        -
         	}
         
        -	function index()
        +	public function index()
         	{
         		$data['news'] = $this->news_model->get_news();
        -
         	}
         
        -	function view($slug)
        +	public function view($slug)
         	{
         		$data['news'] = $this->news_model->get_news($slug);
        -
         	}
        -
         }
         
        @@ -151,7 +144,7 @@ class News extends CI_Controller{

        Now the data is retrieved by the controller through our model, but nothing is displayed yet. The next thing to do is passing this data to the views.

        -function index()
        +public function index()
         {
         	$data['news'] = $this->news_model->get_news();
         	$data['title'] = 'News archive';
        @@ -159,7 +152,6 @@ function index()
         	$this->load->view('templates/header', $data);
         	$this->load->view('news/index', $data);
         	$this->load->view('templates/footer');
        -
         }
         
        @@ -182,7 +174,7 @@ function index()

        The news overview page is now done, but a page to display individual news items is still absent. The model created earlier is made in such way that it can easily be used for this functionality. You only need to add some code to the controller and create a new view. Go back to the news controller and add the following lines to the file.

        -function view($slug)
        +public function view($slug)
         {
         	$data['news_item'] = $this->news_model->get_news($slug);
         
        @@ -196,7 +188,6 @@ function view($slug)
         	$this->load->view('templates/header', $data);
         	$this->load->view('news/view', $data);
         	$this->load->view('templates/footer');
        -
         }
         
        @@ -204,7 +195,7 @@ function view($slug)
         <?php
        -echo '<h2>' . $news_item['title'] . '</h2>';
        +echo '<h2>'.$news_item['title'].'</h2>';
         echo $news_item['text'];
         
        diff --git a/user_guide/tutorial/static_pages.html b/user_guide/tutorial/static_pages.html index bf52f4543..51a04c689 100644 --- a/user_guide/tutorial/static_pages.html +++ b/user_guide/tutorial/static_pages.html @@ -42,7 +42,7 @@ CodeIgniter Home  ›  User Guide Home  ›  -Tutorial  ›  +Tutorial  ›  Static pages
        Search User Guide   
        @@ -79,7 +79,7 @@ As URL schemes become more complex, this may change. But for now, this is all we class Pages extends CI_Controller { - function view($page = 'home') + public function view($page = 'home') { } @@ -134,10 +134,10 @@ If you like to be particularly un-original, try "Hello World!".

        In order to load those pages, you'll have to check whether the requested page actually exists:

        -function view($page = 'home')
        +public function view($page = 'home')
         {
         			
        -	if ( ! file_exists('application/views/pages/' . $page . '.php'))
        +	if ( ! file_exists('application/views/pages/'.$page.'.php'))
         	{
         		// Whoops, we don't have a page for that!
         		show_404();
        @@ -146,10 +146,10 @@ function view($page = 'home')
         	$data['title'] = ucfirst($page); // Capitalize the first letter
         	
         	$this->load->view('templates/header', $data);
        -	$this->load->view('pages/' . $page, $data);
        +	$this->load->view('pages/'.$page, $data);
         	$this->load->view('templates/footer', $data);
        -	
        -}	
        +
        +}
         

        Now, when the page does exist, it is loaded, including the header and footer, and displayed to the user. If the page doesn't exist, a "404 Page not found" error is shown.

        @@ -193,7 +193,7 @@ in the pages controller? Awesome!

      Version 2.0.3

      -- cgit v1.2.3-24-g4f1b From e8349294d8638dac1e689d137188bb7c7c7c19c5 Mon Sep 17 00:00:00 2001 From: Tom Klingenberg Date: Fri, 7 Oct 2011 20:03:30 +0200 Subject: CI_Loader::driver() processes empty library. Fixed. This causes endless recursion calls _ci_load_class(), see #550 --- system/core/Loader.php | 5 +++++ 1 file changed, 5 insertions(+) mode change 100755 => 100644 system/core/Loader.php diff --git a/system/core/Loader.php b/system/core/Loader.php old mode 100755 new mode 100644 index e7fa3d3f6..6b7ee0c28 --- a/system/core/Loader.php +++ b/system/core/Loader.php @@ -616,6 +616,11 @@ class CI_Loader { require BASEPATH.'libraries/Driver.php'; } + if ($library == '') + { + return FALSE; + } + // We can save the loader some time since Drivers will *always* be in a subfolder, // and typically identically named to the library if ( ! strpos($library, '/')) -- cgit v1.2.3-24-g4f1b From 13095cbc1b1b0509ac8c984e7a5fd704d9826569 Mon Sep 17 00:00:00 2001 From: diegorivera Date: Wed, 19 Oct 2011 02:56:15 -0200 Subject: Update system/libraries/Email.php --- system/libraries/Email.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/system/libraries/Email.php b/system/libraries/Email.php index e28c23a04..2916b9a13 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -379,7 +379,15 @@ class CI_Email { */ public function message($body) { - $this->_body = stripslashes(rtrim(str_replace("\r", "", $body))); + $this->_body = rtrim(str_replace("\r", "", $body)); + + //strip slashes only if magic quotes is ON + //if we do it with magic quotes OFF, it strips real, user-inputted chars. + if (get_magic_quotes_gpc()) + { + $this->_body = stripslashes($this->_body); + } + return $this; } -- cgit v1.2.3-24-g4f1b From 6eab49a844b3542a5efee6620233a86f645a30f5 Mon Sep 17 00:00:00 2001 From: diegorivera Date: Wed, 19 Oct 2011 11:18:45 -0200 Subject: I wasn't following the CI code style guide. --- system/libraries/Email.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/system/libraries/Email.php b/system/libraries/Email.php index 2916b9a13..5f8d48682 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -383,10 +383,10 @@ class CI_Email { //strip slashes only if magic quotes is ON //if we do it with magic quotes OFF, it strips real, user-inputted chars. - if (get_magic_quotes_gpc()) - { + if (get_magic_quotes_gpc()) + { $this->_body = stripslashes($this->_body); - } + } return $this; } -- cgit v1.2.3-24-g4f1b From 75b1f3991013c17cacac18e47879c483fe1cf542 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 20 Oct 2011 10:11:59 +0300 Subject: get_magic_quotes_gpc() to be executed only if PHP version is 5.3 or lower --- system/core/Input.php | 11 +++++++---- system/libraries/Email.php | 10 +++++++--- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/system/core/Input.php b/system/core/Input.php index 5a033e7b8..9bfb5f1fb 100755 --- a/system/core/Input.php +++ b/system/core/Input.php @@ -548,8 +548,12 @@ class CI_Input { return $new_array; } - // We strip slashes if magic quotes is on to keep things consistent - if (function_exists('get_magic_quotes_gpc') AND get_magic_quotes_gpc()) + /* We strip slashes if magic quotes is on to keep things consistent + + NOTE: In PHP 5.4 get_magic_quotes_gpc() will always return 0 and + it will probably not exist in future versions at all. + */ + if ( ! is_php('5.4') && get_magic_quotes_gpc()) { $str = stripslashes($str); } @@ -714,7 +718,6 @@ class CI_Input { } } -// END Input class /* End of file Input.php */ -/* Location: ./system/core/Input.php */ +/* Location: ./system/core/Input.php */ \ No newline at end of file diff --git a/system/libraries/Email.php b/system/libraries/Email.php index 5f8d48682..c8b727c34 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -381,9 +381,13 @@ class CI_Email { { $this->_body = rtrim(str_replace("\r", "", $body)); - //strip slashes only if magic quotes is ON - //if we do it with magic quotes OFF, it strips real, user-inputted chars. - if (get_magic_quotes_gpc()) + /* strip slashes only if magic quotes is ON + if we do it with magic quotes OFF, it strips real, user-inputted chars. + + NOTE: In PHP 5.4 get_magic_quotes_gpc() will always return 0 and + it will probably not exist in future versions at all. + */ + if ( ! is_php('5.4') && get_magic_quotes_gpc()) { $this->_body = stripslashes($this->_body); } -- cgit v1.2.3-24-g4f1b From 3e1df1abe203db8c07ffbd9096aec77c458b80d5 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 7 Oct 2011 21:04:58 +0300 Subject: Cleanup and migrate oci8_driver and oci8_result from deprecated PHP4 to PHP5 style functions --- system/database/drivers/oci8/oci8_driver.php | 144 ++++++++++++++++----------- system/database/drivers/oci8/oci8_result.php | 94 ++++++----------- 2 files changed, 120 insertions(+), 118 deletions(-) diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php index 14df104ff..985466a79 100644 --- a/system/database/drivers/oci8/oci8_driver.php +++ b/system/database/drivers/oci8/oci8_driver.php @@ -35,8 +35,6 @@ * This is a modification of the DB_driver class to * permit access to oracle databases * - * NOTE: this uses the PHP 4 oci methods - * * @author Kelly McArdle * */ @@ -77,9 +75,9 @@ class CI_DB_oci8_driver extends CI_DB { * @access private called by the base class * @return resource */ - function db_connect() + public function db_connect() { - return @ocilogon($this->username, $this->password, $this->hostname); + return @oci_connect($this->username, $this->password, $this->hostname, $this->char_set); } // -------------------------------------------------------------------- @@ -90,9 +88,9 @@ class CI_DB_oci8_driver extends CI_DB { * @access private called by the base class * @return resource */ - function db_pconnect() + public function db_pconnect() { - return @ociplogon($this->username, $this->password, $this->hostname); + return @oci_pconnect($this->username, $this->password, $this->hostname, $this->char_set); } // -------------------------------------------------------------------- @@ -106,9 +104,10 @@ class CI_DB_oci8_driver extends CI_DB { * @access public * @return void */ - function reconnect() + public function reconnect() { // not implemented in oracle + return; } // -------------------------------------------------------------------- @@ -119,8 +118,9 @@ class CI_DB_oci8_driver extends CI_DB { * @access private called by the base class * @return resource */ - function db_select() + public function db_select() { + // Not in Oracle - schemas are actually usernames return TRUE; } @@ -134,7 +134,7 @@ class CI_DB_oci8_driver extends CI_DB { * @param string * @return resource */ - function db_set_charset($charset, $collation) + public function db_set_charset($charset, $collation) { // @todo - add support if needed return TRUE; @@ -148,9 +148,9 @@ class CI_DB_oci8_driver extends CI_DB { * @access public * @return string */ - function _version() + public function _version() { - return ociserverversion($this->conn_id); + return oci_server_version($this->conn_id); } // -------------------------------------------------------------------- @@ -158,18 +158,18 @@ class CI_DB_oci8_driver extends CI_DB { /** * Execute the query * - * @access private called by the base class + * @access public called by the base class * @param string an SQL query * @return resource */ - function _execute($sql) + public function _execute($sql) { // oracle must parse the query before it is run. All of the actions with // the query are based on the statement id returned by ociparse $this->stmt_id = FALSE; $this->_set_stmt_id($sql); - ocisetprefetch($this->stmt_id, 1000); - return @ociexecute($this->stmt_id, $this->_commit); + oci_set_prefetch($this->stmt_id, 1000); + return @oci_execute($this->stmt_id, $this->_commit); } /** @@ -179,11 +179,11 @@ class CI_DB_oci8_driver extends CI_DB { * @param string an SQL query * @return none */ - function _set_stmt_id($sql) + private function _set_stmt_id($sql) { if ( ! is_resource($this->stmt_id)) { - $this->stmt_id = ociparse($this->conn_id, $this->_prep_query($sql)); + $this->stmt_id = oci_parse($this->conn_id, $this->_prep_query($sql)); } } @@ -198,7 +198,7 @@ class CI_DB_oci8_driver extends CI_DB { * @param string an SQL query * @return string */ - function _prep_query($sql) + private function _prep_query($sql) { return $sql; } @@ -211,9 +211,9 @@ class CI_DB_oci8_driver extends CI_DB { * @access public * @return cursor id */ - function get_cursor() + public function get_cursor() { - $this->curs_id = ocinewcursor($this->conn_id); + $this->curs_id = oci_new_cursor($this->conn_id); return $this->curs_id; } @@ -237,7 +237,7 @@ class CI_DB_oci8_driver extends CI_DB { * type yes the type of the parameter * length yes the max size of the parameter */ - function stored_procedure($package, $procedure, $params) + public function stored_procedure($package, $procedure, $params) { if ($package == '' OR $procedure == '' OR ! is_array($params)) { @@ -257,7 +257,7 @@ class CI_DB_oci8_driver extends CI_DB { { $sql .= $param['name'] . ","; - if (array_key_exists('type', $param) && ($param['type'] == OCI_B_CURSOR)) + if (array_key_exists('type', $param) && ($param['type'] === OCI_B_CURSOR)) { $have_cursor = TRUE; } @@ -278,7 +278,7 @@ class CI_DB_oci8_driver extends CI_DB { * @access private * @return none */ - function _bind_params($params) + private function _bind_params($params) { if ( ! is_array($params) OR ! is_resource($this->stmt_id)) { @@ -295,7 +295,7 @@ class CI_DB_oci8_driver extends CI_DB { } } - ocibindbyname($this->stmt_id, $param['name'], $param['value'], $param['length'], $param['type']); + oci_bind_by_name($this->stmt_id, $param['name'], $param['value'], $param['length'], $param['type']); } } @@ -307,7 +307,7 @@ class CI_DB_oci8_driver extends CI_DB { * @access public * @return bool */ - function trans_begin($test_mode = FALSE) + public function trans_begin($test_mode = FALSE) { if ( ! $this->trans_enabled) { @@ -337,7 +337,7 @@ class CI_DB_oci8_driver extends CI_DB { * @access public * @return bool */ - function trans_commit() + public function trans_commit() { if ( ! $this->trans_enabled) { @@ -350,7 +350,7 @@ class CI_DB_oci8_driver extends CI_DB { return TRUE; } - $ret = OCIcommit($this->conn_id); + $ret = oci_commit($this->conn_id); $this->_commit = OCI_COMMIT_ON_SUCCESS; return $ret; } @@ -363,7 +363,7 @@ class CI_DB_oci8_driver extends CI_DB { * @access public * @return bool */ - function trans_rollback() + public function trans_rollback() { if ( ! $this->trans_enabled) { @@ -376,7 +376,7 @@ class CI_DB_oci8_driver extends CI_DB { return TRUE; } - $ret = OCIrollback($this->conn_id); + $ret = oci_rollback($this->conn_id); $this->_commit = OCI_COMMIT_ON_SUCCESS; return $ret; } @@ -391,7 +391,7 @@ class CI_DB_oci8_driver extends CI_DB { * @param bool whether or not the string will be used in a LIKE condition * @return string */ - function escape_str($str, $like = FALSE) + public function escape_str($str, $like = FALSE) { if (is_array($str)) { @@ -424,9 +424,9 @@ class CI_DB_oci8_driver extends CI_DB { * @access public * @return integer */ - function affected_rows() + public function affected_rows() { - return @ocirowcount($this->stmt_id); + return @oci_num_rows($this->stmt_id); } // -------------------------------------------------------------------- @@ -437,7 +437,7 @@ class CI_DB_oci8_driver extends CI_DB { * @access public * @return integer */ - function insert_id() + public function insert_id() { // not supported in oracle return $this->display_error('db_unsupported_function'); @@ -455,7 +455,7 @@ class CI_DB_oci8_driver extends CI_DB { * @param string * @return string */ - function count_all($table = '') + public function count_all($table = '') { if ($table == '') { @@ -480,11 +480,11 @@ class CI_DB_oci8_driver extends CI_DB { * * Generates a platform-specific query string so that the table names can be fetched * - * @access private + * @access public * @param boolean - * @return string + * @return string */ - function _list_tables($prefix_limit = FALSE) + public function _list_tables($prefix_limit = FALSE) { $sql = "SELECT TABLE_NAME FROM ALL_TABLES"; @@ -507,7 +507,7 @@ class CI_DB_oci8_driver extends CI_DB { * @param string the table name * @return string */ - function _list_columns($table = '') + public function _list_columns($table = '') { return "SELECT COLUMN_NAME FROM all_tab_columns WHERE table_name = '$table'"; } @@ -523,7 +523,7 @@ class CI_DB_oci8_driver extends CI_DB { * @param string the table name * @return object */ - function _field_data($table) + public function _field_data($table) { return "SELECT * FROM ".$table." where rownum = 1"; } @@ -533,12 +533,13 @@ class CI_DB_oci8_driver extends CI_DB { /** * The error message string * - * @access private + * @access public * @return string */ - function _error_message() + public function _error_message() { - $error = ocierror($this->conn_id); + // If the error was during connection, no conn_id should be passed + $error = is_resource($this->conn_id) ? oci_error($this->conn_id) : oci_error(); return $error['message']; } @@ -547,12 +548,13 @@ class CI_DB_oci8_driver extends CI_DB { /** * The error message number * - * @access private + * @access public * @return integer */ - function _error_number() + public function _error_number() { - $error = ocierror($this->conn_id); + // Same as _error_message() + $error = is_resource($this->conn_id) ? oci_error($this->conn_id) : oci_error(); return $error['code']; } @@ -563,11 +565,11 @@ class CI_DB_oci8_driver extends CI_DB { * * This function escapes column and table names * - * @access private + * @access public * @param string * @return string */ - function _escape_identifiers($item) + public function _escape_identifiers($item) { if ($this->_escape_char == '') { @@ -610,7 +612,7 @@ class CI_DB_oci8_driver extends CI_DB { * @param type * @return type */ - function _from_tables($tables) + public function _from_tables($tables) { if ( ! is_array($tables)) { @@ -633,9 +635,37 @@ class CI_DB_oci8_driver extends CI_DB { * @param array the insert values * @return string */ - function _insert($table, $keys, $values) + public function _insert($table, $keys, $values) { - return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")"; + return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")"; + } + + // -------------------------------------------------------------------- + + /** + * Insert_batch statement + * + * Generates a platform-specific insert string from the supplied data + * + * @access public + * @param string the table name + * @param array the insert keys + * @param array the insert values + * @return string + */ + public function _insert_batch($table, $keys, $values) + { + $keys = implode(', ', $keys); + $sql = "INSERT ALL\n"; + + for ($i = 0, $c = count($values); $i < $c; $i++) + { + $sql .= ' INTO ' . $table . ' (' . $keys . ') VALUES ' . $values[$i] . "\n"; + } + + $sql .= 'SELECT * FROM dual'; + + return $sql; } // -------------------------------------------------------------------- @@ -653,7 +683,7 @@ class CI_DB_oci8_driver extends CI_DB { * @param array the limit clause * @return string */ - function _update($table, $values, $where, $orderby = array(), $limit = FALSE) + public function _update($table, $values, $where, $orderby = array(), $limit = FALSE) { foreach ($values as $key => $val) { @@ -686,7 +716,7 @@ class CI_DB_oci8_driver extends CI_DB { * @param string the table name * @return string */ - function _truncate($table) + public function _truncate($table) { return "TRUNCATE TABLE ".$table; } @@ -704,7 +734,7 @@ class CI_DB_oci8_driver extends CI_DB { * @param string the limit clause * @return string */ - function _delete($table, $where = array(), $like = array(), $limit = FALSE) + public function _delete($table, $where = array(), $like = array(), $limit = FALSE) { $conditions = ''; @@ -738,7 +768,7 @@ class CI_DB_oci8_driver extends CI_DB { * @param integer the offset value * @return string */ - function _limit($sql, $limit, $offset) + public function _limit($sql, $limit, $offset) { $limit = $offset + $limit; $newsql = "SELECT * FROM (select inner_query.*, rownum rnum FROM ($sql) inner_query WHERE rownum < $limit)"; @@ -763,9 +793,9 @@ class CI_DB_oci8_driver extends CI_DB { * @param resource * @return void */ - function _close($conn_id) + public function _close($conn_id) { - @ocilogoff($conn_id); + @oci_close($conn_id); } @@ -774,4 +804,4 @@ class CI_DB_oci8_driver extends CI_DB { /* End of file oci8_driver.php */ -/* Location: ./system/database/drivers/oci8/oci8_driver.php */ \ No newline at end of file +/* Location: ./system/database/drivers/oci8/oci8_driver.php */ diff --git a/system/database/drivers/oci8/oci8_result.php b/system/database/drivers/oci8/oci8_result.php index 88531b436..7de1153ba 100644 --- a/system/database/drivers/oci8/oci8_result.php +++ b/system/database/drivers/oci8/oci8_result.php @@ -40,14 +40,17 @@ class CI_DB_oci8_result extends CI_DB_result { * @access public * @return integer */ - function num_rows() + public function num_rows() { - $rowcount = count($this->result_array()); - @ociexecute($this->stmt_id); - - if ($this->curs_id) + if ($this->num_rows === 0 && count($this->result_array()) > 0) { - @ociexecute($this->curs_id); + $this->num_rows = count($this->result_array()); + @oci_execute($this->stmt_id); + + if ($this->curs_id) + { + @oci_execute($this->curs_id); + } } return $rowcount; @@ -61,9 +64,9 @@ class CI_DB_oci8_result extends CI_DB_result { * @access public * @return integer */ - function num_fields() + public function num_fields() { - $count = @ocinumcols($this->stmt_id); + $count = @oci_num_fields($this->stmt_id); // if we used a limit we subtract it if ($this->limit_used) @@ -84,13 +87,12 @@ class CI_DB_oci8_result extends CI_DB_result { * @access public * @return array */ - function list_fields() + public function list_fields() { $field_names = array(); - $fieldCount = $this->num_fields(); - for ($c = 1; $c <= $fieldCount; $c++) + for ($c = 1, $fieldCount = $this->num_fields(); $c <= $fieldCount; $c++) { - $field_names[] = ocicolumnname($this->stmt_id, $c); + $field_names[] = oci_field_name($this->stmt_id, $c); } return $field_names; } @@ -105,16 +107,15 @@ class CI_DB_oci8_result extends CI_DB_result { * @access public * @return array */ - function field_data() + public function field_data() { $retval = array(); - $fieldCount = $this->num_fields(); - for ($c = 1; $c <= $fieldCount; $c++) + for ($c = 1, $fieldCount = $this->num_fields(); $c <= $fieldCount; $c++) { - $F = new stdClass(); - $F->name = ocicolumnname($this->stmt_id, $c); - $F->type = ocicolumntype($this->stmt_id, $c); - $F->max_length = ocicolumnsize($this->stmt_id, $c); + $F = new stdClass(); + $F->name = oci_field_name($this->stmt_id, $c); + $F->type = oci_field_type($this->stmt_id, $c); + $F->max_length = oci_field_size($this->stmt_id, $c); $retval[] = $F; } @@ -129,11 +130,11 @@ class CI_DB_oci8_result extends CI_DB_result { * * @return null */ - function free_result() + public function free_result() { if (is_resource($this->result_id)) { - ocifreestatement($this->result_id); + oci_free_statement($this->result_id); $this->result_id = FALSE; } } @@ -145,14 +146,13 @@ class CI_DB_oci8_result extends CI_DB_result { * * Returns the result set as an array * - * @access private + * @access public * @return array */ - function _fetch_assoc(&$row) + public function _fetch_assoc() { $id = ($this->curs_id) ? $this->curs_id : $this->stmt_id; - - return ocifetchinto($id, $row, OCI_ASSOC + OCI_RETURN_NULLS); + return oci_fetch_assoc($id); } // -------------------------------------------------------------------- @@ -162,41 +162,13 @@ class CI_DB_oci8_result extends CI_DB_result { * * Returns the result set as an object * - * @access private + * @access public * @return object */ - function _fetch_object() + public function _fetch_object() { - $result = array(); - - // If PHP 5 is being used we can fetch an result object - if (function_exists('oci_fetch_object')) - { - $id = ($this->curs_id) ? $this->curs_id : $this->stmt_id; - - return @oci_fetch_object($id); - } - - // If PHP 4 is being used we have to build our own result - foreach ($this->result_array() as $key => $val) - { - $obj = new stdClass(); - if (is_array($val)) - { - foreach ($val as $k => $v) - { - $obj->$k = $v; - } - } - else - { - $obj->$key = $val; - } - - $result[] = $obj; - } - - return $result; + $id = ($this->curs_id) ? $this->curs_id : $this->stmt_id; + return @oci_fetch_object($id); } // -------------------------------------------------------------------- @@ -207,7 +179,7 @@ class CI_DB_oci8_result extends CI_DB_result { * @access public * @return array */ - function result_array() + public function result_array() { if (count($this->result_array) > 0) { @@ -217,7 +189,7 @@ class CI_DB_oci8_result extends CI_DB_result { // oracle's fetch functions do not return arrays. // The information is returned in reference parameters $row = NULL; - while ($this->_fetch_assoc($row)) + while ($row = $this->_fetch_assoc()) { $this->result_array[] = $row; } @@ -234,10 +206,10 @@ class CI_DB_oci8_result extends CI_DB_result { * this internally before fetching results to make sure the * result set starts at zero * - * @access private + * @access public * @return array */ - function _data_seek($n = 0) + public function _data_seek($n = 0) { return FALSE; // Not needed } -- cgit v1.2.3-24-g4f1b From c622a4155d912ad53143f5de94298eb8e60ba3e7 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 7 Oct 2011 21:17:11 +0300 Subject: Remove another 2 old comments --- system/database/drivers/oci8/oci8_result.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/system/database/drivers/oci8/oci8_result.php b/system/database/drivers/oci8/oci8_result.php index 7de1153ba..ea5f77537 100644 --- a/system/database/drivers/oci8/oci8_result.php +++ b/system/database/drivers/oci8/oci8_result.php @@ -186,8 +186,6 @@ class CI_DB_oci8_result extends CI_DB_result { return $this->result_array; } - // oracle's fetch functions do not return arrays. - // The information is returned in reference parameters $row = NULL; while ($row = $this->_fetch_assoc()) { @@ -218,4 +216,4 @@ class CI_DB_oci8_result extends CI_DB_result { /* End of file oci8_result.php */ -/* Location: ./system/database/drivers/oci8/oci8_result.php */ \ No newline at end of file +/* Location: ./system/database/drivers/oci8/oci8_result.php */ -- cgit v1.2.3-24-g4f1b From cfe49186f26cd7bb6410abd4f1069b49325dc0e9 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 20 Oct 2011 09:44:48 +0300 Subject: Some public and protected method declarations --- system/database/DB_result.php | 46 ++++++++++----------- system/database/drivers/oci8/oci8_driver.php | 60 ++++++++++++++-------------- system/database/drivers/oci8/oci8_result.php | 12 +++--- 3 files changed, 59 insertions(+), 59 deletions(-) diff --git a/system/database/DB_result.php b/system/database/DB_result.php index 0c4e78105..48d66c8e4 100644 --- a/system/database/DB_result.php +++ b/system/database/DB_result.php @@ -45,7 +45,7 @@ class CI_DB_result { * @param string can be "object" or "array" * @return mixed either a result object or array */ - function result($type = 'object') + public function result($type = 'object') { if ($type == 'array') return $this->result_array(); else if ($type == 'object') return $this->result_object(); @@ -60,7 +60,7 @@ class CI_DB_result { * @param class_name A string that represents the type of object you want back * @return array of objects */ - function custom_result_object($class_name) + public function custom_result_object($class_name) { if (array_key_exists($class_name, $this->custom_result_object)) { @@ -79,12 +79,12 @@ class CI_DB_result { while ($row = $this->_fetch_object()) { $object = new $class_name(); - + foreach ($row as $key => $value) { $object->$key = $value; } - + $result_object[] = $object; } @@ -100,7 +100,7 @@ class CI_DB_result { * @access public * @return object */ - function result_object() + public function result_object() { if (count($this->result_object) > 0) { @@ -132,7 +132,7 @@ class CI_DB_result { * @access public * @return array */ - function result_array() + public function result_array() { if (count($this->result_array) > 0) { @@ -166,7 +166,7 @@ class CI_DB_result { * @param string can be "object" or "array" * @return mixed either a result object or array */ - function row($n = 0, $type = 'object') + public function row($n = 0, $type = 'object') { if ( ! is_numeric($n)) { @@ -198,7 +198,7 @@ class CI_DB_result { * @access public * @return object */ - function set_row($key, $value = NULL) + public function set_row($key, $value = NULL) { // We cache the row data for subsequent uses if ( ! is_array($this->row_data)) @@ -230,7 +230,7 @@ class CI_DB_result { * @access public * @return object */ - function custom_row_object($n, $type) + public function custom_row_object($n, $type) { $result = $this->custom_result_object($type); @@ -253,7 +253,7 @@ class CI_DB_result { * @access public * @return object */ - function row_object($n = 0) + public function row_object($n = 0) { $result = $this->result_object(); @@ -278,7 +278,7 @@ class CI_DB_result { * @access public * @return array */ - function row_array($n = 0) + public function row_array($n = 0) { $result = $this->result_array(); @@ -304,7 +304,7 @@ class CI_DB_result { * @access public * @return object */ - function first_row($type = 'object') + public function first_row($type = 'object') { $result = $this->result($type); @@ -323,7 +323,7 @@ class CI_DB_result { * @access public * @return object */ - function last_row($type = 'object') + public function last_row($type = 'object') { $result = $this->result($type); @@ -342,7 +342,7 @@ class CI_DB_result { * @access public * @return object */ - function next_row($type = 'object') + public function next_row($type = 'object') { $result = $this->result($type); @@ -367,7 +367,7 @@ class CI_DB_result { * @access public * @return object */ - function previous_row($type = 'object') + public function previous_row($type = 'object') { $result = $this->result($type); @@ -394,14 +394,14 @@ class CI_DB_result { * operational due to the unavailability of the database resource IDs with * cached results. */ - function num_rows() { return $this->num_rows; } - function num_fields() { return 0; } - function list_fields() { return array(); } - function field_data() { return array(); } - function free_result() { return TRUE; } - function _data_seek() { return TRUE; } - function _fetch_assoc() { return array(); } - function _fetch_object() { return array(); } + public function num_rows() { return $this->num_rows; } + public function num_fields() { return 0; } + public function list_fields() { return array(); } + public function field_data() { return array(); } + public function free_result() { return TRUE; } + protected function _data_seek() { return TRUE; } + protected function _fetch_assoc() { return array(); } + protected function _fetch_object() { return array(); } } // END DB_result class diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php index 985466a79..b4da3e965 100644 --- a/system/database/drivers/oci8/oci8_driver.php +++ b/system/database/drivers/oci8/oci8_driver.php @@ -145,10 +145,10 @@ class CI_DB_oci8_driver extends CI_DB { /** * Version number query string * - * @access public + * @access protected * @return string */ - public function _version() + protected function _version() { return oci_server_version($this->conn_id); } @@ -158,11 +158,11 @@ class CI_DB_oci8_driver extends CI_DB { /** * Execute the query * - * @access public called by the base class + * @access protected called by the base class * @param string an SQL query * @return resource */ - public function _execute($sql) + protected function _execute($sql) { // oracle must parse the query before it is run. All of the actions with // the query are based on the statement id returned by ociparse @@ -480,11 +480,11 @@ class CI_DB_oci8_driver extends CI_DB { * * Generates a platform-specific query string so that the table names can be fetched * - * @access public + * @access protected * @param boolean * @return string */ - public function _list_tables($prefix_limit = FALSE) + protected function _list_tables($prefix_limit = FALSE) { $sql = "SELECT TABLE_NAME FROM ALL_TABLES"; @@ -503,11 +503,11 @@ class CI_DB_oci8_driver extends CI_DB { * * Generates a platform-specific query string so that the column names can be fetched * - * @access public + * @access protected * @param string the table name * @return string */ - public function _list_columns($table = '') + protected function _list_columns($table = '') { return "SELECT COLUMN_NAME FROM all_tab_columns WHERE table_name = '$table'"; } @@ -523,7 +523,7 @@ class CI_DB_oci8_driver extends CI_DB { * @param string the table name * @return object */ - public function _field_data($table) + protected function _field_data($table) { return "SELECT * FROM ".$table." where rownum = 1"; } @@ -533,10 +533,10 @@ class CI_DB_oci8_driver extends CI_DB { /** * The error message string * - * @access public + * @access protected * @return string */ - public function _error_message() + protected function _error_message() { // If the error was during connection, no conn_id should be passed $error = is_resource($this->conn_id) ? oci_error($this->conn_id) : oci_error(); @@ -548,10 +548,10 @@ class CI_DB_oci8_driver extends CI_DB { /** * The error message number * - * @access public + * @access protected * @return integer */ - public function _error_number() + protected function _error_number() { // Same as _error_message() $error = is_resource($this->conn_id) ? oci_error($this->conn_id) : oci_error(); @@ -565,11 +565,11 @@ class CI_DB_oci8_driver extends CI_DB { * * This function escapes column and table names * - * @access public + * @access protected * @param string * @return string */ - public function _escape_identifiers($item) + protected function _escape_identifiers($item) { if ($this->_escape_char == '') { @@ -608,11 +608,11 @@ class CI_DB_oci8_driver extends CI_DB { * This function implicitly groups FROM tables so there is no confusion * about operator precedence in harmony with SQL standards * - * @access public + * @access protected * @param type * @return type */ - public function _from_tables($tables) + protected function _from_tables($tables) { if ( ! is_array($tables)) { @@ -635,7 +635,7 @@ class CI_DB_oci8_driver extends CI_DB { * @param array the insert values * @return string */ - public function _insert($table, $keys, $values) + protected function _insert($table, $keys, $values) { return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")"; } @@ -647,13 +647,13 @@ class CI_DB_oci8_driver extends CI_DB { * * Generates a platform-specific insert string from the supplied data * - * @access public + * @access protected * @param string the table name * @param array the insert keys * @param array the insert values * @return string */ - public function _insert_batch($table, $keys, $values) + protected function _insert_batch($table, $keys, $values) { $keys = implode(', ', $keys); $sql = "INSERT ALL\n"; @@ -675,7 +675,7 @@ class CI_DB_oci8_driver extends CI_DB { * * Generates a platform-specific update string from the supplied data * - * @access public + * @access protected * @param string the table name * @param array the update data * @param array the where clause @@ -683,7 +683,7 @@ class CI_DB_oci8_driver extends CI_DB { * @param array the limit clause * @return string */ - public function _update($table, $values, $where, $orderby = array(), $limit = FALSE) + protected function _update($table, $values, $where, $orderby = array(), $limit = FALSE) { foreach ($values as $key => $val) { @@ -712,11 +712,11 @@ class CI_DB_oci8_driver extends CI_DB { * If the database does not support the truncate() command * This function maps to "DELETE FROM table" * - * @access public + * @access protected * @param string the table name * @return string */ - public function _truncate($table) + protected function _truncate($table) { return "TRUNCATE TABLE ".$table; } @@ -728,13 +728,13 @@ class CI_DB_oci8_driver extends CI_DB { * * Generates a platform-specific delete string from the supplied data * - * @access public + * @access protected * @param string the table name * @param array the where clause * @param string the limit clause * @return string */ - public function _delete($table, $where = array(), $like = array(), $limit = FALSE) + protected function _delete($table, $where = array(), $like = array(), $limit = FALSE) { $conditions = ''; @@ -762,13 +762,13 @@ class CI_DB_oci8_driver extends CI_DB { * * Generates a platform-specific LIMIT clause * - * @access public + * @access protected * @param string the sql query string * @param integer the number of rows to limit the query to * @param integer the offset value * @return string */ - public function _limit($sql, $limit, $offset) + protected function _limit($sql, $limit, $offset) { $limit = $offset + $limit; $newsql = "SELECT * FROM (select inner_query.*, rownum rnum FROM ($sql) inner_query WHERE rownum < $limit)"; @@ -789,11 +789,11 @@ class CI_DB_oci8_driver extends CI_DB { /** * Close DB Connection * - * @access public + * @access protected * @param resource * @return void */ - public function _close($conn_id) + protected function _close($conn_id) { @oci_close($conn_id); } diff --git a/system/database/drivers/oci8/oci8_result.php b/system/database/drivers/oci8/oci8_result.php index ea5f77537..ae133d7b5 100644 --- a/system/database/drivers/oci8/oci8_result.php +++ b/system/database/drivers/oci8/oci8_result.php @@ -146,10 +146,10 @@ class CI_DB_oci8_result extends CI_DB_result { * * Returns the result set as an array * - * @access public + * @access protected * @return array */ - public function _fetch_assoc() + protected function _fetch_assoc() { $id = ($this->curs_id) ? $this->curs_id : $this->stmt_id; return oci_fetch_assoc($id); @@ -162,10 +162,10 @@ class CI_DB_oci8_result extends CI_DB_result { * * Returns the result set as an object * - * @access public + * @access protected * @return object */ - public function _fetch_object() + protected function _fetch_object() { $id = ($this->curs_id) ? $this->curs_id : $this->stmt_id; return @oci_fetch_object($id); @@ -204,10 +204,10 @@ class CI_DB_oci8_result extends CI_DB_result { * this internally before fetching results to make sure the * result set starts at zero * - * @access public + * @access protected * @return array */ - public function _data_seek($n = 0) + protected function _data_seek($n = 0) { return FALSE; // Not needed } -- cgit v1.2.3-24-g4f1b From 9c63d0bb34be4007178d5a7e46348d5e23fee3ff Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Thu, 27 Oct 2011 01:55:44 +0100 Subject: Bumped CodeIgniter version to 2.1.0. --- system/core/CodeIgniter.php | 2 +- user_guide/changelog.html | 2 +- user_guide/database/active_record.html | 2 +- user_guide/database/caching.html | 2 +- user_guide/database/call_function.html | 2 +- user_guide/database/configuration.html | 2 +- user_guide/database/connecting.html | 2 +- user_guide/database/examples.html | 2 +- user_guide/database/fields.html | 2 +- user_guide/database/forge.html | 2 +- user_guide/database/helpers.html | 2 +- user_guide/database/index.html | 2 +- user_guide/database/queries.html | 2 +- user_guide/database/results.html | 2 +- user_guide/database/table_data.html | 2 +- user_guide/database/transactions.html | 2 +- user_guide/database/utilities.html | 2 +- user_guide/doc_style/index.html | 2 +- user_guide/general/alternative_php.html | 2 +- user_guide/general/ancillary_classes.html | 2 +- user_guide/general/autoloader.html | 2 +- user_guide/general/caching.html | 2 +- user_guide/general/cli.html | 2 +- user_guide/general/common_functions.html | 2 +- user_guide/general/controllers.html | 2 +- user_guide/general/core_classes.html | 2 +- user_guide/general/creating_drivers.html | 2 +- user_guide/general/creating_libraries.html | 2 +- user_guide/general/credits.html | 2 +- user_guide/general/drivers.html | 2 +- user_guide/general/environments.html | 2 +- user_guide/general/errors.html | 2 +- user_guide/general/helpers.html | 2 +- user_guide/general/hooks.html | 2 +- user_guide/general/libraries.html | 2 +- user_guide/general/managing_apps.html | 2 +- user_guide/general/models.html | 2 +- user_guide/general/profiling.html | 2 +- user_guide/general/quick_reference.html | 2 +- user_guide/general/requirements.html | 2 +- user_guide/general/reserved_names.html | 2 +- user_guide/general/routing.html | 2 +- user_guide/general/security.html | 2 +- user_guide/general/styleguide.html | 2 +- user_guide/general/urls.html | 2 +- user_guide/general/views.html | 2 +- user_guide/helpers/array_helper.html | 2 +- user_guide/helpers/captcha_helper.html | 2 +- user_guide/helpers/cookie_helper.html | 2 +- user_guide/helpers/date_helper.html | 2 +- user_guide/helpers/directory_helper.html | 2 +- user_guide/helpers/download_helper.html | 2 +- user_guide/helpers/email_helper.html | 2 +- user_guide/helpers/file_helper.html | 2 +- user_guide/helpers/form_helper.html | 2 +- user_guide/helpers/html_helper.html | 2 +- user_guide/helpers/inflector_helper.html | 2 +- user_guide/helpers/language_helper.html | 2 +- user_guide/helpers/number_helper.html | 2 +- user_guide/helpers/path_helper.html | 2 +- user_guide/helpers/security_helper.html | 2 +- user_guide/helpers/smiley_helper.html | 2 +- user_guide/helpers/string_helper.html | 2 +- user_guide/helpers/text_helper.html | 2 +- user_guide/helpers/typography_helper.html | 2 +- user_guide/helpers/xml_helper.html | 2 +- user_guide/index.html | 2 +- user_guide/installation/downloads.html | 2 +- user_guide/installation/index.html | 2 +- user_guide/installation/troubleshooting.html | 2 +- user_guide/installation/upgrade_120.html | 2 +- user_guide/installation/upgrade_130.html | 2 +- user_guide/installation/upgrade_131.html | 2 +- user_guide/installation/upgrade_132.html | 2 +- user_guide/installation/upgrade_133.html | 2 +- user_guide/installation/upgrade_140.html | 2 +- user_guide/installation/upgrade_141.html | 2 +- user_guide/installation/upgrade_150.html | 2 +- user_guide/installation/upgrade_152.html | 2 +- user_guide/installation/upgrade_153.html | 2 +- user_guide/installation/upgrade_154.html | 2 +- user_guide/installation/upgrade_160.html | 2 +- user_guide/installation/upgrade_161.html | 2 +- user_guide/installation/upgrade_162.html | 2 +- user_guide/installation/upgrade_163.html | 2 +- user_guide/installation/upgrade_170.html | 2 +- user_guide/installation/upgrade_171.html | 2 +- user_guide/installation/upgrade_172.html | 2 +- user_guide/installation/upgrade_200.html | 2 +- user_guide/installation/upgrade_201.html | 2 +- user_guide/installation/upgrade_202.html | 2 +- user_guide/installation/upgrade_203.html | 8 +- user_guide/installation/upgrade_b11.html | 2 +- user_guide/installation/upgrading.html | 4 +- user_guide/libraries/benchmark.html | 2 +- user_guide/libraries/caching.html | 2 +- user_guide/libraries/calendar.html | 2 +- user_guide/libraries/cart.html | 2 +- user_guide/libraries/config.html | 2 +- user_guide/libraries/email.html | 2 +- user_guide/libraries/encryption.html | 2 +- user_guide/libraries/file_uploading.html | 2 +- user_guide/libraries/form_validation.html | 2 +- user_guide/libraries/ftp.html | 2 +- user_guide/libraries/image_lib.html | 2 +- user_guide/libraries/input.html | 2 +- user_guide/libraries/javascript.html | 2 +- user_guide/libraries/language.html | 2 +- user_guide/libraries/loader.html | 2 +- user_guide/libraries/migration.html | 176 +++++++++++++++++++++++++++ user_guide/libraries/output.html | 2 +- user_guide/libraries/pagination.html | 2 +- user_guide/libraries/parser.html | 2 +- user_guide/libraries/security.html | 2 +- user_guide/libraries/sessions.html | 2 +- user_guide/libraries/table.html | 2 +- user_guide/libraries/trackback.html | 2 +- user_guide/libraries/typography.html | 2 +- user_guide/libraries/unit_testing.html | 2 +- user_guide/libraries/uri.html | 2 +- user_guide/libraries/user_agent.html | 2 +- user_guide/libraries/xmlrpc.html | 2 +- user_guide/libraries/zip.html | 2 +- user_guide/license.html | 2 +- user_guide/overview/appflow.html | 2 +- user_guide/overview/at_a_glance.html | 2 +- user_guide/overview/cheatsheets.html | 2 +- user_guide/overview/features.html | 2 +- user_guide/overview/getting_started.html | 2 +- user_guide/overview/goals.html | 2 +- user_guide/overview/index.html | 2 +- user_guide/overview/mvc.html | 2 +- user_guide/tutorial/conclusion.html | 2 +- user_guide/tutorial/create_news_items.html | 2 +- user_guide/tutorial/hard_coded_pages.html | 2 +- user_guide/tutorial/index.html | 2 +- user_guide/tutorial/news_section.html | 2 +- user_guide/tutorial/static_pages.html | 2 +- 138 files changed, 317 insertions(+), 141 deletions(-) create mode 100644 user_guide/libraries/migration.html diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php index 0a1391d18..d9977e1ca 100755 --- a/system/core/CodeIgniter.php +++ b/system/core/CodeIgniter.php @@ -39,7 +39,7 @@ * @var string * */ - define('CI_VERSION', '2.0.2'); + define('CI_VERSION', '2.1.0'); /** * CodeIgniter Branch (Core = TRUE, Reactor = FALSE) diff --git a/user_guide/changelog.html b/user_guide/changelog.html index b0da1ac53..35946a217 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -28,7 +28,7 @@
      - +

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

      diff --git a/user_guide/database/active_record.html b/user_guide/database/active_record.html index 3f44fcd5b..074f869b4 100644 --- a/user_guide/database/active_record.html +++ b/user_guide/database/active_record.html @@ -27,7 +27,7 @@
      - +

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

      diff --git a/user_guide/database/results.html b/user_guide/database/results.html index ec5f97762..a6b85d8c4 100644 --- a/user_guide/database/results.html +++ b/user_guide/database/results.html @@ -28,7 +28,7 @@
      - +

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

      diff --git a/user_guide/general/cli.html b/user_guide/general/cli.html index befc9994a..70ab13802 100644 --- a/user_guide/general/cli.html +++ b/user_guide/general/cli.html @@ -28,7 +28,7 @@
      - +

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

      diff --git a/user_guide/general/common_functions.html b/user_guide/general/common_functions.html index 65457759d..2751133bb 100644 --- a/user_guide/general/common_functions.html +++ b/user_guide/general/common_functions.html @@ -28,7 +28,7 @@
      - +

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

      diff --git a/user_guide/installation/downloads.html b/user_guide/installation/downloads.html index f36b2bc0f..5420dec8d 100644 --- a/user_guide/installation/downloads.html +++ b/user_guide/installation/downloads.html @@ -28,7 +28,7 @@
      - +

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

      diff --git a/user_guide/installation/upgrade_203.html b/user_guide/installation/upgrade_203.html index 7dbc907ea..2a0ab52be 100644 --- a/user_guide/installation/upgrade_203.html +++ b/user_guide/installation/upgrade_203.html @@ -3,7 +3,7 @@ -Upgrading from 2.0.2 to 2.0.3 : CodeIgniter User Guide +Upgrading from 2.0.2 to 2.1.0 : CodeIgniter User Guide @@ -28,7 +28,7 @@
      - +

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

      @@ -42,7 +42,7 @@ CodeIgniter Home  ›  User Guide Home  ›  -Upgrading from 2.0.2 to 2.0.3 +Upgrading from 2.0.2 to 2.1.0
      Search User Guide   
      @@ -55,7 +55,7 @@ Upgrading from 2.0.2 to 2.0.3
      -

      Upgrading from 2.0.2 to 2.0.3

      +

      Upgrading from 2.0.2 to 2.1.0

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

      diff --git a/user_guide/installation/upgrade_b11.html b/user_guide/installation/upgrade_b11.html index 7cf06cd9d..dc3c1f07c 100644 --- a/user_guide/installation/upgrade_b11.html +++ b/user_guide/installation/upgrade_b11.html @@ -28,7 +28,7 @@
      - +

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

      diff --git a/user_guide/installation/upgrading.html b/user_guide/installation/upgrading.html index 58a45ee9d..d69b6bc9c 100644 --- a/user_guide/installation/upgrading.html +++ b/user_guide/installation/upgrading.html @@ -28,7 +28,7 @@
      - +

      CodeIgniter User Guide Version 2.0.3

      CodeIgniter User Guide Version 2.1.0

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

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

        -
      • Upgrading from 2.0.2 to 2.0.3
      • +
      • Upgrading from 2.0.2 to 2.1.0
      • Upgrading from 2.0.1 to 2.0.2
      • Upgrading from 2.0 to 2.0.1
      • Upgrading from 1.7.2 to 2.0
      • diff --git a/user_guide/libraries/benchmark.html b/user_guide/libraries/benchmark.html index c7b7ec9a7..602e6fac0 100644 --- a/user_guide/libraries/benchmark.html +++ b/user_guide/libraries/benchmark.html @@ -28,7 +28,7 @@
        - +

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

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

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

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

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

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

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

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

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

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

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

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

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

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

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

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

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

        diff --git a/user_guide/libraries/ftp.html b/user_guide/libraries/ftp.html index 6c7ed5c65..3dbb0530e 100644 --- a/user_guide/libraries/ftp.html +++ b/user_guide/libraries/ftp.html @@ -28,7 +28,7 @@
        - +

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

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

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

        diff --git a/user_guide/libraries/input.html b/user_guide/libraries/input.html index 311f76ee9..cfb0d5e1e 100644 --- a/user_guide/libraries/input.html +++ b/user_guide/libraries/input.html @@ -28,7 +28,7 @@
        - +

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

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

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

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

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

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

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

        diff --git a/user_guide/libraries/migration.html b/user_guide/libraries/migration.html new file mode 100644 index 000000000..ed99044d1 --- /dev/null +++ b/user_guide/libraries/migration.html @@ -0,0 +1,176 @@ + + + + + +Migration Class : CodeIgniter User Guide + + + + + + + + + + + + + + + + + + + + + +
        + + + + + +

        CodeIgniter User Guide Version 2.1.0

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

        Migration Class

        + +

        Migrations are a convenient way for you to alter your database in a structured and organized manner. You could edit fragments of SQL by hand but you would then be responsible for telling other developers that they need to go and run them. You’d also have to keep track of which changes need to be run against the production machines next time you deploy.

        + +

        The database table migration tracks which migrations have already been run so all you have to do is update your application files and call $this->migrate->current() to work out which migrations should be run. The current version is found in config/migration.php.

        + +

        Create a Migration

        + +

        This will be the first migration for a new site which has a blog. All migrations go in the folder application/migrations/ and have names such as: 001_add_blog.php.

        + +
        +defined('BASEPATH') OR exit('No direct script access allowed');
        +
        +class Migration_Add_blog extends CI_Migration {
        +
        +	public function up()
        +	{
        +		$this->dbforge->add_field(array(
        +			'blog_id' => array(
        +				'type' => 'INT',
        +				'constraint' => 5,
        +				'unsigned' => TRUE,
        +				'auto_increment' => TRUE
        +			),
        +			'blog_title' => array(
        +				'type' => 'VARCHAR',
        +				'constraint' => '100',
        +			),
        +			'blog_description' => array(
        +				'type' => 'TEXT',
        +				'null' => TRUE,
        +			),
        +		));
        +		
        +		$this->dbforge->create_table('blog');
        +	}
        +
        +	public function down()
        +	{
        +		$this->dbforge->drop_table('blog');
        +	}
        +
        + +

        Then in application/config/migration.php set $config['migration_version'] = 1;. + +

        Usage Example

        + +

        In this example some simple code is placed in application/controllers/migrate.php to update the schema.

        + +
        +$this->load->library('migration');
        +
        +if ( ! $this->migration->current())
        +{
        +	show_error($this->migration->error_string());
        +}
        +
        + + +

        Function Reference

        + +

        $this->migration->current()

        + +

        The current migration is whatever is set for $config['migration_version'] in application/config/migration.php.

        + + +

        $this->migration->latest()

        + +

        This works much the same way as current() but instead of looking for the $config['migration_version'] the Migration class will use the very newest migration found in the filesystem.

        + +

        $this->migration->version()

        + +

        Version can be used to roll back changes or step forwards programmatically to specific versions. It works just like current but ignores $config['migration_version'].

        + +
        +$this->load->library('migration');
        +
        +$this->migration->version(5);
        +
        + +

        Migration Preferences

        + +

        The following is a list of all the config options for migrations.

        + + + + + + + + + + + + + + + +
        PreferenceDefault ValueOptionsDescription
        migration_enabledFALSETRUE / FALSEEnable or disable migrations.
        migration_version0NoneThe current version your database should use.
        migration_pathAPPPATH.'migrations/'NoneThe path to your migrations folder.
        + + +
        + + + + + + + \ No newline at end of file diff --git a/user_guide/libraries/output.html b/user_guide/libraries/output.html index 7361d7961..77fe464ce 100644 --- a/user_guide/libraries/output.html +++ b/user_guide/libraries/output.html @@ -28,7 +28,7 @@
        - +

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

        diff --git a/user_guide/libraries/pagination.html b/user_guide/libraries/pagination.html index 196555441..b5f971f5a 100644 --- a/user_guide/libraries/pagination.html +++ b/user_guide/libraries/pagination.html @@ -28,7 +28,7 @@
        - +

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

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

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

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

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

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

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

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

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

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

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

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

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

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

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

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

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

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

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

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

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

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

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

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

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

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

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

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

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

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

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

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

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

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

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

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

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

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

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

        diff --git a/user_guide/overview/mvc.html b/user_guide/overview/mvc.html index 4721cbf67..4aebb1095 100644 --- a/user_guide/overview/mvc.html +++ b/user_guide/overview/mvc.html @@ -28,7 +28,7 @@
        - +

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

        diff --git a/user_guide/tutorial/conclusion.html b/user_guide/tutorial/conclusion.html index ccf89175f..9cf146746 100644 --- a/user_guide/tutorial/conclusion.html +++ b/user_guide/tutorial/conclusion.html @@ -28,7 +28,7 @@
        - +

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

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

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

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

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

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

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

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

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

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

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

        -- cgit v1.2.3-24-g4f1b From 5543fd7ba20a1ddc9bdd0fb9505c1de310e9b833 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Thu, 27 Oct 2011 01:55:56 +0100 Subject: Added long missing Migration documentation. --- application/config/migration.php | 5 ++--- user_guide/nav/nav.js | 1 + user_guide/toc.html | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/application/config/migration.php b/application/config/migration.php index dba870010..afa264562 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -4,9 +4,8 @@ | Enable/Disable Migrations |-------------------------------------------------------------------------- | -| Migrations are disabled by default for security reasons. -| You should enable migrations whenever you intend to do a schema migration -| and disable it back when you're done. +| Migrations are disabled by default but should be enabled +| whenever you intend to do a schema migration. | */ $config['migration_enabled'] = FALSE; diff --git a/user_guide/nav/nav.js b/user_guide/nav/nav.js index bc668ec27..b9b6e0943 100644 --- a/user_guide/nav/nav.js +++ b/user_guide/nav/nav.js @@ -103,6 +103,7 @@ function create_menu(basepath) '
      • Javascript Class
      • ' + '
      • Loader Class
      • ' + '
      • Language Class
      • ' + + '
      • Migration Class
      • ' + '
      • Output Class
      • ' + '
      • Pagination Class
      • ' + '
      • Security Class
      • ' + diff --git a/user_guide/toc.html b/user_guide/toc.html index bd6aaf510..01b5a7b92 100644 --- a/user_guide/toc.html +++ b/user_guide/toc.html @@ -29,7 +29,7 @@
        - +

        CodeIgniter User Guide Version 2.0.3

        CodeIgniter User Guide Version 2.1.0

        @@ -157,6 +157,7 @@ Table of Contents
      • Javascript Class
      • Loader Class
      • Language Class
      • +
      • Migration Class
      • Output Class
      • Pagination Class
      • Security Class
      • -- cgit v1.2.3-24-g4f1b From c53eb99a7cc5a49d2de7e96445146d88cf873f90 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Thu, 27 Oct 2011 01:59:29 +0100 Subject: Removed PEAR snipe. --- user_guide/index.html | 1 - 1 file changed, 1 deletion(-) diff --git a/user_guide/index.html b/user_guide/index.html index ac6d0f7f6..fa90983e1 100644 --- a/user_guide/index.html +++ b/user_guide/index.html @@ -77,7 +77,6 @@ minimizing the amount of code needed for a given task.

      • You want a framework that requires nearly zero configuration.
      • You want a framework that does not require you to use the command line.
      • You want a framework that does not require you to adhere to restrictive coding rules.
      • -
      • You are not interested in large-scale monolithic libraries like PEAR.
      • You do not want to be forced to learn a templating language (although a template parser is optionally available if you desire one).
      • You eschew complexity, favoring simple solutions.
      • You need clear, thorough documentation.
      • -- cgit v1.2.3-24-g4f1b From 9744670222ba409c05a857c61daf0a0a5fac8774 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Thu, 27 Oct 2011 02:03:03 +0100 Subject: Removed a bunch of PHP 5 specific messages from FTP documentation. --- user_guide/libraries/ftp.html | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/user_guide/libraries/ftp.html b/user_guide/libraries/ftp.html index 3dbb0530e..175efe19b 100644 --- a/user_guide/libraries/ftp.html +++ b/user_guide/libraries/ftp.html @@ -74,7 +74,7 @@ and deleted. The FTP class also includes a "mirroring" function that permits an

        Usage Examples

        In this example a connection is opened to the FTP server, and a local file is read and uploaded in ASCII mode. The -file permissions are set to 755. Note: Setting permissions requires PHP 5.

        +file permissions are set to 755.

        $this->load->library('ftp');
        @@ -185,8 +185,7 @@ Example:

        Mode options are:  ascii, binary, and auto (the default). If auto is used it will base the mode on the file extension of the source file.

        -

        Permissions are available if you are running PHP 5 and can be passed as an octal value in the fourth parameter.

        - +

        Permissions can be passed as an octal value in the fourth parameter.

        $this->ftp->download()

        @@ -267,7 +266,7 @@ $this->ftp->mirror('/path/to/myfolder/', '/public_html/myfolder/');

        $this->ftp->mkdir()

        Lets you create a directory on your server. Supply the path ending in the folder name you wish to create, with a trailing slash. -Permissions can be set by passed an octal value in the second parameter (if you are running PHP 5).

        +Permissions can be set by passed an octal value in the second parameter.

        // Creates a folder named "bar"
        -- cgit v1.2.3-24-g4f1b From fd82e02ee3636ed7feeedfeefeef794cf77c3a70 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Sun, 4 Sep 2011 13:55:28 +0100 Subject: Removed reference is IS_CLI in the documentation, which should have been $this->input->is_cli_request() --- user_guide/general/cli.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide/general/cli.html b/user_guide/general/cli.html index 70ab13802..5dda24b56 100644 --- a/user_guide/general/cli.html +++ b/user_guide/general/cli.html @@ -83,7 +83,7 @@ Running via the CLI
        • Run your cron-jobs without needing to use wget or curl
        • -
        • Make your cron-jobs inaccessible from being loaded in the URL by checking for IS_CLI
        • +
        • Make your cron-jobs inaccessible from being loaded in the URL by checking for $this->input->is_cli_request()
        • Make interactive "tasks" that can do things like set permissions, prune cache folders, run backups, etc.
        • Integrate with other applications in other languages. For example, a random C++ script could call one command and run code in your models!
        -- cgit v1.2.3-24-g4f1b From 0a4fe3128341264999e0826b4fbb55cfa441a619 Mon Sep 17 00:00:00 2001 From: mmestrovic Date: Thu, 1 Sep 2011 03:30:43 +0300 Subject: Updated download links for current and older versions. --- user_guide/installation/downloads.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/user_guide/installation/downloads.html b/user_guide/installation/downloads.html index 5420dec8d..074fd8bcd 100644 --- a/user_guide/installation/downloads.html +++ b/user_guide/installation/downloads.html @@ -58,7 +58,9 @@ Downloading CodeIgniter

        Downloading CodeIgniter

          -
        • CodeIgniter V 2.0.2 (Current version)
        • +
        • CodeIgniter V 2.1.0 (Current version)
        • +
        • CodeIgniter V 2.0.3
        • +
        • CodeIgniter V 2.0.2
        • CodeIgniter V 2.0.1
        • CodeIgniter V 2.0.0
        • CodeIgniter V 1.7.3
        • -- cgit v1.2.3-24-g4f1b From 33d0502628df3e45b26d2a4075929016b2a7f8a8 Mon Sep 17 00:00:00 2001 From: Greg Aker Date: Sat, 20 Aug 2011 16:53:52 -0500 Subject: Removing duplicate instructions in the 2.0.3 update instructions. --- user_guide/installation/upgrade_203.html | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/user_guide/installation/upgrade_203.html b/user_guide/installation/upgrade_203.html index 2a0ab52be..3aceb7ff1 100644 --- a/user_guide/installation/upgrade_203.html +++ b/user_guide/installation/upgrade_203.html @@ -65,25 +65,21 @@ Upgrading from 2.0.2 to 2.1.0

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

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

          - -

          Step 2: Update CodeIgniter files

          - -

          Replace the files and directories in your "system" folder with the new versions:

          -

          Step 3: Update your main index.php file

          +

          Step 2: Update your main index.php file

          If you are running a stock index.php file simply replace your version with the new one.

          If your index.php file has internal modifications, please add your modifications to the new file and use it.

          -

          Step 4: Replace config/user_agents.php

          +

          Step 3: Replace config/user_agents.php

          This config file has been updated to contain more user agent types, please copy it to application/config/user_agents.php.

          -

          Step 5: Change references of the EXT constant to ".php"

          +

          Step 4: Change references of the EXT constant to ".php"

          Note: The EXT Constant has been marked as deprecated, but has not been removed from the application. You are encouraged to make the changes sooner rather than later.

          -

          Step 6: Remove APPPATH.'third_party' from autoload.php

          +

          Step 5: Remove APPPATH.'third_party' from autoload.php

          Open application/autoload.php, and look for the following:

          -- cgit v1.2.3-24-g4f1b From 7fdfd219ab64a8dc8436a2897cea3982ff8253c5 Mon Sep 17 00:00:00 2001 From: mmestrovic Date: Wed, 14 Sep 2011 01:26:15 +0300 Subject: Added link: "Upgrading from 2.0.3 to 2.1.0" --- user_guide/installation/upgrading.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/user_guide/installation/upgrading.html b/user_guide/installation/upgrading.html index d69b6bc9c..c3f5ae6dd 100644 --- a/user_guide/installation/upgrading.html +++ b/user_guide/installation/upgrading.html @@ -60,7 +60,8 @@ Upgrading from a Previous Version

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

            -
          • Upgrading from 2.0.2 to 2.1.0
          • +
          • Upgrading from 2.0.3 to 2.1.0
          • +
          • Upgrading from 2.0.2 to 2.0.3
          • Upgrading from 2.0.1 to 2.0.2
          • Upgrading from 2.0 to 2.0.1
          • Upgrading from 1.7.2 to 2.0
          • -- cgit v1.2.3-24-g4f1b From f7149f2562c6173f617b32538f438a1be3a4398d Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Thu, 27 Oct 2011 12:42:01 +0100 Subject: Added upgrade guide for 2.1.0. --- user_guide/installation/upgrade_203.html | 4 +- user_guide/installation/upgrade_210.html | 89 ++++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+), 2 deletions(-) create mode 100644 user_guide/installation/upgrade_210.html diff --git a/user_guide/installation/upgrade_203.html b/user_guide/installation/upgrade_203.html index 3aceb7ff1..d0d37677f 100644 --- a/user_guide/installation/upgrade_203.html +++ b/user_guide/installation/upgrade_203.html @@ -42,7 +42,7 @@ CodeIgniter Home  ›  User Guide Home  ›  -Upgrading from 2.0.2 to 2.1.0 +Upgrading from 2.0.2 to 2.0.3
            Search User Guide   
            @@ -55,7 +55,7 @@ Upgrading from 2.0.2 to 2.1.0
            -

            Upgrading from 2.0.2 to 2.1.0

            +

            Upgrading from 2.0.2 to 2.0.3

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

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

            CodeIgniter User Guide Version 2.1.0

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

            Upgrading from 2.0.3 to 2.1.0

            + +

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

            + +

            Step 1: Update your CodeIgniter files

            + +

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

            + +

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

            + +

            Step 2: Replace config/user_agents.php

            + +

            This config file has been updated to contain more user agent types, please copy it to application/config/user_agents.php.

            + + +
            + + + + + + + \ No newline at end of file -- cgit v1.2.3-24-g4f1b From f2bae2cb50d040e17ca0323b394a60499e639834 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Thu, 27 Oct 2011 12:46:52 +0100 Subject: Corrected 2.0.3 to 2.1.0. --- user_guide/installation/upgrade_203.html | 2 +- user_guide/installation/upgrade_210.html | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/user_guide/installation/upgrade_203.html b/user_guide/installation/upgrade_203.html index d0d37677f..d4b703af0 100644 --- a/user_guide/installation/upgrade_203.html +++ b/user_guide/installation/upgrade_203.html @@ -3,7 +3,7 @@ -Upgrading from 2.0.2 to 2.1.0 : CodeIgniter User Guide +Upgrading from 2.0.2 to 2.0.3 : CodeIgniter User Guide diff --git a/user_guide/installation/upgrade_210.html b/user_guide/installation/upgrade_210.html index 7edab2e7d..d9a7213a9 100644 --- a/user_guide/installation/upgrade_210.html +++ b/user_guide/installation/upgrade_210.html @@ -3,7 +3,7 @@ -Upgrading from 2.0.2 to 2.1.0 : CodeIgniter User Guide +Upgrading from 2.0.3 to 2.1.0 : CodeIgniter User Guide @@ -42,7 +42,7 @@ CodeIgniter Home  ›  User Guide Home  ›  -Upgrading from 2.0.2 to 2.1.0 +Upgrading from 2.0.3 to 2.1.0
            Search User Guide   
            -- cgit v1.2.3-24-g4f1b From 9f5316e96ea635a15aa5906bfd2abaea19520970 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Wed, 14 Sep 2011 12:25:14 -0400 Subject: Fixed LIKE statement escaping issues --- system/database/drivers/pdo/pdo_driver.php | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php index 19e069b06..4c911aa6e 100644 --- a/system/database/drivers/pdo/pdo_driver.php +++ b/system/database/drivers/pdo/pdo_driver.php @@ -28,6 +28,7 @@ * @author ExpressionEngine Dev Team * @link http://codeigniter.com/user_guide/database/ */ + class CI_DB_pdo_driver extends CI_DB { var $dbdriver = 'pdo'; @@ -36,7 +37,7 @@ class CI_DB_pdo_driver extends CI_DB { var $_escape_char = ''; var $_like_escape_str; var $_like_escape_chr; - + /** * The syntax to count rows is slightly different across different @@ -50,7 +51,7 @@ class CI_DB_pdo_driver extends CI_DB { function __construct($params) { parent::__construct($params); - + // clause and character used for LIKE escape sequences if (strpos($this->hostname, 'mysql') !== FALSE) { @@ -67,7 +68,7 @@ class CI_DB_pdo_driver extends CI_DB { $this->_like_escape_str = " ESCAPE '%s' "; $this->_like_escape_chr = '!'; } - + $this->hostname = $this->hostname . ";dbname=".$this->database; $this->trans_enabled = FALSE; @@ -179,7 +180,7 @@ class CI_DB_pdo_driver extends CI_DB { { $sql = $this->_prep_query($sql); $result_id = $this->conn_id->query($sql); - + if (is_object($result_id)) { $this->affect_rows = $result_id->rowCount(); @@ -188,7 +189,7 @@ class CI_DB_pdo_driver extends CI_DB { { $this->affect_rows = 0; } - + return $result_id; } @@ -308,16 +309,16 @@ class CI_DB_pdo_driver extends CI_DB { return $str; } - + //Escape the string $str = $this->conn_id->quote($str); - + //If there are duplicated quotes, trim them away if (strpos($str, "'") === 0) { $str = substr($str, 1, -1); } - + // escape LIKE condition wildcards if ($like === TRUE) { @@ -519,7 +520,7 @@ class CI_DB_pdo_driver extends CI_DB { if (strpos($item, '.') !== FALSE) { $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char; - + } else { @@ -569,7 +570,7 @@ class CI_DB_pdo_driver extends CI_DB { { return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")"; } - + // -------------------------------------------------------------------- /** @@ -622,7 +623,7 @@ class CI_DB_pdo_driver extends CI_DB { return $sql; } - + // -------------------------------------------------------------------- /** @@ -764,7 +765,7 @@ class CI_DB_pdo_driver extends CI_DB { { $sql .= " OFFSET ".$offset; } - + return $sql; } } -- cgit v1.2.3-24-g4f1b From e06f2cb3700edd13426af4b66d3f2a4d0fefd080 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Thu, 27 Oct 2011 13:00:00 +0100 Subject: Updated changelog. --- user_guide/changelog.html | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/user_guide/changelog.html b/user_guide/changelog.html index 35946a217..faa96b82f 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -79,6 +79,7 @@ Change Log
          • Database
          • @@ -88,6 +89,13 @@ Change Log
          • Added support to set an optional parameter in your callback rules of validation using the Form Validation Library.
          • Added a Migration Library to assist with applying incremental updates to your database schema.
          • Driver children can be located in any package path.
          • + +
          + +
        • Core +
            +
          • Changed private functions in CI_URI to protected so MY_URI can override them.
          • +
          • Removed CI_CORE boolean constant from CodeIgniter.php (there are no longer Reactor and Core versions).
        @@ -97,7 +105,22 @@ Change Log
      • Fixed #378 Robots identified as regular browsers by the User Agent class.
      • If a config class was loaded first then a library with the same name is loaded, the config would be ignored.
      • 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.
      • -
      • Fixed a bug (Reactor #89) where MySQL export would fail if the table had hyphens or other non alphanumeric/underscore characters.
      • +
      • Fixed a bug (Reactor #89) where MySQL export would fail if the table had hyphens or other non alphanumeric/underscore characters.
      • +
      • Fixed a bug (#200) where MySQL queries would be malformed after calling count_all() then db->get()
      • +
      • Fixed bug #105 that stopped query errors from being logged unless database debugging was enabled
      • +
      • Fixed a bug (#181) where a mis-spelling was in the form validation language file.
      • +
      • Fixed a bug (#160) - Removed unneeded array copy in the file cache driver.
      • +
      • Fixed a bug (#150) - field_data() now correctly returns column length.
      • +
      • Fixed a bug (#8) - load_class() now looks for core classes in APPPATH first, allowing them to be replaced.
      • +
      • Fixed a bug (#24) - ODBC database driver called incorrect parent in __construct().
      • +
      • Fixed a bug (#85) - OCI8 (Oracle) database escape_str() function did not escape correct.
      • +
      • Fixed a bug (#344) - Using schema found in Saving Session Data to a Database, system would throw error "user_data does not have a default value" when deleting then creating a session.
      • +
      • Fixed a bug (#112) - OCI8 (Oracle) driver didn't pass the configured database character set when connecting.
      • +
      • Fixed a bug (#182) - OCI8 (Oracle) driver used to re-execute the statement whenever num_rows() is called.
      • +
      • Fixed a bug (#82) - WHERE clause field names in the DB update_string() method were not escaped, resulting in failed queries in some cases.
      • +
      • Fixed a bug (#89) - Fix a variable type mismatch in DB display_error() where an array is expected, but a string could be set instead.
      • +
      • Fixed a bug (#467) - Suppress warnings generated from get_magic_quotes_gpc() (deprecated in PHP 5.4)
      • +
      • Fixed a bug (#484) - First time _csrf_set_hash() is called, hash is never set to the cookie (in Security.php).
      • Fixed a bug (#60) - Added _file_mime_type() method to the File Uploading Library in order to fix a possible MIME-type injection (also fixes bug #394).
      • Fixed a bug (#537) - Support for all wav type in browser.
      • Fixed a bug (#576) - Using ini_get() function to detect if apc is enabled or not.
      • -- cgit v1.2.3-24-g4f1b From da6aa15a41c2286ca161d036a02f6857ce060e27 Mon Sep 17 00:00:00 2001 From: Nithin Meppurathu Date: Sun, 21 Aug 2011 12:05:17 -0400 Subject: updated changelog and documentation for active record new 3rd argument option #none# to like clause --- user_guide/changelog.html | 3 +++ user_guide/database/active_record.html | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/user_guide/changelog.html b/user_guide/changelog.html index faa96b82f..37dcaea45 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -81,6 +81,8 @@ Change Log
      • Added a CUBRID driver to the Database Driver. Thanks to the CUBRID team for supplying this patch.
      • Added a PDO driver to the Database Driver.
      • Typecast limit and offset in the Database Driver to integers to avoid possible injection.
      • +
      • Added additional option 'none' for the optional third argument for $this->db->like() in the Database Driver. +
    • Libraries @@ -124,6 +126,7 @@ Change Log
    • Fixed a bug (#60) - Added _file_mime_type() method to the File Uploading Library in order to fix a possible MIME-type injection (also fixes bug #394).
    • Fixed a bug (#537) - Support for all wav type in browser.
    • Fixed a bug (#576) - Using ini_get() function to detect if apc is enabled or not.
    • +
    • Fixed a bug (#160) - Removed unneeded array copy in the file cache driver.

    Version 2.0.3

    diff --git a/user_guide/database/active_record.html b/user_guide/database/active_record.html index 074f869b4..bd3c07d88 100644 --- a/user_guide/database/active_record.html +++ b/user_guide/database/active_record.html @@ -334,6 +334,13 @@ $this->db->or_where('id >', $id); $this->db->like('title', 'match', 'both');
    // Produces: WHERE title LIKE '%match%'
    +If you do not want to use the wildcard (%) you can pass to the optional third argument the option 'none'. + + + $this->db->like('title', 'match', 'none');
    +// Produces: WHERE title LIKE 'match' +
    +
  • Associative array method: -- cgit v1.2.3-24-g4f1b From 071e2fbcd775528fb69577c49eed909cb3a56300 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Wed, 10 Aug 2011 09:00:52 -0600 Subject: Typecast limit and offset in the Database Driver to integers. Fixes https://bitbucket.org/ellislab/codeigniter-reactor/issue/341/active-record-limit-function-have-sql#comment-597403 --- user_guide/changelog.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide/changelog.html b/user_guide/changelog.html index 37dcaea45..2552ed64c 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -144,9 +144,9 @@ 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 "application/x-csv" to mimes.php.
  • Fixed a bug where Email library attachments with a "." in the name would using invalid MIME-types.
  • +
  • Callback validation rules can now accept parameters like any other validation rule.
  • Helpers -- cgit v1.2.3-24-g4f1b From 448148b0d8ed1459662cfe501197686b8a48b609 Mon Sep 17 00:00:00 2001 From: Greg Aker Date: Sat, 20 Aug 2011 14:23:14 -0500 Subject: Fixed a bug (#200) where MySQL queries would be malformed after calling db->count_all() then db->get() --- system/database/drivers/cubrid/cubrid_driver.php | 1 + system/database/drivers/mssql/mssql_driver.php | 1 + system/database/drivers/mysql/mysql_driver.php | 1 + system/database/drivers/mysqli/mysqli_driver.php | 1 + system/database/drivers/oci8/oci8_driver.php | 1 + system/database/drivers/odbc/odbc_driver.php | 1 + system/database/drivers/postgre/postgre_driver.php | 1 + system/database/drivers/sqlite/sqlite_driver.php | 1 + system/database/drivers/sqlsrv/sqlsrv_driver.php | 1 + 9 files changed, 9 insertions(+) diff --git a/system/database/drivers/cubrid/cubrid_driver.php b/system/database/drivers/cubrid/cubrid_driver.php index 3f0109249..d01140412 100644 --- a/system/database/drivers/cubrid/cubrid_driver.php +++ b/system/database/drivers/cubrid/cubrid_driver.php @@ -398,6 +398,7 @@ class CI_DB_cubrid_driver extends CI_DB { } $row = $query->row(); + $this->_reset_select(); return (int) $row->numrows; } diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php index 65397ed8f..b39bd9360 100644 --- a/system/database/drivers/mssql/mssql_driver.php +++ b/system/database/drivers/mssql/mssql_driver.php @@ -367,6 +367,7 @@ class CI_DB_mssql_driver extends CI_DB { } $row = $query->row(); + $this->_reset_select(); return (int) $row->numrows; } diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php index 28c75a5e3..872504564 100644 --- a/system/database/drivers/mysql/mysql_driver.php +++ b/system/database/drivers/mysql/mysql_driver.php @@ -385,6 +385,7 @@ class CI_DB_mysql_driver extends CI_DB { } $row = $query->row(); + $this->_reset_select(); return (int) $row->numrows; } diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php index b1796c9df..ddcaff323 100644 --- a/system/database/drivers/mysqli/mysqli_driver.php +++ b/system/database/drivers/mysqli/mysqli_driver.php @@ -386,6 +386,7 @@ class CI_DB_mysqli_driver extends CI_DB { } $row = $query->row(); + $this->_reset_select(); return (int) $row->numrows; } diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php index b4da3e965..930177e62 100644 --- a/system/database/drivers/oci8/oci8_driver.php +++ b/system/database/drivers/oci8/oci8_driver.php @@ -470,6 +470,7 @@ class CI_DB_oci8_driver extends CI_DB { } $row = $query->row(); + $this->_reset_select(); return (int) $row->numrows; } diff --git a/system/database/drivers/odbc/odbc_driver.php b/system/database/drivers/odbc/odbc_driver.php index 6e4ba896f..bcd7937d9 100644 --- a/system/database/drivers/odbc/odbc_driver.php +++ b/system/database/drivers/odbc/odbc_driver.php @@ -339,6 +339,7 @@ class CI_DB_odbc_driver extends CI_DB { } $row = $query->row(); + $this->_reset_select(); return (int) $row->numrows; } diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php index 140396885..5367f9759 100644 --- a/system/database/drivers/postgre/postgre_driver.php +++ b/system/database/drivers/postgre/postgre_driver.php @@ -385,6 +385,7 @@ class CI_DB_postgre_driver extends CI_DB { } $row = $query->row(); + $this->_reset_select(); return (int) $row->numrows; } diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php index eb4e585b3..0cc898b38 100644 --- a/system/database/drivers/sqlite/sqlite_driver.php +++ b/system/database/drivers/sqlite/sqlite_driver.php @@ -354,6 +354,7 @@ class CI_DB_sqlite_driver extends CI_DB { } $row = $query->row(); + $this->_reset_select(); return (int) $row->numrows; } diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php index 1d32792ce..400fd31c6 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_driver.php +++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php @@ -344,6 +344,7 @@ class CI_DB_sqlsrv_driver extends CI_DB { return '0'; $row = $query->row(); + $this->_reset_select(); return $row->numrows; } -- cgit v1.2.3-24-g4f1b From 57514b96b89431d37b3eeea283a3ae0f36ac7ef4 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Thu, 27 Oct 2011 13:20:55 +0100 Subject: Updated changelog. --- user_guide/changelog.html | 2 -- 1 file changed, 2 deletions(-) diff --git a/user_guide/changelog.html b/user_guide/changelog.html index 2552ed64c..312e7e7c1 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -110,7 +110,6 @@ Change Log
  • Fixed a bug (Reactor #89) where MySQL export would fail if the table had hyphens or other non alphanumeric/underscore characters.
  • Fixed a bug (#200) where MySQL queries would be malformed after calling count_all() then db->get()
  • Fixed bug #105 that stopped query errors from being logged unless database debugging was enabled
  • -
  • Fixed a bug (#181) where a mis-spelling was in the form validation language file.
  • Fixed a bug (#160) - Removed unneeded array copy in the file cache driver.
  • Fixed a bug (#150) - field_data() now correctly returns column length.
  • Fixed a bug (#8) - load_class() now looks for core classes in APPPATH first, allowing them to be replaced.
  • @@ -126,7 +125,6 @@ Change Log
  • Fixed a bug (#60) - Added _file_mime_type() method to the File Uploading Library in order to fix a possible MIME-type injection (also fixes bug #394).
  • Fixed a bug (#537) - Support for all wav type in browser.
  • Fixed a bug (#576) - Using ini_get() function to detect if apc is enabled or not.
  • -
  • Fixed a bug (#160) - Removed unneeded array copy in the file cache driver.
  • Version 2.0.3

    -- cgit v1.2.3-24-g4f1b From ad4681f7889beb66f44995882c3977239eb1b3df Mon Sep 17 00:00:00 2001 From: danmontgomery Date: Sun, 21 Aug 2011 15:31:22 -0400 Subject: Fixed issue #150 (for mysql and mysqli), now returns the actual column length. --- system/database/drivers/mysql/mysql_driver.php | 2 +- system/database/drivers/mysql/mysql_result.php | 17 +++++++++++------ system/database/drivers/mysqli/mysqli_driver.php | 2 +- system/database/drivers/mysqli/mysqli_result.php | 19 ++++++++++++------- user_guide/changelog.html | 2 +- 5 files changed, 26 insertions(+), 16 deletions(-) diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php index 872504564..f87cfea4b 100644 --- a/system/database/drivers/mysql/mysql_driver.php +++ b/system/database/drivers/mysql/mysql_driver.php @@ -441,7 +441,7 @@ class CI_DB_mysql_driver extends CI_DB { */ function _field_data($table) { - return "SELECT * FROM ".$table." LIMIT 1"; + return "DESCRIBE ".$table; } // -------------------------------------------------------------------- diff --git a/system/database/drivers/mysql/mysql_result.php b/system/database/drivers/mysql/mysql_result.php index 507389603..2d2905c98 100644 --- a/system/database/drivers/mysql/mysql_result.php +++ b/system/database/drivers/mysql/mysql_result.php @@ -84,14 +84,19 @@ class CI_DB_mysql_result extends CI_DB_result { function field_data() { $retval = array(); - while ($field = mysql_fetch_field($this->result_id)) + while ($field = mysql_fetch_object($this->result_id)) { + preg_match('/([a-zA-Z]+)\((\d+)\)/', $field->Type, $matches); + + $type = $matches[1]; + $length = (int)$matches[2]; + $F = new stdClass(); - $F->name = $field->name; - $F->type = $field->type; - $F->default = $field->def; - $F->max_length = $field->max_length; - $F->primary_key = $field->primary_key; + $F->name = $field->Field; + $F->type = $type; + $F->default = $field->Default; + $F->max_length = $length; + $F->primary_key = ( $field->Key == 'PRI' ? 1 : 0 ); $retval[] = $F; } diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php index ddcaff323..ccd110f79 100644 --- a/system/database/drivers/mysqli/mysqli_driver.php +++ b/system/database/drivers/mysqli/mysqli_driver.php @@ -442,7 +442,7 @@ class CI_DB_mysqli_driver extends CI_DB { */ function _field_data($table) { - return "SELECT * FROM ".$table." LIMIT 1"; + return "DESCRIBE ".$table; } // -------------------------------------------------------------------- diff --git a/system/database/drivers/mysqli/mysqli_result.php b/system/database/drivers/mysqli/mysqli_result.php index c4d8f5d58..ac863056a 100644 --- a/system/database/drivers/mysqli/mysqli_result.php +++ b/system/database/drivers/mysqli/mysqli_result.php @@ -84,21 +84,26 @@ class CI_DB_mysqli_result extends CI_DB_result { function field_data() { $retval = array(); - while ($field = mysqli_fetch_field($this->result_id)) + while ($field = mysqli_fetch_object($this->result_id)) { + preg_match('/([a-zA-Z]+)\((\d+)\)/', $field->Type, $matches); + + $type = $matches[1]; + $length = (int)$matches[2]; + $F = new stdClass(); - $F->name = $field->name; - $F->type = $field->type; - $F->default = $field->def; - $F->max_length = $field->max_length; - $F->primary_key = ($field->flags & MYSQLI_PRI_KEY_FLAG) ? 1 : 0; + $F->name = $field->Field; + $F->type = $type; + $F->default = $field->Default; + $F->max_length = $length; + $F->primary_key = ( $field->Key == 'PRI' ? 1 : 0 ); $retval[] = $F; } return $retval; } - + // -------------------------------------------------------------------- /** diff --git a/user_guide/changelog.html b/user_guide/changelog.html index 312e7e7c1..f2e05fae0 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -111,7 +111,7 @@ Change Log
  • Fixed a bug (#200) where MySQL queries would be malformed after calling count_all() then db->get()
  • Fixed bug #105 that stopped query errors from being logged unless database debugging was enabled
  • Fixed a bug (#160) - Removed unneeded array copy in the file cache driver.
  • -
  • Fixed a bug (#150) - field_data() now correctly returns column length.
  • +
  • Fixed a bug (#150) - field_data() now correctly returns column length.
  • Fixed a bug (#8) - load_class() now looks for core classes in APPPATH first, allowing them to be replaced.
  • Fixed a bug (#24) - ODBC database driver called incorrect parent in __construct().
  • Fixed a bug (#85) - OCI8 (Oracle) database escape_str() function did not escape correct.
  • -- cgit v1.2.3-24-g4f1b From 659baa9668d8650ccaa05ad3bcdc2183c9ff5397 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Thu, 27 Oct 2011 13:24:53 +0100 Subject: Fixed issue #150 correctly. --- system/database/drivers/mysql/mysql_result.php | 6 +++--- system/database/drivers/mysqli/mysqli_result.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/system/database/drivers/mysql/mysql_result.php b/system/database/drivers/mysql/mysql_result.php index 2d2905c98..e1a6e93ca 100644 --- a/system/database/drivers/mysql/mysql_result.php +++ b/system/database/drivers/mysql/mysql_result.php @@ -86,10 +86,10 @@ class CI_DB_mysql_result extends CI_DB_result { $retval = array(); while ($field = mysql_fetch_object($this->result_id)) { - preg_match('/([a-zA-Z]+)\((\d+)\)/', $field->Type, $matches); + preg_match('/([a-zA-Z]+)(\(\d+\))?/', $field->Type, $matches); - $type = $matches[1]; - $length = (int)$matches[2]; + $type = (array_key_exists(1, $matches)) ? $matches[1] : NULL; + $length = (array_key_exists(2, $matches)) ? preg_replace('/[^\d]/', '', $matches[2]) : NULL; $F = new stdClass(); $F->name = $field->Field; diff --git a/system/database/drivers/mysqli/mysqli_result.php b/system/database/drivers/mysqli/mysqli_result.php index ac863056a..124d4e599 100644 --- a/system/database/drivers/mysqli/mysqli_result.php +++ b/system/database/drivers/mysqli/mysqli_result.php @@ -86,10 +86,10 @@ class CI_DB_mysqli_result extends CI_DB_result { $retval = array(); while ($field = mysqli_fetch_object($this->result_id)) { - preg_match('/([a-zA-Z]+)\((\d+)\)/', $field->Type, $matches); + preg_match('/([a-zA-Z]+)(\(\d+\))?/', $field->Type, $matches); - $type = $matches[1]; - $length = (int)$matches[2]; + $type = (array_key_exists(1, $matches)) ? $matches[1] : NULL; + $length = (array_key_exists(2, $matches)) ? preg_replace('/[^\d]/', '', $matches[2]) : NULL; $F = new stdClass(); $F->name = $field->Field; -- cgit v1.2.3-24-g4f1b From 49a27745e1ba505ca72dc84f56301f7ae76d70d4 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Thu, 27 Oct 2011 13:34:35 +0100 Subject: Changelog updated. --- user_guide/changelog.html | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/user_guide/changelog.html b/user_guide/changelog.html index f2e05fae0..19e659f45 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -57,8 +57,6 @@ Change Log

    Change Log

    -

    The Reactor Marker indicates items that were contributed to CodeIgniter via CodeIgniter Reactor.

    -

    Version 2.1.0

    Release Date: November 01, 2011

    @@ -91,13 +89,12 @@ Change Log
  • Added support to set an optional parameter in your callback rules of validation using the Form Validation Library.
  • Added a Migration Library to assist with applying incremental updates to your database schema.
  • Driver children can be located in any package path.
  • -
  • Core
      -
    • Changed private functions in CI_URI to protected so MY_URI can override them.
    • -
    • Removed CI_CORE boolean constant from CodeIgniter.php (there are no longer Reactor and Core versions).
    • +
    • Changed private functions in URI Library to protected so MY_URI can override them.
    • +
    • Removed CI_CORE boolean constant from CodeIgniter.php (there are no longer different Reactor and Core versions).
  • @@ -108,23 +105,23 @@ Change Log
  • If a config class was loaded first then a library with the same name is loaded, the config would be ignored.
  • 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.
  • Fixed a bug (Reactor #89) where MySQL export would fail if the table had hyphens or other non alphanumeric/underscore characters.
  • -
  • Fixed a bug (#200) where MySQL queries would be malformed after calling count_all() then db->get()
  • +
  • Fixed a bug (#200) where MySQL queries would be malformed after calling $this->db->count_all() then $this->db->get()
  • Fixed bug #105 that stopped query errors from being logged unless database debugging was enabled
  • Fixed a bug (#160) - Removed unneeded array copy in the file cache driver.
  • Fixed a bug (#150) - field_data() now correctly returns column length.
  • Fixed a bug (#8) - load_class() now looks for core classes in APPPATH first, allowing them to be replaced.
  • Fixed a bug (#24) - ODBC database driver called incorrect parent in __construct().
  • -
  • Fixed a bug (#85) - OCI8 (Oracle) database escape_str() function did not escape correct.
  • +
  • Fixed a bug (#85) - OCI8 (Oracle) database escape_str() function did not escape correct.
  • Fixed a bug (#344) - Using schema found in Saving Session Data to a Database, system would throw error "user_data does not have a default value" when deleting then creating a session.
  • Fixed a bug (#112) - OCI8 (Oracle) driver didn't pass the configured database character set when connecting.
  • Fixed a bug (#182) - OCI8 (Oracle) driver used to re-execute the statement whenever num_rows() is called.
  • -
  • Fixed a bug (#82) - WHERE clause field names in the DB update_string() method were not escaped, resulting in failed queries in some cases.
  • -
  • Fixed a bug (#89) - Fix a variable type mismatch in DB display_error() where an array is expected, but a string could be set instead.
  • -
  • Fixed a bug (#467) - Suppress warnings generated from get_magic_quotes_gpc() (deprecated in PHP 5.4)
  • -
  • Fixed a bug (#484) - First time _csrf_set_hash() is called, hash is never set to the cookie (in Security.php).
  • -
  • Fixed a bug (#60) - Added _file_mime_type() method to the File Uploading Library in order to fix a possible MIME-type injection (also fixes bug #394).
  • +
  • Fixed a bug (#82) - WHERE clause field names in the DB update_string() method were not escaped, resulting in failed queries in some cases.
  • +
  • Fixed a bug (#89) - Fix a variable type mismatch in DB display_error() where an array is expected, but a string could be set instead.
  • +
  • Fixed a bug (#467) - Suppress warnings generated from get_magic_quotes_gpc() (deprecated in PHP 5.4)
  • +
  • Fixed a bug (#484) - First time _csrf_set_hash() is called, hash is never set to the cookie (in Security.php).
  • +
  • Fixed a bug (#60) - Added _file_mime_type() method to the File Uploading Library in order to fix a possible MIME-type injection (also fixes bug #394).
  • Fixed a bug (#537) - Support for all wav type in browser.
  • -
  • Fixed a bug (#576) - Using ini_get() function to detect if apc is enabled or not.
  • +
  • Fixed a bug (#576) - Using ini_get() function to detect if apc is enabled or not.
  • Version 2.0.3

    -- cgit v1.2.3-24-g4f1b From 426ff851c2164651228a9a9bc10869301b19dbcc Mon Sep 17 00:00:00 2001 From: Kyle Farris Date: Mon, 29 Aug 2011 23:26:07 -0300 Subject: Added the 'user_data' key to the userdata property so that sessions using a database can be deleted properly when using the table schema found in the "Saving Session Data to a Database" section of the Session Class in the user guide. --- system/libraries/Session.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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' => '' ); -- cgit v1.2.3-24-g4f1b From 55027807e4826dfe722598172ab7ffbd9dc0b48c Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 25 Aug 2011 10:51:44 +0900 Subject: add html_escape() function to escape HTML. --- system/core/Common.php | 24 ++++++++++++++++++++++++ user_guide/changelog.html | 1 + user_guide/general/common_functions.html | 2 ++ 3 files changed, 27 insertions(+) diff --git a/system/core/Common.php b/system/core/Common.php index db9fbeb9f..3d6931bc0 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -536,5 +536,29 @@ if ( ! function_exists('remove_invisible_characters')) } } +// ------------------------------------------------------------------------ + +/** +* Returns HTML escaped variable +* +* @access public +* @param mixed +* @return mixed +*/ +if ( ! function_exists('html_escape')) +{ + function html_escape($var) + { + if (is_array($var)) + { + return array_map('html_escape', $var); + } + else + { + return htmlspecialchars($var, ENT_QUOTES, config_item('charset')); + } + } +} + /* End of file Common.php */ /* Location: ./system/core/Common.php */ \ No newline at end of file diff --git a/user_guide/changelog.html b/user_guide/changelog.html index 19e659f45..11a15370e 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -64,6 +64,7 @@ Change Log
  • General Changes
  • Helpers diff --git a/user_guide/general/common_functions.html b/user_guide/general/common_functions.html index 2751133bb..f290521a9 100644 --- a/user_guide/general/common_functions.html +++ b/user_guide/general/common_functions.html @@ -104,6 +104,8 @@ else

    This function prevents inserting null characters between ascii characters, like Java\0script.

    +

    html_escape($mixed)

    +

    This function provides short cut for htmlspecialchars() function. It accepts string and array. To prevent Cross Site Scripting (XSS), it is very useful.

  • -- cgit v1.2.3-24-g4f1b From 530becb7e80cb3a2647d31d2cc8ce88328189358 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Tue, 25 Oct 2011 10:37:31 -0400 Subject: Changed mysql charset to PDO option --- system/database/drivers/pdo/pdo_driver.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php index 4c911aa6e..e536cc4bf 100644 --- a/system/database/drivers/pdo/pdo_driver.php +++ b/system/database/drivers/pdo/pdo_driver.php @@ -46,7 +46,8 @@ class CI_DB_pdo_driver extends CI_DB { */ var $_count_string = "SELECT COUNT(*) AS "; var $_random_keyword; - + + var $options = array(); function __construct($params) { @@ -57,6 +58,9 @@ class CI_DB_pdo_driver extends CI_DB { { $this->_like_escape_str = ''; $this->_like_escape_chr = ''; + + //Set the charset with the connection options + $this->options['PDO::MYSQL_ATTR_INIT_COMMAND'] = "SET NAMES {$this->char_set}"; } else if (strpos($this->hostname, 'odbc') !== FALSE) { @@ -83,9 +87,8 @@ class CI_DB_pdo_driver extends CI_DB { */ function db_connect() { - return new PDO($this->hostname,$this->username,$this->password, array( - PDO::ATTR_ERRMODE => PDO::ERRMODE_SILENT - )); + $this->options['PDO::ATTR_ERRMODE'] = PDO::ERRMODE_SILENT; + return new PDO($this->hostname,$this->username,$this->password, $this->options); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From d019fd673a730bf87f1410a752818f16b6ced713 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Wed, 26 Oct 2011 11:26:17 -0400 Subject: Set charset in DSN if PHP >= 5.3.6 --- system/database/drivers/pdo/pdo_driver.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php index e536cc4bf..b4c3102ed 100644 --- a/system/database/drivers/pdo/pdo_driver.php +++ b/system/database/drivers/pdo/pdo_driver.php @@ -59,6 +59,12 @@ class CI_DB_pdo_driver extends CI_DB { $this->_like_escape_str = ''; $this->_like_escape_chr = ''; + //Prior to this version, the charset can't be set in the dsn + if(is_php('5.3.6')) + { + $this->hostname .= ";charset={$this->char_set}"; + } + //Set the charset with the connection options $this->options['PDO::MYSQL_ATTR_INIT_COMMAND'] = "SET NAMES {$this->char_set}"; } @@ -236,7 +242,7 @@ class CI_DB_pdo_driver extends CI_DB { // Reset the transaction failure flag. // If the $test_mode flag is set to TRUE transactions will be rolled back // even if the queries produce a successful result. - $this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE; + $this->_trans_failure = (bool) ($test_mode === TRUE); return $this->conn_id->beginTransaction(); } -- cgit v1.2.3-24-g4f1b From 70eeb93361c4e6a08584fd600d173842e15a4f13 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Wed, 26 Oct 2011 11:31:49 -0400 Subject: Misc formatting fixes --- system/database/drivers/pdo/pdo_driver.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php index b4c3102ed..f69893273 100644 --- a/system/database/drivers/pdo/pdo_driver.php +++ b/system/database/drivers/pdo/pdo_driver.php @@ -78,8 +78,8 @@ class CI_DB_pdo_driver extends CI_DB { $this->_like_escape_str = " ESCAPE '%s' "; $this->_like_escape_chr = '!'; } - - $this->hostname = $this->hostname . ";dbname=".$this->database; + + $this->hostname .= ";dbname=".$this->database; $this->trans_enabled = FALSE; $this->_random_keyword = ' RND('.time().')'; // database specific random keyword @@ -94,7 +94,8 @@ class CI_DB_pdo_driver extends CI_DB { function db_connect() { $this->options['PDO::ATTR_ERRMODE'] = PDO::ERRMODE_SILENT; - return new PDO($this->hostname,$this->username,$this->password, $this->options); + + return new PDO($this->hostname, $this->username, $this->password, $this->options); } // -------------------------------------------------------------------- @@ -107,10 +108,10 @@ class CI_DB_pdo_driver extends CI_DB { */ function db_pconnect() { - return new PDO($this->hostname,$this->username,$this->password, array( - PDO::ATTR_ERRMODE => PDO::ERRMODE_SILENT, - PDO::ATTR_PERSISTENT => true - )); + $this->options['PDO::ATTR_ERRMODE'] = PDO::ERRMODE_SILENT; + $this->options['PDO::ATTR_PERSISTENT'] = TRUE; + + return new PDO($this->hostname, $this->username, $this->password, $this->options); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 04b0cf073484d80fb65c4bc072db9a91fef7040f Mon Sep 17 00:00:00 2001 From: Yoko TAMADA Date: Tue, 1 Nov 2011 23:01:29 +0900 Subject: fix user_guide/database/results.html, unmodified variable '$user' to '$row' --- user_guide/database/results.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide/database/results.html b/user_guide/database/results.html index a6b85d8c4..0baf992fb 100644 --- a/user_guide/database/results.html +++ b/user_guide/database/results.html @@ -103,7 +103,7 @@ Query Results $query = $this->db->query("SELECT * FROM users;");

    - foreach ($query->result('User') as $user)
    + foreach ($query->result('User') as $row)
    {
       echo $row->name; // call attributes
       echo $row->reverse_name(); // or methods defined on the 'User' class
    -- cgit v1.2.3-24-g4f1b From 2c7e01dc7a26629b1e8447c54b49d55295bb3cc9 Mon Sep 17 00:00:00 2001 From: Ben Edmunds Date: Sat, 20 Aug 2011 14:02:33 -0500 Subject: Resolved issue 167 - Input Class Userguide Update --- user_guide/libraries/input.html | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/user_guide/libraries/input.html b/user_guide/libraries/input.html index cfb0d5e1e..10c84a9ea 100644 --- a/user_guide/libraries/input.html +++ b/user_guide/libraries/input.html @@ -73,11 +73,11 @@ Input Class

    The security filtering function is called automatically when a new controller is invoked. It does the following:

      -
    • Destroys the global GET array. Since CodeIgniter does not utilize GET strings, there is no reason to allow it.
    • +
    • If $config['allow_get_array'] is FALSE(default is TRUE), destroys the global GET array.
    • Destroys all global variables in the event register_globals is turned on.
    • -
    • Filters the POST/COOKIE array keys, permitting only alpha-numeric (and a few other) characters.
    • +
    • Filters the GET/POST/COOKIE array keys, permitting only alpha-numeric (and a few other) characters.
    • Provides XSS (Cross-site Scripting Hacks) filtering. This can be enabled globally, or upon request.
    • -
    • Standardizes newline characters to \n
    • +
    • Standardizes newline characters to \n(In Windows \r\n)
    @@ -133,13 +133,13 @@ else
    $this->input->post('some_data', TRUE);

    To return an array of all POST items call without any parameters.

    -

    To return all POST items and pass them through the XSS filter leave the first parameter blank while setting the second parameter to boolean;

    +

    To return all POST items and pass them through the XSS filter set the first parameter NULL while setting the second parameter to boolean;

    The function returns FALSE (boolean) if there are no items in the POST.

    - $this->input->post(); // returns all POST items with XSS filter + $this->input->post(NULL, TRUE); // returns all POST items with XSS filter
    - $this->input->post(NULL, FALSE); // returns all POST items without XSS + $this->input->post(); // returns all POST items without XSS filter

    $this->input->get()

    @@ -149,13 +149,13 @@ else
    $this->input->get('some_data', TRUE);

    To return an array of all GET items call without any parameters.

    -

    To return all GET items and pass them through the XSS filter leave the first parameter blank while setting the second parameter to boolean;

    +

    To return all GET items and pass them through the XSS filter set the first parameter NULL while setting the second parameter to boolean;

    The function returns FALSE (boolean) if there are no items in the GET.

    - $this->input->get(); // returns all GET items with XSS filter + $this->input->get(NULL, TRUE); // returns all GET items with XSS filter
    - $this->input->get(NULL, FALSE); // returns all GET items without XSS filtering + $this->input->get(); // returns all GET items without XSS filtering

    $this->input->get_post()

    -- cgit v1.2.3-24-g4f1b From 8d0a31314fbf8040cce5d7601a12fffe208ae884 Mon Sep 17 00:00:00 2001 From: Shane Pearson Date: Mon, 22 Aug 2011 16:11:20 -0500 Subject: Fix #8 - Load core classes from the application folder first. --- system/core/Common.php | 6 +++--- user_guide/changelog.html | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/system/core/Common.php b/system/core/Common.php index 3d6931bc0..d79375475 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -132,9 +132,9 @@ if ( ! function_exists('load_class')) $name = FALSE; - // Look for the class first in the native system/libraries folder - // thenin the local application/libraries folder - foreach (array(BASEPATH, APPPATH) as $path) + // Look for the class first in the local application/libraries folder + // then in the native system/libraries folder + foreach (array(APPPATH, BASEPATH) as $path) { if (file_exists($path.$directory.'/'.$class.'.php')) { diff --git a/user_guide/changelog.html b/user_guide/changelog.html index 11a15370e..69ba4e6c8 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -95,7 +95,7 @@ Change Log
  • Core
    • Changed private functions in URI Library to protected so MY_URI can override them.
    • -
    • Removed CI_CORE boolean constant from CodeIgniter.php (there are no longer different Reactor and Core versions).
    • +
    • Removed CI_CORE boolean constant from CodeIgniter.php (there are no longer different Reactor and Core versions).
  • @@ -110,7 +110,7 @@ Change Log
  • Fixed bug #105 that stopped query errors from being logged unless database debugging was enabled
  • Fixed a bug (#160) - Removed unneeded array copy in the file cache driver.
  • Fixed a bug (#150) - field_data() now correctly returns column length.
  • -
  • Fixed a bug (#8) - load_class() now looks for core classes in APPPATH first, allowing them to be replaced.
  • +
  • Fixed a bug (#8) - Look for core classes in APPPATH first.
  • Fixed a bug (#24) - ODBC database driver called incorrect parent in __construct().
  • Fixed a bug (#85) - OCI8 (Oracle) database escape_str() function did not escape correct.
  • Fixed a bug (#344) - Using schema found in Saving Session Data to a Database, system would throw error "user_data does not have a default value" when deleting then creating a session.
  • -- cgit v1.2.3-24-g4f1b From 72b5b8a506df81252d71c69336c0de0172f9e616 Mon Sep 17 00:00:00 2001 From: Shane Pearson Date: Mon, 22 Aug 2011 16:17:32 -0500 Subject: updated changelog message --- user_guide/changelog.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide/changelog.html b/user_guide/changelog.html index 69ba4e6c8..9130bf1bd 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -110,7 +110,7 @@ Change Log
  • Fixed bug #105 that stopped query errors from being logged unless database debugging was enabled
  • Fixed a bug (#160) - Removed unneeded array copy in the file cache driver.
  • Fixed a bug (#150) - field_data() now correctly returns column length.
  • -
  • Fixed a bug (#8) - Look for core classes in APPPATH first.
  • +
  • Fixed a bug (#8) - load_class() now looks for core classes in APPPATH first, allowing them to be replaced.
  • Fixed a bug (#24) - ODBC database driver called incorrect parent in __construct().
  • Fixed a bug (#85) - OCI8 (Oracle) database escape_str() function did not escape correct.
  • Fixed a bug (#344) - Using schema found in Saving Session Data to a Database, system would throw error "user_data does not have a default value" when deleting then creating a session.
  • -- cgit v1.2.3-24-g4f1b From 03192a087965e6927a4842e49f5fd825dedd350f Mon Sep 17 00:00:00 2001 From: saintnicster Date: Wed, 14 Sep 2011 16:30:21 -0500 Subject: Copied into GitHub from @kenjis 's bitbucket repo.https://bitbucket.org/kenjis/ci-user-guide/changeset/3d579dd14afe --- user_guide/database/active_record.html | 39 ++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/user_guide/database/active_record.html b/user_guide/database/active_record.html index bd3c07d88..17c58c9f1 100644 --- a/user_guide/database/active_record.html +++ b/user_guide/database/active_record.html @@ -546,7 +546,7 @@ $data = array(
       )
    );

    -$this->db->update_batch('mytable', $data); +$this->db->insert_batch('mytable', $data);

    // Produces: INSERT INTO mytable (title, name, date) VALUES ('My title', 'My name', 'My date'), ('Another title', 'Another name', 'Another date')
    @@ -669,6 +669,41 @@ You can optionally pass this information directly into the update function as a

    You may also use the $this->db->set() function described above when performing updates.

    +

    $this->db->update_batch();

    +

    Generates an update string based on the data you supply, and runs the query. You can either pass an +array or an object to the function. Here is an example using an array:

    + + +$data = array(
    +   array(
    +      'title' => 'My title' ,
    +      'name' => 'My Name 2' ,
    +      'date' => 'My date 2'
    +   ),
    +   array(
    +      'title' => 'Another title' ,
    +      'name' => 'Another Name 2' ,
    +      'date' => 'Another date 2'
    +   )
    +);
    +
    +$this->db->update_batch('mytable', $data, 'title'); +

    +// Produces:
    +// UPDATE `mytable` SET `name` = CASE
    +// WHEN `title` = 'My title' THEN 'My Name 2'
    +// WHEN `title` = 'Another title' THEN 'Another Name 2'
    +// ELSE `name` END,
    +// `date` = CASE
    +// WHEN `title` = 'My title' THEN 'My date 2'
    +// WHEN `title` = 'Another title' THEN 'Another date 2'
    +// ELSE `date` END
    +// WHERE `title` IN ('My title','Another title')
    + +

    The first parameter will contain the table name, the second is an associative array of values, the third parameter is the where key.

    + +

    Note: All values are escaped automatically producing safer queries.

    +  

    Deleting Data

    @@ -786,4 +821,4 @@ Next Topic:  Transactions
    - \ No newline at end of file + -- cgit v1.2.3-24-g4f1b From bc503c9312ba4c78581e67ed9ed6576a2ef26dac Mon Sep 17 00:00:00 2001 From: daparky Date: Fri, 4 Nov 2011 20:13:26 +0000 Subject: The link to common functions wasn't closed properly under the 'Added html_escape() to the Common functions' change. --- user_guide/changelog.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide/changelog.html b/user_guide/changelog.html index 9130bf1bd..de14c1d26 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -64,7 +64,7 @@ Change Log
  • General Changes
  • Helpers -- cgit v1.2.3-24-g4f1b From da8a560802501cb660952dccab3f3761352c323c Mon Sep 17 00:00:00 2001 From: Aaron Kuzemchak Date: Sat, 3 Sep 2011 20:59:07 -0400 Subject: Enables real page numbers for URI segment in Pagination library --- system/libraries/Pagination.php | 85 +++++++++++++++++++++++++++++++----- user_guide/libraries/pagination.html | 6 ++- 2 files changed, 78 insertions(+), 13 deletions(-) diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php index cc62e660b..cdaacf2d4 100644 --- a/system/libraries/Pagination.php +++ b/system/libraries/Pagination.php @@ -34,6 +34,7 @@ class CI_Pagination { var $per_page = 10; // Max number of items you want shown per page var $num_links = 2; // Number of "digit" links to show before/after the currently viewed page var $cur_page = 0; // The current page being viewed + var $use_page_numbers = FALSE; // Use page number for segment instead of offset var $first_link = '‹ First'; var $next_link = '>'; var $prev_link = '<'; @@ -128,12 +129,22 @@ class CI_Pagination { return ''; } + // Set the base page index for starting page number + if ($this->use_page_numbers) + { + $base_page = 1; + } + else + { + $base_page = 0; + } + // Determine the current page number. $CI =& get_instance(); if ($CI->config->item('enable_query_strings') === TRUE OR $this->page_query_string === TRUE) { - if ($CI->input->get($this->query_string_segment) != 0) + if ($CI->input->get($this->query_string_segment) != $base_page) { $this->cur_page = $CI->input->get($this->query_string_segment); @@ -143,7 +154,7 @@ class CI_Pagination { } else { - if ($CI->uri->segment($this->uri_segment) != 0) + if ($CI->uri->segment($this->uri_segment) != $base_page) { $this->cur_page = $CI->uri->segment($this->uri_segment); @@ -151,6 +162,12 @@ class CI_Pagination { $this->cur_page = (int) $this->cur_page; } } + + // Set current page to 1 if using page numbers instead of offset + if ($this->use_page_numbers AND $this->cur_page == 0) + { + $this->cur_page = $base_page; + } $this->num_links = (int)$this->num_links; @@ -161,18 +178,32 @@ class CI_Pagination { if ( ! is_numeric($this->cur_page)) { - $this->cur_page = 0; + $this->cur_page = $base_page; } // Is the page number beyond the result range? // If so we show the last page - if ($this->cur_page > $this->total_rows) + if ($this->use_page_numbers) { - $this->cur_page = ($num_pages - 1) * $this->per_page; + if ($this->cur_page > $num_pages) + { + $this->cur_page = $num_pages; + } + } + else + { + if ($this->cur_page > $this->total_rows) + { + $this->cur_page = ($num_pages - 1) * $this->per_page; + } } $uri_page_number = $this->cur_page; - $this->cur_page = floor(($this->cur_page/$this->per_page) + 1); + + if ( ! $this->use_page_numbers) + { + $this->cur_page = floor(($this->cur_page/$this->per_page) + 1); + } // Calculate the start and end numbers. These determine // which number to start and end the digit links with @@ -203,7 +234,14 @@ class CI_Pagination { // Render the "previous" link if ($this->prev_link !== FALSE AND $this->cur_page != 1) { - $i = $uri_page_number - $this->per_page; + if ($this->use_page_numbers) + { + $i = $uri_page_number - 1; + } + else + { + $i = $uri_page_number - $this->per_page; + } if ($i == 0 && $this->first_url != '') { @@ -223,9 +261,16 @@ class CI_Pagination { // Write the digit links for ($loop = $start -1; $loop <= $end; $loop++) { - $i = ($loop * $this->per_page) - $this->per_page; + if ($this->use_page_numbers) + { + $i = $loop; + } + else + { + $i = ($loop * $this->per_page) - $this->per_page; + } - if ($i >= 0) + if ($i >= $base_page) { if ($this->cur_page == $loop) { @@ -233,7 +278,7 @@ class CI_Pagination { } else { - $n = ($i == 0) ? '' : $i; + $n = ($i == $base_page) ? '' : $i; if ($n == '' && $this->first_url != '') { @@ -253,13 +298,29 @@ class CI_Pagination { // Render the "next" link if ($this->next_link !== FALSE AND $this->cur_page < $num_pages) { - $output .= $this->next_tag_open.'anchor_class.'href="'.$this->base_url.$this->prefix.($this->cur_page * $this->per_page).$this->suffix.'">'.$this->next_link.''.$this->next_tag_close; + if ($this->use_page_numbers) + { + $i = $this->cur_page + 1; + } + else + { + $i = ($this->cur_page * $this->per_page); + } + + $output .= $this->next_tag_open.'anchor_class.'href="'.$this->base_url.$this->prefix.$i.$this->suffix.'">'.$this->next_link.''.$this->next_tag_close; } // Render the "Last" link if ($this->last_link !== FALSE AND ($this->cur_page + $this->num_links) < $num_pages) { - $i = (($num_pages * $this->per_page) - $this->per_page); + if ($this->use_page_numbers) + { + $i = $num_pages; + } + else + { + $i = (($num_pages * $this->per_page) - $this->per_page); + } $output .= $this->last_tag_open.'anchor_class.'href="'.$this->base_url.$this->prefix.$i.$this->suffix.'">'.$this->last_link.''.$this->last_tag_close; } diff --git a/user_guide/libraries/pagination.html b/user_guide/libraries/pagination.html index b5f971f5a..6478694d0 100644 --- a/user_guide/libraries/pagination.html +++ b/user_guide/libraries/pagination.html @@ -119,7 +119,11 @@ something different you can specify it.

    The number of "digit" links you would like before and after the selected page number. For example, the number 2 will place two digits on either side, as in the example links at the very top of this page.

    -

    $config['page_query_string'] = TRUE

    + +

    $config['use_page_numbers'] = TRUE;

    +

    By default, the URI segment will use the starting index for the items you are paginating. If you prefer to show the the actual page number, set this to TRUE.

    + +

    $config['page_query_string'] = TRUE;

    By default, the pagination library assume you are using URI Segments, and constructs your links something like

    http://example.com/index.php/test/page/20

    If you have $config['enable_query_strings'] set to TRUE your links will automatically be re-written using Query Strings. This option can also be explictly set. Using $config['page_query_string'] set to TRUE, the pagination link will become.

    -- cgit v1.2.3-24-g4f1b From 1a160c9bc2b0817c822365b7aae5866af830d2cd Mon Sep 17 00:00:00 2001 From: Aaron Kuzemchak Date: Tue, 20 Sep 2011 21:29:30 -0400 Subject: Updating changelog --- user_guide/changelog.html | 1 + 1 file changed, 1 insertion(+) diff --git a/user_guide/changelog.html b/user_guide/changelog.html index 9130bf1bd..27980cf32 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -90,6 +90,7 @@ Change Log
  • Added support to set an optional parameter in your callback rules of validation using the Form Validation Library.
  • Added a Migration Library to assist with applying incremental updates to your database schema.
  • Driver children can be located in any package path.
  • +
  • Added $config['use_page_numbers'] to the Pagination library, which enables real page numbers in the URI.
  • Core -- cgit v1.2.3-24-g4f1b From d0b61ef16e247d5252c7505ac8e13517ce26ff04 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Tue, 8 Nov 2011 14:49:24 +0000 Subject: Added ->db->replace() for MySQLi. --- system/database/drivers/mysqli/mysqli_driver.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php index ccd110f79..d3200f328 100644 --- a/system/database/drivers/mysqli/mysqli_driver.php +++ b/system/database/drivers/mysqli/mysqli_driver.php @@ -570,6 +570,25 @@ class CI_DB_mysqli_driver extends CI_DB { { return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES ".implode(', ', $values); } + + // -------------------------------------------------------------------- + + + /** + * Replace statement + * + * Generates a platform-specific replace string from the supplied data + * + * @access public + * @param string the table name + * @param array the insert keys + * @param array the insert values + * @return string + */ + function _replace($table, $keys, $values) + { + return "REPLACE INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")"; + } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 56aff8b1339989a387bae47cbad0f6b3b8617ccf Mon Sep 17 00:00:00 2001 From: purwandi Date: Thu, 8 Sep 2011 19:05:29 +0700 Subject: Modified repo from mercurial to git on User Guide --- user_guide/installation/downloads.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/user_guide/installation/downloads.html b/user_guide/installation/downloads.html index 074fd8bcd..e4e0bc27f 100644 --- a/user_guide/installation/downloads.html +++ b/user_guide/installation/downloads.html @@ -88,14 +88,14 @@ Downloading CodeIgniter -

    Mercurial Server

    -

    Mercurial is a distributed version control system.

    +

    Git Server

    +

    Git is a distributed version control system.

    -

    Public Hg access is available at BitBucket. +

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

    -

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

    +

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

  • -- cgit v1.2.3-24-g4f1b From 9c893ca9323ac90f658f2cca791f387b45c2eba1 Mon Sep 17 00:00:00 2001 From: purwandi Date: Thu, 8 Sep 2011 19:40:32 +0700 Subject: Fix some typo --- user_guide/installation/downloads.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide/installation/downloads.html b/user_guide/installation/downloads.html index e4e0bc27f..14c65edd0 100644 --- a/user_guide/installation/downloads.html +++ b/user_guide/installation/downloads.html @@ -91,11 +91,11 @@ Downloading CodeIgniter

    Git Server

    Git is a distributed version control system.

    -

    Public Git access is available at Github. +

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

    -

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

    +

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

    -- cgit v1.2.3-24-g4f1b From 644a1474b497fbf0b3a780d379df3a990f77a84c Mon Sep 17 00:00:00 2001 From: Syahril Zulkefli Date: Sun, 13 Nov 2011 23:41:37 +0800 Subject: Fix invalid date format --- system/helpers/date_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php index 553e8d7ee..8ad396cfe 100644 --- a/system/helpers/date_helper.php +++ b/system/helpers/date_helper.php @@ -116,7 +116,7 @@ if ( ! function_exists('standard_date')) 'DATE_COOKIE' => '%l, %d-%M-%y %H:%i:%s UTC', 'DATE_ISO8601' => '%Y-%m-%dT%H:%i:%s%Q', 'DATE_RFC822' => '%D, %d %M %y %H:%i:%s %O', - 'DATE_RFC850' => '%l, %d-%M-%y %H:%m:%i UTC', + 'DATE_RFC850' => '%l, %d-%M-%y %H:%i:%i UTC', 'DATE_RFC1036' => '%D, %d %M %y %H:%i:%s %O', 'DATE_RFC1123' => '%D, %d %M %Y %H:%i:%s %O', 'DATE_RSS' => '%D, %d %M %Y %H:%i:%s %O', -- cgit v1.2.3-24-g4f1b From 9667b5585f66f0763f57f5ca578d986812f48b94 Mon Sep 17 00:00:00 2001 From: Syahril Zulkefli Date: Sun, 13 Nov 2011 23:43:37 +0800 Subject: Fix invalid date format --- system/helpers/date_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php index 8ad396cfe..0aeb7fafb 100644 --- a/system/helpers/date_helper.php +++ b/system/helpers/date_helper.php @@ -116,7 +116,7 @@ if ( ! function_exists('standard_date')) 'DATE_COOKIE' => '%l, %d-%M-%y %H:%i:%s UTC', 'DATE_ISO8601' => '%Y-%m-%dT%H:%i:%s%Q', 'DATE_RFC822' => '%D, %d %M %y %H:%i:%s %O', - 'DATE_RFC850' => '%l, %d-%M-%y %H:%i:%i UTC', + 'DATE_RFC850' => '%l, %d-%M-%y %H:%i:%s UTC', 'DATE_RFC1036' => '%D, %d %M %y %H:%i:%s %O', 'DATE_RFC1123' => '%D, %d %M %Y %H:%i:%s %O', 'DATE_RSS' => '%D, %d %M %Y %H:%i:%s %O', -- cgit v1.2.3-24-g4f1b From f6bd296482ed5697b77f23901a16444bf96cb4f4 Mon Sep 17 00:00:00 2001 From: Syahril Zulkefli Date: Sun, 13 Nov 2011 23:46:58 +0800 Subject: Fix invalid datetime format --- system/libraries/Xmlrpc.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php index 5da6ea6ae..d702e902f 100644 --- a/system/libraries/Xmlrpc.php +++ b/system/libraries/Xmlrpc.php @@ -1404,14 +1404,14 @@ class XML_RPC_Values extends CI_Xmlrpc { if ($utc == 1) { - $t = strftime("%Y%m%dT%H:%M:%S", $time); + $t = strftime("%Y%m%dT%H:%i:%s", $time); } else { if (function_exists('gmstrftime')) - $t = gmstrftime("%Y%m%dT%H:%M:%S", $time); + $t = gmstrftime("%Y%m%dT%H:%i:%s", $time); else - $t = strftime("%Y%m%dT%H:%M:%S", $time - date('Z')); + $t = strftime("%Y%m%dT%H:%i:%s", $time - date('Z')); } return $t; } -- cgit v1.2.3-24-g4f1b From db5a5494018ed8fe83e8899ba583cdf6de9525af Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Sun, 13 Nov 2011 18:47:19 +0000 Subject: Updated changelog. --- user_guide/changelog.html | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/user_guide/changelog.html b/user_guide/changelog.html index 6b2976855..d065bd478 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -77,25 +77,25 @@ Change Log
  • Database
      -
    • Added a CUBRID driver to the Database Driver. Thanks to the CUBRID team for supplying this patch.
    • -
    • Added a PDO driver to the Database Driver.
    • -
    • Typecast limit and offset in the Database Driver to integers to avoid possible injection.
    • -
    • Added additional option 'none' for the optional third argument for $this->db->like() in the Database Driver. +
    • Added a CUBRID driver to the Database driver. Thanks to the CUBRID team for supplying this patch.
    • +
    • Added a PDO driver to the Database driver.
    • +
    • Typecast limit and offset in the Database driver to integers to avoid possible injection.
    • +
    • Added additional option 'none' for the optional third argument for $this->db->like() in the Database driver.
  • Libraries
      -
    • Changed $this->cart->insert() in the Cart Library to return the Row ID if a single item was inserted successfully.
    • -
    • Added support to set an optional parameter in your callback rules of validation using the Form Validation Library.
    • -
    • Added a Migration Library to assist with applying incremental updates to your database schema.
    • +
    • Changed $this->cart->insert() in the Cart library to return the Row ID if a single item was inserted successfully.
    • +
    • Added support to set an optional parameter in your callback rules of validation using the Form Validation library.
    • +
    • Added a Migration library to assist with applying incremental updates to your database schema.
    • Driver children can be located in any package path.
    • Added $config['use_page_numbers'] to the Pagination library, which enables real page numbers in the URI.
  • Core
      -
    • Changed private functions in URI Library to protected so MY_URI can override them.
    • +
    • Changed private functions in URI library to protected so MY_URI can override them.
    • Removed CI_CORE boolean constant from CodeIgniter.php (there are no longer different Reactor and Core versions).
  • @@ -103,7 +103,7 @@ Change Log

    Bug fixes for 2.1.0

      -
    • Fixed #378 Robots identified as regular browsers by the User Agent class.
    • +
    • Fixed #378 Robots identified as regular browsers by the User Agent class.
    • If a config class was loaded first then a library with the same name is loaded, the config would be ignored.
    • 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.
    • Fixed a bug (Reactor #89) where MySQL export would fail if the table had hyphens or other non alphanumeric/underscore characters.
    • @@ -124,6 +124,7 @@ Change Log
    • Fixed a bug (#60) - Added _file_mime_type() method to the File Uploading Library in order to fix a possible MIME-type injection (also fixes bug #394).
    • Fixed a bug (#537) - Support for all wav type in browser.
    • Fixed a bug (#576) - Using ini_get() function to detect if apc is enabled or not.
    • +
    • Fixed invalid date time format in Date helper and XMLRPC library.

    Version 2.0.3

    -- cgit v1.2.3-24-g4f1b From a35e31c3ead0396e2a7c7be9b292c66a6457a1a0 Mon Sep 17 00:00:00 2001 From: Ben Edmunds Date: Sat, 20 Aug 2011 14:17:16 -0500 Subject: Resolved issue 65 - made action on form_open_multipart helper function call optional --- system/helpers/form_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php index 47f93e748..d9305c00b 100644 --- a/system/helpers/form_helper.php +++ b/system/helpers/form_helper.php @@ -94,7 +94,7 @@ if ( ! function_exists('form_open')) */ if ( ! function_exists('form_open_multipart')) { - function form_open_multipart($action, $attributes = array(), $hidden = array()) + function form_open_multipart($action = '', $attributes = array(), $hidden = array()) { if (is_string($attributes)) { -- cgit v1.2.3-24-g4f1b From c78301cee7b648911601f663731ddb4871d1bba4 Mon Sep 17 00:00:00 2001 From: Radu Potop Date: Wed, 28 Sep 2011 13:57:51 +0300 Subject: Added TLS and SSL support to Email library. Fixes issue #171 --- system/libraries/Email.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/system/libraries/Email.php b/system/libraries/Email.php index c8b727c34..9ec40af9d 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -36,6 +36,7 @@ class CI_Email { var $smtp_pass = ""; // SMTP Password var $smtp_port = "25"; // SMTP Port var $smtp_timeout = 5; // SMTP Timeout in seconds + var $smtp_crypto = ""; // SMTP Encryption. Can be null, tls or ssl. var $wordwrap = TRUE; // TRUE/FALSE Turns word-wrap on/off var $wrapchars = "76"; // Number of characters to wrap at. var $mailtype = "text"; // text/html Defines email formatting @@ -1678,7 +1679,10 @@ class CI_Email { */ protected function _smtp_connect() { - $this->_smtp_connect = fsockopen($this->smtp_host, + $ssl = NULL; + if ($this->smtp_crypto == 'ssl') + $ssl = 'ssl://'; + $this->_smtp_connect = fsockopen($ssl.$this->smtp_host, $this->smtp_port, $errno, $errstr, @@ -1691,6 +1695,14 @@ class CI_Email { } $this->_set_error_message($this->_get_smtp_data()); + + if ($this->smtp_crypto == 'tls') + { + $this->_send_command('hello'); + $this->_send_command('starttls'); + stream_socket_enable_crypto($this->_smtp_connect, TRUE, STREAM_CRYPTO_METHOD_TLS_CLIENT); + } + return $this->_send_command('hello'); } @@ -1717,6 +1729,12 @@ class CI_Email { $resp = 250; break; + case 'starttls' : + + $this->_send_data('STARTTLS'); + + $resp = 220; + break; case 'from' : $this->_send_data('MAIL FROM:<'.$data.'>'); -- cgit v1.2.3-24-g4f1b From 61d1977d4b1a37043ed7dde43701483bf2714785 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Sun, 13 Nov 2011 19:23:40 +0000 Subject: More changelog tweaking. --- user_guide/changelog.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/user_guide/changelog.html b/user_guide/changelog.html index d065bd478..353427546 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -82,6 +82,7 @@ Change Log
  • Typecast limit and offset in the Database driver to integers to avoid possible injection.
  • Added additional option 'none' for the optional third argument for $this->db->like() in the Database driver.
  • +
  • Added $this->db->insert_batch() support to the OCI8 (Oracle) driver.
  • Libraries @@ -90,7 +91,9 @@ Change Log
  • Added support to set an optional parameter in your callback rules of validation using the Form Validation library.
  • Added a Migration library to assist with applying incremental updates to your database schema.
  • Driver children can be located in any package path.
  • +
  • Added is_unique to the Form Validation library.
  • Added $config['use_page_numbers'] to the Pagination library, which enables real page numbers in the URI.
  • +
  • Added TLS and SSL Encryption for SMTP.
  • Core -- cgit v1.2.3-24-g4f1b From fbcf88b9687ed25c71f0036112f9a120a7623302 Mon Sep 17 00:00:00 2001 From: Pascal Kriete Date: Mon, 14 Nov 2011 13:39:37 -0500 Subject: Removing stray docblocks --- system/core/CodeIgniter.php | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php index d9977e1ca..db1aee574 100755 --- a/system/core/CodeIgniter.php +++ b/system/core/CodeIgniter.php @@ -33,12 +33,6 @@ * @var string * */ - /** - * CodeIgniter Version - * - * @var string - * - */ define('CI_VERSION', '2.1.0'); /** @@ -47,12 +41,6 @@ * @var boolean * */ - /** - * CodeIgniter Branch (Core = TRUE, Reactor = FALSE) - * - * @var string - * - */ define('CI_CORE', FALSE); /* -- cgit v1.2.3-24-g4f1b From c38e3b672335e3a00d68decf2b629a0afc7c769d Mon Sep 17 00:00:00 2001 From: Pascal Kriete Date: Mon, 14 Nov 2011 13:55:00 -0500 Subject: Tweaking the xss filter for IE tags, parameter injection, and weird html5 attributes. --- system/core/Security.php | 91 ++++++++++++++++++++++-------------------------- 1 file changed, 41 insertions(+), 50 deletions(-) diff --git a/system/core/Security.php b/system/core/Security.php index dcc680a11..a3e227437 100755 --- a/system/core/Security.php +++ b/system/core/Security.php @@ -77,7 +77,8 @@ class CI_Security { '-moz-binding' => '[removed]', '' => '-->', - ' '<![CDATA[' + ' '<![CDATA[', + '' => '<comment>' ); /* never allowed, regex replacement */ @@ -475,15 +476,7 @@ class CI_Security { { if ($this->_xss_hash == '') { - if (phpversion() >= 4.2) - { - mt_srand(); - } - else - { - mt_srand(hexdec(substr(md5(microtime()), -8)) & 0x7fffffff); - } - + mt_srand(); $this->_xss_hash = md5(time() + mt_rand(0, 1999999999)); } @@ -497,14 +490,11 @@ class CI_Security { * * This function is a replacement for html_entity_decode() * - * In some versions of PHP the native function does not work - * when UTF-8 is the specified character set, so this gives us - * a work-around. More info here: - * http://bugs.php.net/bug.php?id=25670 - * - * NOTE: html_entity_decode() has a bug in some PHP versions when UTF-8 is the - * character set, and the PHP developers said they were not back porting the - * fix to versions other than PHP 5.x. + * The reason we are not using html_entity_decode() by itself is because + * while it is not technically correct to leave out the semicolon + * at the end of an entity most browsers will still interpret the entity + * correctly. html_entity_decode() does not convert entities without + * semicolons, so we are left with our own little solution here. Bummer. * * @param string * @param string @@ -512,33 +502,14 @@ class CI_Security { */ public function entity_decode($str, $charset='UTF-8') { - if (stristr($str, '&') === FALSE) return $str; - - // The reason we are not using html_entity_decode() by itself is because - // while it is not technically correct to leave out the semicolon - // at the end of an entity most browsers will still interpret the entity - // correctly. html_entity_decode() does not convert entities without - // semicolons, so we are left with our own little solution here. Bummer. - - if (function_exists('html_entity_decode') && - (strtolower($charset) != 'utf-8')) - { - $str = html_entity_decode($str, ENT_COMPAT, $charset); - $str = preg_replace('~&#x(0*[0-9a-f]{2,5})~ei', 'chr(hexdec("\\1"))', $str); - return preg_replace('~&#([0-9]{2,4})~e', 'chr(\\1)', $str); - } - - // Numeric Entities - $str = preg_replace('~&#x(0*[0-9a-f]{2,5});{0,1}~ei', 'chr(hexdec("\\1"))', $str); - $str = preg_replace('~&#([0-9]{2,4});{0,1}~e', 'chr(\\1)', $str); - - // Literal Entities - Slightly slow so we do another check if (stristr($str, '&') === FALSE) { - $str = strtr($str, array_flip(get_html_translation_table(HTML_ENTITIES))); + return $str; } - return $str; + $str = html_entity_decode($str, ENT_COMPAT, $charset); + $str = preg_replace('~&#x(0*[0-9a-f]{2,5})~ei', 'chr(hexdec("\\1"))', $str); + return preg_replace('~&#([0-9]{2,4})~e', 'chr(\\1)', $str); } // -------------------------------------------------------------------- @@ -632,25 +603,45 @@ class CI_Security { protected function _remove_evil_attributes($str, $is_image) { // All javascript event handlers (e.g. onload, onclick, onmouseover), style, and xmlns - $evil_attributes = array('on\w*', 'style', 'xmlns'); + $evil_attributes = array('on\w*', 'style', 'xmlns', 'formaction'); if ($is_image === TRUE) { /* - * Adobe Photoshop puts XML metadata into JFIF images, + * Adobe Photoshop puts XML metadata into JFIF images, * including namespacing, so we have to allow this for images. */ unset($evil_attributes[array_search('xmlns', $evil_attributes)]); } - + do { - $str = preg_replace( - "#<(/?[^><]+?)([^A-Za-z\-])(".implode('|', $evil_attributes).")(\s*=\s*)([\"][^>]*?[\"]|[\'][^>]*?[\']|[^>]*?)([\s><])([><]*)#i", - "<$1$6", - $str, -1, $count - ); - } while ($count); + $count = 0; + $attribs = array(); + + // find occurrences of illegal attribute strings without quotes + preg_match_all("/(".implode('|', $evil_attributes).")\s*=\s*([^\s]*)/is", $str, $matches, PREG_SET_ORDER); + + foreach ($matches as $attr) + { + $attribs[] = preg_quote($attr[0], '/'); + } + + // find occurrences of illegal attribute strings with quotes (042 and 047 are octal quotes) + preg_match_all("/(".implode('|', $evil_attributes).")\s*=\s*(\042|\047)([^\\2]*?)(\\2)/is", $str, $matches, PREG_SET_ORDER); + foreach ($matches as $attr) + { + $attribs[] = preg_quote($attr[0], '/'); + } + + // replace illegal attribute strings that are inside an html tag + if (count($attribs) > 0) + { + $str = preg_replace("/<(\/?[^><]+?)([^A-Za-z\-])(".implode('|', $attribs).")([\s><])([><]*)/i", '<$1$2$4$5', $str, -1, $count); + } + + } while ($count); + return $str; } -- cgit v1.2.3-24-g4f1b From 917c3455cc70d5117daa7359f345a820154ada3e Mon Sep 17 00:00:00 2001 From: Pascal Kriete Date: Mon, 14 Nov 2011 13:55:31 -0500 Subject: Changelogging and setting release date. --- user_guide/changelog.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/user_guide/changelog.html b/user_guide/changelog.html index 353427546..167616e57 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -58,13 +58,14 @@ Change Log

    Change Log

    Version 2.1.0

    -

    Release Date: November 01, 2011

    +

    Release Date: November 14, 2011

    • General Changes
        +
      • Fixed a potential parameter injection flaw in the Security Library and strengthened the XSS filter for HTML5 vulnerabilites.
      • Callback validation rules can now accept parameters like any other validation rule.
      • -
      • Added html_escape() to the Common functions to escape HTML output for preventing XSS easliy.
      • +
      • Added html_escape() to the Common functions to escape HTML output for preventing XSS easliy.
    • Helpers -- cgit v1.2.3-24-g4f1b From 0199f68db46d375af2d4cb831c679d3040601f25 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Tue, 22 Nov 2011 14:57:21 +0000 Subject: Readded PDO drivers. --- system/database/drivers/pdo/index.html | 10 ++ system/database/drivers/pdo/pdo_driver.php | 30 ++-- system/database/drivers/pdo/pdo_forge.php | 266 ++++++++++++++++++++++++++++ system/database/drivers/pdo/pdo_result.php | 171 ++++++++++++++++++ system/database/drivers/pdo/pdo_utility.php | 103 +++++++++++ 5 files changed, 565 insertions(+), 15 deletions(-) create mode 100644 system/database/drivers/pdo/index.html create mode 100644 system/database/drivers/pdo/pdo_forge.php create mode 100644 system/database/drivers/pdo/pdo_result.php create mode 100644 system/database/drivers/pdo/pdo_utility.php diff --git a/system/database/drivers/pdo/index.html b/system/database/drivers/pdo/index.html new file mode 100644 index 000000000..c942a79ce --- /dev/null +++ b/system/database/drivers/pdo/index.html @@ -0,0 +1,10 @@ + + + 403 Forbidden + + + +

      Directory access is forbidden.

      + + + \ No newline at end of file diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php index f69893273..5de2079bb 100644 --- a/system/database/drivers/pdo/pdo_driver.php +++ b/system/database/drivers/pdo/pdo_driver.php @@ -5,9 +5,9 @@ * An open source application development framework for PHP 5.1.6 or newer * * @package CodeIgniter - * @author ExpressionEngine Dev Team * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. * @license http://codeigniter.com/user_guide/license.html + * @author EllisLab Dev Team * @link http://codeigniter.com * @since Version 2.1.0 * @filesource @@ -25,10 +25,9 @@ * @package CodeIgniter * @subpackage Drivers * @category Database - * @author ExpressionEngine Dev Team + * @author EllisLab Dev Team * @link http://codeigniter.com/user_guide/database/ */ - class CI_DB_pdo_driver extends CI_DB { var $dbdriver = 'pdo'; @@ -37,7 +36,7 @@ class CI_DB_pdo_driver extends CI_DB { var $_escape_char = ''; var $_like_escape_str; var $_like_escape_chr; - + /** * The syntax to count rows is slightly different across different @@ -52,13 +51,13 @@ class CI_DB_pdo_driver extends CI_DB { function __construct($params) { parent::__construct($params); - + // clause and character used for LIKE escape sequences if (strpos($this->hostname, 'mysql') !== FALSE) { $this->_like_escape_str = ''; $this->_like_escape_chr = ''; - + //Prior to this version, the charset can't be set in the dsn if(is_php('5.3.6')) { @@ -80,6 +79,7 @@ class CI_DB_pdo_driver extends CI_DB { } $this->hostname .= ";dbname=".$this->database; + $this->trans_enabled = FALSE; $this->_random_keyword = ' RND('.time().')'; // database specific random keyword @@ -190,7 +190,7 @@ class CI_DB_pdo_driver extends CI_DB { { $sql = $this->_prep_query($sql); $result_id = $this->conn_id->query($sql); - + if (is_object($result_id)) { $this->affect_rows = $result_id->rowCount(); @@ -199,7 +199,7 @@ class CI_DB_pdo_driver extends CI_DB { { $this->affect_rows = 0; } - + return $result_id; } @@ -319,16 +319,16 @@ class CI_DB_pdo_driver extends CI_DB { return $str; } - + //Escape the string $str = $this->conn_id->quote($str); - + //If there are duplicated quotes, trim them away if (strpos($str, "'") === 0) { $str = substr($str, 1, -1); } - + // escape LIKE condition wildcards if ($like === TRUE) { @@ -530,7 +530,7 @@ class CI_DB_pdo_driver extends CI_DB { if (strpos($item, '.') !== FALSE) { $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char; - + } else { @@ -580,7 +580,7 @@ class CI_DB_pdo_driver extends CI_DB { { return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")"; } - + // -------------------------------------------------------------------- /** @@ -633,7 +633,7 @@ class CI_DB_pdo_driver extends CI_DB { return $sql; } - + // -------------------------------------------------------------------- /** @@ -775,7 +775,7 @@ class CI_DB_pdo_driver extends CI_DB { { $sql .= " OFFSET ".$offset; } - + return $sql; } } diff --git a/system/database/drivers/pdo/pdo_forge.php b/system/database/drivers/pdo/pdo_forge.php new file mode 100644 index 000000000..1462e8c21 --- /dev/null +++ b/system/database/drivers/pdo/pdo_forge.php @@ -0,0 +1,266 @@ +db->db_debug) + { + return $this->db->display_error('db_unsuported_feature'); + } + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Drop database + * + * @access private + * @param string the database name + * @return bool + */ + function _drop_database($name) + { + // PDO has no "drop database" command since it's + // designed to connect to an existing database + if ($this->db->db_debug) + { + return $this->db->display_error('db_unsuported_feature'); + } + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Create Table + * + * @access private + * @param string the table name + * @param array the fields + * @param mixed primary key(s) + * @param mixed key(s) + * @param boolean should 'IF NOT EXISTS' be added to the SQL + * @return bool + */ + function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) + { + $sql = 'CREATE TABLE '; + + if ($if_not_exists === TRUE) + { + $sql .= 'IF NOT EXISTS '; + } + + $sql .= $this->db->_escape_identifiers($table)." ("; + $current_field_count = 0; + + foreach ($fields as $field=>$attributes) + { + // Numeric field names aren't allowed in databases, so if the key is + // numeric, we know it was assigned by PHP and the developer manually + // entered the field information, so we'll simply add it to the list + if (is_numeric($field)) + { + $sql .= "\n\t$attributes"; + } + else + { + $attributes = array_change_key_case($attributes, CASE_UPPER); + + $sql .= "\n\t".$this->db->_protect_identifiers($field); + + $sql .= ' '.$attributes['TYPE']; + + if (array_key_exists('CONSTRAINT', $attributes)) + { + $sql .= '('.$attributes['CONSTRAINT'].')'; + } + + if (array_key_exists('UNSIGNED', $attributes) && $attributes['UNSIGNED'] === TRUE) + { + $sql .= ' UNSIGNED'; + } + + if (array_key_exists('DEFAULT', $attributes)) + { + $sql .= ' DEFAULT \''.$attributes['DEFAULT'].'\''; + } + + if (array_key_exists('NULL', $attributes) && $attributes['NULL'] === TRUE) + { + $sql .= ' NULL'; + } + else + { + $sql .= ' NOT NULL'; + } + + if (array_key_exists('AUTO_INCREMENT', $attributes) && $attributes['AUTO_INCREMENT'] === TRUE) + { + $sql .= ' AUTO_INCREMENT'; + } + } + + // don't add a comma on the end of the last field + if (++$current_field_count < count($fields)) + { + $sql .= ','; + } + } + + if (count($primary_keys) > 0) + { + $primary_keys = $this->db->_protect_identifiers($primary_keys); + $sql .= ",\n\tPRIMARY KEY (" . implode(', ', $primary_keys) . ")"; + } + + if (is_array($keys) && count($keys) > 0) + { + foreach ($keys as $key) + { + if (is_array($key)) + { + $key = $this->db->_protect_identifiers($key); + } + else + { + $key = array($this->db->_protect_identifiers($key)); + } + + $sql .= ",\n\tFOREIGN KEY (" . implode(', ', $key) . ")"; + } + } + + $sql .= "\n)"; + + return $sql; + } + + // -------------------------------------------------------------------- + + /** + * Drop Table + * + * @access private + * @return bool + */ + function _drop_table($table) + { + // Not a supported PDO feature + if ($this->db->db_debug) + { + return $this->db->display_error('db_unsuported_feature'); + } + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Alter table query + * + * Generates a platform-specific query so that a table can be altered + * Called by add_column(), drop_column(), and column_alter(), + * + * @access private + * @param string the ALTER type (ADD, DROP, CHANGE) + * @param string the column name + * @param string the table name + * @param string the column definition + * @param string the default value + * @param boolean should 'NOT NULL' be added + * @param string the field after which we should add the new field + * @return object + */ + function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') + { + $sql = 'ALTER TABLE '.$this->db->_protect_identifiers($table)." $alter_type ".$this->db->_protect_identifiers($column_name); + + // DROP has everything it needs now. + if ($alter_type == 'DROP') + { + return $sql; + } + + $sql .= " $column_definition"; + + if ($default_value != '') + { + $sql .= " DEFAULT \"$default_value\""; + } + + if ($null === NULL) + { + $sql .= ' NULL'; + } + else + { + $sql .= ' NOT NULL'; + } + + if ($after_field != '') + { + $sql .= ' AFTER ' . $this->db->_protect_identifiers($after_field); + } + + return $sql; + + } + + + // -------------------------------------------------------------------- + + /** + * Rename a table + * + * Generates a platform-specific query so that a table can be renamed + * + * @access private + * @param string the old table name + * @param string the new table name + * @return string + */ + function _rename_table($table_name, $new_table_name) + { + $sql = 'ALTER TABLE '.$this->db->_protect_identifiers($table_name)." RENAME TO ".$this->db->_protect_identifiers($new_table_name); + return $sql; + } + + +} + +/* End of file pdo_forge.php */ +/* Location: ./system/database/drivers/pdo/pdo_forge.php */ \ No newline at end of file diff --git a/system/database/drivers/pdo/pdo_result.php b/system/database/drivers/pdo/pdo_result.php new file mode 100644 index 000000000..7f3058ff0 --- /dev/null +++ b/system/database/drivers/pdo/pdo_result.php @@ -0,0 +1,171 @@ +result_id->rowCount(); + } + + // -------------------------------------------------------------------- + + /** + * Number of fields in the result set + * + * @access public + * @return integer + */ + function num_fields() + { + return $this->result_id->columnCount(); + } + + // -------------------------------------------------------------------- + + /** + * Fetch Field Names + * + * Generates an array of column names + * + * @access public + * @return array + */ + function list_fields() + { + if ($this->db->db_debug) + { + return $this->db->display_error('db_unsuported_feature'); + } + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Field data + * + * Generates an array of objects containing field meta-data + * + * @access public + * @return array + */ + function field_data() + { + $data = array(); + + try + { + for($i = 0; $i < $this->num_fields(); $i++) + { + $data[] = $this->result_id->getColumnMeta($i); + } + + return $data; + } + catch (Exception $e) + { + if ($this->db->db_debug) + { + return $this->db->display_error('db_unsuported_feature'); + } + return FALSE; + } + } + + // -------------------------------------------------------------------- + + /** + * Free the result + * + * @return null + */ + function free_result() + { + if (is_object($this->result_id)) + { + $this->result_id = FALSE; + } + } + + // -------------------------------------------------------------------- + + /** + * Data Seek + * + * Moves the internal pointer to the desired offset. We call + * this internally before fetching results to make sure the + * result set starts at zero + * + * @access private + * @return array + */ + function _data_seek($n = 0) + { + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Result - associative array + * + * Returns the result set as an array + * + * @access private + * @return array + */ + function _fetch_assoc() + { + return $this->result_id->fetch(PDO::FETCH_ASSOC); + } + + // -------------------------------------------------------------------- + + /** + * Result - object + * + * Returns the result set as an object + * + * @access private + * @return object + */ + function _fetch_object() + { + return $this->result_id->fetchObject(); + } + +} + + +/* End of file pdo_result.php */ +/* Location: ./system/database/drivers/pdo/pdo_result.php */ \ No newline at end of file diff --git a/system/database/drivers/pdo/pdo_utility.php b/system/database/drivers/pdo/pdo_utility.php new file mode 100644 index 000000000..29aefca80 --- /dev/null +++ b/system/database/drivers/pdo/pdo_utility.php @@ -0,0 +1,103 @@ +db->db_debug) + { + return $this->db->display_error('db_unsuported_feature'); + } + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Optimize table query + * + * Generates a platform-specific query so that a table can be optimized + * + * @access private + * @param string the table name + * @return object + */ + function _optimize_table($table) + { + // Not a supported PDO feature + if ($this->db->db_debug) + { + return $this->db->display_error('db_unsuported_feature'); + } + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Repair table query + * + * Generates a platform-specific query so that a table can be repaired + * + * @access private + * @param string the table name + * @return object + */ + function _repair_table($table) + { + // Not a supported PDO feature + if ($this->db->db_debug) + { + return $this->db->display_error('db_unsuported_feature'); + } + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * PDO Export + * + * @access private + * @param array Preferences + * @return mixed + */ + function _backup($params = array()) + { + // Currently unsupported + return $this->db->display_error('db_unsuported_feature'); + } + +} + +/* End of file pdo_utility.php */ +/* Location: ./system/database/drivers/pdo/pdo_utility.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b