From cb07a322bee5c5b0a551ab959c7475a1a702ad03 Mon Sep 17 00:00:00 2001 From: Michael Dennis Date: Sat, 20 Aug 2011 23:40:59 -0700 Subject: Fix for the Image_lib clear() function so that it resets all variables to their default values. This should fix issues #157 and #174. https://github.com/EllisLab/CodeIgniter/issues/157 https://github.com/EllisLab/CodeIgniter/issues/174 --- system/libraries/Image_lib.php | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index 8902f524d..6855e4498 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -104,15 +104,37 @@ class CI_Image_lib { */ function clear() { - $props = array('source_folder', 'dest_folder', 'source_image', 'full_src_path', 'full_dst_path', 'new_image', 'image_type', 'size_str', 'quality', 'orig_width', 'orig_height', 'rotation_angle', 'x_axis', 'y_axis', 'create_fnc', 'copy_fnc', 'wm_overlay_path', 'wm_use_truetype', 'dynamic_output', 'wm_font_size', 'wm_text', 'wm_vrt_alignment', 'wm_hor_alignment', 'wm_padding', 'wm_hor_offset', 'wm_vrt_offset', 'wm_font_color', 'wm_use_drop_shadow', 'wm_shadow_color', 'wm_shadow_distance', 'wm_opacity'); + $props = array('library_path', 'source_image', 'new_image', 'width', 'height', 'rotation_angle', 'x_axis', 'y_axis', 'wm_text', 'wm_overlay_path', 'wm_font_path', 'wm_shadow_color', 'source_folder', 'dest_folder', 'mime_type', 'orig_width', 'orig_height', 'image_type', 'size_str', 'full_src_path', 'full_dst_path'); foreach ($props as $val) { $this->$val = ''; } - // special consideration for master_dim - $this->master_dim = 'auto'; + $this->image_library = 'gd2'; + $this->dynamic_output = FALSE; + $this->quality = '90'; + $this->create_thumb = FALSE; + $this->thumb_marker = '_thumb'; + $this->maintain_ratio = TRUE; + $this->master_dim = 'auto'; + $this->wm_type = 'text'; + $this->wm_x_transp = 4; + $this->wm_y_transp = 4; + $this->wm_font_size = 17; + $this->wm_vrt_alignment = 'B'; + $this->wm_hor_alignment = 'C'; + $this->wm_padding = 0; + $this->wm_hor_offset = 0; + $this->wm_vrt_offset = 0; + $this->wm_font_color = '#ffffff'; + $this->wm_shadow_distance = 2; + $this->wm_opacity = 50; + $this->create_fnc = 'imagecreatetruecolor'; + $this->copy_fnc = 'imagecopyresampled'; + $this->error_msg = array(); + $this->wm_use_drop_shadow = FALSE; + $this->wm_use_truetype = FALSE; } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From a49727ae12e7cf0c71ee7e7d39cc8341623cd1c9 Mon Sep 17 00:00:00 2001 From: Michael Dennis Date: Mon, 29 Aug 2011 10:32:11 -0700 Subject: Added documentation to the change log for the Image_lib clear() function fix --- user_guide/changelog.html | 1 + 1 file changed, 1 insertion(+) diff --git a/user_guide/changelog.html b/user_guide/changelog.html index 978b710be..2932f520b 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -118,6 +118,7 @@ Change Log
  • 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 bugs (#157 and #174) - the Image_lib clear() function now resets all variables to their default values.
  • Version 2.0.3

    -- cgit v1.2.3-24-g4f1b From 319cf4d4d9897a929d6d58ad1a29bcc4a85a0b42 Mon Sep 17 00:00:00 2001 From: Michael Dennis Date: Mon, 29 Aug 2011 12:06:59 -0700 Subject: Added reactor icon to change log for Image_lib clear() function fix --- 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 2932f520b..77d29e869 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -118,7 +118,7 @@ Change Log
  • 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 bugs (#157 and #174) - the Image_lib clear() function now resets all variables to their default values.
  • +
  • Fixed bugs (#157 and #174) - the Image_lib clear() function now resets all variables to their default values.
  • Version 2.0.3

    -- cgit v1.2.3-24-g4f1b From 37e351f1c1bf76758685158630be723e2951c032 Mon Sep 17 00:00:00 2001 From: Kyle Farris Date: Wed, 7 Sep 2011 11:14:46 -0300 Subject: Fix for issue #406 --- system/database/drivers/sqlsrv/sqlsrv_driver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php index 400fd31c6..1021db945 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_driver.php +++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php @@ -86,7 +86,7 @@ class CI_DB_sqlsrv_driver extends CI_DB { */ function db_pconnect() { - $this->db_connect(TRUE); + return $this->db_connect(TRUE); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 6636cef6fc457b3a0490d051587cb430aa0021d0 Mon Sep 17 00:00:00 2001 From: Kyle Farris Date: Wed, 7 Sep 2011 11:25:54 -0300 Subject: Added changelog item for Issue #406 --- user_guide/changelog.html | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/user_guide/changelog.html b/user_guide/changelog.html index e3f12772e..6fe501e06 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -113,14 +113,15 @@ 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 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 (#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 (#406) - sqlsrv DB driver not reuturning resource on db_pconnect().
  • Version 2.0.3

    -- cgit v1.2.3-24-g4f1b From cd38d6774bf11bab8e2a07f861c876097a287f59 Mon Sep 17 00:00:00 2001 From: Kyle Farris Date: Fri, 14 Oct 2011 12:49:40 -0400 Subject: Merged with develop and updated to new changelog. --- user_guide/changelog.html | 1438 ----------------------------------- user_guide_src/source/changelog.rst | 4 + 2 files changed, 4 insertions(+), 1438 deletions(-) delete mode 100644 user_guide/changelog.html diff --git a/user_guide/changelog.html b/user_guide/changelog.html deleted file mode 100644 index 6fe501e06..000000000 --- a/user_guide/changelog.html +++ /dev/null @@ -1,1438 +0,0 @@ - - - - - - - - - - - - - - - - - - - -Change Log : CodeIgniter User Guide - - - - - - - -
    - - - - - -

    CodeIgniter User Guide Version 2.0.3

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

    Change Log

    - -

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

    - -

    Version 2.1.0 (planned)

    -

    Release Date: Not Released

    - -
      -
    • General Changes -
        -
      • Added Android to the list of user agents.
      • -
      • Added Windows 7 to the list of user platforms.
      • -
      • Callback validation rules can now accept parameters like any other validation rule.
      • -
      • Ability to log certain error types, not all under a threshold.
      • -
      • Added html_escape() to Common functions to escape HTML output for preventing XSS.
      • -
      -
    • -
    • Helpers -
        -
      • Added increment_string() to String Helper to turn "foo" into "foo-1" or "foo-1" into "foo-2".
      • -
      • Altered form helper - made action on form_open_multipart helper function call optional. Fixes (#65)
      • -
      • url_title() will now trim extra dashes from beginning and end.
      • -
      • Improved speed of String Helper's random_string() method
      • -
      -
    • -
    • 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 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.
      • -
      • Driver children can be located in any package path.
      • -
      • Added max_filename_increment config setting for Upload library.
      • -
      • CI_Loader::_ci_autoloader() is now a protected method.
      • -
      • Added is_unique to the Form Validation library.
      • -
      -
    • -
    • Core -
        -
      • Changed private functions in CI_URI to protected so MY_URI can override them.
      • -
      -
    • -
    - -

    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 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 (#406) - sqlsrv DB driver not reuturning resource on db_pconnect().
    • -
    - -

    Version 2.0.3

    -

    Release Date: August 20, 2011

    - -
      -
    • Security -
        -
      • An improvement was made to the MySQL and MySQLi drivers to prevent exposing a potential vector for SQL injection on sites using multi-byte character sets in the database client connection.

        An incompatibility in PHP versions < 5.2.3 and MySQL < 5.0.7 with mysql_set_charset() creates a situation where using multi-byte character sets on these environments may potentially expose a SQL injection attack vector. Latin-1, UTF-8, and other "low ASCII" character sets are unaffected on all environments.

        If you are running or considering running a multi-byte character set for your database connection, please pay close attention to the server environment you are deploying on to ensure you are not vulnerable.

      • -
      -
    • -
    • General Changes -
        -
      • Fixed a bug where there was a misspelling within a code comment in the index.php file.
      • -
      • 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 CSRF protection URI whitelisting.
      • -
      • Fixed a bug where Email library attachments with a "." in the name would using invalid MIME-types.
      • -
      • Added support for pem,p10,p12,p7a,p7c,p7m,p7r,p7s,crt,crl,der,kdb,rsa,cer,sst,csr Certs to mimes.php.
      • -
      • Added support pgp,gpg to mimes.php.
      • -
      • Added support 3gp, 3g2, mp4, wmv, f4v, vlc Video files to mimes.php.
      • -
      • Added support m4a, aac, m4u, xspf, au, ac3, flac, ogg Audio files to mimes.php.
      • - -
      -
    • -
    • 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.
      • -
      -
    • -
    • Libraries -
        -
      • Altered Session to use a longer match against the user_agent string. See upgrade notes if using database sessions.
      • -
      • 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.
    • -
    • 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.
    • -
    - -

    Version 2.0.2

    -

    Release Date: April 7, 2011
    -Hg Tag: v2.0.2

    - -
      -
    • General changes -
        -
      • 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.
      • -
      -
    • -
    • 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.
      • -
      -
    • -
    • Database -
        -
      • $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.
    • - -
    - -

    Version 2.0.1

    -

    Release Date: March 15, 2011
    -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, - which configuration files are loaded (see below). Read more on the Handling Environments page.
      • -
      • 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.
      • -
      -
    • -
    • Helpers -
        -
      • 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.
    • -
    - -

    Version 2.0.0

    -

    Release Date: January 28, 2011
    -Hg Tag: v2.0.0

    - -
      -
    • General changes -
        -
      • PHP 4 support is removed. CodeIgniter now requires PHP 5.1.6.
      • -
      • 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.
      • -
      • 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.
      • -
      • Added the ability to set config values (or override config values) directly from data set in the main index.php file. This allows a single application to be used with multiple front controllers, each having its own config values.
      • -
      • Added $config['directory_trigger'] to the config file so that a controller sub-directory can be specified when running _GET strings instead of URI segments.
      • -
      • Added ability to set "Package" paths - specific paths where the Loader and Config classes should try to look first for a requested file. This allows distribution of sub-applications with their own libraries, models, config files, etc. in a single "package" directory. See the Loader class documentation for more details.
      • -
      • 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';.
      • -
      -
    • Libraries -
        -
      • 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.
      • -
      • Added CSRF (Cross-site Reference Forgery) protection to the Security library.
      • -
      • Added $parse_exec_vars property to Output library.
      • -
      • Added ability to enable / disable individual sections of the Profiler
      • -
      • Added a wildcard option $config['allowed_types'] = '*' to the File Uploading Class.
      • -
      • Added an 'object' config variable to the XML-RPC Server library so that one can specify the object to look for requested methods, instead of assuming it is in the $CI superobject.
      • -
      • Added "is_object" into the list of unit tests capable of being run.
      • -
      • Table library will generate an empty cell with a blank string, or NULL value.
      • -
      • Added ability to set tag attributes for individual cells in the Table library
      • -
      • Added a parse_string() method to the Parser Class.
      • -
      • Added HTTP headers and Config information to the Profiler output.
      • -
      • Added Chrome and Flock to the list of detectable browsers by browser() in the User Agent Class.
      • -
      • The Unit Test Class now has an optional "notes" field available to it, and allows for discrete display of test result items using $this->unit->set_test_items().
      • -
      • Added a $xss_clean class variable to the XMLRPC library, enabling control over the use of the Security library's xss_clean() method.
      • -
      • Added a download() method to the FTP library
      • -
      • Changed do_xss_clean() to return FALSE if the uploaded file fails XSS checks.
      • -
      • Added stripslashes() and trim()ing of double quotes from $_FILES type value to standardize input in Upload library.
      • -
      • Added a second parameter (boolean) to $this->zip->read_dir('/path/to/directory', FALSE) to remove the preceding trail of empty folders when creating a Zip archive. This example would contain a zip with "directory" and all of its contents.
      • -
      • Added ability in the Image Library to handle PNG transparency for resize operations when using the GD lib.
      • -
      • Modified the Session class to prevent use if no encryption key is set in the config file.
      • -
      • Added a new config item to the Session class sess_expire_on_close to allow sessions to auto-expire when the browser window is closed.
      • -
      • Improved performance of the Encryption library on servers where Mcrypt is available.
      • -
      • Changed the default encryption mode in the Encryption library to CBC.
      • -
      • Added an encode_from_legacy() method to provide a way to transition encrypted data from CodeIgniter 1.x to CodeIgniter 2.x. - Please see the upgrade instructions for details.
      • -
      • 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.
      • -
      -
    • -
    • Database -
        -
      • database configuration.
      • -
      • Added autoinit value to database configuration.
      • -
      • Added stricton value to database configuration.
      • -
      • Added database_exists() to the Database Utilities Class.
      • -
      • Semantic change to db->version() function to allow a list of exceptions for databases with functions to return version string instead of specially formed SQL queries. Currently this list only includes Oracle and SQLite.
      • -
      • Fixed a bug where driver specific table identifier protection could lead to malformed queries in the field_data() functions.
      • -
      • Fixed a bug where an undefined class variable was referenced in database drivers.
      • -
      • Modified the database errors to show the filename and line number of the problematic query.
      • -
      • Removed the following deprecated functions: orwhere, orlike, groupby, orhaving, orderby, getwhere.
      • -
      • Removed deprecated _drop_database() and _create_database() functions from the db utility drivers.
      • -
      • Improved dbforge create_table() function for the Postgres driver.
      • -
      -
    • -
    • Helpers -
        -
      • Added convert_accented_characters() function to text helper.
      • -
      • Added accept-charset to the list of inserted attributes of form_open() in the Form Helper.
      • -
      • Deprecated the dohash() function in favour of do_hash() for naming consistency.
      • -
      • Non-backwards compatible change made to get_dir_file_info() in the File Helper. No longer recurses - by default so as to encourage responsible use (this function can cause server performance issues when used without caution).
      • -
      • Modified the second parameter of directory_map() in the Directory Helper to accept an integer to specify recursion depth.
      • -
      • Modified delete_files() in the File Helper to return FALSE on failure.
      • -
      • Added an optional second parameter to byte_format() in the Number Helper to allow for decimal precision.
      • -
      • Added alpha, and sha1 string types to random_string() in the String Helper.
      • -
      • Modified prep_url() so as to not prepend http:// if the supplied string already has a scheme.
      • -
      • Modified get_file_info in the file helper, changing filectime() to filemtime() for dates.
      • -
      • Modified smiley_js() to add optional third parameter to return only the javascript with no script tags.
      • -
      • The img() function of the HTML helper will now generate an empty string as an alt attribute if one is not provided.
      • -
      • If CSRF is enabled in the application config file, form_open() will automatically insert it as a hidden field.
      • -
      • Added sanitize_filename() into the Security helper.
      • -
      • Added ellipsize() to the Text Helper
      • -
      • Added elements() to the Array Helper
      • -
      -
    • -
    • Other Changes -
        -
      • Added an optional second parameter to show_404() to disable logging.
      • -
      • Updated loader to automatically apply the sub-class prefix as an option when loading classes. Class names can be prefixed with the standard "CI_" or the same prefix as the subclass prefix, or no prefix at all.
      • -
      • Increased randomness with is_really_writable() to avoid file collisions when hundreds or thousands of requests occur at once.
      • -
      • Switched some DIR_WRITE_MODE constant uses to FILE_WRITE_MODE where files and not directories are being operated on.
      • -
      • get_mime_by_extension() is now case insensitive.
      • -
      • Added "default" to the list Reserved Names.
      • -
      • Added 'application/x-msdownload' for .exe files and ''application/x-gzip-compressed' for .tgz files to config/mimes.php.
      • -
      • Updated the output library to no longer compress output or send content-length headers if the server runs with zlib.output_compression enabled.
      • -
      • Eliminated a call to is_really_writable() on each request unless it is really needed (Output caching)
      • -
      • Documented append_output() in the Output Class.
      • -
      • Documented a second argument in the decode() function for the Encryption Class.
      • -
      • Documented db->close().
      • -
      • Updated the router to support a default route with any number of segments.
      • -
      • Moved _remove_invisible_characters() function from the Security Library to common functions.
      • -
      • Added audio/mpeg3 as a valid mime type for MP3.
      • -
      -
    • -
    - -

    Bug fixes for 2.0.0

    -
      -
    • 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.
    • -
    • Fixed assorted user guide typos or examples (#10693, #8951, #7825, #8660, #7883, #6771, #10656).
    • -
    • Fixed a language key in the profiler: "profiler_no_memory_usage" to "profiler_no_memory".
    • -
    • Fixed an error in the Zip library that didn't allow downloading on PHP 4 servers.
    • -
    • Fixed a bug in the Form Validation library where fields passed as rule parameters were not being translated (#9132)
    • -
    • Modified inflector helper to properly pluralize words that end in 'ch' or 'sh'
    • -
    • Fixed a bug in xss_clean() that was not allowing hyphens in query strings of submitted URLs.
    • -
    • Fixed bugs in get_dir_file_info() and get_file_info() in the File Helper with recursion, and file paths on Windows.
    • -
    • Fixed a bug where Active Record override parameter would not let you disable Active Record if it was enabled in your database config file.
    • -
    • Fixed a bug in reduce_double_slashes() in the String Helper to properly remove duplicate leading slashes (#7585)
    • -
    • Fixed a bug in values_parsing() of the XML-RPC library which prevented NULL variables typed as 'string' from being handled properly.
    • -
    • Fixed a bug were form_open_multipart() didn't accept string attribute arguments (#10930).
    • -
    • Fixed a bug (#10470) where get_mime_by_extension() was case sensitive.
    • -
    • Fixed a bug where some error messages for the SQLite and Oracle drivers would not display.
    • -
    • Fixed a bug where files created with the Zip Library would result in file creation dates of 1980.
    • -
    • Fixed a bug in the Session library that would result in PHP error when attempting to store values with objects.
    • -
    • Fixed a bug where extending the Controller class would result in a fatal PHP error.
    • -
    • Fixed a PHP Strict Standards Error in the index.php file.
    • -
    • Fixed a bug where getimagesize() was being needlessly checked on non-image files in is_allowed_type().
    • -
    • Fixed a bug in the Encryption library where an empty key was not triggering an error.
    • -
    • Fixed a bug in the Email library where CC and BCC recipients were not reset when using the clear() method (#109).
    • -
    • Fixed a bug in the URL Helper where prep_url() could cause a PHP error on PHP versions < 5.1.2.
    • -
    • Added a log message in core/output if the cache directory config value was not found.
    • -
    • Fixed a bug where multiple libraries could not be loaded by passing an array to load->library()
    • -
    • Fixed a bug in the html helper where too much white space was rendered between the src and alt tags in the img() function.
    • -
    • Fixed a bug in the profilers _compile_queries() function.
    • -
    • Fixed a bug in the date helper where the DATE_ISO8601 variable was returning an incorrectly formatted date string.
    • -
    - -

    Version 1.7.2

    -

    Release Date: September 11, 2009
    -Hg Tag: v1.7.2

    - -
      -
    • Libraries -
        -
      • Added a new Cart Class.
      • -
      • Added the ability to pass $config['file_name'] for the File Uploading Class and rename the uploaded file.
      • -
      • Changed order of listed user-agents so Safari would more accurately report itself. (#6844)
      • -
      -
    • -
    • Database -
        -
      • Switched from using gettype() in escape() to is_* methods, since future PHP versions might change its output.
      • -
      • Updated all database drivers to handle arrays in escape_str()
      • -
      • Added escape_like_str() method for escaping strings to be used in LIKE conditions
      • -
      • Updated Active Record to utilize the new LIKE escaping mechanism.
      • -
      • Added reconnect() method to DB drivers to try to keep alive / reestablish a connection after a long idle.
      • -
      • Modified MSSQL driver to use mssql_get_last_message() for error messages.
      • -
      -
    • -
    • Helpers -
        -
      • Added form_multiselect() to the Form helper.
      • -
      • Modified form_hidden() in the Form helper to accept multi-dimensional arrays.
      • -
      • Modified form_prep() in the Form helper to keep track of prepped fields to avoid multiple prep/mutation from subsequent calls which can occur when using Form Validation - and form helper functions to output form fields.
      • -
      • Modified directory_map() in the Directory helper to allow the inclusion of hidden files, and to return FALSE on failure to read directory.
      • -
      • Modified the Smiley helper to work with multiple fields and insert the smiley at the last known cursor position.
      • -
      -
    • -
    • General - -
    • -
    - -

    Bug fixes for 1.7.2

    -
      -
    • Fixed assorted user guide typos or examples (#6743, #7214, #7516, #7287, #7852, #8224, #8324, #8349).
    • -
    • Fixed a bug in the Form Validation library where multiple callbacks weren't working (#6110)
    • -
    • doctype helper default value was missing a "1".
    • -
    • Fixed a bug in the language class when outputting an error for an unfound file.
    • -
    • Fixed a bug in the Calendar library where the shortname was output for "May".
    • -
    • Fixed a bug with ORIG_PATH_INFO that was allowing URIs of just a slash through.
    • -
    • Fixed a fatal error in the Oracle and ODBC drivers (#6752)
    • -
    • Fixed a bug where xml_from_result() was checking for a nonexistent method.
    • -
    • Fixed a bug where Database Forge's add_column and modify_column were not looping through when sent multiple fields.
    • -
    • Fixed a bug where the File Helper was using '/' instead of the DIRECTORY_SEPARATOR constant.
    • -
    • Fixed a bug to prevent PHP errors when attempting to use sendmail on servers that have manually disabled the PHP popen() function.
    • -
    • Fixed a bug that would cause PHP errors in XML-RPC data if the PHP data type did not match the specified XML-RPC type.
    • -
    • Fixed a bug in the XML-RPC class with parsing dateTime.iso8601 data types.
    • -
    • Fixed a case sensitive string replacement in xss_clean()
    • -
    • Fixed a bug in form_textarea() where form data was not prepped correctly.
    • -
    • Fixed a bug in form_prep() causing it to not preserve entities in the user's original input when called back into a form element
    • -
    • Fixed a bug in _protect_identifiers() where the swap prefix ($swap_pre) was not being observed.
    • -
    • Fixed a bug where the 400 status header sent with the 'disallowed URI characters' was not compatible with CGI environments.
    • -
    • Fixed a bug in the typography class where heading tags could have paragraph tags inserted when using auto_typography().
    • -
    - -

    Version 1.7.1

    -

    Release Date: February 10, 2009
    -Hg Tag: 1.7.1

    - -
      -
    • Libraries -
        -
      • Fixed an arbitrary script execution security flaw (#6068) in the Form Validation library (thanks to hkk)
      • -
      • Changed default current page indicator in the Pagination library to use <strong> instead of <b>
      • -
      • A "HTTP/1.1 400 Bad Request" header is now sent when disallowed characters are encountered.
      • -
      • Added <big>, <small>, <q>, and <tt> to the Typography parser's inline elements.
      • -
      • Added more accurate error reporting for the Email library when using sendmail.
      • -
      • Removed a strict type check from the rotate() function of the Image Manipulation Class.
      • -
      • Added enhanced error checking in file saving in the Image library when using the GD lib.
      • -
      • Added an additional newline between multipart email headers and the MIME message text for better compatibility with a variety of MUAs.
      • -
      • Made modest improvements to efficiency and accuracy of explode_name() in the Image lib.
      • -
      -
    • -
    • Database -
        -
      • Added where_in to the list of expected arguments received by delete().
      • -
      -
    • -
    • Helpers -
        -
      • Added the ability to have optgroups in form_dropdown() within the form helper.
      • -
      • Added a doctype() function to the HTML helper.
      • -
      • Added ability to force lowercase for url_title() in the URL helper.
      • -
      • Changed the default "type" of form_button() to "button" from "submit" in the form helper.
      • -
      • Changed redirect() in the URL helper to allow redirections to URLs outside of the CI site.
      • -
      • Updated get_cookie() to try to fetch the cookie using the global cookie prefix if the requested cookie name doesn't exist.
      • -
      -
    • -
    • Other Changes -
        -
      • Improved security in xss_clean() to help prevent attacks targeting Internet Explorer.
      • -
      • Added 'application/msexcel' to config/mimes.php for .xls files.
      • -
      • Added 'proxy_ips' config item to whitelist reverse proxy servers from which to trust the HTTP_X_FORWARDED_FOR header to - to determine the visitor's IP address.
      • -
      • Improved accuracy of Upload::is_allowed_filetype() for images (#6715)
      • -
      -
    • -
    - -

    Bug fixes for 1.7.1

    -
      -
    • Database -
        -
      • Fixed a bug when doing 'random' on order_by() (#5706).
      • -
      • Fixed a bug where adding a primary key through Forge could fail (#5731).
      • -
      • Fixed a bug when using DB cache on multiple databases (#5737).
      • -
      • Fixed a bug where TRUNCATE was not considered a "write" query (#6619).
      • -
      • Fixed a bug where csv_from_result() was checking for a nonexistent method.
      • -
      • Fixed a bug _protect_identifiers() where it was improperly removing all pipe symbols from items
      • -
      -
    • -
    • Fixed assorted user guide typos or examples (#5998, #6093, #6259, #6339, #6432, #6521).
    • -
    • Fixed a bug in the MySQLi driver when no port is specified
    • -
    • Fixed a bug (#5702), in which the field label was not being fetched properly, when "matching" one field to another.
    • -
    • Fixed a bug in which identifers were not being escaped properly when reserved characters were used.
    • -
    • Fixed a bug with the regular expression used to protect submitted paragraph tags in auto typography.
    • -
    • Fixed a bug where double dashes within tag attributes were being converted to em dash entities.
    • -
    • Fixed a bug where double spaces within tag attributes were being converted to non-breaking space entities.
    • -
    • Fixed some accuracy issues with curly quotes in Typography::format_characters()
    • -
    • Changed a few docblock comments to reflect actual return values.
    • -
    • Fixed a bug with high ascii characters in subject and from email headers.
    • -
    • Fixed a bug in xss_clean() where whitespace following a validated character entity would not be preserved.
    • -
    • Fixed a bug where HTML comments and <pre> tags were being parsed in Typography::auto_typography().
    • -
    • Fixed a bug with non-breaking space cleanup in Typography::auto_typography().
    • -
    • Fixed a bug in database escaping where a compound statement (ie: SUM()) wasn't handled correctly with database prefixes.
    • -
    • Fixed a bug when an opening quote is preceded by a paragraph tag and immediately followed by another tag.
    • -
    • Fixed a bug in the Text Helper affecting some locales where word_censor() would not work on words beginning or ending with an accented character.
    • -
    • Fixed a bug in the Text Helper character limiter where the provided limit intersects the last word of the string.
    • -
    • Fixed a bug (#6342) with plural() in the Inflection helper with words ending in "y".
    • -
    • Fixed bug (#6517) where Routed URI segments returned by URI::rsegment() method were incorrect for the default controller.
    • -
    • Fixed a bug (#6706) in the Security Helper where xss_clean() was using a deprecated second argument.
    • -
    • Fixed a bug in the URL helper url_title() function where trailing periods were allowed at the end of a URL.
    • -
    • Fixed a bug (#6669) in the Email class when CRLF's are used for the newline character with headers when used with the "mail" protocol.
    • -
    • Fixed a bug (#6500) where URI::A_filter_uri() was exit()ing an error instead of using show_error().
    • -
    • Fixed a bug (#6592) in the File Helper where get_dir_file_info() where recursion was not occurring properly.
    • -
    • Tweaked Typography::auto_typography() for some edge-cases.
    • -
    - - -

    Version 1.7

    -

    Release Date: October 23, 2008
    -Hg Tag: 1.7.0

    - -
      -
    • Libraries -
        -
      • Added a new Form Validation Class. It simplifies setting rules and field names, supports arrays as field names, allows groups of validation rules to be saved in a config file, and adds some helper functions for use in view files. Please note that the old Validation class is now deprecated. We will leave it in the library folder for some time so that existing applications that use it will not break, but you are encouraged to migrate to the new version.
      • -
      • Updated the Sessions class so that any custom data being saved gets stored to a database rather than the session cookie (assuming you are using a database to store session data), permitting much more data to be saved.
      • -
      • Added the ability to store libraries in subdirectories within either the main "libraries" or the local application "libraries" folder. Please see the Loader class for more info.
      • -
      • Added the ability to assign library objects to your own variable names when you use $this->load->library(). Please see the Loader class for more info.
      • -
      • Added controller class/method info to Profiler class and support for multiple database connections.
      • -
      • Improved the "auto typography" feature and moved it out of the helper into its own Typography Class.
      • -
      • Improved performance and accuracy of xss_clean(), including reduction of false positives on image/file tests.
      • -
      • Improved Parser class to allow multiple calls to the parse() function. The output of each is appended in the output.
      • -
      • Added max_filename option to set a file name length limit in the File Upload Class.
      • -
      • Added set_status_header() function to Output class.
      • -
      • Modified Pagination class to only output the "First" link when the link for page one would not be shown.
      • -
      • Added support for mb_strlen in the Form Validation class so that multi-byte languages will calculate string lengths properly.
      • -
      -
    • -
    • Database -
        -
      • Improved Active Record class to allow full path column and table names: hostname.database.table.column. Also improved the alias handling.
      • -
      • Improved how table and column names are escaped and prefixed. It now honors full path names when adding prefixes and escaping.
      • -
      • Added Active Record caching feature to "update" and "delete" functions.
      • -
      • Added removal of non-printing control characters in escape_str() of DB drivers that do not have native PHP escaping mechanisms (mssql, oci8, odbc), to avoid potential SQL errors, and possible sources of SQL injection.
      • -
      • Added port support to MySQL, MySQLi, and MS SQL database drivers.
      • -
      • Added driver name variable in each DB driver, based on bug report #4436.
      • -
      -
    • -
    • Helpers -
        -
      • Added several new "setting" functions to the Form helper that allow POST data to be retrieved and set into forms. These are intended to be used on their own, or with the new Form Validation Class.
      • -
      • Added current_url() and uri_segments() to URL helper.
      • -
      • Altered auto_link() in the URL helper so that email addresses with "+" included will be linked.
      • -
      • Added meta() function to HTML helper.
      • -
      • Improved accuracy of calculations in Number helper.
      • -
      • Removed added newlines ("\n") from most form and html helper functions.
      • -
      • Tightened up validation in the Date helper function human_to_unix(), and eliminated the POSIX regex.
      • -
      • Updated Date helper to match the world's current time zones and offsets.
      • -
      • Modified url_title() in the URL helper to remove characters and digits that are part of - character entities, to allow dashes, underscores, and periods regardless of the $separator, and to allow uppercase characters.
      • -
      • Added support for arbitrary attributes in anchor_popup() of the URL helper.
      • -
      -
    • -
    • Other Changes -
        -
      • Added PHP Style Guide to docs.
      • -
      • Added sanitization in xss_clean() for a deprecated HTML tag that could be abused in user input in Internet Explorer.
      • -
      • Added a few openxml document mime types, and an additional mobile agent to mimes.php and user_agents.php respectively.
      • -
      • Added a file lock check during caching, before trying to write to the file.
      • -
      • Modified Cookie key cleaning to unset a few troublesome key names that can be present in certain environments, preventing CI from halting execution.
      • -
      • Changed the output of the profiler to use style attribute rather than clear, and added the id "codeigniter_profiler" to the container div.
      • -
      -
    • -
    - -

    Bug fixes for 1.7.0

    -
      -
    • Fixed bug in xss_clean() that could remove some desirable tag attributes.
    • -
    • Fixed assorted user guide typos or examples (#4807, #4812, #4840, #4862, #4864, #4899, #4930, #5006, #5071, #5158, #5229, #5254, #5351).
    • -
    • Fixed an edit from 1.6.3 that made the $robots array in user_agents.php go poof.
    • -
    • Fixed a bug in the Email library with quoted-printable encoding improperly encoding space and tab characters.
    • -
    • Modified XSS sanitization to no longer add semicolons after &[single letter], such as in M&M's, B&B, etc.
    • -
    • Modified XSS sanitization to no longer strip XHTML image tags of closing slashes.
    • -
    • Fixed a bug in the Session class when database sessions are used where upon session update all userdata would be errantly written to the session cookie.
    • -
    • Fixed a bug (#4536) in backups with the MySQL driver where some legacy code was causing certain characters to be double escaped.
    • -
    • Fixed a routing bug (#4661) that occurred when the default route pointed to a subfolder.
    • -
    • Fixed the spelling of "Dhaka" in the timezone_menu() function of the Date helper.
    • -
    • Fixed the spelling of "raspberry" in config/smileys.php.
    • -
    • Fixed incorrect parenthesis in form_open() function (#5135).
    • -
    • Fixed a bug that was ignoring case when comparing controller methods (#4560).
    • -
    • Fixed a bug (#4615) that was not setting SMTP authorization settings when using the initialize function.
    • -
    • Fixed a bug in highlight_code() in the Text helper that would leave a stray </span> in certain cases.
    • -
    • Fixed Oracle bug (#3306) that was preventing multiple queries in one action.
    • -
    • Fixed ODBC bug that was ignoring connection params due to its use of a constructor.
    • -
    • Fixed a DB driver bug with num_rows() that would cause an error with the Oracle driver.
    • -
    • Fixed MS SQL bug (#4915). Added brackets around database name in MS SQL driver when selecting the database, in the event that reserved characters are used in the name.
    • -
    • Fixed a DB caching bug (4718) in which the path was incorrect when no URI segments were present.
    • -
    • Fixed Image_lib class bug #4562. A path was not defined for NetPBM.
    • -
    • Fixed Image_lib class bug #4532. When cropping an image with identical height/width settings on output, a copy is made.
    • -
    • Fixed DB_driver bug (4900), in which a database error was not being logged correctly.
    • -
    • Fixed DB backup bug in which field names were not being escaped.
    • -
    • Fixed a DB Active Record caching bug in which multiple calls to cached data were not being honored.
    • -
    • Fixed a bug in the Session class that was disallowing slashes in the serialized array.
    • -
    • Fixed a Form Validation bug in which the "isset" error message was being trigged by the "required" rule.
    • -
    • Fixed a spelling error in a Loader error message.
    • -
    • Fixed a bug (5050) with IP validation with empty segments.
    • -
    • Fixed a bug in which the parser was being greedy if multiple identical sets of tags were encountered.
    • -
    - -

    Version 1.6.3

    -

    Release Date: June 26, 2008
    -Hg Tag: v1.6.3

    - -

    Version 1.6.3 is a security and maintenance release and is recommended for all users.

    -
      -
    • Database -
        -
      • Modified MySQL/MySQLi Forge class to give explicit names to keys
      • -
      • Added ability to set multiple column non-primary keys to the Forge class
      • -
      • Added ability to set additional database config values in DSN connections via the query string.
      • -
      -
    • -
    • Libraries -
        -
      • Set the mime type check in the Upload class to reference the global mimes variable.
      • -
      • Added support for query strings to the Pagination class, automatically detected or explicitly declared.
      • -
      • Added get_post() to the Input class.
      • -
      • Documented get() in the Input class.
      • -
      • Added the ability to automatically output language items as form labels in the Language class.
      • -
      -
    • -
    • Helpers - -
    • -
    • Other changes -
        -
      • Improved security in xss_clean().
      • -
      • Removed an unused Router reference in _display_cache().
      • -
      • Added ability to use xss_clean() to test images for XSS, useful for upload security.
      • -
      • Considerably expanded list of mobile user-agents in config/user_agents.php.
      • -
      • Charset information in the userguide has been moved above title for internationalization purposes (#4614).
      • -
      • Added "Using Associative Arrays In a Request Parameter" example to the XMLRPC userguide page.
      • -
      • Removed maxlength and size as automatically added attributes of form_input() in the form helper.
      • -
      • Documented the language file use of byte_format() in the number helper.
      • -
      -
    • -
    - - -

    Bug fixes for 1.6.3

    - -
      -
    • Added a language key for valid_emails in validation_lang.php.
    • -
    • Amended fixes for bug (#3419) with parsing DSN database connections.
    • -
    • Moved the _has_operators() function (#4535) into DB_driver from DB_active_rec.
    • -
    • Fixed a syntax error in upload_lang.php.
    • -
    • Fixed a bug (#4542) with a regular expression in the Image library.
    • -
    • Fixed a bug (#4561) where orhaving() wasn't properly passing values.
    • -
    • Removed some unused variables from the code (#4563).
    • -
    • Fixed a bug where having() was not adding an = into the statement (#4568).
    • -
    • Fixed assorted user guide typos or examples (#4574, #4706).
    • -
    • Added quoted-printable headers to Email class when the multi-part override is used.
    • -
    • Fixed a double opening <p> tag in the index pages of each system directory.
    • -
    - -

    Version 1.6.2

    -

    Release Date: May 13, 2008
    -Hg Tag: 1.6.2

    -
      -
    • Active Record -
        -
      • Added the ability to prevent escaping in having() clauses.
      • -
      • Added rename_table() into DBForge.
      • -
      • Fixed a bug that wasn't allowing escaping to be turned off if the value of a query was NULL.
      • -
      • DB Forge is now assigned to any models that exist after loading (#3457).
      • -
      -
    • -
    • Database -
        -
      • Added Strict Mode to database transactions.
      • -
      • Escape behaviour in where() clauses has changed; values in those with the "FALSE" argument are no longer escaped (ie: quoted).
      • -
      -
    • -
    • Config -
        -
      • Added 'application/vnd.ms-powerpoint' to list of mime types.
      • -
      • Added 'audio/mpg' to list of mime types.
      • -
      • Added new user-modifiable file constants.php containing file mode and fopen constants.
      • -
      • Added the ability to set CRLF settings via config in the Email class.
      • -
      -
    • -
    • Libraries -
        -
      • Added increased security for filename handling in the Upload library.
      • -
      • Added increased security for sessions for client-side data tampering.
      • -
      • The MySQLi forge class is now in sync with MySQL forge.
      • -
      • Added the ability to set CRLF settings via config in the Email class.
      • -
      • Unit Testing results are now colour coded, and a change was made to the default template of results.
      • -
      • Added a valid_emails rule to the Validation class.
      • -
      • The Zip class now exits within download().
      • -
      • The Zip class has undergone a substantial re-write for speed and clarity (thanks stanleyxu for the hard work and code contribution in bug report #3425!)
      • -
      -
    • -
    • Helpers -
        -
      • Added a Compatibility Helper for using some common PHP 5 functions safely in applications that might run on PHP 4 servers (thanks Seppo for the hard work and code contribution!)
      • -
      • Added form_button() in the Form helper.
      • -
      • Changed the radio() and checkbox() functions to default to not checked by default.
      • -
      • Added the ability to include an optional HTTP Response Code in the redirect() function of the URL Helper.
      • -
      • Modified img() in the HTML Helper to remove an unneeded space (#4208).
      • -
      • Modified anchor() in the URL helper to no longer add a default title= attribute (#4209).
      • -
      • The Download helper now exits within force_download().
      • -
      • Added get_dir_file_info(), get_file_info(), and get_mime_by_extension() to the File Helper.
      • -
      • Added symbolic_permissions() and octal_permissions() to the File helper.
      • -
      -
    • -
    • Plugins -
        -
      • Modified captcha generation to first look for the function imagecreatetruecolor, and fallback to imagecreate if it isn't available (#4226).
      • -
      -
    • -
    • Other - Changes -
        -
      • Added ability for xss_clean() to accept arrays.
      • -
      • Removed closing PHP tags from all PHP files to avoid accidental output and potential 'cannot modify headers' errors.
      • -
      • Removed "scripts" from the auto-load search path. Scripts were deprecated - in Version 1.4.1 (September 21, 2006). If you still need to use them for legacy reasons, they must now be manually loaded in each Controller.
      • -
      • Added a Reserved Names page to the userguide, and migrated reserved controller names into it.
      • -
      • Added a Common Functions page to the userguide for globally available functions.
      • -
      • Improved security and performance of xss_clean().
      • -
      -
    • -
    - -

    Bugfixes for 1.6.2

    -
      -
    • Fixed a bug where SET queries were not being handled as "write" queries.
    • -
    • Fixed a bug (#3191) with ORIG_PATH_INFO URI parsing.
    • -
    • Fixed a bug in DB Forge, when inserting an id field (#3456).
    • -
    • Fixed a bug in the table library that could cause identically constructed rows to be dropped (#3459).
    • -
    • Fixed DB Driver and MySQLi result driver checking for resources instead of objects (#3461).
    • -
    • Fixed an AR_caching error where it wasn't tracking table aliases (#3463).
    • -
    • Fixed a bug in AR compiling, where select statements with arguments got incorrectly escaped (#3478).
    • -
    • Fixed an incorrect documentation of $this->load->language (#3520).
    • -
    • Fixed bugs (#3523, #4350) in get_filenames() with recursion and problems with Windows when $include_path is used.
    • -
    • Fixed a bug (#4153) in the XML-RPC class preventing dateTime.iso8601 from being used.
    • -
    • Fixed an AR bug with or_where_not_in() (#4171).
    • -
    • Fixed a bug with xss_clean() that would add semicolons to GET URI variable strings.
    • -
    • Fixed a bug (#4206) in the Directory Helper where the directory resource was not being closed, and minor improvements.
    • -
    • Fixed a bug in the FTP library where delete_dir() was not working recursively (#4215).
    • -
    • Fixed a Validation bug when set_rules() is used with a non-array field name and rule (#4220).
    • -
    • Fixed a bug (#4223) where DB caching would not work for returned DB objects or multiple DB connections.
    • -
    • Fixed a bug in the Upload library that might output the same error twice (#4390).
    • -
    • Fixed an AR bug when joining with a table alias and table prefix (#4400).
    • -
    • Fixed a bug in the DB class testing the $params argument.
    • -
    • Fixed a bug in the Table library where the integer 0 in cell data would be displayed as a blank cell.
    • -
    • Fixed a bug in link_tag() of the URL helper where a key was passed instead of a value.
    • -
    • Fixed a bug in DB_result::row() that prevented it from returning individual fields with MySQL NULL values.
    • -
    • Fixed a bug where SMTP emails were not having dot transformation performed on lines that begin with a dot.
    • -
    • Fixed a bug in display_error() in the DB driver that was instantiating new Language and Exception objects, and not using the error heading.
    • -
    • Fixed a bug (#4413) where a URI containing slashes only e.g. 'http://example.com/index.php?//' would result in PHP errors
    • -
    • Fixed an array to string conversion error in the Validation library (#4425)
    • -
    • Fixed bug (#4451, #4299, #4339) where failed transactions will not rollback when debug mode is enabled.
    • -
    • Fixed a bug (#4506) with overlay_watermark() in the Image library preventing support for PNG-24s with alpha transparency
    • -
    • Fixed assorted user guide typos (#3453, #4364, #4379, #4399, #4408, #4412, #4448, #4488).
    • -
    - -

    Version 1.6.1

    -

    Release Date: February 12, 2008
    -Hg Tag: 1.6.1

    -
      -
    • Active Record - -
    • -
    • Database drivers -
        -
      • Added support for setting client character set and collation for MySQLi.
      • -
      -
    • -
    • Core Changes -
        -
      • Modified xss_clean() to be more intelligent with its handling of URL encoded strings.
      • -
      • Added $_SERVER, $_FILES, $_ENV, and $_SESSION to sanitization of globals.
      • -
      • Added a Path Helper.
      • -
      • Simplified _reindex_segments() in the URI class.
      • -
      • Escaped the '-' in the default 'permitted_uri_chars' config item, to prevent errors if developers just try to add additional characters to the end of the default expression.
      • -
      • Modified method calling to controllers to show a 404 when a private or protected method is accessed via a URL.
      • -
      • Modified framework initiated 404s to log the controller and method for invalid requests.
      • -
      -
    • -
    • Helpers -
        -
      • Modified get_filenames() in the File Helper to return FALSE if the $source_dir is not readable.
      • -
      -
    • -
    - - -

    Bugfixes for 1.6.1

    -
      -
    • Deprecated is_numeric as a validation rule. Use of numeric and integer are preferred.
    • -
    • Fixed bug (#3379) in DBForge with SQLite for table creation.
    • -
    • Made Active Record fully database prefix aware (#3384).
    • -
    • Fixed a bug where DBForge was outputting invalid SQL in Postgres by adding brackets around the tables in FROM.
    • -
    • Changed the behaviour of Active Record's update() to make the WHERE clause optional (#3395).
    • -
    • Fixed a bug (#3396) where certain POST variables would cause a PHP warning.
    • -
    • Fixed a bug in query binding (#3402).
    • -
    • Changed order of SQL keywords in the Profiler $highlight array so OR would not be highlighted before ORDER BY.
    • -
    • Fixed a bug (#3404) where the MySQLi driver was testing if $this->conn_id was a resource instead of an object.
    • -
    • Fixed a bug (#3419) connecting to a database via a DSN string.
    • -
    • Fixed a bug (#3445) where the routed segment array was not re-indexed to begin with 1 when the default controller is used.
    • -
    • Fixed assorted user guide typos.
    • -
    - - - -

    Version 1.6.0

    -

    Release Date: January 30, 2008

    -
      -
    • DBForge -
        -
      • Added DBForge to the database tools.
      • -
      • Moved create_database() and drop_database() into DBForge.
      • -
      • Added add_field(), add_key(), create_table(), drop_table(), add_column(), drop_column(), modify_column() into DBForge.
      • -
      -
    • - -
    • Active Record -
        -
      • Added protect_identifiers() in Active Record.
      • -
      • All AR queries are backticked if appropriate to the database.
      • -
      • Added where_in(), or_where_in(), where_not_in(), or_where_not_in(), not_like() and or_not_like() to Active Record.
      • -
      • Added support for limit() into update() and delete() statements in Active Record.
      • -
      • Added empty_table() and truncate_table() to Active Record.
      • -
      • Added the ability to pass an array of tables to the delete() statement in Active Record.
      • -
      • Added count_all_results() function to Active Record.
      • -
      • Added select_max(), select_min(), select_avg() and select_sum() to Active Record.
      • -
      • Added the ability to use aliases with joins in Active Record.
      • -
      • Added a third parameter to Active Record's like() clause to control where the wildcard goes.
      • -
      • Added a third parameter to set() in Active Record that withholds escaping data.
      • -
      • Changed the behaviour of variables submitted to the where() clause with no values to auto set "IS NULL"
      • -
      -
    • - -
    • Other Database Related -
        -
      • MySQL driver now requires MySQL 4.1+
      • -
      • Added $this->DB->save_queries variable to DB driver, enabling queries to get saved or not. Previously they were always saved.
      • -
      • Added $this->db->dbprefix() to manually add database prefixes.
      • -
      • Added 'random' as an order_by() option , and removed "rand()" as a listed option as it was MySQL only.
      • -
      • Added a check for NULL fields in the MySQL database backup utility.
      • -
      • Added "constrain_by_prefix" parameter to db->list_table() function. If set to TRUE it will limit the result to only table names with the current prefix.
      • -
      • Deprecated from Active Record; getwhere() for get_where(); groupby() for group_by(); havingor() for having_or(); orderby() for order_by; orwhere() for or_where(); and orlike() for or_like().
      • -
      • Modified csv_from_result() to output CSV data more in the spirit of basic rules of RFC 4180.
      • -
      • Added 'char_set' and 'dbcollat' database configuration settings, to explicitly set the client communication properly.
      • -
      • Removed 'active_r' configuration setting and replaced with a global $active_record setting, which is more - in harmony with the global nature of the behavior (#1834).
      • -
      -
    • - -
    • Core changes -
        -
      • Added ability to load multiple views, whose content will be appended to the output in the order loaded.
      • -
      • Added the ability to auto-load Models.
      • -
      • Reorganized the URI and Routes classes for better clarity.
      • -
      • Added Compat.php to allow function overrides for older versions of PHP or PHP environments missing certain extensions / libraries
      • -
      • Added memory usage, GET, URI string data, and individual query execution time to Profiler output.
      • -
      • Deprecated Scaffolding.
      • -
      • Added is_really_writable() to Common.php to provide a cross-platform reliable method of testing file/folder writability.
      • -
      -
    • - -
    • Libraries -
        -
      • Changed the load protocol of Models to allow for extension.
      • -
      • Strengthened the Encryption library to help protect against man in the middle attacks when MCRYPT_MODE_CBC mode is used.
      • -
      • Added Flashdata variables, session_id regeneration and configurable session update times to the Session class.
      • -
      • Removed 'last_visit' from the Session class.
      • -
      • Added a language entry for valid_ip validation error.
      • -
      • Modified prep_for_form() in the Validation class to accept arrays, adding support for POST array validation (via callbacks only)
      • -
      • Added an "integer" rule into the Validation library.
      • -
      • Added valid_base64() to the Validation library.
      • -
      • Documented clear() in the Image Processing library.
      • -
      • Changed the behaviour of custom callbacks so that they no longer trigger the "required" rule.
      • -
      • Modified Upload class $_FILES error messages to be more precise.
      • -
      • Moved the safe mode and auth checks for the Email library into the constructor.
      • -
      • Modified variable names in _ci_load() method of Loader class to avoid conflicts with view variables.
      • -
      • Added a few additional mime type variations for CSV.
      • -
      • Enabled the 'system' methods for the XML-RPC Server library, except for 'system.multicall' which is still disabled.
      • -
      -
    • - -
    • Helpers & Plugins -
        -
      • Added link_tag() to the HTML helper.
      • -
      • Added img() to the HTML helper.
      • -
      • Added ability to "extend" Helpers.
      • -
      • Added an email helper into core helpers.
      • -
      • Added strip_quotes() function to string helper.
      • -
      • Added reduce_multiples() function to string helper.
      • -
      • Added quotes_to_entities() function to string helper.
      • -
      • Added form_fieldset(), form_fieldset_close(), form_label(), and form_reset() function to form helper.
      • -
      • Added support for external urls in form_open().
      • -
      • Removed support for db_backup in MySQLi due to incompatible functions.
      • -
      • Javascript Calendar plugin now uses the months and days from the calendar language file, instead of hard-coded values, internationalizing it.
      • -
      -
    • - - -
    • Documentation Changes -
        -
      • Added Writing Documentation section for the community to use in writing their own documentation.
      • -
      • Added titles to all user manual pages.
      • -
      • Added attributes into <html> of userguide for valid html.
      • -
      • Added Zip Encoding Class to the table of contents of the userguide.
      • -
      • Moved part of the userguide menu javascript to an external file.
      • -
      • Documented distinct() in Active Record.
      • -
      • Documented the timezones() function in the Date Helper.
      • -
      • Documented unset_userdata in the Session class.
      • -
      • Documented 2 config options to the Database configuration page.
      • -
      -
    • -
    - -

    Bug fixes for Version 1.6.0

    - -
      -
    • Fixed a bug (#1813) preventing using $CI->db in the same application with returned database objects.
    • -
    • Fixed a bug (#1842) where the $this->uri->rsegments array would not include the 'index' method if routed to the controller without an implicit method.
    • -
    • Fixed a bug (#1872) where word_limiter() was not retaining whitespace.
    • -
    • Fixed a bug (#1890) in csv_from_result() where content that included the delimiter would break the file.
    • -
    • Fixed a bug (#2542)in the clean_email() method of the Email class to allow for non-numeric / non-sequential array keys.
    • -
    • Fixed a bug (#2545) in _html_entity_decode_callback() when 'global_xss_filtering' is enabled.
    • -
    • Fixed a bug (#2668) in the parser class where numeric data was ignored.
    • -
    • Fixed a bug (#2679) where the "previous" pagination link would get drawn on the first page.
    • -
    • Fixed a bug (#2702) in _object_to_array that broke some types of inserts and updates.
    • -
    • Fixed a bug (#2732) in the SQLite driver for PHP 4.
    • -
    • Fixed a bug (#2754) in Pagination to scan for non-positive num_links.
    • -
    • Fixed a bug (#2762) in the Session library where user agent matching would fail on user agents ending with a space.
    • -
    • Fixed a bug (#2784) $field_names[] vs $Ffield_names[] in postgres and sqlite drivers.
    • -
    • Fixed a bug (#2810) in the typography helper causing extraneous paragraph tags when string contains tags.
    • -
    • Fixed a bug (#2849) where arguments passed to a subfolder controller method would be incorrectly shifted, dropping the 3rd segment value.
    • -
    • Fixed a bug (#2858) which referenced a wrong variable in the Image class.
    • -
    • Fixed a bug (#2875)when loading plugin files as _plugin. and not _pi.
    • -
    • Fixed a bug (#2912) in get_filenames() in the File Helper where the array wasn't cleared after each call.
    • -
    • Fixed a bug (#2974) in highlight_phrase() that caused an error with slashes.
    • -
    • Fixed a bug (#3003) in the Encryption Library to support modes other than MCRYPT_MODE_ECB
    • -
    • Fixed a bug (#3015) in the User Agent library where more then 2 languages where not reported with languages().
    • -
    • Fixed a bug (#3017) in the Email library where some timezones were calculated incorrectly.
    • -
    • Fixed a bug (#3024) in which master_dim wasn't getting reset by clear() in the Image library.
    • -
    • Fixed a bug (#3156) in Text Helper highlight_code() causing PHP tags to be handled incorrectly.
    • -
    • Fixed a bug (#3166) that prevented num_rows from working in Oracle.
    • -
    • Fixed a bug (#3175) preventing certain libraries from working properly when autoloaded in PHP 4.
    • -
    • Fixed a bug (#3267) in the Typography Helper where unordered list was listed "un.
    • -
    • Fixed a bug (#3268) where the Router could leave '/' as the path.
    • -
    • Fixed a bug (#3279) where the Email class was sending the wrong Content-Transfer-Encoding for some character sets.
    • -
    • Fixed a bug (#3284) where the rsegment array would not be set properly if the requested URI contained more segments than the routed URI.
    • -
    • Removed extraneous load of $CFG in _display_cache() of the Output class (#3285).
    • -
    • Removed an extraneous call to loading models (#3286).
    • -
    • Fixed a bug (#3310) with sanitization of globals in the Input class that could unset CI's global variables.
    • -
    • Fixed a bug (#3314) which would cause the top level path to be deleted in delete_files() of the File helper.
    • -
    • Fixed a bug (#3328) where the smiley helper might return an undefined variable.
    • -
    • Fixed a bug (#3330) in the FTP class where a comparison wasn't getting made.
    • -
    • Removed an unused parameter from Profiler (#3332).
    • -
    • Fixed a bug in database driver where num_rows property wasn't getting updated.
    • -
    • Fixed a bug in the upload library when allowed_files wasn't defined.
    • -
    • Fixed a bug in word_wrap() of the Text Helper that incorrectly referenced an object.
    • -
    • Fixed a bug in Validation where valid_ip() wasn't called properly.
    • -
    • Fixed a bug in Validation where individual error messages for checkboxes wasn't supported.
    • -
    • Fixed a bug in captcha calling an invalid PHP function.
    • -
    • Fixed a bug in the cookie helper "set_cookie" function. It was not honoring the config settings.
    • -
    • Fixed a bug that was making validation callbacks required even when not set as such.
    • -
    • Fixed a bug in the XML-RPC library so if a type is specified, a more intelligent decision is made as to the default type.
    • -
    • Fixed an example of comma-separated emails in the email library documentation.
    • -
    • Fixed an example in the Calendar library for Showing Next/Previous Month Links.
    • -
    • Fixed a typo in the database language file.
    • -
    • Fixed a typo in the image language file "suppor" to "support".
    • -
    • Fixed an example for XML RPC.
    • -
    • Fixed an example of accept_charset() in the User Agent Library.
    • -
    • Fixed a typo in the docblock comments that had CodeIgniter spelled CodeIgnitor.
    • -
    • Fixed a typo in the String Helper (uniquid changed to uniqid).
    • -
    • Fixed typos in the email Language class (email_attachment_unredable, email_filed_smtp_login), and FTP Class (ftp_unable_to_remame).
    • -
    • Added a stripslashes() into the Upload Library.
    • -
    • Fixed a series of grammatical and spelling errors in the language files.
    • -
    • Fixed assorted user guide typos.
    • -
    -

    Version 1.5.4

    -

    Release Date: July 12, 2007

    -
      -
    • Added custom Language files to the autoload options.
    • -
    • Added stripslashes() to the _clean_input_data() function in the Input class when magic quotes is on so that data will always be un-slashed within the framework.
    • -
    • Added array to string into the profiler.
    • -
    • Added some additional mime types in application/config/mimes.php.
    • -
    • Added filename_security() method to Input library.
    • -
    • Added some additional arguments to the Inflection helper singular() to compensate for words ending in "s". Also added a force parameter to pluralize().
    • -
    • Added $config['charset'] to the config file. Default value is 'UTF-8', used in some string handling functions.
    • -
    • Fixed MSSQL insert_id().
    • -
    • Fixed a logic error in the DB trans_status() function. It was incorrectly returning TRUE on failure and FALSE on success.
    • -
    • Fixed a bug that was allowing multiple load attempts on extended classes.
    • -
    • Fixed a bug in the bootstrap file that was incorrectly attempting to discern the full server path even when it was explicity set by the user.
    • -
    • Fixed a bug in the escape_str() function in the MySQL driver.
    • -
    • Fixed a typo in the Calendar library
    • -
    • Fixed a typo in rpcs.php library
    • -
    • Fixed a bug in the Zip library, providing PC Zip file compatibility with Mac OS X
    • -
    • Fixed a bug in router that was ignoring the scaffolding route for optimization
    • -
    • Fixed an IP validation bug.
    • -
    • Fixed a bug in display of POST keys in the Profiler output
    • -
    • Fixed a bug in display of queries with characters that would be interpreted as HTML in the Profiler output
    • -
    • Fixed a bug in display of Email class print debugger with characters that would be interpreted as HTML in the debugging output
    • -
    • Fixed a bug in the Content-Transfer-Encoding of HTML emails with the quoted-printable MIME type
    • -
    • Fixed a bug where one could unset certain PHP superglobals by setting them via GET or POST data
    • -
    • Fixed an undefined function error in the insert_id() function of the PostgreSQL driver
    • -
    • Fixed various doc typos.
    • -
    • Documented two functions from the String helper that were missing from the user guide: trim_slashes() and reduce_double_slashes().
    • -
    • Docs now validate to XHTML 1 transitional
    • -
    • Updated the XSS Filtering to take into account the IE expression() ability and improved certain deletions to prevent possible exploits
    • -
    • Modified the Router so that when Query Strings are Enabled, the controller trigger and function trigger values are sanitized for filename include security.
    • -
    • Modified the is_image() method in the Upload library to take into account Windows IE 6/7 eccentricities when dealing with MIMEs
    • -
    • Modified XSS Cleaning routine to be more performance friendly and compatible with PHP 5.2's new PCRE backtrack and recursion limits.
    • -
    • Modified the URL Helper to type cast the $title as a string in case a numeric value is supplied
    • -
    • Modified Form Helper form_dropdown() to type cast the keys and values of the options array as strings, allowing numeric values to be properly set as 'selected'
    • -
    • Deprecated the use if is_numeric() in various places since it allows periods. Due to compatibility problems with ctype_digit(), making it unreliable in some installations, the following regular expression was used instead: preg_match("/[^0-9]/", $n)
    • -
    • Deprecated: APPVER has been deprecated and replaced with CI_VERSION for clarity.
    • -
    -

    Version 1.5.3

    -

    Release Date: April 15, 2007

    -
      -
    • Added array to string into the profiler
    • -
    • Code Igniter references updated to CodeIgniter
    • -
    • pMachine references updated to EllisLab
    • -
    • Fixed a bug in the repeater function of string helper.
    • -
    • Fixed a bug in ODBC driver
    • -
    • Fixed a bug in result_array() that was returning an empty array when no result is produced.
    • -
    • Fixed a bug in the redirect function of the url helper.
    • -
    • Fixed an undefined variable in Loader
    • -
    • Fixed a version bug in the Postgres driver
    • -
    • Fixed a bug in the textarea function of the form helper for use with strings
    • -
    • Fixed doc typos.
    • -
    -

    Version 1.5.2

    -

    Release Date: February 13, 2007

    -
      -
    • Added subversion information to the downloads page.
    • -
    • Added support for captions in the Table Library
    • -
    • Fixed a bug in the download_helper that was causing Internet Explorer to load rather than download
    • -
    • Fixed a bug in the Active Record Join function that was not taking table prefixes into consideration.
    • -
    • Removed unescaped variables in error messages of Input and Router classes
    • -
    • Fixed a bug in the Loader that was causing errors on Libraries loaded twice. A debug message is now silently made in the log.
    • -
    • Fixed a bug in the form helper that gave textarea a value attribute
    • -
    • Fixed a bug in the Image Library that was ignoring resizing the same size image
    • -
    • Fixed some doc typos.
    • -
    - - -

    Version 1.5.1

    -

    Release Date: November 23, 2006

    -
      -
    • Added support for submitting arrays of libraries in the $this->load->library function.
    • -
    • Added support for naming custom library files in lower or uppercase.
    • -
    • Fixed a bug related to output buffering.
    • -
    • Fixed a bug in the active record class that was not resetting query data after a completed query.
    • -
    • Fixed a bug that was suppressing errors in controllers.
    • -
    • Fixed a problem that can cause a loop to occur when the config file is missing.
    • -
    • Fixed a bug that occurred when multiple models were loaded with the third parameter set to TRUE.
    • -
    • Fixed an oversight that was not unsetting globals properly in the input sanitize function.
    • -
    • Fixed some bugs in the Oracle DB driver.
    • -
    • Fixed an incorrectly named variable in the MySQLi result driver.
    • -
    • Fixed some doc typos.
    • -
    -

    Version 1.5.0.1

    -

    Release Date: October 31, 2006

    -
      -
    • Fixed a problem in which duplicate attempts to load helpers and classes were not being stopped.
    • -
    • Fixed a bug in the word_wrap() helper function.
    • -
    • Fixed an invalid color Hex number in the Profiler class.
    • -
    • Fixed a corrupted image in the user guide.
    • -
    - - - -

    Version 1.5.0

    -

    Release Date: October 30, 2006

    - -
      -
    • Added DB utility class, permitting DB backups, CVS or XML files from DB results, and various other functions.
    • -
    • Added Database Caching Class.
    • -
    • Added transaction support to the database classes.
    • -
    • Added Profiler Class which generates a report of Benchmark execution times, queries, and POST data at the bottom of your pages.
    • -
    • Added User Agent Library which allows browsers, robots, and mobile devises to be identified.
    • -
    • Added HTML Table Class , enabling tables to be generated from arrays or database results.
    • -
    • Added Zip Encoding Library.
    • -
    • Added FTP Library.
    • -
    • Added the ability to extend libraries and extend core classes, in addition to being able to replace them.
    • -
    • Added support for storing models within sub-folders.
    • -
    • Added Download Helper.
    • -
    • Added simple_query() function to the database classes
    • -
    • Added standard_date() function to the Date Helper.
    • -
    • Added $query->free_result() to database class.
    • -
    • Added $query->list_fields() function to database class
    • -
    • Added $this->db->platform() function
    • -
    • Added new File Helper: get_filenames()
    • -
    • Added new helper: Smiley Helper
    • -
    • Added support for <ul> and <ol> lists in the HTML Helper
    • -
    • Added the ability to rewrite short tags on-the-fly, converting them to standard PHP statements, for those servers that do not support short tags. This allows the cleaner syntax to be used regardless of whether it's supported by the server.
    • -
    • Added the ability to rename or relocate the "application" folder.
    • -
    • Added more thorough initialization in the upload class so that all class variables are reset.
    • -
    • Added "is_numeric" to validation, which uses the native PHP is_numeric function.
    • -
    • Improved the URI handler to make it more reliable when the $config['uri_protocol'] item is set to AUTO.
    • -
    • Moved most of the functions in the Controller class into the Loader class, allowing fewer reserved function names for controllers when running under PHP 5.
    • -
    • Updated the DB Result class to return an empty array when $query->result() doesn't produce a result.
    • -
    • Updated the input->cookie() and input->post() functions in Input Class to permit arrays contained cookies that are arrays to be run through the XSS filter.
    • -
    • Documented three functions from the Validation class that were missing from the user guide: set_select(), set_radio(), and set_checkbox().
    • -
    • Fixed a bug in the Email class related to SMTP Helo data.
    • -
    • Fixed a bug in the word wrapping helper and function in the email class.
    • -
    • Fixed a bug in the validation class.
    • -
    • Fixed a bug in the typography helper that was incorrectly wrapping block level elements in paragraph tags.
    • -
    • Fixed a problem in the form_prep() function that was double encoding entities.
    • -
    • Fixed a bug that affects some versions of PHP when output buffering is nested.
    • -
    • Fixed a bug that caused CI to stop working when the PHP magic __get() or __set() functions were used within models or controllers.
    • -
    • Fixed a pagination bug that was permitting negative values in the URL.
    • -
    • Fixed an oversight in which the Loader class was not allowed to be extended.
    • -
    • Changed _get_config() to get_config() since the function is not a private one.
    • -
    • Deprecated "init" folder. Initialization happens automatically now. Please see documentation.
    • -
    • Deprecated $this->db->field_names() USE $this->db->list_fields()
    • -
    • Deprecated the $config['log_errors'] item from the config.php file. Instead, $config['log_threshold'] can be set to "0" to turn it off.
    • -
    - - - - -

    Version 1.4.1

    -

    Release Date: September 21, 2006

    - -
      -
    • Added a new feature that passes URI segments directly to your function calls as parameters. See the Controllers page for more info.
    • -
    • Added support for a function named _output(), which when used in your controllers will received the final rendered output from the output class. More info in the Controllers page.
    • -
    • Added several new functions in the URI Class to let you retrieve and manipulate URI segments that have been re-routed using the URI Routing feature. Previously, the URI class did not permit you to access any re-routed URI segments, but now it does.
    • -
    • Added $this->output->set_header() function, which allows you to set server headers.
    • -
    • Updated plugins, helpers, and language classes to allow your application folder to contain its own plugins, helpers, and language folders. Previously they were always treated as global for your entire installation. If your application folder contains any of these resources they will be used instead the global ones.
    • -
    • Added Inflector helper.
    • -
    • Added element() function in the array helper.
    • -
    • Added RAND() to active record orderby() function.
    • -
    • Added delete_cookie() and get_cookie() to Cookie helper, even though the input class has a cookie fetching function.
    • -
    • Added Oracle database driver (still undergoing testing so it might have some bugs).
    • -
    • Added the ability to combine pseudo-variables and php variables in the template parser class.
    • -
    • Added output compression option to the config file.
    • -
    • Removed the is_numeric test from the db->escape() function.
    • -
    • Fixed a MySQLi bug that was causing error messages not to contain proper error data.
    • -
    • Fixed a bug in the email class which was causing it to ignore explicitly set alternative headers.
    • -
    • Fixed a bug that was causing a PHP error when the Exceptions class was called within the get_config() function since it was causing problems.
    • -
    • Fixed an oversight in the cookie helper in which the config file cookie settings were not being honored.
    • -
    • Fixed an oversight in the upload class. An item mentioned in the 1.4 changelog was missing.
    • -
    • Added some code to allow email attachments to be reset when sending batches of email.
    • -
    • Deprecated the application/scripts folder. It will continue to work for legacy users, but it is recommended that you create your own -libraries or models instead. It was originally added before CI had user libraries or models, but it's not needed anymore.
    • -
    • Deprecated the $autoload['core'] item from the autoload.php file. Instead, please now use: $autoload['libraries']
    • -
    • Deprecated the following database functions: $this->db->smart_escape_str() and $this->db->fields().
    • -
    - - - -

    Version 1.4.0

    -

    Release Date: September 17, 2006

    - -
      -
    • Added Hooks feature, enabling you to tap into and modify the inner workings of the framework without hacking the core files.
    • -
    • Added the ability to organize controller files into sub-folders. Kudos to Marco for suggesting this (and the next two) feature.
    • -
    • Added regular expressions support for routing rules.
    • -
    • Added the ability to remap function calls within your controllers.
    • -
    • Added the ability to replace core system classes with your own classes.
    • -
    • Added support for % character in URL.
    • -
    • Added the ability to supply full URLs using the anchor() helper function.
    • -
    • Added mode parameter to file_write() helper.
    • -
    • Added support for changing the port number in the Postgres driver.
    • -
    • Moved the list of "allowed URI characters" out of the Router class and into the config file.
    • -
    • Moved the MIME type array out of the Upload class and into its own file in the applications/config/ folder.
    • -
    • Updated the Upload class to allow the upload field name to be set when calling do_upload().
    • -
    • Updated the Config Library to be able to load config files silently, and to be able to assign config files to their own index (to avoid collisions if you use multiple config files).
    • -
    • Updated the URI Protocol code to allow more options so that URLs will work more reliably in different environments.
    • -
    • Updated the form_open() helper to allow the GET method to be used.
    • -
    • Updated the MySQLi execute() function with some code to help prevent lost connection errors.
    • -
    • Updated the SQLite Driver to check for object support before attempting to return results as objects. If unsupported it returns an array.
    • -
    • Updated the Models loader function to allow multiple loads of the same model.
    • -
    • Updated the MS SQL driver so that single quotes are escaped.
    • -
    • Updated the Postgres and ODBC drivers for better compatibility.
    • -
    • Removed a strtolower() call that was changing URL segments to lower case.
    • -
    • Removed some references that were interfering with PHP 4.4.1 compatibility.
    • -
    • Removed backticks from Postgres class since these are not needed.
    • -
    • Renamed display() to _display() in the Output class to make it clear that it's a private function.
    • -
    • Deprecated the hash() function due to a naming conflict with a native PHP function with the same name. Please use dohash() instead.
    • -
    • Fixed an bug that was preventing the input class from unsetting GET variables.
    • -
    • Fixed a router bug that was making it too greedy when matching end segments.
    • -
    • Fixed a bug that was preventing multiple discrete database calls.
    • -
    • Fixed a bug in which loading a language file was producing a "file contains no data" message.
    • -
    • Fixed a session bug caused by the XSS Filtering feature inadvertently changing the case of certain words.
    • -
    • Fixed some missing prefixes when using the database prefix feature.
    • -
    • Fixed a typo in the Calendar class (cal_november).
    • -
    • Fixed a bug in the form_checkbox() helper.
    • -
    • Fixed a bug that was allowing the second segment of the URI to be identical to the class name.
    • -
    • Fixed an evaluation bug in the database initialization function.
    • -
    • Fixed a minor bug in one of the error messages in the language class.
    • -
    • Fixed a bug in the date helper timespan function.
    • -
    • Fixed an undefined variable in the DB Driver class.
    • -
    • Fixed a bug in which dollar signs used as binding replacement values in the DB class would be treated as RegEx back-references.
    • -
    • Fixed a bug in the set_hash() function which was preventing MD5 from being used.
    • -
    • Fixed a couple bugs in the Unit Testing class.
    • -
    • Fixed an incorrectly named variable in the Validation class.
    • -
    • Fixed an incorrectly named variable in the URI class.
    • -
    • Fixed a bug in the config class that was preventing the base URL from being called properly.
    • -
    • Fixed a bug in the validation class that was not permitting callbacks if the form field was empty.
    • -
    • Fixed a problem that was preventing scaffolding from working properly with MySQLi.
    • -
    • Fixed some MS SQL bugs.
    • -
    • Fixed some doc typos.
    • -
    - - - -

    Version 1.3.3

    -

    Release Date: June 1, 2006

    - -
      - -
    • Models do not connect automatically to the database as of this version. More info here.
    • -
    • Updated the Sessions class to utilize the active record class when running session related queries. Previously the queries assumed MySQL syntax.
    • -
    • Updated alternator() function to re-initialize when called with no arguments, allowing multiple calls.
    • -
    • Fixed a bug in the active record "having" function.
    • -
    • Fixed a problem in the validation class which was making checkboxes be ignored when required.
    • -
    • Fixed a bug in the word_limiter() helper function. It was cutting off the fist word.
    • -
    • Fixed a bug in the xss_clean function due to a PHP bug that affects some versions of html_entity_decode.
    • -
    • Fixed a validation bug that was preventing rules from being set twice in one controller.
    • -
    • Fixed a calendar bug that was not letting it use dynamically loaded languages.
    • -
    • Fixed a bug in the active record class when using WHERE clauses with LIKE
    • -
    • Fixed a bug in the hash() security helper.
    • -
    • Fixed some typos.
    • -
    - - - - -

    Version 1.3.2

    -

    Release Date: April 17, 2006

    - -
      -
    • Changed the behavior of the validation class such that if a "required" rule is NOT explicitly stated for a field then all other tests get ignored.
    • -
    • Fixed a bug in the Controller class that was causing it to look in the local "init" folder instead of the main system one.
    • -
    • Fixed a bug in the init_pagination file. The $config item was not being set correctly.
    • -
    • Fixed a bug in the auto typography helper that was causing inconsistent behavior.
    • -
    • Fixed a couple bugs in the Model class.
    • -
    • Fixed some documentation typos and errata.
    • -
    - - - -

    Version 1.3.1

    -

    Release Date: April 11, 2006

    - -
      -
    • Added a Unit Testing Library.
    • -
    • Added the ability to pass objects to the insert() and update() database functions. -This feature enables you to (among other things) use your Model class variables to run queries with. See the Models page for details.
    • -
    • Added the ability to pass objects to the view loading function: $this->load->view('my_view', $object);
    • -
    • Added getwhere function to Active Record class.
    • -
    • Added count_all function to Active Record class.
    • -
    • Added language file for scaffolding and fixed a scaffolding bug that occurs when there are no rows in the specified table.
    • -
    • Added $this->db->last_query(), which allows you to view your last query that was run.
    • -
    • Added a new mime type to the upload class for better compatibility.
    • -
    • Changed how cache files are read to prevent PHP errors if the cache file contains an XML tag, which PHP wants to interpret as a short tag.
    • -
    • Fixed a bug in a couple of the active record functions (where and orderby).
    • -
    • Fixed a bug in the image library when realpath() returns false.
    • -
    • Fixed a bug in the Models that was preventing libraries from being used within them.
    • -
    • Fixed a bug in the "exact_length" function of the validation class.
    • -
    • Fixed some typos in the user guide
    • -
    - - -

    Version 1.3

    -

    Release Date: April 3, 2006

    - -
      -
    • Added support for Models.
    • -
    • Redesigned the database libraries to support additional RDBMs (Postgres, MySQLi, etc.).
    • -
    • Redesigned the Active Record class to enable more varied types of queries with simpler syntax, and advanced features like JOINs.
    • -
    • Added a feature to the database class that lets you run custom function calls.
    • -
    • Added support for private functions in your controllers. Any controller function name that starts with an underscore will not be served by a URI request.
    • -
    • Added the ability to pass your own initialization parameters to your custom core libraries when using $this->load->library()
    • -
    • Added support for running standard query string URLs. These can be optionally enabled in your config file.
    • -
    • Added the ability to specify a "suffix", which will be appended to your URLs. For example, you could add .html to your URLs, making them appear static. This feature is enabled in your config file.
    • -
    • Added a new error template for use with native PHP errors.
    • -
    • Added "alternator" function in the string helpers.
    • -
    • Removed slashing from the input class. After much debate we decided to kill this feature.
    • -
    • Change the commenting style in the scripts to the PEAR standard so that IDEs and tools like phpDocumenter can harvest the comments.
    • -
    • Added better class and function name-spacing to avoid collisions with user developed classes. All CodeIgniter classes are now prefixed with CI_ and -all controller methods are prefixed with _ci to avoid controller collisions. A list of reserved function names can be found here.
    • -
    • Redesigned how the "CI" super object is referenced, depending on whether PHP 4 or 5 is being run, since PHP 5 allows a more graceful way to manage objects that utilizes a bit less resources.
    • -
    • Deprecated: $this->db->use_table() has been deprecated. Please read the Active Record page for information.
    • -
    • Deprecated: $this->db->smart_escape_str() has been deprecated. Please use this instead: $this->db->escape()
    • -
    • Fixed a bug in the exception handler which was preventing some PHP errors from showing up.
    • -
    • Fixed a typo in the URI class. $this->total_segment() should be plural: $this->total_segments()
    • -
    • Fixed some typos in the default calendar template
    • -
    • Fixed some typos in the user guide
    • -
    - - - - - - - - -

    Version 1.2

    -

    Release Date: March 21, 2006

    - -
      -
    • Redesigned some internal aspects of the framework to resolve scoping problems that surfaced during the beta tests. The problem was most notable when instantiating classes in your constructors, particularly if those classes in turn did work in their constructors.
    • -
    • Added a global function named get_instance() allowing the main CodeIgniter object to be accessible throughout your own classes.
    • -
    • Added new File Helper: delete_files()
    • -
    • Added new URL Helpers: base_url(), index_page()
    • -
    • Added the ability to create your own core libraries and store them in your local application directory.
    • -
    • Added an overwrite option to the Upload class, enabling files to be overwritten rather than having the file name appended.
    • -
    • Added Javascript Calendar plugin.
    • -
    • Added search feature to user guide. Note: This is done using Google, which at the time of this writing has not crawled all the pages of the docs.
    • -
    • Updated the parser class so that it allows tag pars within other tag pairs.
    • -
    • Fixed a bug in the DB "where" function.
    • -
    • Fixed a bug that was preventing custom config files to be auto-loaded.
    • -
    • Fixed a bug in the mysql class bind feature that prevented question marks in the replacement data.
    • -
    • Fixed some bugs in the xss_clean function
    • -
    - - - - - -

    Version Beta 1.1

    -

    Release Date: March 10, 2006

    - -
      -
    • Added a Calendaring class.
    • -
    • Added support for running multiple applications that share a common CodeIgniter backend.
    • -
    • Moved the "uri protocol" variable from the index.php file into the config.php file
    • -
    • Fixed a problem that was preventing certain function calls from working within constructors.
    • -
    • Fixed a problem that was preventing the $this->load->library function from working in constructors.
    • -
    • Fixed a bug that occurred when the session class was loaded using the auto-load routine.
    • -
    • Fixed a bug that can happen with PHP versions that do not support the E_STRICT constant
    • -
    • Fixed a data type error in the form_radio function (form helper)
    • -
    • Fixed a bug that was preventing the xss_clean function from being called from the validation class.
    • -
    • Fixed the cookie related config names, which were incorrectly specified as $conf rather than $config
    • -
    • Fixed a pagination problem in the scaffolding.
    • -
    • Fixed a bug in the mysql class "where" function.
    • -
    • Fixed a regex problem in some code that trimmed duplicate slashes.
    • -
    • Fixed a bug in the br() function in the HTML helper
    • -
    • Fixed a syntax mistake in the form_dropdown function in the Form Helper.
    • -
    • Removed the "style" attributes form the form helpers.
    • -
    • Updated the documentation. Added "next/previous" links to each page and fixed various typos.
    • -
    - -

    Version Beta 1.0

    -

    Release Date: February 28, 2006

    -

    First publicly released version.

    - -
    - - - - - - - diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index a6a2683aa..ba6aaaac8 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -46,6 +46,8 @@ Release Date: Not Released $this->db->like() in the :doc:`Database Driver `. - Added $this->db->insert_batch() support to the OCI8 (Oracle) driver. + - Fixed a bug (#200) where MySQL queries would be malformed after calling + `count_all()` then `db->get()`. - Libraries @@ -108,6 +110,8 @@ Bug fixes for 2.1.0 - 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. - Fixed a bug (#537) - Support for all wav type in browser. +- Fixed a bug (#200) - MySQL queries would be malformed after calling + count_all() then db->get(). Version 2.0.3 ============= -- cgit v1.2.3-24-g4f1b From d08aa31a8b578a2e6687be4c9fe864fe08bd66d6 Mon Sep 17 00:00:00 2001 From: Kyle Farris Date: Fri, 14 Oct 2011 13:56:54 -0300 Subject: Ooops, removed duplicate entry in changelog. --- user_guide_src/source/changelog.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index ba6aaaac8..b844fdcc6 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -46,8 +46,6 @@ Release Date: Not Released $this->db->like() in the :doc:`Database Driver `. - Added $this->db->insert_batch() support to the OCI8 (Oracle) driver. - - Fixed a bug (#200) where MySQL queries would be malformed after calling - `count_all()` then `db->get()`. - Libraries -- cgit v1.2.3-24-g4f1b From 6f1fa5e6e40ae35bb8eeec359cb9f830b832c572 Mon Sep 17 00:00:00 2001 From: Kyle Farris Date: Fri, 14 Oct 2011 15:13:39 -0300 Subject: Fixed new line typo. --- user_guide_src/source/changelog.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index b844fdcc6..7b89f1782 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -108,8 +108,7 @@ Bug fixes for 2.1.0 - 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. - Fixed a bug (#537) - Support for all wav type in browser. -- Fixed a bug (#200) - MySQL queries would be malformed after calling - count_all() then db->get(). +- Fixed a bug (#200) - MySQL queries would be malformed after calling count_all() then db->get(). Version 2.0.3 ============= -- cgit v1.2.3-24-g4f1b From b840a6704feb7a2439bbd3a9a23127dafc7b42f7 Mon Sep 17 00:00:00 2001 From: Seb Pollard Date: Sat, 22 Oct 2011 23:28:21 +0100 Subject: Fixed an issue with the Image_lib class not clearing width, height or create_thumb properties when calling the clear() method. --- system/libraries/Image_lib.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index beb463b32..ceb31d1f0 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -116,7 +116,7 @@ class CI_Image_lib { */ function clear() { - $props = array('source_folder', 'dest_folder', 'source_image', 'full_src_path', 'full_dst_path', 'new_image', 'image_type', 'size_str', 'quality', 'orig_width', 'orig_height', 'rotation_angle', 'x_axis', 'y_axis', 'create_fnc', 'copy_fnc', 'wm_overlay_path', 'wm_use_truetype', 'dynamic_output', 'wm_font_size', 'wm_text', 'wm_vrt_alignment', 'wm_hor_alignment', 'wm_padding', 'wm_hor_offset', 'wm_vrt_offset', 'wm_font_color', 'wm_use_drop_shadow', 'wm_shadow_color', 'wm_shadow_distance', 'wm_opacity'); + $props = array('source_folder', 'dest_folder', 'source_image', 'full_src_path', 'full_dst_path', 'new_image', 'image_type', 'size_str', 'quality', 'orig_width', 'orig_height', 'rotation_angle', 'x_axis', 'y_axis', 'create_fnc', 'copy_fnc', 'wm_overlay_path', 'wm_use_truetype', 'dynamic_output', 'wm_font_size', 'wm_text', 'wm_vrt_alignment', 'wm_hor_alignment', 'wm_padding', 'wm_hor_offset', 'wm_vrt_offset', 'wm_font_color', 'wm_use_drop_shadow', 'wm_shadow_color', 'wm_shadow_distance', 'wm_opacity', 'width', 'height'); foreach ($props as $val) { @@ -125,6 +125,9 @@ class CI_Image_lib { // special consideration for master_dim $this->master_dim = 'auto'; + + // special consideration for create_thumb + $this->create_thumb = FALSE; } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 6a33e55ed119cea7763a8647d7ed4355951f9776 Mon Sep 17 00:00:00 2001 From: Kyle Ridolfo Date: Thu, 27 Oct 2011 15:40:06 -0300 Subject: Added links to the user guide for Encryption class and Session class. --- application/config/config.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/application/config/config.php b/application/config/config.php index 808cc33bd..063c3d5d1 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -253,6 +253,9 @@ $config['cache_path'] = ''; | | If you use the Encryption class or the Session class you | MUST set an encryption key. See the user guide for info. +| +| http://codeigniter.com/user_guide/libraries/encryption.html +| http://codeigniter.com/user_guide/libraries/sessions.html | */ $config['encryption_key'] = ''; -- cgit v1.2.3-24-g4f1b From 29130086c3b8df146c8c599f5ba47038efa10faf Mon Sep 17 00:00:00 2001 From: Thomas Traub Date: Fri, 4 Nov 2011 14:16:43 +0100 Subject: Add file exists check to prevent stat failed error warnings in the log These occur when creating .zips by passing data and creating an artificial fs structure inside the .zip --- system/libraries/Zip.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php index 9101eecb4..8e4357051 100644 --- a/system/libraries/Zip.php +++ b/system/libraries/Zip.php @@ -100,7 +100,7 @@ class CI_Zip { function _get_mod_time($dir) { // filemtime() will return false, but it does raise an error. - $date = (@filemtime($dir)) ? filemtime($dir) : getdate($this->now); + $date = (file_exists($dir) && @filemtime($dir)) ? filemtime($dir) : getdate($this->now); $time['file_mtime'] = ($date['hours'] << 11) + ($date['minutes'] << 5) + $date['seconds'] / 2; $time['file_mdate'] = (($date['year'] - 1980) << 9) + ($date['mon'] << 5) + $date['mday']; -- cgit v1.2.3-24-g4f1b From ed477270cca24e91941d947c00370ee8712e5fac Mon Sep 17 00:00:00 2001 From: Repox Date: Tue, 22 Nov 2011 11:13:48 +0100 Subject: Altered the suggested mod_rewrite rules for removing index.php from URL to better fit the needs between CI routing and asset files. This suggestion addresses issue #684 --- user_guide_src/source/general/urls.rst | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/user_guide_src/source/general/urls.rst b/user_guide_src/source/general/urls.rst index 211537675..6618aeece 100644 --- a/user_guide_src/source/general/urls.rst +++ b/user_guide_src/source/general/urls.rst @@ -45,12 +45,13 @@ method in which everything is redirected except the specified items: :: - RewriteEngine on - RewriteCond $1 !^(index\.php|images|robots\.txt) + RewriteEngine On + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php/$1 [L] -In the above example, any HTTP request other than those for index.php, -images, and robots.txt is treated as a request for your index.php file. +In the above example, any HTTP request other than those for index.php, existing +directories and existing files is treated as a request for your index.php file. Adding a URL Suffix =================== -- cgit v1.2.3-24-g4f1b From 1f9a40f2465ee135d4ed0292d51a1ed6571173f0 Mon Sep 17 00:00:00 2001 From: Repox Date: Tue, 22 Nov 2011 11:25:24 +0100 Subject: Altered the explenation of the rewrite rules to better fit the actual result. --- user_guide_src/source/general/urls.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/general/urls.rst b/user_guide_src/source/general/urls.rst index 6618aeece..3126fcf36 100644 --- a/user_guide_src/source/general/urls.rst +++ b/user_guide_src/source/general/urls.rst @@ -50,7 +50,7 @@ method in which everything is redirected except the specified items: RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php/$1 [L] -In the above example, any HTTP request other than those for index.php, existing +In the above example, any HTTP request other than those for existing directories and existing files is treated as a request for your index.php file. Adding a URL Suffix -- cgit v1.2.3-24-g4f1b From 0372f1ade3029c8363f1ed13545590c45d45d82f Mon Sep 17 00:00:00 2001 From: a-krebs Date: Wed, 23 Nov 2011 00:04:34 -0700 Subject: fix to issue #696 - make oci_execute calls inside num_rows non-committing, since they are only there to reset which row is next in line for oci_fetch calls and thus don't need to be committed. --- system/database/drivers/oci8/oci8_result.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/database/drivers/oci8/oci8_result.php b/system/database/drivers/oci8/oci8_result.php index 3ec71a9d6..f32559289 100644 --- a/system/database/drivers/oci8/oci8_result.php +++ b/system/database/drivers/oci8/oci8_result.php @@ -57,11 +57,11 @@ class CI_DB_oci8_result extends CI_DB_result { if ($this->num_rows === 0 && count($this->result_array()) > 0) { $this->num_rows = count($this->result_array()); - @oci_execute($this->stmt_id); + @oci_execute($this->stmt_id, OCI_DEFAULT); if ($this->curs_id) { - @oci_execute($this->curs_id); + @oci_execute($this->curs_id, OCI_DEFAULT); } } -- cgit v1.2.3-24-g4f1b From ab3efbb7a1bf3a70fc7c1aef4cf1007e490d7b2d Mon Sep 17 00:00:00 2001 From: Repox Date: Thu, 24 Nov 2011 09:27:37 +0100 Subject: Updating the user agent after being corrected on commit b8daad7 Relates to issue #683. --- application/config/user_agents.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/config/user_agents.php b/application/config/user_agents.php index c3c7eaecb..7f5fe810c 100644 --- a/application/config/user_agents.php +++ b/application/config/user_agents.php @@ -174,7 +174,7 @@ $mobiles = array( 'mobilexplorer' => "Mobile Explorer", 'operamini' => "Opera Mini", 'opera mini' => "Opera Mini", - 'opera mobi' => "Opera Mini", + 'opera mobi' => "Opera Mobile", // Other 'digital paths' => "Digital Paths", -- cgit v1.2.3-24-g4f1b From 65134ce0b594c378679c92c40fb835cf9ab5cdd0 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Mon, 28 Nov 2011 08:45:03 -0500 Subject: Fixed sytax error in pdo driver --- system/database/drivers/pdo/pdo_driver.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php index 5f63a3771..18a508b15 100644 --- a/system/database/drivers/pdo/pdo_driver.php +++ b/system/database/drivers/pdo/pdo_driver.php @@ -255,11 +255,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. -<<<<<<< HEAD - $this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE; -======= $this->_trans_failure = (bool) ($test_mode === TRUE); ->>>>>>> master return $this->conn_id->beginTransaction(); } -- cgit v1.2.3-24-g4f1b From ea6e466309887cef69f5685f97d17e6e6b335c2f Mon Sep 17 00:00:00 2001 From: Felix Balfoort Date: Tue, 29 Nov 2011 15:53:01 +0100 Subject: The DB_driver can now use failover databases if specified The DB_driver can now use failover databases if specified. If the main connection shouldn't connect for some reason the DB_driver will now try to connect to specified connections in the failover config. Example config: $db['default']['hostname'] = 'localhost'; $db['default']['username'] = ''; $db['default']['password'] = ''; $db['default']['database'] = ''; $db['default']['dbdriver'] = 'mysql'; $db['default']['dbprefix'] = ''; $db['default']['pconnect'] = TRUE; $db['default']['db_debug'] = TRUE; $db['default']['cache_on'] = FALSE; $db['default']['cachedir'] = ''; $db['default']['char_set'] = 'utf8'; $db['default']['dbcollat'] = 'utf8_general_ci'; $db['default']['swap_pre'] = ''; $db['default']['autoinit'] = TRUE; $db['default']['stricton'] = FALSE; $db['default']['failover'] = array(); $db['default']['failover'][0]['hostname'] = 'localhost1'; $db['default']['failover'][0]['username'] = ''; $db['default']['failover'][0]['password'] = ''; $db['default']['failover'][0]['database'] = ''; $db['default']['failover'][0]['dbdriver'] = 'mysql'; $db['default']['failover'][0]['dbprefix'] = ''; $db['default']['failover'][0]['pconnect'] = TRUE; $db['default']['failover'][0]['db_debug'] = TRUE; $db['default']['failover'][0]['cache_on'] = FALSE; $db['default']['failover'][0]['cachedir'] = ''; $db['default']['failover'][0]['char_set'] = 'utf8'; $db['default']['failover'][0]['dbcollat'] = 'utf8_general_ci'; $db['default']['failover'][0]['swap_pre'] = ''; $db['default']['failover'][0]['autoinit'] = TRUE; $db['default']['failover'][0]['stricton'] = FALSE; $db['default']['failover'][0]['failover'] = array(); $db['default']['failover'][1]['hostname'] = 'localhost2'; $db['default']['failover'][1]['username'] = ''; $db['default']['failover'][1]['password'] = ''; $db['default']['failover'][1]['database'] = ''; $db['default']['failover'][1]['dbdriver'] = 'mysql'; $db['default']['failover'][1]['dbprefix'] = ''; $db['default']['failover'][1]['pconnect'] = TRUE; $db['default']['failover'][1]['db_debug'] = TRUE; $db['default']['failover'][1]['cache_on'] = FALSE; $db['default']['failover'][1]['cachedir'] = ''; $db['default']['failover'][1]['char_set'] = 'utf8'; $db['default']['failover'][1]['dbcollat'] = 'utf8_general_ci'; $db['default']['failover'][1]['swap_pre'] = ''; $db['default']['failover'][1]['autoinit'] = TRUE; $db['default']['failover'][1]['stricton'] = FALSE; $db['default']['failover'][1]['failover'] = array(); Signed-off-by: Felix Balfoort --- application/config/database.php | 19 +++++++++++++++++++ system/database/DB_driver.php | 37 ++++++++++++++++++++++++++++++++----- 2 files changed, 51 insertions(+), 5 deletions(-) diff --git a/application/config/database.php b/application/config/database.php index 28b792f75..12ef7fed0 100644 --- a/application/config/database.php +++ b/application/config/database.php @@ -62,6 +62,7 @@ | ['autoinit'] Whether or not to automatically initialize the database. | ['stricton'] TRUE/FALSE - forces 'Strict Mode' connections | - good for ensuring strict SQL while developing +| ['failover'] array - A array with 0 or more data for connections if the main should fail. | | The $active_group variable lets you choose which connection group to | make active. By default there is only one group (the 'default' group). @@ -88,6 +89,24 @@ $db['default']['dbcollat'] = 'utf8_general_ci'; $db['default']['swap_pre'] = ''; $db['default']['autoinit'] = TRUE; $db['default']['stricton'] = FALSE; +$db['default']['failover'] = array(); + +$db['default']['hostname'] = 'localhost'; +$db['default']['username'] = ''; +$db['default']['password'] = ''; +$db['default']['database'] = ''; +$db['default']['dbdriver'] = 'mysql'; +$db['default']['dbprefix'] = ''; +$db['default']['pconnect'] = TRUE; +$db['default']['db_debug'] = TRUE; +$db['default']['cache_on'] = FALSE; +$db['default']['cachedir'] = ''; +$db['default']['char_set'] = 'utf8'; +$db['default']['dbcollat'] = 'utf8_general_ci'; +$db['default']['swap_pre'] = ''; +$db['default']['autoinit'] = TRUE; +$db['default']['stricton'] = FALSE; +$db['default']['failover'] = array(); /* End of file database.php */ diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index cc40ba48a..c2d57a833 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -126,16 +126,43 @@ class CI_DB_driver { // Connect to the database and set the connection ID $this->conn_id = ($this->pconnect == FALSE) ? $this->db_connect() : $this->db_pconnect(); - // No connection resource? Throw an error + // No connection resource? Check if there is a failover else throw an error if ( ! $this->conn_id) { - log_message('error', 'Unable to connect to the database'); + // Check if there is a failover set + if ( ! empty($this->failover) && is_array($this->failover)) + { + // Go over all the failovers + foreach ($this->failover as $failover) + { + // Replace the current settings with those of the failover + foreach ($failover as $key => $val) + { + $this->$key = $val; + } - if ($this->db_debug) + // Try to connect + $this->conn_id = ($this->pconnect == FALSE) ? $this->db_connect() : $this->db_pconnect(); + + // If a connection is made break the foreach loop + if ($this->conn_id) + { + break; + } + } + } + + // We still don't have a connection? + if ( ! $this->conn_id) { - $this->display_error('db_unable_to_connect'); + log_message('error', 'Unable to connect to the database'); + + if ($this->db_debug) + { + $this->display_error('db_unable_to_connect'); + } + return FALSE; } - return FALSE; } // ---------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 5d581b6d664c6ef662bcb9572ca147ac17af52cb Mon Sep 17 00:00:00 2001 From: Felix Balfoort Date: Tue, 29 Nov 2011 15:53:01 +0100 Subject: The DB_driver can now use failover databases if specified The DB_driver can now use failover databases if specified. If the main connection shouldn't connect for some reason the DB_driver will now try to connect to specified connections in the failover config. Example config: $db['default']['hostname'] = 'localhost'; $db['default']['username'] = ''; $db['default']['password'] = ''; $db['default']['database'] = ''; $db['default']['dbdriver'] = 'mysql'; $db['default']['dbprefix'] = ''; $db['default']['pconnect'] = TRUE; $db['default']['db_debug'] = TRUE; $db['default']['cache_on'] = FALSE; $db['default']['cachedir'] = ''; $db['default']['char_set'] = 'utf8'; $db['default']['dbcollat'] = 'utf8_general_ci'; $db['default']['swap_pre'] = ''; $db['default']['autoinit'] = TRUE; $db['default']['stricton'] = FALSE; $db['default']['failover'] = array(); $db['default']['failover'][0]['hostname'] = 'localhost1'; $db['default']['failover'][0]['username'] = ''; $db['default']['failover'][0]['password'] = ''; $db['default']['failover'][0]['database'] = ''; $db['default']['failover'][0]['dbdriver'] = 'mysql'; $db['default']['failover'][0]['dbprefix'] = ''; $db['default']['failover'][0]['pconnect'] = TRUE; $db['default']['failover'][0]['db_debug'] = TRUE; $db['default']['failover'][0]['cache_on'] = FALSE; $db['default']['failover'][0]['cachedir'] = ''; $db['default']['failover'][0]['char_set'] = 'utf8'; $db['default']['failover'][0]['dbcollat'] = 'utf8_general_ci'; $db['default']['failover'][0]['swap_pre'] = ''; $db['default']['failover'][0]['autoinit'] = TRUE; $db['default']['failover'][0]['stricton'] = FALSE; $db['default']['failover'][0]['failover'] = array(); $db['default']['failover'][1]['hostname'] = 'localhost2'; $db['default']['failover'][1]['username'] = ''; $db['default']['failover'][1]['password'] = ''; $db['default']['failover'][1]['database'] = ''; $db['default']['failover'][1]['dbdriver'] = 'mysql'; $db['default']['failover'][1]['dbprefix'] = ''; $db['default']['failover'][1]['pconnect'] = TRUE; $db['default']['failover'][1]['db_debug'] = TRUE; $db['default']['failover'][1]['cache_on'] = FALSE; $db['default']['failover'][1]['cachedir'] = ''; $db['default']['failover'][1]['char_set'] = 'utf8'; $db['default']['failover'][1]['dbcollat'] = 'utf8_general_ci'; $db['default']['failover'][1]['swap_pre'] = ''; $db['default']['failover'][1]['autoinit'] = TRUE; $db['default']['failover'][1]['stricton'] = FALSE; $db['default']['failover'][1]['failover'] = array(); Signed-off-by: Felix Balfoort --- application/config/database.php | 3 ++- system/database/DB_driver.php | 37 ++++++++++++++++++++++++++++++++----- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/application/config/database.php b/application/config/database.php index 28b792f75..58eec4b30 100644 --- a/application/config/database.php +++ b/application/config/database.php @@ -62,6 +62,7 @@ | ['autoinit'] Whether or not to automatically initialize the database. | ['stricton'] TRUE/FALSE - forces 'Strict Mode' connections | - good for ensuring strict SQL while developing +| ['failover'] array - A array with 0 or more data for connections if the main should fail. | | The $active_group variable lets you choose which connection group to | make active. By default there is only one group (the 'default' group). @@ -88,7 +89,7 @@ $db['default']['dbcollat'] = 'utf8_general_ci'; $db['default']['swap_pre'] = ''; $db['default']['autoinit'] = TRUE; $db['default']['stricton'] = FALSE; - +$db['default']['failover'] = array(); /* End of file database.php */ /* Location: ./application/config/database.php */ \ No newline at end of file diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index cc40ba48a..c2d57a833 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -126,16 +126,43 @@ class CI_DB_driver { // Connect to the database and set the connection ID $this->conn_id = ($this->pconnect == FALSE) ? $this->db_connect() : $this->db_pconnect(); - // No connection resource? Throw an error + // No connection resource? Check if there is a failover else throw an error if ( ! $this->conn_id) { - log_message('error', 'Unable to connect to the database'); + // Check if there is a failover set + if ( ! empty($this->failover) && is_array($this->failover)) + { + // Go over all the failovers + foreach ($this->failover as $failover) + { + // Replace the current settings with those of the failover + foreach ($failover as $key => $val) + { + $this->$key = $val; + } - if ($this->db_debug) + // Try to connect + $this->conn_id = ($this->pconnect == FALSE) ? $this->db_connect() : $this->db_pconnect(); + + // If a connection is made break the foreach loop + if ($this->conn_id) + { + break; + } + } + } + + // We still don't have a connection? + if ( ! $this->conn_id) { - $this->display_error('db_unable_to_connect'); + log_message('error', 'Unable to connect to the database'); + + if ($this->db_debug) + { + $this->display_error('db_unable_to_connect'); + } + return FALSE; } - return FALSE; } // ---------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 85fe96df4dd7b7e163fae2d7e0420e750559e65c Mon Sep 17 00:00:00 2001 From: Felix Balfoort Date: Tue, 29 Nov 2011 16:27:53 +0100 Subject: Updated change log and and database configuration to include failover --- user_guide_src/source/changelog.rst | 1 + user_guide_src/source/database/configuration.rst | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 979755c06..5c7fd8d59 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -97,6 +97,7 @@ Release Date: Not Released $this->db->like() in the :doc:`Database Driver `. - Added $this->db->insert_batch() support to the OCI8 (Oracle) driver. + - Added failover if the main connections in the config should fail - Libraries diff --git a/user_guide_src/source/database/configuration.rst b/user_guide_src/source/database/configuration.rst index 687f0d920..a6bfc8979 100644 --- a/user_guide_src/source/database/configuration.rst +++ b/user_guide_src/source/database/configuration.rst @@ -28,6 +28,28 @@ prototype:: $db['default']['autoinit'] = TRUE; $db['default']['stricton'] = FALSE; +You can also specify failovers for the situation when the main connection cannot connect for some reason. +These failovers can be specified by setting the failover for a connection like this:: + + $db['default']['failover'][0]['hostname'] = 'localhost1'; + $db['default']['failover'][0]['username'] = ''; + $db['default']['failover'][0]['password'] = ''; + $db['default']['failover'][0]['database'] = ''; + $db['default']['failover'][0]['dbdriver'] = 'mysql'; + $db['default']['failover'][0]['dbprefix'] = ''; + $db['default']['failover'][0]['pconnect'] = TRUE; + $db['default']['failover'][0]['db_debug'] = TRUE; + $db['default']['failover'][0]['cache_on'] = FALSE; + $db['default']['failover'][0]['cachedir'] = ''; + $db['default']['failover'][0]['char_set'] = 'utf8'; + $db['default']['failover'][0]['dbcollat'] = 'utf8_general_ci'; + $db['default']['failover'][0]['swap_pre'] = ''; + $db['default']['failover'][0]['autoinit'] = TRUE; + $db['default']['failover'][0]['stricton'] = FALSE; + $db['default']['failover'][0]['failover'] = array(); + +You can specify as much failovers as you like. + The reason we use a multi-dimensional array rather than a more simple one is to permit you to optionally store multiple sets of connection values. If, for example, you run multiple environments (development, -- cgit v1.2.3-24-g4f1b From 68f5d49d838fb2822b0f41e9b270f57e386f3fe4 Mon Sep 17 00:00:00 2001 From: Felix Balfoort Date: Tue, 29 Nov 2011 17:03:23 +0100 Subject: changed much to many in the documentation --- user_guide_src/source/database/configuration.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/database/configuration.rst b/user_guide_src/source/database/configuration.rst index a6bfc8979..60a2026e5 100644 --- a/user_guide_src/source/database/configuration.rst +++ b/user_guide_src/source/database/configuration.rst @@ -48,7 +48,7 @@ These failovers can be specified by setting the failover for a connection like t $db['default']['failover'][0]['stricton'] = FALSE; $db['default']['failover'][0]['failover'] = array(); -You can specify as much failovers as you like. +You can specify as many failovers as you like. The reason we use a multi-dimensional array rather than a more simple one is to permit you to optionally store multiple sets of connection -- cgit v1.2.3-24-g4f1b From 292a0f661baedaa0a2bd61795e564c4195f4b0b8 Mon Sep 17 00:00:00 2001 From: Felix Balfoort Date: Tue, 29 Nov 2011 22:29:33 +0100 Subject: Changed the array structure in the userguide --- user_guide_src/source/database/configuration.rst | 52 ++++++++++++++++-------- 1 file changed, 36 insertions(+), 16 deletions(-) diff --git a/user_guide_src/source/database/configuration.rst b/user_guide_src/source/database/configuration.rst index 60a2026e5..433c67152 100644 --- a/user_guide_src/source/database/configuration.rst +++ b/user_guide_src/source/database/configuration.rst @@ -31,22 +31,42 @@ prototype:: You can also specify failovers for the situation when the main connection cannot connect for some reason. These failovers can be specified by setting the failover for a connection like this:: - $db['default']['failover'][0]['hostname'] = 'localhost1'; - $db['default']['failover'][0]['username'] = ''; - $db['default']['failover'][0]['password'] = ''; - $db['default']['failover'][0]['database'] = ''; - $db['default']['failover'][0]['dbdriver'] = 'mysql'; - $db['default']['failover'][0]['dbprefix'] = ''; - $db['default']['failover'][0]['pconnect'] = TRUE; - $db['default']['failover'][0]['db_debug'] = TRUE; - $db['default']['failover'][0]['cache_on'] = FALSE; - $db['default']['failover'][0]['cachedir'] = ''; - $db['default']['failover'][0]['char_set'] = 'utf8'; - $db['default']['failover'][0]['dbcollat'] = 'utf8_general_ci'; - $db['default']['failover'][0]['swap_pre'] = ''; - $db['default']['failover'][0]['autoinit'] = TRUE; - $db['default']['failover'][0]['stricton'] = FALSE; - $db['default']['failover'][0]['failover'] = array(); + $db['default']['failover'] = array( + array( + 'hostname' => 'localhost1', + 'username' => '', + 'password' => '', + 'database' => '', + 'dbdriver' => 'mysql', + 'dbprefix' => '', + 'pconnect' => TRUE, + 'db_debug' => TRUE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'autoinit' => TRUE, + 'stricton' => FALSE + ), + array( + 'hostname' => 'localhost2', + 'username' => '', + 'password' => '', + 'database' => '', + 'dbdriver' => 'mysql', + 'dbprefix' => '', + 'pconnect' => TRUE, + 'db_debug' => TRUE, + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'autoinit' => TRUE, + 'stricton' => FALSE + ) + ); You can specify as many failovers as you like. -- cgit v1.2.3-24-g4f1b From 71b78096d95fc8f5ab46686168acd702abb90dc9 Mon Sep 17 00:00:00 2001 From: Repox Date: Thu, 1 Dec 2011 09:19:43 +0100 Subject: This fixes issue #725 --- system/database/DB_driver.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index c2d57a833..9d92f2f87 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -1064,7 +1064,14 @@ class CI_DB_driver { { $args = (func_num_args() > 1) ? array_splice(func_get_args(), 1) : null; - return call_user_func_array($function, $args); + if (is_null($args)) + { + return call_user_func($function); + } + else + { + return call_user_func_array($function, $args); + } } } -- cgit v1.2.3-24-g4f1b From 796b2b711f22775ef8e2a578bd71d065f9800442 Mon Sep 17 00:00:00 2001 From: Jack Webb-Heller Date: Thu, 1 Dec 2011 11:56:12 +0000 Subject: CodeIgniter ignores the set config value for Maximum Execution Time, overwriting it with its own value of 300 seconds. Whilst this is sensible in the vast majority of situations (browsers), when running a script from CLI, it is likely that execution times may need to be longer. Therefore, don't override the time limit if being run from the CLI - instead default back to PHP's own configuration. --- system/core/CodeIgniter.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php index 4d76a5587..abdbf91d8 100755 --- a/system/core/CodeIgniter.php +++ b/system/core/CodeIgniter.php @@ -106,9 +106,13 @@ * Set a liberal script execution time limit * ------------------------------------------------------ */ - if (function_exists("set_time_limit") == TRUE AND @ini_get("safe_mode") == 0) + if (function_exists("set_time_limit") AND @ini_get("safe_mode") == 0) { - @set_time_limit(300); + // Do not override the Time Limit value if running from Command Line + if(php_sapi_name() != 'cli' && ! empty($_SERVER['REMOTE_ADDR'])) + { + @set_time_limit(300); + } } /* -- cgit v1.2.3-24-g4f1b From eea0cbebc48d156f74c044f9932602d051eb9401 Mon Sep 17 00:00:00 2001 From: Jack Webb-Heller Date: Thu, 1 Dec 2011 13:37:08 +0000 Subject: Removed `$_SERVER['REMOTE_ADDR']` following feedback --- system/core/CodeIgniter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php index abdbf91d8..97527e5ca 100755 --- a/system/core/CodeIgniter.php +++ b/system/core/CodeIgniter.php @@ -109,7 +109,7 @@ if (function_exists("set_time_limit") AND @ini_get("safe_mode") == 0) { // Do not override the Time Limit value if running from Command Line - if(php_sapi_name() != 'cli' && ! empty($_SERVER['REMOTE_ADDR'])) + if(php_sapi_name() != 'cli') { @set_time_limit(300); } -- cgit v1.2.3-24-g4f1b From 717253f5c77a11b1b997069ff53bd2d2ab2e538c Mon Sep 17 00:00:00 2001 From: Tomasz T Date: Fri, 2 Dec 2011 17:57:30 +0100 Subject: SELECT * FROM isn't that innocuous, changed to SELECT 1 --- system/database/drivers/postgre/postgre_forge.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/database/drivers/postgre/postgre_forge.php b/system/database/drivers/postgre/postgre_forge.php index 166cc4e6a..ddbce6062 100644 --- a/system/database/drivers/postgre/postgre_forge.php +++ b/system/database/drivers/postgre/postgre_forge.php @@ -83,7 +83,7 @@ class CI_DB_postgre_forge extends CI_DB_forge { { if ($this->db->table_exists($table)) { - return "SELECT * FROM $table"; // Needs to return innocous but valid SQL statement + return "SELECT 1"; // Needs to return innocous but valid SQL statement } } -- cgit v1.2.3-24-g4f1b From 9a4902a9708dfe3c99cd5d6d6b765288c23a6977 Mon Sep 17 00:00:00 2001 From: Eric Barnes Date: Sat, 3 Dec 2011 23:46:06 -0500 Subject: Changed visibility of pagination properties and methods. --- system/libraries/Pagination.php | 77 ++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 39 deletions(-) diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php index f470debeb..600aaa663 100644 --- a/system/libraries/Pagination.php +++ b/system/libraries/Pagination.php @@ -5,9 +5,9 @@ * An open source application development framework for PHP 5.1.6 or newer * * NOTICE OF LICENSE - * + * * Licensed under the Open Software License version 3.0 - * + * * This source file is subject to the Open Software License (OSL 3.0) that is * bundled with this package in the files license.txt / license.rst. It is * also available through the world wide web at this URL: @@ -38,39 +38,38 @@ */ class CI_Pagination { - var $base_url = ''; // The page we are linking to - var $prefix = ''; // A custom prefix added to the path. - var $suffix = ''; // A custom suffix added to the path. - - var $total_rows = 0; // Total number of items (database results) - 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 = '<'; - var $last_link = 'Last ›'; - var $uri_segment = 3; - var $full_tag_open = ''; - var $full_tag_close = ''; - var $first_tag_open = ''; - var $first_tag_close = ' '; - var $last_tag_open = ' '; - var $last_tag_close = ''; - var $first_url = ''; // Alternative URL for the First Page. - var $cur_tag_open = ' '; - var $cur_tag_close = ''; - var $next_tag_open = ' '; - var $next_tag_close = ' '; - var $prev_tag_open = ' '; - var $prev_tag_close = ''; - var $num_tag_open = ' '; - var $num_tag_close = ''; - var $page_query_string = FALSE; - var $query_string_segment = 'per_page'; - var $display_pages = TRUE; - var $anchor_class = ''; + protected $base_url = ''; // The page we are linking to + protected $prefix = ''; // A custom prefix added to the path. + protected $suffix = ''; // A custom suffix added to the path. + protected $total_rows = 0; // Total number of items (database results) + protected $per_page = 10; // Max number of items you want shown per page + protected $num_links = 2; // Number of "digit" links to show before/after the currently viewed page + protected $cur_page = 0; // The current page being viewed + protected $use_page_numbers = FALSE; // Use page number for segment instead of offset + protected $first_link = '‹ First'; + protected $next_link = '>'; + protected $prev_link = '<'; + protected $last_link = 'Last ›'; + protected $uri_segment = 3; + protected $full_tag_open = ''; + protected $full_tag_close = ''; + protected $first_tag_open = ''; + protected $first_tag_close = ' '; + protected $last_tag_open = ' '; + protected $last_tag_close = ''; + protected $first_url = ''; // Alternative URL for the First Page. + protected $cur_tag_open = ' '; + protected $cur_tag_close = ''; + protected $next_tag_open = ' '; + protected $next_tag_close = ' '; + protected $prev_tag_open = ' '; + protected $prev_tag_close = ''; + protected $num_tag_open = ' '; + protected $num_tag_close = ''; + protected $page_query_string = FALSE; + protected $query_string_segment = 'per_page'; + protected $display_pages = TRUE; + protected $anchor_class = ''; /** * Constructor @@ -102,7 +101,7 @@ class CI_Pagination { * @param array initialization parameters * @return void */ - function initialize($params = array()) + public function initialize($params = array()) { if (count($params) > 0) { @@ -124,7 +123,7 @@ class CI_Pagination { * @access public * @return string */ - function create_links() + public function create_links() { // If our item count or per-page total is zero there is no need to continue. if ($this->total_rows == 0 OR $this->per_page == 0) @@ -167,7 +166,7 @@ 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) { @@ -204,7 +203,7 @@ class CI_Pagination { } $uri_page_number = $this->cur_page; - + if ( ! $this->use_page_numbers) { $this->cur_page = floor(($this->cur_page/$this->per_page) + 1); -- cgit v1.2.3-24-g4f1b From bce4140f05f9e8642554eac7aee232023b9a93d9 Mon Sep 17 00:00:00 2001 From: Eric Barnes Date: Sat, 3 Dec 2011 23:47:41 -0500 Subject: Changed pagination construct to call initialize so it sets the anchor class properly. Fixes #737 --- system/libraries/Pagination.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php index 600aaa663..eea953ae4 100644 --- a/system/libraries/Pagination.php +++ b/system/libraries/Pagination.php @@ -79,16 +79,7 @@ class CI_Pagination { */ public function __construct($params = array()) { - if (count($params) > 0) - { - $this->initialize($params); - } - - if ($this->anchor_class != '') - { - $this->anchor_class = 'class="'.$this->anchor_class.'" '; - } - + $this->initialize($params); log_message('debug', "Pagination Class Initialized"); } @@ -113,6 +104,11 @@ class CI_Pagination { } } } + + if ($this->anchor_class != '') + { + $this->anchor_class = 'class="'.$this->anchor_class.'" '; + } } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From cccde9650f061eee602013a1f3695a293f46d13e Mon Sep 17 00:00:00 2001 From: Eric Barnes Date: Sun, 4 Dec 2011 00:01:17 -0500 Subject: Fix for is_unique when you are not connected to a db. Refs: #724 --- system/libraries/Form_validation.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index 5663da981..918f6904c 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -5,9 +5,9 @@ * An open source application development framework for PHP 5.1.6 or newer * * NOTICE OF LICENSE - * + * * Licensed under the Open Software License version 3.0 - * + * * This source file is subject to the Open Software License (OSL 3.0) that is * bundled with this package in the files license.txt / license.rst. It is * also available through the world wide web at this URL: @@ -949,7 +949,7 @@ class CI_Form_validation { return ($str !== $field) ? FALSE : TRUE; } - + // -------------------------------------------------------------------- /** @@ -962,10 +962,13 @@ class CI_Form_validation { */ public function is_unique($str, $field) { - list($table, $field)=explode('.', $field); - $query = $this->CI->db->limit(1)->get_where($table, array($field => $str)); - - return $query->num_rows() === 0; + list($table, $field) = explode('.', $field); + if (isset($this->CI->db)) + { + $query = $this->CI->db->limit(1)->get_where($table, array($field => $str)); + return $query->num_rows() === 0; + } + return FALSE; } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 2835e08ac46ab5c260978a2013ba8837222318c5 Mon Sep 17 00:00:00 2001 From: Jeroen van der Gulik Date: Sun, 4 Dec 2011 14:19:38 +0100 Subject: - Stop logger from trying to chmod on each event to safe i/o and prevent error messages popping up when the user is different then the webserver --- system/libraries/Log.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/system/libraries/Log.php b/system/libraries/Log.php index 6ea905f73..46c5b6ed2 100644 --- a/system/libraries/Log.php +++ b/system/libraries/Log.php @@ -111,6 +111,7 @@ class CI_Log { if ( ! file_exists($filepath)) { + $newfile = TRUE; $message .= "<"."?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?".">\n\n"; } @@ -126,7 +127,10 @@ class CI_Log { flock($fp, LOCK_UN); fclose($fp); - @chmod($filepath, FILE_WRITE_MODE); + if (isset($newfile) AND $newfile === TRUE) + { + @chmod($filepath, FILE_WRITE_MODE); + } return TRUE; } @@ -134,4 +138,4 @@ class CI_Log { // END Log Class /* End of file Log.php */ -/* Location: ./system/libraries/Log.php */ \ No newline at end of file +/* Location: ./system/libraries/Log.php */ -- cgit v1.2.3-24-g4f1b From 1d861530da2d598f14c16c68461d83cd5c25bdf6 Mon Sep 17 00:00:00 2001 From: Eric Barnes Date: Sun, 4 Dec 2011 10:30:58 -0500 Subject: Updated change log with fixed issues. --- user_guide_src/source/changelog.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 5c7fd8d59..a5407ee29 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -59,7 +59,9 @@ Bug fixes for 3.0 - Fixed a bug (#181) where a mis-spelling was in the form validation language file. - Fixed a bug (#159, #163) that mishandled Active Record nested transactions because _trans_depth was not getting incremented. +- Fixed a bug (#737, #75) where pagination anchor class was not set properly when using initialize method. - Bug #419 - auto_link() now recognizes URLs that come after a word boundary. +- Bug #724 - is_unique in form validation now checks that you are connected to a database. Version 2.1.0 ============= -- cgit v1.2.3-24-g4f1b From f30da660db8077978e83a09054d0a0c9aebb1e5b Mon Sep 17 00:00:00 2001 From: Eric Barnes Date: Sun, 4 Dec 2011 10:35:58 -0500 Subject: Added change log message about logger chmod. Refs: #739 --- user_guide_src/source/changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index a5407ee29..5d7cb2643 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -27,6 +27,7 @@ Release Date: Not Released - Added support pgp and gpg to mimes.php. - Added support 3gp, 3g2, mp4, wmv, f4v, vlc Video files to mimes.php. - Added support m4a, aac, m4u, xspf, au, ac3, flac, ogg Audio files to mimes.php. + - Changed logger to only chmod when file is first created. - Helpers -- cgit v1.2.3-24-g4f1b From 1866d4fd4ac60295f76f3a8d70f3e4bcaa44b081 Mon Sep 17 00:00:00 2001 From: Thomas Traub Date: Mon, 5 Dec 2011 11:58:10 +0100 Subject: The changelog entry for issue #647 --- user_guide_src/source/changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 5d7cb2643..2bfae3fd7 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -63,6 +63,7 @@ Bug fixes for 3.0 - Fixed a bug (#737, #75) where pagination anchor class was not set properly when using initialize method. - Bug #419 - auto_link() now recognizes URLs that come after a word boundary. - Bug #724 - is_unique in form validation now checks that you are connected to a database. +- Bug #647 - _get_mod_time() in Zip library no longer generates stat failed errors Version 2.1.0 ============= -- cgit v1.2.3-24-g4f1b From 98f85b177d6ebf6dbc3a2ec8313ef738eca2fbf2 Mon Sep 17 00:00:00 2001 From: Thomas Traub Date: Mon, 5 Dec 2011 14:58:29 +0100 Subject: Took out the now unnecessary error suppression --- system/libraries/Zip.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php index 8e4357051..ef6c3e530 100644 --- a/system/libraries/Zip.php +++ b/system/libraries/Zip.php @@ -99,8 +99,8 @@ class CI_Zip { */ function _get_mod_time($dir) { - // filemtime() will return false, but it does raise an error. - $date = (file_exists($dir) && @filemtime($dir)) ? filemtime($dir) : getdate($this->now); + // filemtime() may return false, but raises an error for non-existing files + $date = (file_exists($dir) && filemtime($dir)) ? filemtime($dir) : getdate($this->now); $time['file_mtime'] = ($date['hours'] << 11) + ($date['minutes'] << 5) + $date['seconds'] / 2; $time['file_mdate'] = (($date['year'] - 1980) << 9) + ($date['mon'] << 5) + $date['mday']; -- cgit v1.2.3-24-g4f1b From b9ec402de2ad190df899426f4bbcebbcc759d01f Mon Sep 17 00:00:00 2001 From: Tomasz T Date: Mon, 5 Dec 2011 15:28:33 +0100 Subject: changed create_table method to check whether a value returned from driver's forge is sql or bool (acts exactly as create_database) --- system/database/DB_forge.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php index 1aa2334ea..78bf77a9f 100644 --- a/system/database/DB_forge.php +++ b/system/database/DB_forge.php @@ -205,6 +205,12 @@ class CI_DB_forge { $sql = $this->_create_table($this->db->dbprefix.$table, $this->fields, $this->primary_keys, $this->keys, $if_not_exists); $this->_reset(); + + if (is_bool($sql)) + { + return $sql; + } + return $this->db->query($sql); } -- cgit v1.2.3-24-g4f1b From c9fc88c09c1a0accdddd3710907fee2f5b42d7ad Mon Sep 17 00:00:00 2001 From: Tomasz T Date: Mon, 5 Dec 2011 15:30:05 +0100 Subject: changed _create_table to return true if table already exists --- system/database/drivers/postgre/postgre_forge.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/system/database/drivers/postgre/postgre_forge.php b/system/database/drivers/postgre/postgre_forge.php index ddbce6062..df0338e73 100644 --- a/system/database/drivers/postgre/postgre_forge.php +++ b/system/database/drivers/postgre/postgre_forge.php @@ -81,9 +81,10 @@ class CI_DB_postgre_forge extends CI_DB_forge { if ($if_not_exists === TRUE) { + // PostgreSQL doesn't support IF NOT EXISTS syntax so we check if table exists manually if ($this->db->table_exists($table)) { - return "SELECT 1"; // Needs to return innocous but valid SQL statement + return TRUE; } } -- cgit v1.2.3-24-g4f1b From 7fcfbda4cd72d4198c9b45ac13bcbd47bf067b81 Mon Sep 17 00:00:00 2001 From: Thomas Traub Date: Mon, 5 Dec 2011 17:08:50 +0100 Subject: Update system/libraries/Zip.php --- system/libraries/Zip.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php index ef6c3e530..2fc30e469 100644 --- a/system/libraries/Zip.php +++ b/system/libraries/Zip.php @@ -100,7 +100,7 @@ class CI_Zip { function _get_mod_time($dir) { // filemtime() may return false, but raises an error for non-existing files - $date = (file_exists($dir) && filemtime($dir)) ? filemtime($dir) : getdate($this->now); + $date = (file_exists($dir) && $filemtime = filemtime($dir)) ? $filemtime : getdate($this->now); $time['file_mtime'] = ($date['hours'] << 11) + ($date['minutes'] << 5) + $date['seconds'] / 2; $time['file_mdate'] = (($date['year'] - 1980) << 9) + ($date['mon'] << 5) + $date['mday']; -- cgit v1.2.3-24-g4f1b From 5d4da1bae6f00a193db06e940cd59ebf9743b615 Mon Sep 17 00:00:00 2001 From: Eric Barnes Date: Mon, 5 Dec 2011 21:55:00 -0500 Subject: Added change log item for bug #608 --- user_guide_src/source/changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 2bfae3fd7..c4fbb67b2 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -64,6 +64,7 @@ Bug fixes for 3.0 - Bug #419 - auto_link() now recognizes URLs that come after a word boundary. - Bug #724 - is_unique in form validation now checks that you are connected to a database. - Bug #647 - _get_mod_time() in Zip library no longer generates stat failed errors +- Bug #608 - Fixes an issue with the Image_lib class not clearing properties completely Version 2.1.0 ============= -- cgit v1.2.3-24-g4f1b From 3cece7b27c965a9a6bc73d080f6df0a6ba681be0 Mon Sep 17 00:00:00 2001 From: Eric Barnes Date: Mon, 5 Dec 2011 22:10:12 -0500 Subject: Updated change log --- user_guide_src/source/changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index c4fbb67b2..8dfe2492a 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -65,6 +65,7 @@ Bug fixes for 3.0 - Bug #724 - is_unique in form validation now checks that you are connected to a database. - Bug #647 - _get_mod_time() in Zip library no longer generates stat failed errors - Bug #608 - Fixes an issue with the Image_lib class not clearing properties completely +- Fixed bugs (#157 and #174) - the Image_lib clear() function now resets all variables to their default values. Version 2.1.0 ============= -- cgit v1.2.3-24-g4f1b From dba657efda6e057dc0c741dc449937c8ba5a029a Mon Sep 17 00:00:00 2001 From: Thomas Traub Date: Tue, 6 Dec 2011 06:30:37 +0100 Subject: Update system/libraries/Zip.php --- system/libraries/Zip.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php index 2fc30e469..52f1bc3d0 100644 --- a/system/libraries/Zip.php +++ b/system/libraries/Zip.php @@ -100,8 +100,8 @@ class CI_Zip { function _get_mod_time($dir) { // filemtime() may return false, but raises an error for non-existing files - $date = (file_exists($dir) && $filemtime = filemtime($dir)) ? $filemtime : getdate($this->now); - + $date = (file_exists($dir)) ? filemtime($dir): getdate($this->now); + $time['file_mtime'] = ($date['hours'] << 11) + ($date['minutes'] << 5) + $date['seconds'] / 2; $time['file_mdate'] = (($date['year'] - 1980) << 9) + ($date['mon'] << 5) + $date['mday']; -- cgit v1.2.3-24-g4f1b From 17bcd2b5c8b994ca14cc19d31674258b07c905fc Mon Sep 17 00:00:00 2001 From: Tomasz T Date: Tue, 6 Dec 2011 12:36:16 +0100 Subject: updated changelog with dbforge fix --- user_guide_src/source/changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 5c7fd8d59..cbe6da28a 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -60,6 +60,7 @@ Bug fixes for 3.0 language file. - Fixed a bug (#159, #163) that mishandled Active Record nested transactions because _trans_depth was not getting incremented. - Bug #419 - auto_link() now recognizes URLs that come after a word boundary. +- Fixed a bug where using $this->dbforge->create_table() with PostgreSQL database could lead to fetching whole table. Version 2.1.0 ============= -- cgit v1.2.3-24-g4f1b From 59dbcda901f45c5183e976a0a2da7c7459294d05 Mon Sep 17 00:00:00 2001 From: toopay Date: Thu, 8 Dec 2011 20:42:41 +0700 Subject: Exception for sqlite --- system/database/drivers/pdo/pdo_driver.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php index 18a508b15..457cf714a 100644 --- a/system/database/drivers/pdo/pdo_driver.php +++ b/system/database/drivers/pdo/pdo_driver.php @@ -90,7 +90,10 @@ class CI_DB_pdo_driver extends CI_DB { $this->_like_escape_chr = '!'; } - $this->hostname .= ";dbname=".$this->database; + if (strpos($this->hostname, 'sqlite') === FALSE) + { + $this->hostname .= ";dbname=".$this->database; + } $this->trans_enabled = FALSE; -- cgit v1.2.3-24-g4f1b From 7a617a0bc0933685c803740c67535620599eb173 Mon Sep 17 00:00:00 2001 From: Zac Clancy Date: Thu, 8 Dec 2011 23:38:10 -0500 Subject: Fixed typo in introductory paragraph. --- user_guide_src/source/tutorial/create_news_items.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/tutorial/create_news_items.rst b/user_guide_src/source/tutorial/create_news_items.rst index 003b94bd8..794b67eed 100644 --- a/user_guide_src/source/tutorial/create_news_items.rst +++ b/user_guide_src/source/tutorial/create_news_items.rst @@ -2,7 +2,7 @@ Create news items ################# -You now know how you can read data from a database using CodeIgnite, but +You now know how you can read data from a database using CodeIgniter, 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. -- cgit v1.2.3-24-g4f1b From cde712ce354dcfd69f9c5e2b56ef7d6f1206d11a Mon Sep 17 00:00:00 2001 From: Eric Barnes Date: Fri, 9 Dec 2011 11:27:51 -0500 Subject: Added ability to change the separator value in the humanize function --- system/helpers/inflector_helper.php | 18 +++++++++--------- user_guide_src/source/changelog.rst | 1 + user_guide_src/source/helpers/inflector_helper.rst | 6 ++++++ 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php index 513a9c54f..3393bda8f 100644 --- a/system/helpers/inflector_helper.php +++ b/system/helpers/inflector_helper.php @@ -5,9 +5,9 @@ * An open source application development framework for PHP 5.1.6 or newer * * NOTICE OF LICENSE - * + * * Licensed under the Open Software License version 3.0 - * + * * This source file is subject to the Open Software License (OSL 3.0) that is * bundled with this package in the files license.txt / license.rst. It is * also available through the world wide web at this URL: @@ -84,7 +84,7 @@ if ( ! function_exists('singular')) '/(n)ews$/' => '\1\2ews', '/([^u])s$/' => '\1', ); - + foreach ($singular_rules as $rule => $replacement) { if (preg_match($rule, $result)) @@ -115,7 +115,7 @@ if ( ! function_exists('plural')) function plural($str, $force = FALSE) { $result = strval($str); - + $plural_rules = array( '/^(ox)$/' => '\1\2en', // ox '/([m|l])ouse$/' => '\1ice', // mouse, louse @@ -196,20 +196,20 @@ if ( ! function_exists('underscore')) /** * Humanize * - * Takes multiple words separated by underscores and changes them to spaces + * Takes multiple words separated by the separator and changes them to spaces * * @access public - * @param string + * @param string $str + * @param string $separator * @return str */ if ( ! function_exists('humanize')) { - function humanize($str) + function humanize($str, $separator = '_') { - return ucwords(preg_replace('/[_]+/', ' ', strtolower(trim($str)))); + return ucwords(preg_replace('/['.$separator.']+/', ' ', strtolower(trim($str)))); } } - /* End of file inflector_helper.php */ /* Location: ./system/helpers/inflector_helper.php */ \ No newline at end of file diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 205b087f5..6f41f4519 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -33,6 +33,7 @@ Release Date: Not Released - url_title() will now trim extra dashes from beginning and end. - Added XHTML Basic 1.1 doctype to :doc:`HTML Helper `. + - Changed humanize to include a second param for the separator. - Database diff --git a/user_guide_src/source/helpers/inflector_helper.rst b/user_guide_src/source/helpers/inflector_helper.rst index cf246b9de..cc46a1851 100644 --- a/user_guide_src/source/helpers/inflector_helper.rst +++ b/user_guide_src/source/helpers/inflector_helper.rst @@ -77,3 +77,9 @@ them. Each word is capitalized. Example $word = "my_dog_spot"; echo humanize($word); // Returns "My Dog Spot" +To use dashes instead of underscores + +:: + + $word = "my-dog-spot"; + echo humanize($word, '-'); // Returns "My Dog Spot" \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 2e5bda3bde171e71306c80479f04d886127d88a2 Mon Sep 17 00:00:00 2001 From: Andrew Seymour Date: Tue, 13 Dec 2011 11:40:15 +0000 Subject: Updated Cart.php to handle quantity changes differently (now auto-increments), also updated the changelog to reflect this change for the people that are currently using this library --- system/libraries/Cart.php | 28 +++++++++++++++++++++++----- user_guide_src/source/changelog.rst | 1 + 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php index a0e1bb91e..13485a3ee 100644 --- a/system/libraries/Cart.php +++ b/system/libraries/Cart.php @@ -41,6 +41,7 @@ class CI_Cart { // These are the regular expression rules that we use to validate the product ID and product name var $product_id_rules = '\.a-z0-9_-'; // alpha-numeric, dashes, underscores, or periods var $product_name_rules = '\.\:\-_ a-z0-9'; // alpha-numeric, dashes, underscores, colons or periods + var $product_name_safe = true; // only allow safe product names // Private variables. Do not change! var $CI; @@ -195,10 +196,13 @@ class CI_Cart { // Validate the product name. It can only be alpha-numeric, dashes, underscores, colons or periods. // Note: These can be user-specified by setting the $this->product_name_rules variable. - if ( ! preg_match("/^[".$this->product_name_rules."]+$/i", $items['name'])) + if($this->product_name_safe) { - log_message('error', 'An invalid name was submitted as the product name: '.$items['name'].' The name can only contain alpha-numeric characters, dashes, underscores, colons, and spaces'); - return FALSE; + if ( ! preg_match("/^[".$this->product_name_rules."]+$/i", $items['name'])) + { + log_message('error', 'An invalid name was submitted as the product name: '.$items['name'].' The name can only contain alpha-numeric characters, dashes, underscores, colons, and spaces'); + return FALSE; + } } // -------------------------------------------------------------------- @@ -242,7 +246,18 @@ class CI_Cart { // -------------------------------------------------------------------- // Now that we have our unique "row ID", we'll add our cart items to the master array - + // grab quantity if it's already there and add it on + if(isset($this->_cart_contents[$rowid]['qty'])) + { + // set our old quantity + $old_quantity = (int)$this->_cart_contents[$rowid]['qty']; + } + else + { + // we have no old quantity but - we don't want to throw an error + $old_quantity = 0; + } + // let's unset this first, just to make sure our index contains only the data from this submission unset($this->_cart_contents[$rowid]); @@ -254,7 +269,10 @@ class CI_Cart { { $this->_cart_contents[$rowid][$key] = $val; } - + + // add old quantity back in + $this->_cart_contents[$rowid]['qty'] = ($this->_cart_contents[$rowid]['qty'] + $old_quantity); + // Woot! return $rowid; } diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 6f41f4519..71104418a 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -47,6 +47,7 @@ Release Date: Not Released - CI_Loader::_ci_autoloader() is now a protected method. - Modified valid_ip() to use PHP's filter_var() when possible (>= PHP 5.2) in the :doc:`Form Validation library `. - Added custom filename to Email::attach() as $this->email->attach($filename, $disposition, $newname) + - The Cart library now auto-increments quantity's instead of just resetting it, this is the default behaviour of large e-commerce sites. - Core -- cgit v1.2.3-24-g4f1b From 3dd66631330841e4d0e29a95fc279a5d5cc921f2 Mon Sep 17 00:00:00 2001 From: Andrew Seymour Date: Tue, 13 Dec 2011 15:50:52 +0000 Subject: Merged the two if's together as suggested by @philsturgeon - updated the Changelog to include something that may be important --- system/libraries/Cart.php | 9 +++------ user_guide_src/source/changelog.rst | 1 + 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php index 13485a3ee..f9f3bca47 100644 --- a/system/libraries/Cart.php +++ b/system/libraries/Cart.php @@ -196,13 +196,10 @@ class CI_Cart { // Validate the product name. It can only be alpha-numeric, dashes, underscores, colons or periods. // Note: These can be user-specified by setting the $this->product_name_rules variable. - if($this->product_name_safe) + if ( $this->product_name_safe && ! preg_match("/^[".$this->product_name_rules."]+$/i", $items['name'])) { - if ( ! preg_match("/^[".$this->product_name_rules."]+$/i", $items['name'])) - { - log_message('error', 'An invalid name was submitted as the product name: '.$items['name'].' The name can only contain alpha-numeric characters, dashes, underscores, colons, and spaces'); - return FALSE; - } + log_message('error', 'An invalid name was submitted as the product name: '.$items['name'].' The name can only contain alpha-numeric characters, dashes, underscores, colons, and spaces'); + return FALSE; } // -------------------------------------------------------------------- diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 71104418a..eda64e7ff 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -48,6 +48,7 @@ Release Date: Not Released - Modified valid_ip() to use PHP's filter_var() when possible (>= PHP 5.2) in the :doc:`Form Validation library `. - Added custom filename to Email::attach() as $this->email->attach($filename, $disposition, $newname) - The Cart library now auto-increments quantity's instead of just resetting it, this is the default behaviour of large e-commerce sites. + - Cart Product Name strictness can be disabled via the Cart Library by switching "$product_name_safe" - Core -- cgit v1.2.3-24-g4f1b From fefff9fcdfc26676b8c57653c3d8176b729901b2 Mon Sep 17 00:00:00 2001 From: Andrew Seymour Date: Tue, 13 Dec 2011 15:52:50 +0000 Subject: Spacing added, @philsturgeon is too picky! --- system/libraries/Cart.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php index f9f3bca47..997b9b8de 100644 --- a/system/libraries/Cart.php +++ b/system/libraries/Cart.php @@ -244,7 +244,7 @@ class CI_Cart { // Now that we have our unique "row ID", we'll add our cart items to the master array // grab quantity if it's already there and add it on - if(isset($this->_cart_contents[$rowid]['qty'])) + if( isset($this->_cart_contents[$rowid]['qty'])) { // set our old quantity $old_quantity = (int)$this->_cart_contents[$rowid]['qty']; -- cgit v1.2.3-24-g4f1b From de2e96a298cc48b8e86a03d530bc328bd43b0c80 Mon Sep 17 00:00:00 2001 From: Andrew Seymour Date: Tue, 13 Dec 2011 16:44:59 +0000 Subject: Added the ability to get the contents in a different order --- system/libraries/Cart.php | 12 ++++++++++-- user_guide_src/source/libraries/cart.rst | 7 +++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php index 997b9b8de..2e580863b 100644 --- a/system/libraries/Cart.php +++ b/system/libraries/Cart.php @@ -476,9 +476,17 @@ class CI_Cart { * @access public * @return array */ - function contents() + function contents($newest_first = false) { - $cart = $this->_cart_contents; + // do we want the newest first? + if($newest_first) + { + // reverse the array + $cart = array_reverse($this->_cart_contents); + } else { + // just added first to last + $cart = $this->_cast_contents; + } // Remove these so they don't create a problem when showing the cart table unset($cart['total_items']); diff --git a/user_guide_src/source/libraries/cart.rst b/user_guide_src/source/libraries/cart.rst index 850d7e9a8..a1e042ef2 100644 --- a/user_guide_src/source/libraries/cart.rst +++ b/user_guide_src/source/libraries/cart.rst @@ -266,10 +266,13 @@ $this->cart->total_items(); Displays the total number of items in the cart. -$this->cart->contents(); +$this->cart->contents(boolean); ************************ -Returns an array containing everything in the cart. +Returns an array containing everything in the cart. You can sort the order, +by which this is returned by passing it "true" where the contents will be sorted +from newest to oldest, by leaving this function blank, you'll automatically just get +first added to the basket to last added to the basket. $this->cart->has_options(rowid); ********************************* -- cgit v1.2.3-24-g4f1b From 17aebce8e06fae0edf1d54cf6823f1b8f48924c0 Mon Sep 17 00:00:00 2001 From: Andrew Seymour Date: Tue, 13 Dec 2011 16:57:13 +0000 Subject: Changed the syntax slightly, @philsturgeon may be claustrophobic as he doesn't like no spaces --- system/libraries/Cart.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php index 2e580863b..e78ecd5f6 100644 --- a/system/libraries/Cart.php +++ b/system/libraries/Cart.php @@ -244,7 +244,7 @@ class CI_Cart { // Now that we have our unique "row ID", we'll add our cart items to the master array // grab quantity if it's already there and add it on - if( isset($this->_cart_contents[$rowid]['qty'])) + if (isset($this->_cart_contents[$rowid]['qty'])) { // set our old quantity $old_quantity = (int)$this->_cart_contents[$rowid]['qty']; -- cgit v1.2.3-24-g4f1b From f75ec11d7ed0592f930dd3a090db7c1c6d251eed Mon Sep 17 00:00:00 2001 From: Andrew Seymour Date: Wed, 14 Dec 2011 09:36:39 +0000 Subject: Added in a remove item from cart function to save the "hacky" method of updating a product with 0 quantity, updated the changelog to reflect and to be neater and more readable surrounding the changes of the Cart library --- system/libraries/Cart.php | 24 +++++++++++++++++++++++- user_guide_src/source/changelog.rst | 6 ++++-- user_guide_src/source/libraries/cart.rst | 5 +++++ 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php index e78ecd5f6..7f6cdf5dd 100644 --- a/system/libraries/Cart.php +++ b/system/libraries/Cart.php @@ -450,7 +450,29 @@ class CI_Cart { { return $this->_cart_contents['cart_total']; } - + + // -------------------------------------------------------------------- + + /** + * Remove Item + * + * Removes an item from the cart + * + * @access public + * @return boolean + */ + public function remove($rowid) + { + // just do an unset + unset($this->_cart_contents[$rowid]); + + // we need to save the cart now we've made our changes + $this->_save_cart(); + + // completed + return true; + } + // -------------------------------------------------------------------- /** diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index eda64e7ff..72b7f7e8a 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -47,8 +47,10 @@ Release Date: Not Released - CI_Loader::_ci_autoloader() is now a protected method. - Modified valid_ip() to use PHP's filter_var() when possible (>= PHP 5.2) in the :doc:`Form Validation library `. - Added custom filename to Email::attach() as $this->email->attach($filename, $disposition, $newname) - - The Cart library now auto-increments quantity's instead of just resetting it, this is the default behaviour of large e-commerce sites. - - Cart Product Name strictness can be disabled via the Cart Library by switching "$product_name_safe" + - Cart library changes include; + - It now auto-increments quantity's instead of just resetting it, this is the default behaviour of large e-commerce sites. + - Product Name strictness can be disabled via the Cart Library by switching "$product_name_safe" + - Added function remove() to remove a cart item, updating with quantity of 0 seemed like a hack but has remained to retain compatability - Core diff --git a/user_guide_src/source/libraries/cart.rst b/user_guide_src/source/libraries/cart.rst index a1e042ef2..fbf777884 100644 --- a/user_guide_src/source/libraries/cart.rst +++ b/user_guide_src/source/libraries/cart.rst @@ -256,6 +256,11 @@ $this->cart->update(); Permits you to update items in the shopping cart, as outlined above. +$this->cart->remove(rowid); +********************** + +Allows you to remove an item from the shopping cart by passing it the rowid. + $this->cart->total(); ********************* -- cgit v1.2.3-24-g4f1b From 3a67ed15d984a341612af9e1dd9ba52f30d02e89 Mon Sep 17 00:00:00 2001 From: Andrew Seymour Date: Wed, 14 Dec 2011 15:35:06 +0000 Subject: Slight syntax change to the Cart class --- system/libraries/Cart.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php index 7f6cdf5dd..717ccd9fb 100644 --- a/system/libraries/Cart.php +++ b/system/libraries/Cart.php @@ -505,7 +505,9 @@ class CI_Cart { { // reverse the array $cart = array_reverse($this->_cart_contents); - } else { + } + else + { // just added first to last $cart = $this->_cast_contents; } -- cgit v1.2.3-24-g4f1b From 399cca920b3d2d94e3c0f8d1099b22b6482481da Mon Sep 17 00:00:00 2001 From: Eric Barnes Date: Wed, 14 Dec 2011 11:04:14 -0500 Subject: Added a reference note for people needing to limit to a set number of characters --- user_guide_src/source/helpers/text_helper.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/user_guide_src/source/helpers/text_helper.rst b/user_guide_src/source/helpers/text_helper.rst index e97643275..8cb2d6f96 100644 --- a/user_guide_src/source/helpers/text_helper.rst +++ b/user_guide_src/source/helpers/text_helper.rst @@ -46,6 +46,9 @@ more or less then what you specify. Example The third parameter is an optional suffix added to the string, if undeclared this helper uses an ellipsis. +**Note:** If you need to truncate to an exact number of characters please see +the :ref:`ellipsize` function below. + ascii_to_entities() =================== @@ -136,6 +139,8 @@ complete words. Example // Would produce: Here is a simple string of text that will help us demonstrate this function +.. _ellipsize: + ellipsize() =========== -- cgit v1.2.3-24-g4f1b From 79c1c46c4c99ca143a1231f7fd6b845f7276e1fd Mon Sep 17 00:00:00 2001 From: Joel Kallman Date: Sun, 18 Dec 2011 19:25:45 -0500 Subject: Makes form open properly when empty array of parameters is passed Signed-off-by: Joel Kallman --- 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 0f02bcf75..347e8be90 100644 --- a/system/helpers/form_helper.php +++ b/system/helpers/form_helper.php @@ -1000,7 +1000,7 @@ if ( ! function_exists('_attributes_to_string')) $attributes = (array)$attributes; } - if (is_array($attributes) AND count($attributes) > 0) + if (is_array($attributes) AND ($formtag === TRUE OR count($attributes) > 0)) { $atts = ''; -- cgit v1.2.3-24-g4f1b From d054e137917ef1131195679aa8abeb4dbf69e4e4 Mon Sep 17 00:00:00 2001 From: Eric Barnes Date: Mon, 19 Dec 2011 00:25:01 -0500 Subject: Added #795 to changelog --- user_guide_src/source/changelog.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 72b7f7e8a..74c29a509 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -72,7 +72,7 @@ Bug fixes for 3.0 - Bug #608 - Fixes an issue with the Image_lib class not clearing properties completely - Fixed bugs (#157 and #174) - the Image_lib clear() function now resets all variables to their default values. - Fixed a bug where using $this->dbforge->create_table() with PostgreSQL database could lead to fetching whole table. - +- Bug #795 - Fixed form method and accept-charset when passing an empty array. Version 2.1.0 ============= -- cgit v1.2.3-24-g4f1b From 4eea9895e8ced75a1099c56215c09773de94b92c Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 19 Dec 2011 12:05:41 +0200 Subject: Add method visibility declarations and optimize display_errors() method in Image_lib, Trackback and Upload libraries --- system/libraries/Image_lib.php | 58 +++++++++++++++++++----------------------- system/libraries/Trackback.php | 42 +++++++++++++----------------- system/libraries/Upload.php | 10 ++------ 3 files changed, 46 insertions(+), 64 deletions(-) diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index 2ed488c7e..c4797e34a 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -114,7 +114,7 @@ class CI_Image_lib { * @access public * @return void */ - function clear() + public function clear() { $props = array('library_path', 'source_image', 'new_image', 'width', 'height', 'rotation_angle', 'x_axis', 'y_axis', 'wm_text', 'wm_overlay_path', 'wm_font_path', 'wm_shadow_color', 'source_folder', 'dest_folder', 'mime_type', 'orig_width', 'orig_height', 'image_type', 'size_str', 'full_src_path', 'full_dst_path'); @@ -158,7 +158,7 @@ class CI_Image_lib { * @param array * @return bool */ - function initialize($props = array()) + public function initialize($props = array()) { /* * Convert array elements into class variables @@ -379,7 +379,7 @@ class CI_Image_lib { * @access public * @return bool */ - function resize() + public function resize() { $protocol = 'image_process_'.$this->image_library; @@ -402,7 +402,7 @@ class CI_Image_lib { * @access public * @return bool */ - function crop() + public function crop() { $protocol = 'image_process_'.$this->image_library; @@ -425,7 +425,7 @@ class CI_Image_lib { * @access public * @return bool */ - function rotate() + public function rotate() { // Allowed rotation values $degs = array(90, 180, 270, 'vrt', 'hor'); @@ -478,7 +478,7 @@ class CI_Image_lib { * @param string * @return bool */ - function image_process_gd($action = 'resize') + public function image_process_gd($action = 'resize') { $v2_override = FALSE; @@ -590,7 +590,7 @@ class CI_Image_lib { * @param string * @return bool */ - function image_process_imagemagick($action = 'resize') + public function image_process_imagemagick($action = 'resize') { // Do we have a vaild library path? if ($this->library_path == '') @@ -660,7 +660,7 @@ class CI_Image_lib { * @param string * @return bool */ - function image_process_netpbm($action = 'resize') + public function image_process_netpbm($action = 'resize') { if ($this->library_path == '') { @@ -743,7 +743,7 @@ class CI_Image_lib { * @access public * @return bool */ - function image_rotate_gd() + public function image_rotate_gd() { // Create the image handle if ( ! ($src_img = $this->image_create_gd())) @@ -796,7 +796,7 @@ class CI_Image_lib { * @access public * @return bool */ - function image_mirror_gd() + public function image_mirror_gd() { if ( ! $src_img = $this->image_create_gd()) { @@ -882,7 +882,7 @@ class CI_Image_lib { * @param string * @return bool */ - function watermark() + public function watermark() { if ($this->wm_type == 'overlay') { @@ -902,7 +902,7 @@ class CI_Image_lib { * @access public * @return bool */ - function overlay_watermark() + public function overlay_watermark() { if ( ! function_exists('imagecolortransparent')) { @@ -1015,7 +1015,7 @@ class CI_Image_lib { * @access public * @return bool */ - function text_watermark() + public function text_watermark() { if ( ! ($src_img = $this->image_create_gd())) { @@ -1159,7 +1159,7 @@ class CI_Image_lib { * @param string * @return resource */ - function image_create_gd($path = '', $image_type = '') + public function image_create_gd($path = '', $image_type = '') { if ($path == '') $path = $this->full_src_path; @@ -1216,7 +1216,7 @@ class CI_Image_lib { * @param resource * @return bool */ - function image_save_gd($resource) + public function image_save_gd($resource) { switch ($this->image_type) { @@ -1277,7 +1277,7 @@ class CI_Image_lib { * @param resource * @return void */ - function image_display_gd($resource) + public function image_display_gd($resource) { header("Content-Disposition: filename={$this->source_image};"); header("Content-Type: {$this->mime_type}"); @@ -1312,7 +1312,7 @@ class CI_Image_lib { * @access public * @return void */ - function image_reproportion() + public function image_reproportion() { if ( ! is_numeric($this->width) OR ! is_numeric($this->height) OR $this->width == 0 OR $this->height == 0) return; @@ -1354,7 +1354,7 @@ class CI_Image_lib { * @param string * @return mixed */ - function get_image_properties($path = '', $return = FALSE) + public function get_image_properties($path = '', $return = FALSE) { // For now we require GD but we should // find a way to determine this using IM or NetPBM @@ -1414,7 +1414,7 @@ class CI_Image_lib { * @param array * @return array */ - function size_calculator($vals) + public function size_calculator($vals) { if ( ! is_array($vals)) { @@ -1462,7 +1462,7 @@ class CI_Image_lib { * @param array * @return array */ - function explode_name($source_image) + public function explode_name($source_image) { $ext = strrchr($source_image, '.'); $name = ($ext === FALSE) ? $source_image : substr($source_image, 0, -strlen($ext)); @@ -1478,7 +1478,7 @@ class CI_Image_lib { * @access public * @return bool */ - function gd_loaded() + public function gd_loaded() { if ( ! extension_loaded('gd')) { @@ -1499,7 +1499,7 @@ class CI_Image_lib { * @access public * @return mixed */ - function gd_version() + public function gd_version() { if (function_exists('gd_info')) { @@ -1521,7 +1521,7 @@ class CI_Image_lib { * @param string * @return void */ - function set_error($msg) + public function set_error($msg) { $CI =& get_instance(); $CI->lang->load('imglib'); @@ -1553,19 +1553,13 @@ class CI_Image_lib { * @param string * @return string */ - function display_errors($open = '

    ', $close = '

    ') + public function display_errors($open = '

    ', $close = '

    ') { - $str = ''; - foreach ($this->error_msg as $val) - { - $str .= $open.$val.$close; - } - - return $str; + return (count($this->error_msg) > 0) ? $open . implode($close . $open, $this->error_msg) . $close : ''; } } // END Image_lib Class /* End of file Image_lib.php */ -/* Location: ./system/libraries/Image_lib.php */ \ No newline at end of file +/* Location: ./system/libraries/Image_lib.php */ diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index e903ea7d0..3fa55ca20 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -5,9 +5,9 @@ * An open source application development framework for PHP 5.1.6 or newer * * NOTICE OF LICENSE - * + * * Licensed under the Open Software License version 3.0 - * + * * This source file is subject to the Open Software License (OSL 3.0) that is * bundled with this package in the files license.txt / license.rst. It is * also available through the world wide web at this URL: @@ -66,7 +66,7 @@ class CI_Trackback { * @param array * @return bool */ - function send($tb_data) + public function send($tb_data) { if ( ! is_array($tb_data)) { @@ -147,7 +147,7 @@ class CI_Trackback { * @access public * @return bool */ - function receive() + public function receive() { foreach (array('url', 'title', 'blog_name', 'excerpt') as $val) { @@ -190,7 +190,7 @@ class CI_Trackback { * @param string * @return void */ - function send_error($message = 'Incomplete Information') + public function send_error($message = 'Incomplete Information') { echo "\n\n1\n".$message."\n"; exit; @@ -207,7 +207,7 @@ class CI_Trackback { * @access public * @return void */ - function send_success() + public function send_success() { echo "\n\n0\n"; exit; @@ -222,7 +222,7 @@ class CI_Trackback { * @param string * @return string */ - function data($item) + public function data($item) { return ( ! isset($this->data[$item])) ? '' : $this->data[$item]; } @@ -240,7 +240,7 @@ class CI_Trackback { * @param string * @return bool */ - function process($url, $data) + public function process($url, $data) { $target = parse_url($url); @@ -309,7 +309,7 @@ class CI_Trackback { * @param string * @return string */ - function extract_urls($urls) + public function extract_urls($urls) { // Remove the pesky white space and replace with a comma. $urls = preg_replace("/\s*(\S+)\s*/", "\\1,", $urls); @@ -345,7 +345,7 @@ class CI_Trackback { * @param string * @return string */ - function validate_url($url) + public function validate_url($url) { $url = trim($url); @@ -364,7 +364,7 @@ class CI_Trackback { * @param string * @return string */ - function get_id($url) + public function get_id($url) { $tb_id = ""; @@ -413,7 +413,7 @@ class CI_Trackback { * @param string * @return string */ - function convert_xml($str) + public function convert_xml($str) { $temp = '__TEMP_AMPERSANDS__'; @@ -443,7 +443,7 @@ class CI_Trackback { * @param string * @return string */ - function limit_characters($str, $n = 500, $end_char = '…') + public function limit_characters($str, $n = 500, $end_char = '…') { if (strlen($str) < $n) { @@ -480,7 +480,7 @@ class CI_Trackback { * @param string * @return string */ - function convert_ascii($str) + public function convert_ascii($str) { $count = 1; $out = ''; @@ -526,7 +526,7 @@ class CI_Trackback { * @param string * @return void */ - function set_error($msg) + public function set_error($msg) { log_message('error', $msg); $this->error_msg[] = $msg; @@ -542,19 +542,13 @@ class CI_Trackback { * @param string * @return string */ - function display_errors($open = '

    ', $close = '

    ') + public function display_errors($open = '

    ', $close = '

    ') { - $str = ''; - foreach ($this->error_msg as $val) - { - $str .= $open.$val.$close; - } - - return $str; + return (count($this->error_msg) > 0) ? $open . implode($close . $open, $this->error_msg) . $close : ''; } } // END Trackback Class /* End of file Trackback.php */ -/* Location: ./system/libraries/Trackback.php */ \ No newline at end of file +/* Location: ./system/libraries/Trackback.php */ diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php index 66e91c5b6..ab97d1a0f 100644 --- a/system/libraries/Upload.php +++ b/system/libraries/Upload.php @@ -934,13 +934,7 @@ class CI_Upload { */ public function display_errors($open = '

    ', $close = '

    ') { - $str = ''; - foreach ($this->error_msg as $val) - { - $str .= $open.$val.$close; - } - - return $str; + return (count($this->error_msg) > 0) ? $open . implode($close . $open, $this->error_msg) . $close : ''; } // -------------------------------------------------------------------- @@ -1086,4 +1080,4 @@ class CI_Upload { // END Upload Class /* End of file Upload.php */ -/* Location: ./system/libraries/Upload.php */ \ No newline at end of file +/* Location: ./system/libraries/Upload.php */ -- cgit v1.2.3-24-g4f1b From dc3e4bedb39afe30d95635e5258aaecec4dfd74c Mon Sep 17 00:00:00 2001 From: Eric Barnes Date: Mon, 19 Dec 2011 13:48:29 -0500 Subject: Fixed year and month seconds for timespan(). --- system/helpers/date_helper.php | 70 ++++++++++++++++++------------------- user_guide_src/source/changelog.rst | 1 + 2 files changed, 36 insertions(+), 35 deletions(-) diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php index 8c92fdc89..49dbdbeb3 100644 --- a/system/helpers/date_helper.php +++ b/system/helpers/date_helper.php @@ -5,9 +5,9 @@ * An open source application development framework for PHP 5.1.6 or newer * * NOTICE OF LICENSE - * + * * Licensed under the Open Software License version 3.0 - * + * * This source file is subject to the Open Software License (OSL 3.0) that is * bundled with this package in the files license.txt / license.rst. It is * also available through the world wide web at this URL: @@ -96,14 +96,14 @@ if ( ! function_exists('mdate')) { if ($datestr == '') { - return ''; + return ''; } $time = ($time == '') ? now() : $time; $datestr = str_replace( - '%\\', - '', + '%\\', + '', preg_replace("/([a-z]+?){1}/i", "\\\\\\1", $datestr) ); @@ -181,15 +181,15 @@ if ( ! function_exists('timespan')) $seconds = ($time <= $seconds) ? 1 : $time - $seconds; $str = ''; - $years = floor($seconds / 31536000); + $years = floor($seconds / 31557600); if ($years > 0) { $str .= $years.' '.$CI->lang->line((($years > 1) ? 'date_years' : 'date_year')).', '; } - $seconds -= $years * 31536000; - $months = floor($seconds / 2628000); + $seconds -= $years * 31557600; + $months = floor($seconds / 2629743); if ($years > 0 OR $months > 0) { @@ -198,7 +198,7 @@ if ( ! function_exists('timespan')) $str .= $months.' '.$CI->lang->line((($months > 1) ? 'date_months' : 'date_month')).', '; } - $seconds -= $months * 2628000; + $seconds -= $months * 2629743; } $weeks = floor($seconds / 604800); @@ -315,13 +315,13 @@ if ( ! function_exists('local_to_gmt')) { $time = time(); } - + return mktime( - gmdate("H", $time), - gmdate("i", $time), - gmdate("s", $time), - gmdate("m", $time), - gmdate("d", $time), + gmdate("H", $time), + gmdate("i", $time), + gmdate("s", $time), + gmdate("m", $time), + gmdate("d", $time), gmdate("Y", $time) ); } @@ -494,17 +494,17 @@ if ( ! function_exists('human_to_unix')) if (substr($ampm, 0, 1) == 'p' AND $hour < 12) { - $hour = $hour + 12; + $hour = $hour + 12; } if (substr($ampm, 0, 1) == 'a' AND $hour == 12) { $hour = '00'; } - + if (strlen($hour) == 1) { - $hour = '0'.$hour; + $hour = '0'.$hour; } } @@ -517,7 +517,7 @@ if ( ! function_exists('human_to_unix')) /** * Turns many "reasonably-date-like" strings into something * that is actually useful. This only works for dates after unix epoch. - * + * * @access public * @param string The terribly formatted date-like string * @param string Date format to return (same as php date function) @@ -525,7 +525,7 @@ if ( ! function_exists('human_to_unix')) */ if ( ! function_exists('nice_date')) { - function nice_date($bad_date = '', $format = FALSE) + function nice_date($bad_date = '', $format = FALSE) { if (empty($bad_date)) { @@ -533,47 +533,47 @@ if ( ! function_exists('nice_date')) } // Date like: YYYYMM - if (preg_match('/^\d{6}$/', $bad_date)) + if (preg_match('/^\d{6}$/', $bad_date)) { - if (in_array(substr($bad_date, 0, 2),array('19', '20'))) + if (in_array(substr($bad_date, 0, 2),array('19', '20'))) { $year = substr($bad_date, 0, 4); $month = substr($bad_date, 4, 2); - } - else + } + else { $month = substr($bad_date, 0, 2); $year = substr($bad_date, 2, 4); } - + return date($format, strtotime($year . '-' . $month . '-01')); } - + // Date Like: YYYYMMDD - if (preg_match('/^\d{8}$/',$bad_date)) + if (preg_match('/^\d{8}$/',$bad_date)) { $month = substr($bad_date, 0, 2); $day = substr($bad_date, 2, 2); $year = substr($bad_date, 4, 4); - + return date($format, strtotime($month . '/01/' . $year)); } - + // Date Like: MM-DD-YYYY __or__ M-D-YYYY (or anything in between) if (preg_match('/^\d{1,2}-\d{1,2}-\d{4}$/',$bad_date)) - { + { list($m, $d, $y) = explode('-', $bad_date); return date($format, strtotime("{$y}-{$m}-{$d}")); } - + // Any other kind of string, when converted into UNIX time, // produces "0 seconds after epoc..." is probably bad... // return "Invalid Date". if (date('U', strtotime($bad_date)) == '0') - { + { return "Invalid Date"; } - + // It's probably a valid-ish date format already return date($format, strtotime($bad_date)); } @@ -688,9 +688,9 @@ if ( ! function_exists('timezones')) { return $zones; } - + $tz = ($tz == 'GMT') ? 'UTC' : $tz; - + return ( ! isset($zones[$tz])) ? 0 : $zones[$tz]; } } diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 74c29a509..44c9432a2 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -73,6 +73,7 @@ Bug fixes for 3.0 - Fixed bugs (#157 and #174) - the Image_lib clear() function now resets all variables to their default values. - Fixed a bug where using $this->dbforge->create_table() with PostgreSQL database could lead to fetching whole table. - Bug #795 - Fixed form method and accept-charset when passing an empty array. +- Bug #797 - timespan was using incorrect seconds for year and month. Version 2.1.0 ============= -- cgit v1.2.3-24-g4f1b From c4caf5a181344e48fc6740f1383dd302f5b604d2 Mon Sep 17 00:00:00 2001 From: Mancy Date: Tue, 20 Dec 2011 11:47:51 +0300 Subject: taking care of LIKE when used in UPDATE statement #798 --- system/database/DB_active_rec.php | 2 +- system/database/drivers/mysql/mysql_driver.php | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php index 43920772a..7a608c4f0 100644 --- a/system/database/DB_active_rec.php +++ b/system/database/DB_active_rec.php @@ -1424,7 +1424,7 @@ class CI_DB_active_record extends CI_DB_driver { $this->limit($limit); } - $sql = $this->_update($this->_protect_identifiers($this->ar_from[0], TRUE, NULL, FALSE), $this->ar_set, $this->ar_where, $this->ar_orderby, $this->ar_limit); + $sql = $this->_update($this->_protect_identifiers($this->ar_from[0], TRUE, NULL, FALSE), $this->ar_set, $this->ar_where, $this->ar_orderby, $this->ar_limit, , $this->ar_like); $this->_reset_write(); return $this->query($sql); diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php index 828ef006b..7952312ab 100644 --- a/system/database/drivers/mysql/mysql_driver.php +++ b/system/database/drivers/mysql/mysql_driver.php @@ -606,7 +606,7 @@ class CI_DB_mysql_driver extends CI_DB { * @param array the limit clause * @return string */ - function _update($table, $values, $where, $orderby = array(), $limit = FALSE) + function _update($table, $values, $where, $orderby = array(), $limit = FALSE, $like = array()) { foreach ($values as $key => $val) { @@ -620,6 +620,15 @@ class CI_DB_mysql_driver extends CI_DB { $sql = "UPDATE ".$table." SET ".implode(', ', $valstr); $sql .= ($where != '' AND count($where) >=1) ? " WHERE ".implode(" ", $where) : ''; + + if (count($like) > 0) { + $sql .= ($where == '' AND count($where) <1) ? " WHERE " : ' AND '; + foreach ($like as $st_like) { + + $sql .= " " . $st_like; + + } + } $sql .= $orderby.$limit; -- cgit v1.2.3-24-g4f1b From 205d02936cf76f9b430129d9b704c182933cfee4 Mon Sep 17 00:00:00 2001 From: Mancy Date: Tue, 20 Dec 2011 12:45:58 +0300 Subject: #798: following current codeigniter code standards --- system/database/drivers/mysql/mysql_driver.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php index 7952312ab..6ded6e531 100644 --- a/system/database/drivers/mysql/mysql_driver.php +++ b/system/database/drivers/mysql/mysql_driver.php @@ -621,12 +621,13 @@ class CI_DB_mysql_driver extends CI_DB { $sql .= ($where != '' AND count($where) >=1) ? " WHERE ".implode(" ", $where) : ''; - if (count($like) > 0) { + if (count($like) > 0) + { $sql .= ($where == '' AND count($where) <1) ? " WHERE " : ' AND '; - foreach ($like as $st_like) { - - $sql .= " " . $st_like; - + + foreach ($like as $st_like) + { + $sql .= " " . $st_like; } } -- cgit v1.2.3-24-g4f1b From 0d91fd2956812e07905d8047ef95a0e556edbb1a Mon Sep 17 00:00:00 2001 From: Mancy Date: Tue, 20 Dec 2011 13:13:14 +0300 Subject: #798: update changelog and typo fix --- system/database/DB_active_rec.php | 2 +- user_guide_src/source/changelog.rst | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php index 7a608c4f0..41950e7d8 100644 --- a/system/database/DB_active_rec.php +++ b/system/database/DB_active_rec.php @@ -1424,7 +1424,7 @@ class CI_DB_active_record extends CI_DB_driver { $this->limit($limit); } - $sql = $this->_update($this->_protect_identifiers($this->ar_from[0], TRUE, NULL, FALSE), $this->ar_set, $this->ar_where, $this->ar_orderby, $this->ar_limit, , $this->ar_like); + $sql = $this->_update($this->_protect_identifiers($this->ar_from[0], TRUE, NULL, FALSE), $this->ar_set, $this->ar_where, $this->ar_orderby, $this->ar_limit, $this->ar_like); $this->_reset_write(); return $this->query($sql); diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 74c29a509..4e0f04105 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -40,6 +40,7 @@ Release Date: Not Released - Added new :doc:`Active Record ` methods that return the SQL string of queries without executing them: get_compiled_select(), get_compiled_insert(), get_compiled_update(), get_compiled_delete(). + - Taking care of LIKE condition when used with MySQL UPDATE statement. - Libraries -- cgit v1.2.3-24-g4f1b From 3a45957a30ff908445b2772efac8fdb65b64e6cd Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 21 Dec 2011 11:23:11 +0200 Subject: Also replace old-style 'var' with 'public' --- system/libraries/Image_lib.php | 90 +++++++++++++++++++++--------------------- system/libraries/Trackback.php | 12 +++--- system/libraries/Upload.php | 4 +- 3 files changed, 53 insertions(+), 53 deletions(-) diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index c4797e34a..20ca1f055 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -38,55 +38,55 @@ */ class CI_Image_lib { - var $image_library = 'gd2'; // Can be: imagemagick, netpbm, gd, gd2 - var $library_path = ''; - var $dynamic_output = FALSE; // Whether to send to browser or write to disk - var $source_image = ''; - var $new_image = ''; - var $width = ''; - var $height = ''; - var $quality = '90'; - var $create_thumb = FALSE; - var $thumb_marker = '_thumb'; - var $maintain_ratio = TRUE; // Whether to maintain aspect ratio when resizing or use hard values - var $master_dim = 'auto'; // auto, height, or width. Determines what to use as the master dimension - var $rotation_angle = ''; - var $x_axis = ''; - var $y_axis = ''; + public $image_library = 'gd2'; // Can be: imagemagick, netpbm, gd, gd2 + public $library_path = ''; + public $dynamic_output = FALSE; // Whether to send to browser or write to disk + public $source_image = ''; + public $new_image = ''; + public $width = ''; + public $height = ''; + public $quality = '90'; + public $create_thumb = FALSE; + public $thumb_marker = '_thumb'; + public $maintain_ratio = TRUE; // Whether to maintain aspect ratio when resizing or use hard values + public $master_dim = 'auto'; // auto, height, or width. Determines what to use as the master dimension + public $rotation_angle = ''; + public $x_axis = ''; + public $y_axis = ''; // Watermark Vars - var $wm_text = ''; // Watermark text if graphic is not used - var $wm_type = 'text'; // Type of watermarking. Options: text/overlay - var $wm_x_transp = 4; - var $wm_y_transp = 4; - var $wm_overlay_path = ''; // Watermark image path - var $wm_font_path = ''; // TT font - var $wm_font_size = 17; // Font size (different versions of GD will either use points or pixels) - var $wm_vrt_alignment = 'B'; // Vertical alignment: T M B - var $wm_hor_alignment = 'C'; // Horizontal alignment: L R C - var $wm_padding = 0; // Padding around text - var $wm_hor_offset = 0; // Lets you push text to the right - var $wm_vrt_offset = 0; // Lets you push text down - var $wm_font_color = '#ffffff'; // Text color - var $wm_shadow_color = ''; // Dropshadow color - var $wm_shadow_distance = 2; // Dropshadow distance - var $wm_opacity = 50; // Image opacity: 1 - 100 Only works with image + public $wm_text = ''; // Watermark text if graphic is not used + public $wm_type = 'text'; // Type of watermarking. Options: text/overlay + public $wm_x_transp = 4; + public $wm_y_transp = 4; + public $wm_overlay_path = ''; // Watermark image path + public $wm_font_path = ''; // TT font + public $wm_font_size = 17; // Font size (different versions of GD will either use points or pixels) + public $wm_vrt_alignment = 'B'; // Vertical alignment: T M B + public $wm_hor_alignment = 'C'; // Horizontal alignment: L R C + public $wm_padding = 0; // Padding around text + public $wm_hor_offset = 0; // Lets you push text to the right + public $wm_vrt_offset = 0; // Lets you push text down + public $wm_font_color = '#ffffff'; // Text color + public $wm_shadow_color = ''; // Dropshadow color + public $wm_shadow_distance = 2; // Dropshadow distance + public $wm_opacity = 50; // Image opacity: 1 - 100 Only works with image // Private Vars - var $source_folder = ''; - var $dest_folder = ''; - var $mime_type = ''; - var $orig_width = ''; - var $orig_height = ''; - var $image_type = ''; - var $size_str = ''; - var $full_src_path = ''; - var $full_dst_path = ''; - var $create_fnc = 'imagecreatetruecolor'; - var $copy_fnc = 'imagecopyresampled'; - var $error_msg = array(); - var $wm_use_drop_shadow = FALSE; - var $wm_use_truetype = FALSE; + public $source_folder = ''; + public $dest_folder = ''; + public $mime_type = ''; + public $orig_width = ''; + public $orig_height = ''; + public $image_type = ''; + public $size_str = ''; + public $full_src_path = ''; + public $full_dst_path = ''; + public $create_fnc = 'imagecreatetruecolor'; + public $copy_fnc = 'imagecopyresampled'; + public $error_msg = array(); + public $wm_use_drop_shadow = FALSE; + public $wm_use_truetype = FALSE; /** * Constructor diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index 3fa55ca20..1e5928314 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -40,12 +40,12 @@ */ class CI_Trackback { - var $time_format = 'local'; - var $charset = 'UTF-8'; - var $data = array('url' => '', 'title' => '', 'excerpt' => '', 'blog_name' => '', 'charset' => ''); - var $convert_ascii = TRUE; - var $response = ''; - var $error_msg = array(); + public $time_format = 'local'; + public $charset = 'UTF-8'; + public $data = array('url' => '', 'title' => '', 'excerpt' => '', 'blog_name' => '', 'charset' => ''); + public $convert_ascii = TRUE; + public $response = ''; + public $error_msg = array(); /** * Constructor diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php index ab97d1a0f..826bcceb8 100644 --- a/system/libraries/Upload.php +++ b/system/libraries/Upload.php @@ -5,9 +5,9 @@ * An open source application development framework for PHP 5.1.6 or newer * * NOTICE OF LICENSE - * + * * Licensed under the Open Software License version 3.0 - * + * * This source file is subject to the Open Software License (OSL 3.0) that is * bundled with this package in the files license.txt / license.rst. It is * also available through the world wide web at this URL: -- cgit v1.2.3-24-g4f1b From bb2488305194e50881df0971bf4f33f30d974d36 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 21 Dec 2011 16:42:51 +0200 Subject: Improved the Cart library --- system/libraries/Cart.php | 196 +++++++++++------------------------- user_guide_src/source/changelog.rst | 1 + 2 files changed, 62 insertions(+), 135 deletions(-) diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php index 717ccd9fb..b2cc2081e 100644 --- a/system/libraries/Cart.php +++ b/system/libraries/Cart.php @@ -1,13 +1,13 @@ -CI =& get_instance(); // Are any config settings being passed manually? If so, set them - $config = array(); - if (count($params) > 0) - { - foreach ($params as $key => $val) - { - $config[$key] = $val; - } - } + $config = is_array($params) ? $params : array(); // Load the Sessions class $this->CI->load->library('session', $config); - // Grab the shopping cart array from the session table, if it exists - if ($this->CI->session->userdata('cart_contents') !== FALSE) - { - $this->_cart_contents = $this->CI->session->userdata('cart_contents'); - } - else + // Grab the shopping cart array from the session table + $this->_cart_contents = $this->CI->session->userdata('cart_contents'); + if ($this->_cart_contents === FALSE) { // No cart exists so we'll set some base values - $this->_cart_contents['cart_total'] = 0; - $this->_cart_contents['total_items'] = 0; + $this->_cart_contents = array('cart_total' => 0, 'total_items' => 0); } log_message('debug', "Cart Class Initialized"); @@ -95,10 +84,10 @@ class CI_Cart { * @param array * @return bool */ - function insert($items = array()) + public function insert($items = array()) { // Was any cart data passed? No? Bah... - if ( ! is_array($items) OR count($items) == 0) + if ( ! is_array($items) OR count($items) === 0) { log_message('error', 'The insert method must be passed an array containing data.'); return FALSE; @@ -132,7 +121,7 @@ class CI_Cart { } // Save the cart data if the insert was successful - if ($save_cart == TRUE) + if ($save_cart === TRUE) { $this->_save_cart(); return isset($rowid) ? $rowid : TRUE; @@ -150,10 +139,10 @@ class CI_Cart { * @param array * @return bool */ - function _insert($items = array()) + private function _insert($items = array()) { // Was any cart data passed? No? Bah... - if ( ! is_array($items) OR count($items) == 0) + if ( ! is_array($items) OR count($items) === 0) { log_message('error', 'The insert method must be passed an array containing data.'); return FALSE; @@ -170,10 +159,8 @@ class CI_Cart { // -------------------------------------------------------------------- - // Prep the quantity. It can only be a number. Duh... - $items['qty'] = trim(preg_replace('/([^0-9])/i', '', $items['qty'])); - // Trim any leading zeros - $items['qty'] = trim(preg_replace('/(^[0]+)/i', '', $items['qty'])); + // Prep the quantity. It can only be a number. Duh... also trim any leading zeros + $items['qty'] = ltrim(trim(preg_replace('/([^0-9])/i', '', $items['qty'])), '0'); // If the quantity is zero or blank there's nothing for us to do if ( ! is_numeric($items['qty']) OR $items['qty'] == 0) @@ -186,7 +173,7 @@ class CI_Cart { // Validate the product ID. It can only be alpha-numeric, dashes, underscores or periods // Not totally sure we should impose this rule, but it seems prudent to standardize IDs. // Note: These can be user-specified by setting the $this->product_id_rules variable. - if ( ! preg_match("/^[".$this->product_id_rules."]+$/i", $items['id'])) + if ( ! preg_match('/^['.$this->product_id_rules.']+$/i', $items['id'])) { log_message('error', 'Invalid product ID. The product ID can only contain alpha-numeric characters, dashes, and underscores'); return FALSE; @@ -196,7 +183,7 @@ class CI_Cart { // Validate the product name. It can only be alpha-numeric, dashes, underscores, colons or periods. // Note: These can be user-specified by setting the $this->product_name_rules variable. - if ( $this->product_name_safe && ! preg_match("/^[".$this->product_name_rules."]+$/i", $items['name'])) + if ($this->product_name_safe && ! preg_match('/^['.$this->product_name_rules.']+$/i', $items['name'])) { log_message('error', 'An invalid name was submitted as the product name: '.$items['name'].' The name can only contain alpha-numeric characters, dashes, underscores, colons, and spaces'); return FALSE; @@ -204,10 +191,8 @@ class CI_Cart { // -------------------------------------------------------------------- - // Prep the price. Remove anything that isn't a number or decimal point. - $items['price'] = trim(preg_replace('/([^0-9\.])/i', '', $items['price'])); - // Trim any leading zeros - $items['price'] = trim(preg_replace('/(^[0]+)/i', '', $items['price'])); + // Prep the price. Remove leading zeros and anything that isn't a number or decimal point. + $items['price'] = lrtrim(trim(preg_replace('/([^0-9\.])/i', '', $items['price'])), '0'); // Is the price a valid number? if ( ! is_numeric($items['price'])) @@ -244,33 +229,13 @@ class CI_Cart { // Now that we have our unique "row ID", we'll add our cart items to the master array // grab quantity if it's already there and add it on - if (isset($this->_cart_contents[$rowid]['qty'])) - { - // set our old quantity - $old_quantity = (int)$this->_cart_contents[$rowid]['qty']; - } - else - { - // we have no old quantity but - we don't want to throw an error - $old_quantity = 0; - } - - // let's unset this first, just to make sure our index contains only the data from this submission - unset($this->_cart_contents[$rowid]); + $old_quantity = isset($this->_cart_contents[$rowid]['qty']) ? (int) $this->_cart_contents[$rowid]['qty'] : 0; - // Create a new index with our new row ID - $this->_cart_contents[$rowid]['rowid'] = $rowid; + // Re-create the entry, just to make sure our index contains only the data from this submission + $items['rowid'] = $rowid; + $items['qty'] += $old_quantity; + $this->_cart_contents[$rowid] = $items; - // And add the new items to the cart array - foreach ($items as $key => $val) - { - $this->_cart_contents[$rowid][$key] = $val; - } - - // add old quantity back in - $this->_cart_contents[$rowid]['qty'] = ($this->_cart_contents[$rowid]['qty'] + $old_quantity); - - // Woot! return $rowid; } @@ -289,10 +254,10 @@ class CI_Cart { * @param string * @return bool */ - function update($items = array()) + public function update($items = array()) { // Was any cart data passed? - if ( ! is_array($items) OR count($items) == 0) + if ( ! is_array($items) OR count($items) === 0) { return FALSE; } @@ -302,9 +267,9 @@ class CI_Cart { // determine the array type is by looking for a required array key named "id". // If it's not found we assume it's a multi-dimensional array $save_cart = FALSE; - if (isset($items['rowid']) AND isset($items['qty'])) + if (isset($items['rowid'], $items['qty'])) { - if ($this->_update($items) == TRUE) + if ($this->_update($items) === TRUE) { $save_cart = TRUE; } @@ -313,9 +278,9 @@ class CI_Cart { { foreach ($items as $val) { - if (is_array($val) AND isset($val['rowid']) AND isset($val['qty'])) + if (is_array($val) && isset($val['rowid'], $val['qty'])) { - if ($this->_update($val) == TRUE) + if ($this->_update($val) === TRUE) { $save_cart = TRUE; } @@ -324,7 +289,7 @@ class CI_Cart { } // Save the cart data if the insert was successful - if ($save_cart == TRUE) + if ($save_cart === TRUE) { $this->_save_cart(); return TRUE; @@ -347,7 +312,7 @@ class CI_Cart { * @param array * @return bool */ - function _update($items = array()) + private function _update($items = array()) { // Without these array indexes there is nothing we can do if ( ! isset($items['qty']) OR ! isset($items['rowid']) OR ! isset($this->_cart_contents[$items['rowid']])) @@ -393,15 +358,10 @@ class CI_Cart { * @access private * @return bool */ - function _save_cart() + private function _save_cart() { - // Unset these so our total can be calculated correctly below - unset($this->_cart_contents['total_items']); - unset($this->_cart_contents['cart_total']); - // Lets add up the individual prices and set the cart sub-total - $total = 0; - $items = 0; + $this->_cart_contents['total_items'] = $this->_cart_contents['cart_total'] = 0; foreach ($this->_cart_contents as $key => $val) { // We make sure the array contains the proper indexes @@ -410,17 +370,11 @@ class CI_Cart { continue; } - $total += ($val['price'] * $val['qty']); - $items += $val['qty']; - - // Set the subtotal + $this->_cart_contents['cart_total'] += ($val['price'] * $val['qty']); + $this->_cart_contents['total_items'] += $val['qty']; $this->_cart_contents[$key]['subtotal'] = ($this->_cart_contents[$key]['price'] * $this->_cart_contents[$key]['qty']); } - // Set the cart total and total items. - $this->_cart_contents['total_items'] = $items; - $this->_cart_contents['cart_total'] = $total; - // Is our cart empty? If so we delete it from the session if (count($this->_cart_contents) <= 2) { @@ -434,7 +388,6 @@ class CI_Cart { // Let's pass it to the Session class so it can be stored $this->CI->session->set_userdata(array('cart_contents' => $this->_cart_contents)); - // Woot! return TRUE; } @@ -446,13 +399,13 @@ class CI_Cart { * @access public * @return integer */ - function total() + public function total() { return $this->_cart_contents['cart_total']; } - + // -------------------------------------------------------------------- - + /** * Remove Item * @@ -463,16 +416,12 @@ class CI_Cart { */ public function remove($rowid) { - // just do an unset + // unset & save unset($this->_cart_contents[$rowid]); - - // we need to save the cart now we've made our changes $this->_save_cart(); - - // completed - return true; + return TRUE; } - + // -------------------------------------------------------------------- /** @@ -483,7 +432,7 @@ class CI_Cart { * @access public * @return integer */ - function total_items() + public function total_items() { return $this->_cart_contents['total_items']; } @@ -498,19 +447,10 @@ class CI_Cart { * @access public * @return array */ - function contents($newest_first = false) + public function contents($newest_first = FALSE) { // do we want the newest first? - if($newest_first) - { - // reverse the array - $cart = array_reverse($this->_cart_contents); - } - else - { - // just added first to last - $cart = $this->_cast_contents; - } + $cart = ($newest_first) ? array_reverse($this->_cart_contents) : $this->_cart_contents; // Remove these so they don't create a problem when showing the cart table unset($cart['total_items']); @@ -528,16 +468,11 @@ class CI_Cart { * that has options associated with it. * * @access public - * @return array + * @return bool */ - function has_options($rowid = '') + public function has_options($rowid = '') { - if ( ! isset($this->_cart_contents[$rowid]['options']) OR count($this->_cart_contents[$rowid]['options']) === 0) - { - return FALSE; - } - - return TRUE; + return (isset($this->_cart_contents[$rowid]['options']) && count($this->_cart_contents[$rowid]['options']) !== 0) ? TRUE : FALSE; } // -------------------------------------------------------------------- @@ -550,14 +485,9 @@ class CI_Cart { * @access public * @return array */ - function product_options($rowid = '') + public function product_options($rowid = '') { - if ( ! isset($this->_cart_contents[$rowid]['options'])) - { - return array(); - } - - return $this->_cart_contents[$rowid]['options']; + return isset($this->_cart_contents[$rowid]['options']) ? $this->_cart_contents[$rowid]['options'] : array(); } // -------------------------------------------------------------------- @@ -568,9 +498,9 @@ class CI_Cart { * Returns the supplied number with commas and a decimal point. * * @access public - * @return integer + * @return string */ - function format_number($n = '') + public function format_number($n = '') { if ($n == '') { @@ -591,15 +521,11 @@ class CI_Cart { * Empties the cart and kills the session * * @access public - * @return null + * @return void */ - function destroy() + public function destroy() { - unset($this->_cart_contents); - - $this->_cart_contents['cart_total'] = 0; - $this->_cart_contents['total_items'] = 0; - + $this->_cart_contents = array('cart_total' => 0, 'total_items' => 0); $this->CI->session->unset_userdata('cart_contents'); } @@ -608,4 +534,4 @@ class CI_Cart { // END Cart Class /* End of file Cart.php */ -/* Location: ./system/libraries/Cart.php */ \ No newline at end of file +/* Location: ./system/libraries/Cart.php */ diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 62f60b1bb..8a7109feb 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -75,6 +75,7 @@ Bug fixes for 3.0 - Fixed a bug where using $this->dbforge->create_table() with PostgreSQL database could lead to fetching whole table. - Bug #795 - Fixed form method and accept-charset when passing an empty array. - Bug #797 - timespan was using incorrect seconds for year and month. +- Fixed a bug in CI_Cart::contents() where if called without a TRUE (or equal) parameter, it would fail due to a typo. Version 2.1.0 ============= -- cgit v1.2.3-24-g4f1b From 2c685fb03a4d4b5a96789b839147191ce8cffacc Mon Sep 17 00:00:00 2001 From: pporlan Date: Thu, 22 Dec 2011 12:15:25 +0100 Subject: Adding $escape parameter to the order_by function, this enables ordering by custom fields --- system/database/DB_active_rec.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php index 41950e7d8..412febfcc 100644 --- a/system/database/DB_active_rec.php +++ b/system/database/DB_active_rec.php @@ -830,9 +830,10 @@ class CI_DB_active_record extends CI_DB_driver { * * @param string * @param string direction: asc or desc + * @param bool enable field name escaping * @return object */ - public function order_by($orderby, $direction = '') + public function order_by($orderby, $direction = '', $escape = TRUE) { if (strtolower($direction) == 'random') { @@ -845,7 +846,7 @@ class CI_DB_active_record extends CI_DB_driver { } - if (strpos($orderby, ',') !== FALSE) + if ((strpos($orderby, ',') !== FALSE) && ($escape === TRUE)) { $temp = array(); foreach (explode(',', $orderby) as $part) @@ -863,7 +864,10 @@ class CI_DB_active_record extends CI_DB_driver { } else if ($direction != $this->_random_keyword) { - $orderby = $this->_protect_identifiers($orderby); + if ($escape === TRUE) + { + $orderby = $this->_protect_identifiers($orderby); + } } $orderby_statement = $orderby.$direction; -- cgit v1.2.3-24-g4f1b From 17779d6163aa3a2b0544a45f7159717c95a23c2f Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 22 Dec 2011 13:21:08 +0200 Subject: Cast to float instead of using preg_replace() for sanitizing numbers --- system/libraries/Cart.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php index b2cc2081e..01a0cb8ce 100644 --- a/system/libraries/Cart.php +++ b/system/libraries/Cart.php @@ -160,7 +160,7 @@ class CI_Cart { // -------------------------------------------------------------------- // Prep the quantity. It can only be a number. Duh... also trim any leading zeros - $items['qty'] = ltrim(trim(preg_replace('/([^0-9])/i', '', $items['qty'])), '0'); + $items['qty'] = (float) $items['qty']; // If the quantity is zero or blank there's nothing for us to do if ( ! is_numeric($items['qty']) OR $items['qty'] == 0) @@ -192,7 +192,7 @@ class CI_Cart { // -------------------------------------------------------------------- // Prep the price. Remove leading zeros and anything that isn't a number or decimal point. - $items['price'] = lrtrim(trim(preg_replace('/([^0-9\.])/i', '', $items['price'])), '0'); + $items['price'] = (float) $items['price']; // Is the price a valid number? if ( ! is_numeric($items['price'])) @@ -321,7 +321,7 @@ class CI_Cart { } // Prep the quantity - $items['qty'] = preg_replace('/([^0-9])/i', '', $items['qty']); + $items['qty'] = (float) $items['qty']; // Is the quantity a number? if ( ! is_numeric($items['qty'])) @@ -388,6 +388,7 @@ class CI_Cart { // Let's pass it to the Session class so it can be stored $this->CI->session->set_userdata(array('cart_contents' => $this->_cart_contents)); + // Woot! return TRUE; } @@ -508,7 +509,7 @@ class CI_Cart { } // Remove anything that isn't a number or decimal point. - $n = trim(preg_replace('/([^0-9\.])/i', '', $n)); + $n = (float) $n; return number_format($n, 2, '.', ','); } -- cgit v1.2.3-24-g4f1b From 83d15051930c48643dc7f684275eb92b41e26cb6 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 22 Dec 2011 13:35:42 +0200 Subject: Clean up the Driver library --- system/libraries/Driver.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/system/libraries/Driver.php b/system/libraries/Driver.php index 8df137e74..183a95985 100644 --- a/system/libraries/Driver.php +++ b/system/libraries/Driver.php @@ -1,13 +1,13 @@ -lib_name)) { @@ -55,11 +55,11 @@ class CI_Driver_Library { // The class will be prefixed with the parent lib $child_class = $this->lib_name.'_'.$child; - + // Remove the CI_ prefix and lowercase $lib_name = ucfirst(strtolower(str_replace('CI_', '', $this->lib_name))); $driver_name = strtolower(str_replace('CI_', '', $child_class)); - + if (in_array($driver_name, array_map('strtolower', $this->valid_drivers))) { // check and see if the driver is in a separate file @@ -119,6 +119,7 @@ class CI_Driver_Library { * @link */ class CI_Driver { + protected $parent; private $methods = array(); @@ -238,4 +239,4 @@ class CI_Driver { // END CI_Driver CLASS /* End of file Driver.php */ -/* Location: ./system/libraries/Driver.php */ \ No newline at end of file +/* Location: ./system/libraries/Driver.php */ -- cgit v1.2.3-24-g4f1b From 1bd3d887057ce807944188f8f18142c14418b2ea Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 22 Dec 2011 15:38:20 +0200 Subject: Improve the Email library --- system/libraries/Email.php | 480 ++++++++++++++++----------------------------- 1 file changed, 172 insertions(+), 308 deletions(-) diff --git a/system/libraries/Email.php b/system/libraries/Email.php index 631b62e86..5158e859c 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -1,13 +1,13 @@ -_smtp_auth = ($this->smtp_user == '' AND $this->smtp_pass == '') ? FALSE : TRUE; - $this->_safe_mode = ((boolean)@ini_get("safe_mode") === FALSE) ? FALSE : TRUE; + $this->_safe_mode = (bool) @ini_get("safe_mode"); } log_message('debug', "Email Class Initialized"); @@ -140,7 +140,7 @@ class CI_Email { $this->clear(); $this->_smtp_auth = ($this->smtp_user == '' AND $this->smtp_pass == '') ? FALSE : TRUE; - $this->_safe_mode = ((boolean)@ini_get("safe_mode") === FALSE) ? FALSE : TRUE; + $this->_safe_mode = (bool) @ini_get("safe_mode"); return $this; } @@ -194,7 +194,7 @@ class CI_Email { { if (preg_match( '/\<(.*)\>/', $from, $match)) { - $from = $match['1']; + $from = $match[1]; } if ($this->validate) @@ -237,7 +237,7 @@ class CI_Email { { if (preg_match( '/\<(.*)\>/', $replyto, $match)) { - $replyto = $match['1']; + $replyto = $match[1]; } if ($this->validate) @@ -250,7 +250,7 @@ class CI_Email { $name = $replyto; } - if (strncmp($name, '"', 1) != 0) + if (strncmp($name, '"', 1) !== 0) { $name = '"'.$name.'"'; } @@ -280,7 +280,7 @@ class CI_Email { $this->validate_email($to); } - if ($this->_get_protocol() != 'mail') + if ($this->_get_protocol() !== 'mail') { $this->_set_header('To', implode(", ", $to)); } @@ -320,7 +320,7 @@ class CI_Email { $this->_set_header('Cc', implode(", ", $cc)); - if ($this->_get_protocol() == "smtp") + if ($this->_get_protocol() === 'smtp') { $this->_cc_array = $cc; } @@ -354,7 +354,7 @@ class CI_Email { $this->validate_email($bcc); } - if (($this->_get_protocol() == "smtp") OR ($this->bcc_batch_mode && count($bcc) > $this->bcc_batch_size)) + if ($this->_get_protocol() === 'smtp' OR ($this->bcc_batch_mode && count($bcc) > $this->bcc_batch_size)) { $this->_bcc_array = $bcc; } @@ -538,19 +538,13 @@ class CI_Email { */ public function set_priority($n = 3) { - if ( ! is_numeric($n)) - { - $this->priority = 3; - return; - } - - if ($n < 1 OR $n > 5) + if ( ! is_numeric($n) OR $n < 1 OR $n > 5) { $this->priority = 3; return; } - $this->priority = $n; + $this->priority = (int) $n; return $this; } @@ -565,14 +559,7 @@ class CI_Email { */ public function set_newline($newline = "\n") { - if ($newline != "\n" AND $newline != "\r\n" AND $newline != "\r") - { - $this->newline = "\n"; - return; - } - - $this->newline = $newline; - + $this->newline = ($newline !== "\n" AND $newline !== "\r\n" AND $newline !== "\r") ? "\n" : $newline; return $this; } @@ -587,14 +574,7 @@ class CI_Email { */ public function set_crlf($crlf = "\n") { - if ($crlf != "\n" AND $crlf != "\r\n" AND $crlf != "\r") - { - $this->crlf = "\n"; - return; - } - - $this->crlf = $crlf; - + $this->crlf = ($crlf !== "\n" AND $crlf !== "\r\n" AND $crlf !== "\r") ? "\n" : $crlf; return $this; } @@ -622,9 +602,7 @@ class CI_Email { */ protected function _get_message_id() { - $from = $this->_headers['Return-Path']; - $from = str_replace(">", "", $from); - $from = str_replace("<", "", $from); + $from = str_replace(array('>', '<'), array('', ''), $this->_headers['Return-Path']); return "<".uniqid('').strstr($from, '@').">"; } @@ -664,7 +642,7 @@ class CI_Email { foreach ($this->_base_charsets as $charset) { - if (strncmp($charset, $this->charset, strlen($charset)) == 0) + if (strncmp($charset, $this->charset, strlen($charset)) === 0) { $this->_encoding = '7bit'; } @@ -686,15 +664,15 @@ class CI_Email { */ protected function _get_content_type() { - if ($this->mailtype == 'html' && count($this->_attach_name) == 0) + if ($this->mailtype === 'html' && count($this->_attach_name) === 0) { return 'html'; } - elseif ($this->mailtype == 'html' && count($this->_attach_name) > 0) + elseif ($this->mailtype === 'html' && count($this->_attach_name) > 0) { return 'html-attach'; } - elseif ($this->mailtype == 'text' && count($this->_attach_name) > 0) + elseif ($this->mailtype === 'text' && count($this->_attach_name) > 0) { return 'plain-attach'; } @@ -715,9 +693,9 @@ class CI_Email { protected function _set_date() { $timezone = date("Z"); - $operator = (strncmp($timezone, '-', 1) == 0) ? '-' : '+'; + $operator = (strncmp($timezone, '-', 1) === 0) ? '-' : '+'; $timezone = abs($timezone); - $timezone = floor($timezone/3600) * 100 + ($timezone % 3600 ) / 60; + $timezone = floor($timezone/3600) * 100 + ($timezone % 3600) / 60; return sprintf("%s %s%04d", date("D, j M Y H:i:s"), $operator, $timezone); } @@ -775,7 +753,7 @@ class CI_Email { */ public function valid_email($address) { - return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $address)) ? FALSE : TRUE; + return (bool) preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $address); } // -------------------------------------------------------------------- @@ -791,28 +769,14 @@ class CI_Email { { if ( ! is_array($email)) { - if (preg_match('/\<(.*)\>/', $email, $match)) - { - return $match['1']; - } - else - { - return $email; - } + return (preg_match('/\<(.*)\>/', $email, $match)) ? $match[1] : $email; } $clean_email = array(); foreach ($email as $addy) { - if (preg_match( '/\<(.*)\>/', $addy, $match)) - { - $clean_email[] = $match['1']; - } - else - { - $clean_email[] = $addy; - } + $clean_email[] = (preg_match( '/\<(.*)\>/', $addy, $match)) ? $match[1] : $addy; } return $clean_email; @@ -838,32 +802,15 @@ class CI_Email { return $this->word_wrap($this->alt_message, '76'); } - if (preg_match('/\(.*)\<\/body\>/si', $this->_body, $match)) - { - $body = $match['1']; - } - else - { - $body = $this->_body; - } - - $body = trim(strip_tags($body)); - $body = preg_replace( '#