From 6986479050e7bf02cbafd9dbc82640a9e3865bb9 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Thu, 3 May 2012 14:05:00 -0400 Subject: Make valid_email helper function more accurate --- system/helpers/email_helper.php | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/system/helpers/email_helper.php b/system/helpers/email_helper.php index 0516e938a..c7b3abada 100644 --- a/system/helpers/email_helper.php +++ b/system/helpers/email_helper.php @@ -42,12 +42,40 @@ if ( ! function_exists('valid_email')) /** * Validate email address * + * Updated to be more accurate to RFC822 + * see: http://www.iamcal.com/publish/articles/php/parsing_email/ + * * @param string * @return bool */ - function valid_email($address) + function valid_email($email) { - return (bool) preg_match('/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix', $address); + $qtext = '[^\\x0d\\x22\\x5c\\x80-\\xff]'; + + $dtext = '[^\\x0d\\x5b-\\x5d\\x80-\\xff]'; + + $atom = '[^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c'. + '\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+'; + + $quoted_pair = '\\x5c[\\x00-\\x7f]'; + + $domain_literal = "\\x5b({$dtext}|{$quoted_pair})*\\x5d"; + + $quoted_string = "\\x22({$qtext}|{$quoted_pair})*\\x22"; + + $domain_ref = $atom; + + $sub_domain = "({$domain_ref}|{$domain_literal})"; + + $word = "({$atom}|{$quoted_string})"; + + $domain = "{$sub_domain}(\\x2e{$sub_domain})*"; + + $local_part = "{$word}(\\x2e{$word})*"; + + $addr_spec = "{$local_part}\\x40{$domain}"; + + return (bool) preg_match("!^{$addr_spec}$!", $email); } } -- cgit v1.2.3-24-g4f1b From 40dd9b5ffa1a9e0b1b885d4b592636dcc04af023 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Wed, 16 May 2012 15:41:05 -0400 Subject: Added filter_var for newer versions of php --- system/helpers/email_helper.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/system/helpers/email_helper.php b/system/helpers/email_helper.php index c7b3abada..449aadfc2 100644 --- a/system/helpers/email_helper.php +++ b/system/helpers/email_helper.php @@ -50,6 +50,13 @@ if ( ! function_exists('valid_email')) */ function valid_email($email) { + // Use PHP's filters if they exist + if (function_exists('filter_var')) + { + return (bool) filter_var($email, FILTER_VALIDATE_EMAIL); + } + + // Fallback based on RFC822 $qtext = '[^\\x0d\\x22\\x5c\\x80-\\xff]'; $dtext = '[^\\x0d\\x5b-\\x5d\\x80-\\xff]'; -- cgit v1.2.3-24-g4f1b From 421d6abf1ad3a1cfb96f9aad326c72c9b6fa3a06 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Thu, 17 May 2012 07:46:25 -0400 Subject: Remove regex validation in favor of filter_var --- system/helpers/email_helper.php | 34 +--------------------------------- 1 file changed, 1 insertion(+), 33 deletions(-) diff --git a/system/helpers/email_helper.php b/system/helpers/email_helper.php index 449aadfc2..ea9f6105d 100644 --- a/system/helpers/email_helper.php +++ b/system/helpers/email_helper.php @@ -50,39 +50,7 @@ if ( ! function_exists('valid_email')) */ function valid_email($email) { - // Use PHP's filters if they exist - if (function_exists('filter_var')) - { - return (bool) filter_var($email, FILTER_VALIDATE_EMAIL); - } - - // Fallback based on RFC822 - $qtext = '[^\\x0d\\x22\\x5c\\x80-\\xff]'; - - $dtext = '[^\\x0d\\x5b-\\x5d\\x80-\\xff]'; - - $atom = '[^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c'. - '\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+'; - - $quoted_pair = '\\x5c[\\x00-\\x7f]'; - - $domain_literal = "\\x5b({$dtext}|{$quoted_pair})*\\x5d"; - - $quoted_string = "\\x22({$qtext}|{$quoted_pair})*\\x22"; - - $domain_ref = $atom; - - $sub_domain = "({$domain_ref}|{$domain_literal})"; - - $word = "({$atom}|{$quoted_string})"; - - $domain = "{$sub_domain}(\\x2e{$sub_domain})*"; - - $local_part = "{$word}(\\x2e{$word})*"; - - $addr_spec = "{$local_part}\\x40{$domain}"; - - return (bool) preg_match("!^{$addr_spec}$!", $email); + return (bool) filter_var($email, FILTER_VALIDATE_EMAIL); } } -- cgit v1.2.3-24-g4f1b From d013c63462b4eaa2ac2f684b2ad498a9c4fb7dd5 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Thu, 17 May 2012 08:15:47 -0400 Subject: tweak and changelog entry --- system/helpers/email_helper.php | 5 +---- user_guide_src/source/changelog.rst | 1 + 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/system/helpers/email_helper.php b/system/helpers/email_helper.php index ea9f6105d..628667d4d 100644 --- a/system/helpers/email_helper.php +++ b/system/helpers/email_helper.php @@ -42,15 +42,12 @@ if ( ! function_exists('valid_email')) /** * Validate email address * - * Updated to be more accurate to RFC822 - * see: http://www.iamcal.com/publish/articles/php/parsing_email/ - * * @param string * @return bool */ function valid_email($email) { - return (bool) filter_var($email, FILTER_VALIDATE_EMAIL); + return filter_var($email, FILTER_VALIDATE_EMAIL); } } diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index d33a6a635..f835a8c8d 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -52,6 +52,7 @@ Release Date: Not Released - set_realpath() can now also handle file paths as opposed to just directories. - do_hash() now uses PHP's native hash() function, supporting more algorithms. - Added an optional paramater to ``delete_files()`` to enable it to skip deleting files such as .htaccess and index.html. + - Updated email helper to use ``filter_var`` to validate email addresses - Database -- cgit v1.2.3-24-g4f1b From ce79be0b5ffc9d5754c93771a8c289a252ec437b Mon Sep 17 00:00:00 2001 From: Derek Jones Date: Mon, 25 Jun 2012 23:23:46 -0700 Subject: Fixing various Sphinx bugs and syntax errors in docs --- user_guide_src/source/changelog.rst | 30 ++-- user_guide_src/source/database/results.rst | 4 +- user_guide_src/source/helpers/date_helper.rst | 165 ++++++++------------- user_guide_src/source/helpers/url_helper.rst | 6 +- user_guide_src/source/installation/upgrade_300.rst | 4 +- user_guide_src/source/libraries/email.rst | 2 +- user_guide_src/source/libraries/pagination.rst | 2 +- 7 files changed, 82 insertions(+), 131 deletions(-) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 28e2f94bb..e6afd350a 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -358,7 +358,7 @@ Release Date: November 14, 2011 injection. - Added additional option 'none' for the optional third argument for $this->db->like() in the :doc:`Database - Driver `. + Driver `. - Added $this->db->insert_batch() support to the OCI8 (Oracle) driver. - Added failover if the main connections in the config should fail @@ -1632,27 +1632,27 @@ Release Date: January 30, 2008 - Active Record - Added protect_identifiers() in :doc:`Active - Record <./database/active_record>`. + Record <./database/query_builder>`. - 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 :doc:`Active - Record <./database/active_record>`. + Record <./database/query_builder>`. - Added support for limit() into update() and delete() statements in - :doc:`Active Record <./database/active_record>`. + :doc:`Active Record <./database/query_builder>`. - Added empty_table() and truncate_table() to :doc:`Active - Record <./database/active_record>`. + Record <./database/query_builder>`. - Added the ability to pass an array of tables to the delete() - statement in :doc:`Active Record <./database/active_record>`. + statement in :doc:`Active Record <./database/query_builder>`. - Added count_all_results() function to :doc:`Active - Record <./database/active_record>`. + Record <./database/query_builder>`. - Added select_max(), select_min(), select_avg() and - select_sum() to :doc:`Active Record <./database/active_record>`. + select_sum() to :doc:`Active Record <./database/query_builder>`. - Added the ability to use aliases with joins in :doc:`Active - Record <./database/active_record>`. + Record <./database/query_builder>`. - Added a third parameter to Active Record's like() clause to control where the wildcard goes. - Added a third parameter to set() in :doc:`Active - Record <./database/active_record>` that withholds escaping + Record <./database/query_builder>` that withholds escaping data. - Changed the behaviour of variables submitted to the where() clause with no values to auto set "IS NULL" @@ -1760,7 +1760,7 @@ Release Date: January 30, 2008 the table of contents of the userguide. - Moved part of the userguide menu javascript to an external file. - Documented distinct() in :doc:`Active - Record <./database/active_record>`. + Record <./database/query_builder>`. - Documented the timezones() function in the :doc:`Date Helper <./helpers/date_helper>`. - Documented unset_userdata in the :doc:`Session @@ -2336,9 +2336,9 @@ Release Date: April 11, 2006 function <./general/views>`: $this->load->view('my_view', $object); - Added getwhere function to :doc:`Active Record - class <./database/active_record>`. + class <./database/query_builder>`. - Added count_all function to :doc:`Active Record - class <./database/active_record>`. + class <./database/query_builder>`. - Added language file for scaffolding and fixed a scaffolding bug that occurs when there are no rows in the specified table. - Added :doc:`$this->db->last_query() <./database/queries>`, which @@ -2363,7 +2363,7 @@ Release Date: April 3, 2006 - Added support for :doc:`Models `. - Redesigned the database libraries to support additional RDBMs (Postgres, MySQLi, etc.). -- Redesigned the :doc:`Active Record class <./database/active_record>` +- Redesigned the :doc:`Active Record class <./database/query_builder>` 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 :doc:`custom @@ -2396,7 +2396,7 @@ Release Date: April 3, 2006 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 :doc:`Active Record <./database/active_record>` page for + the :doc:`Active Record <./database/query_builder>` page for information. - Deprecated: $this->db->smart_escape_str() has been deprecated. Please use this instead: $this->db->escape() diff --git a/user_guide_src/source/database/results.rst b/user_guide_src/source/database/results.rst index ac4fc3733..d032f734e 100644 --- a/user_guide_src/source/database/results.rst +++ b/user_guide_src/source/database/results.rst @@ -139,13 +139,13 @@ parameter: .. note:: all the functions above will load the whole result into memory (prefetching) use unbuffered_row() for processing large result sets. unbuffered_row($type) -===== +===================== This function returns a single result row without prefetching the whole result in memory as row() does. If your query has more than one row, it returns the current row and moves the internal data pointer ahead. The result is returned as $type could be 'object' (default) or 'array' that will return an associative array. - +:: $query = $this->db->query("YOUR QUERY"); diff --git a/user_guide_src/source/helpers/date_helper.rst b/user_guide_src/source/helpers/date_helper.rst index ba079394d..5adfb18d2 100644 --- a/user_guide_src/source/helpers/date_helper.rst +++ b/user_guide_src/source/helpers/date_helper.rst @@ -87,30 +87,20 @@ contain the date as a Unix timestamp. Supported formats: -+----------------+------------------------+-----------------------------------+ -| Constant | Description | Example | -+================+========================+===================================+ -| DATE_ATOM | Atom | 2005-08-15T16:13:03+0000 | -+----------------+------------------------+-----------------------------------+ -| DATE_COOKIE | HTTP Cookies | Sun, 14 Aug 2005 16:13:03 UTC | -+----------------+------------------------+-----------------------------------+ -| DATE_ISO8601 | ISO-8601 | 2005-08-14T16:13:03+00:00 | -+----------------+------------------------+-----------------------------------+ -| DATE_RFC822 | RFC 822 | Sun, 14 Aug 05 16:13:03 UTC | -+----------------+------------------------+-----------------------------------+ -| DATE_RFC850 | RFC 850 | Sunday, 14-Aug-05 16:13:03 UTC | -+----------------+------------------------+-----------------------------------+ -| DATE_RFC1036 | RFC 1036 | Sunday, 14-Aug-05 16:13:03 UTC | -+----------------+------------------------+-----------------------------------+ -| DATE_RFC1123 | RFC 1123 | Sun, 14 Aug 2005 16:13:03 UTC | -+----------------+------------------------+-----------------------------------+ -| DATE_RFC2822 | RFC 2822 | Sun, 14 Aug 2005 16:13:03 +0000 | -+----------------+------------------------+-----------------------------------+ -| DATE_RSS | RSS | Sun, 14 Aug 2005 16:13:03 UTC | -+----------------+------------------------+-----------------------------------+ -| DATE_W3C | W3C | 2005-08-14T16:13:03+0000 | -+----------------+------------------------+-----------------------------------+ - +=============== ======================= ====================================== +Constant Description Example +=============== ======================= ====================================== +DATE_ATOM Atom 2005-08-15T16:13:03+0000 +DATE_COOKIE HTTP Cookies Sun, 14 Aug 2005 16:13:03 UTC +DATE_ISO8601 ISO-8601 2005-08-14T16:13:03+00:00 +DATE_RFC822 RFC 822 Sun, 14 Aug 05 16:13:03 UTC +DATE_RFC850 RFC 850 Sunday, 14-Aug-05 16:13:03 UTC +DATE_RFC1036 RFC 1036 Sunday, 14-Aug-05 16:13:03 UTC +DATE_RFC1123 RFC 1123 Sun, 14 Aug 2005 16:13:03 UTC +DATE_RFC2822 RFC 2822 Sun, 14 Aug 2005 16:13:03 +0000 +DATE_RSS RSS Sun, 14 Aug 2005 16:13:03 UTC +DATE_W3C W3C 2005-08-14T16:13:03+0000 +=============== ======================= ====================================== local_to_gmt() ============== @@ -421,86 +411,47 @@ The following table indicates each timezone and its location. Note some of the location lists have been abridged for clarity and formatting. -+------------+----------------------------------------------------------------+ -| Time Zone | Location | -+============+================================================================+ -| UM12 | (UTC - 12:00) Baker/Howland Island | -+------------+----------------------------------------------------------------+ -| UM11 | (UTC - 11:00) Samoa Time Zone, Niue | -+------------+----------------------------------------------------------------+ -| UM10 | (UTC - 10:00) Hawaii-Aleutian Standard Time, Cook Islands | -+------------+----------------------------------------------------------------+ -| UM95 | (UTC - 09:30) Marquesas Islands | -+------------+----------------------------------------------------------------+ -| UM9 | (UTC - 09:00) Alaska Standard Time, Gambier Islands | -+------------+----------------------------------------------------------------+ -| UM8 | (UTC - 08:00) Pacific Standard Time, Clipperton Island | -+------------+----------------------------------------------------------------+ -| UM7 | (UTC - 11:00) Mountain Standard Time | -+------------+----------------------------------------------------------------+ -| UM6 | (UTC - 06:00) Central Standard Time | -+------------+----------------------------------------------------------------+ -| UM5 | (UTC - 05:00) Eastern Standard Time, Western Caribbean | -+------------+----------------------------------------------------------------+ -| UM45 | (UTC - 04:30) Venezuelan Standard Time | -+------------+----------------------------------------------------------------+ -| UM4 | (UTC - 04:00) Atlantic Standard Time, Eastern Caribbean | -+------------+----------------------------------------------------------------+ -| UM35 | (UTC - 03:30) Newfoundland Standard Time | -+------------+----------------------------------------------------------------+ -| UM3 | (UTC - 03:00) Argentina, Brazil, French Guiana, Uruguay | -+------------+----------------------------------------------------------------+ -| UM2 | (UTC - 02:00) South Georgia/South Sandwich Islands | -+------------+----------------------------------------------------------------+ -| UM1 | (UTC -1:00) Azores, Cape Verde Islands | -+------------+----------------------------------------------------------------+ -| UTC | (UTC) Greenwich Mean Time, Western European Time | -+------------+----------------------------------------------------------------+ -| UP1 | (UTC +1:00) Central European Time, West Africa Time | -+------------+----------------------------------------------------------------+ -| UP2 | (UTC +2:00) Central Africa Time, Eastern European Time | -+------------+----------------------------------------------------------------+ -| UP3 | (UTC +3:00) Moscow Time, East Africa Time | -+------------+----------------------------------------------------------------+ -| UP35 | (UTC +3:30) Iran Standard Time | -+------------+----------------------------------------------------------------+ -| UP4 | (UTC +4:00) Azerbaijan Standard Time, Samara Time | -+------------+----------------------------------------------------------------+ -| UP45 | (UTC +4:30) Afghanistan | -+------------+----------------------------------------------------------------+ -| UP5 | (UTC +5:00) Pakistan Standard Time, Yekaterinburg Time | -+------------+----------------------------------------------------------------+ -| UP55 | (UTC +5:30) Indian Standard Time, Sri Lanka Time | -+------------+----------------------------------------------------------------+ -| UP575 | (UTC +5:45) Nepal Time | -+------------+----------------------------------------------------------------+ -| UP6 | (UTC +6:00) Bangladesh Standard Time, Bhutan Time, Omsk Time | -+------------+----------------------------------------------------------------+ -| UP65 | (UTC +6:30) Cocos Islands, Myanmar | -+------------+----------------------------------------------------------------+ -| UP7 | (UTC +7:00) Krasnoyarsk Time, Cambodia, Laos, Thailand, Vietnam| -+------------+----------------------------------------------------------------+ -| UP8 | (UTC +8:00) Australian Western Standard Time, Beijing Time | -+------------+----------------------------------------------------------------+ -| UP875 | (UTC +8:45) Australian Central Western Standard Time | -+------------+----------------------------------------------------------------+ -| UP9 | (UTC +9:00) Japan Standard Time, Korea Standard Time, Yakutsk | -+------------+----------------------------------------------------------------+ -| UP95 | (UTC +9:30) Australian Central Standard Time | -+------------+----------------------------------------------------------------+ -| UP10 | (UTC +10:00) Australian Eastern Standard Time, Vladivostok Time| -+------------+----------------------------------------------------------------+ -| UP105 | (UTC +10:30) Lord Howe Island | -+------------+----------------------------------------------------------------+ -| UP11 | (UTC +11:00) Magadan Time, Solomon Islands, Vanuatu | -+------------+----------------------------------------------------------------+ -| UP115 | (UTC +11:30) Norfolk Island | -+------------+----------------------------------------------------------------+ -| UP12 | (UTC +12:00) Fiji, Gilbert Islands, Kamchatka, New Zealand | -+------------+----------------------------------------------------------------+ -| UP1275 | (UTC +12:45) Chatham Islands Standard Time | -+------------+----------------------------------------------------------------+ -| UP13 | (UTC +13:00) Phoenix Islands Time, Tonga | -+------------+----------------------------------------------------------------+ -| UP14 | (UTC +14:00) Line Islands | -+------------+----------------------------------------------------------------+ +=========== ===================================================================== +Time Zone Location +=========== ===================================================================== +UM2 (UTC - 12:00) Baker/Howland Island +UM1 (UTC - 11:00) Samoa Time Zone, Niue +UM0 (UTC - 10:00) Hawaii-Aleutian Standard Time, Cook Islands +UM95 (UTC - 09:30) Marquesas Islands +UM9 (UTC - 09:00) Alaska Standard Time, Gambier Islands +UM8 (UTC - 08:00) Pacific Standard Time, Clipperton Island +UM7 (UTC - 11:00) Mountain Standard Time +UM6 (UTC - 06:00) Central Standard Time +UM5 (UTC - 05:00) Eastern Standard Time, Western Caribbean +UM45 (UTC - 04:30) Venezuelan Standard Time +UM4 (UTC - 04:00) Atlantic Standard Time, Eastern Caribbean +UM35 (UTC - 03:30) Newfoundland Standard Time +UM3 (UTC - 03:00) Argentina, Brazil, French Guiana, Uruguay +UM2 (UTC - 02:00) South Georgia/South Sandwich Islands +UM (UTC -1:00) Azores, Cape Verde Islands +UTC (UTC) Greenwich Mean Time, Western European Time +UP1 (UTC +1:00) Central European Time, West Africa Time +UP2 (UTC +2:00) Central Africa Time, Eastern European Time +UP3 (UTC +3:00) Moscow Time, East Africa Time +UP35 (UTC +3:30) Iran Standard Time +UP4 (UTC +4:00) Azerbaijan Standard Time, Samara Time +UP45 (UTC +4:30) Afghanistan +UP5 (UTC +5:00) Pakistan Standard Time, Yekaterinburg Time +UP55 (UTC +5:30) Indian Standard Time, Sri Lanka Time +UP575 (UTC +5:45) Nepal Time +UP6 (UTC +6:00) Bangladesh Standard Time, Bhutan Time, Omsk Time +UP65 (UTC +6:30) Cocos Islands, Myanmar +UP7 (UTC +7:00) Krasnoyarsk Time, Cambodia, Laos, Thailand, Vietnam +UP8 (UTC +8:00) Australian Western Standard Time, Beijing Time +UP875 (UTC +8:45) Australian Central Western Standard Time +UP9 (UTC +9:00) Japan Standard Time, Korea Standard Time, Yakutsk +UP95 (UTC +9:30) Australian Central Standard Time +UP10 (UTC +10:00) Australian Eastern Standard Time, Vladivostok Time +UP105 (UTC +10:30) Lord Howe Island +UP11 (UTC +11:00) Magadan Time, Solomon Islands, Vanuatu +UP115 (UTC +11:30) Norfolk Island +UP12 (UTC +12:00) Fiji, Gilbert Islands, Kamchatka, New Zealand +UP1275 (UTC +12:45) Chatham Islands Standard Time +UP1 (UTC +13:00) Phoenix Islands Time, Tonga +UP14 (UTC +14:00) Line Islands +=========== ===================================================================== \ No newline at end of file diff --git a/user_guide_src/source/helpers/url_helper.rst b/user_guide_src/source/helpers/url_helper.rst index 3c91fd5dd..82db6a5b3 100644 --- a/user_guide_src/source/helpers/url_helper.rst +++ b/user_guide_src/source/helpers/url_helper.rst @@ -182,9 +182,9 @@ browser settings. Here is an example with attributes echo anchor_popup('news/local/123', 'Click Me!', $atts); .. note:: The above attributes are the function defaults so you only need to -set the ones that are different from what you need. If you want the -function to use all of its defaults simply pass an empty array in the -third parameter + set the ones that are different from what you need. If you want the + function to use all of its defaults simply pass an empty array in the + third parameter :: diff --git a/user_guide_src/source/installation/upgrade_300.rst b/user_guide_src/source/installation/upgrade_300.rst index c70737cff..14199092f 100644 --- a/user_guide_src/source/installation/upgrade_300.rst +++ b/user_guide_src/source/installation/upgrade_300.rst @@ -35,7 +35,7 @@ Move any entries that you might have listed there to `$autoload['libraries']` in Step 4: Update your config/database.php ======================================= -Due to 3.0.0's renaming of Active Record to Query Builder, inside your _config/database.php_, you will +Due to 3.0.0's renaming of Active Record to Query Builder, inside your `config/database.php`, you will need to rename the `$active_record` variable to `$query_builder`. $active_group = 'default'; @@ -45,4 +45,4 @@ need to rename the `$active_record` variable to `$query_builder`. Step 5: Move your errors folder =============================== -In version 3.0.0, the errors folder has been moved from _application/errors_ to _application/views/errors_. \ No newline at end of file +In version 3.0.0, the errors folder has been moved from _application/errors* to _application/views/errors*. \ No newline at end of file diff --git a/user_guide_src/source/libraries/email.rst b/user_guide_src/source/libraries/email.rst index f99eb91df..c5fa68004 100644 --- a/user_guide_src/source/libraries/email.rst +++ b/user_guide_src/source/libraries/email.rst @@ -183,7 +183,7 @@ accept HTML email. If you do not set your own message CodeIgniter will extract the message from your HTML email and strip the tags. $this->email->set_header() ------------------------ +-------------------------- Appends additional headers to the e-mail:: diff --git a/user_guide_src/source/libraries/pagination.rst b/user_guide_src/source/libraries/pagination.rst index 15b3675df..a7e4c84c9 100644 --- a/user_guide_src/source/libraries/pagination.rst +++ b/user_guide_src/source/libraries/pagination.rst @@ -113,7 +113,7 @@ Note that "per_page" is the default query string passed, however can be configured using $config['query_string_segment'] = 'your_string' $config['reuse_query_string'] = FALSE; -==================================== +====================================== By default your Query String arguments (nothing to do with other query string options) will be ignored. Setting this config to -- cgit v1.2.3-24-g4f1b From d13803813b355fccb17dd4f148f43b7a20977781 Mon Sep 17 00:00:00 2001 From: Derek Jones Date: Mon, 25 Jun 2012 23:54:18 -0700 Subject: First pass at ToC remediation --- user_guide_src/source/_themes/eldocs/layout.html | 58 ++-------- .../_themes/eldocs/static/asset/css/common.css | 83 ++++++++++---- user_guide_src/source/general/welcome.rst | 32 ++++++ user_guide_src/source/index.rst | 121 ++++++++++++++++----- 4 files changed, 191 insertions(+), 103 deletions(-) create mode 100644 user_guide_src/source/general/welcome.rst diff --git a/user_guide_src/source/_themes/eldocs/layout.html b/user_guide_src/source/_themes/eldocs/layout.html index 4b1a0221c..01db07cac 100644 --- a/user_guide_src/source/_themes/eldocs/layout.html +++ b/user_guide_src/source/_themes/eldocs/layout.html @@ -9,6 +9,9 @@ {%- if project == 'ExpressionEngine' %}{% set project_abbreviation = 'ee' %}{% set project_domain = 'expressionengine.com' %}{% endif -%} {%- if project == 'CodeIgniter' %}{% set project_abbreviation = 'ci' %}{% set project_domain = 'codeigniter.com' %}{% endif -%} {%- if project == 'MojoMotor' %}{% set project_abbreviation = 'mm' %}{% set project_domain = 'mojomotor.com' %}{% endif -%} +{%- set exclude_comments = ['index', 'license', 'changelog', + 'development/index', 'development/extension_hooks/index', + 'development/guidelines/template'] %} @@ -85,10 +88,6 @@
{{ project }}

{{ release }} User Guide

- {%- if show_source and has_source and sourcename %} -

{{ _('Show Source') }}

- {%- endif %}
@@ -124,49 +124,9 @@ {%- block footer %} {%- endblock %} - - - - \ No newline at end of file + diff --git a/user_guide_src/source/_themes/eldocs/static/asset/css/common.css b/user_guide_src/source/_themes/eldocs/static/asset/css/common.css index 66768bac6..6cabda037 100644 --- a/user_guide_src/source/_themes/eldocs/static/asset/css/common.css +++ b/user_guide_src/source/_themes/eldocs/static/asset/css/common.css @@ -49,7 +49,9 @@ h1, h2, h3, h4, h5, h6, pre{ color: #094776; } h1{ font-size: 28px; } -h2{ font-size: 24px; } +h2{ font-size: 24px; font-weight: normal; } + +h1, h2, h3, h4, h5, h6{ margin-bottom: 20px; } h2, h3{ border-bottom: 2px solid #EEEEEE; padding: 0 0 3px; } @@ -73,6 +75,10 @@ p, dl, ul, ol{ margin: 20px 0; } li > ol{ margin: 0; margin-left: 40px; } dl > dd{ margin-left: 20px; } + + li > p { margin: 0; } + +#expressionengine-user-guide li em { font-style: normal; } p, li, dd, dt, pre{ line-height: 1.5; } @@ -141,39 +147,31 @@ img{ display: block; max-width: 100%; } fieldset{ border: 0; } .top{ float: right; } -.next{ padding: 0 20px 0 10px; } -.prev{ padding-right: 10px; } -.highlight-ci, +.admonition, .highlight-ee, +.highlight-ci, .highlight-rst, .highlight-bash, .highlight-perl, +.highlight-php, .cp-path, -.important, -.note{ - background-color: #F5FBFF; +.codeblock{ + background-color: #F9FEFF; border: 1px solid #C8DEF0; - margin: 20px 0 20px 20px; + -moz-box-shadow: 4px 4px 0 rgba(0,0,0,0.03); + -webkit-box-shadow: 4px 4px 0 rgba(0,0,0,0.03); + box-shadow: 4px 4px 0 rgba(0,0,0,0.03); + margin: 20px 0; padding: 10px 10px 8px; } - .highlight-ci, - .highlight-ee, - .highlight-rst, - .highlight-bash, - .highlight-perl{ - -moz-box-shadow: 4px 4px 0 rgba(0,0,0,0.03); - -webkit-box-shadow: 4px 4px 0 rgba(0,0,0,0.03); - box-shadow: 4px 4px 0 rgba(0,0,0,0.03); - } - - .cp-path{ background-color: #FFFDED; border-color: #D1CDB0; } - .important, .note{ background-color: #F2FFE8; border-color: #B9D3A6; } - .highlight-rst{ background-color: #F9FEFE; border-color: #AACFCF; } + .admonition p{ margin: 0; } + + .codeblock{ margin: 10px 0; } - .important p, - .note p{ margin: 0; } + .cp-path{ background-color: #FAFFF6; border-color: #D1CDB0; } + .important, .note{ background-color: #FFFFF2; border-color: #C8C8A5; } .admonition-title{ float: left; @@ -295,6 +293,43 @@ fieldset{ border: 0; } #footer p{ margin: 0; } +#comments, +#feedLink{ background: #FCFCFC; padding: 1px 40px 20px; } + + #comments{ border-top: 1px solid #CCCCCC; } + #comments h3{ margin: 20px 0; } + +.comments td.avatar{ min-width: 100px; } + +.comments td.column1, +.comments td.post{ background-color: #FFFFFF; padding: 10px; } + +.comments td.staffeven{ border-left: 10px solid #C8DEF0; } + +#comment_form p, +.comments p{ margin: 0; } + + .comments p{ margin-bottom: 10px; } + +#comment_form textarea{ + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; + margin-bottom: 10px; + resize: none; + width: 100%; +} + +#comment_form input[type="submit"]{ margin-top: 10px; } + + #comment_form textarea:focus{ background-color: #FFFFF2; border: 1px solid #666666; outline: 0; } + + #commentFormInstructions{ font-size: 12px; margin: 20px 0; } + + #feedLink a{ font-size: 16px; } + + #feedLink a img{ float: left; margin-right: 5px; } + @media (max-width:800px){ #footer .top, #header form{ float: none; margin-bottom: 10px; } @@ -310,4 +345,4 @@ fieldset{ border: 0; } @media screen and (-webkit-min-device-pixel-ratio:0){ #header input[type="submit"]{ padding-bottom: 7px; } -} \ No newline at end of file +} diff --git a/user_guide_src/source/general/welcome.rst b/user_guide_src/source/general/welcome.rst new file mode 100644 index 000000000..b28c3bcc2 --- /dev/null +++ b/user_guide_src/source/general/welcome.rst @@ -0,0 +1,32 @@ +###################### +Welcome to CodeIgniter +###################### + +CodeIgniter is an Application Development Framework - a toolkit - for +people who build web sites using PHP. Its goal is to enable you to +develop projects much faster than you could if you were writing code +from scratch, by providing a rich set of libraries for commonly needed +tasks, as well as a simple interface and logical structure to access +these libraries. CodeIgniter lets you creatively focus on your project +by minimizing the amount of code needed for a given task. + +*********************** +Who is CodeIgniter For? +*********************** + +CodeIgniter is right for you if: + +- You want a framework with a small footprint. +- You need exceptional performance. +- You need broad compatibility with standard hosting accounts that run + a variety of PHP versions and configurations. +- You want a framework that requires nearly zero configuration. +- You want a framework that does not require you to use the command + line. +- You want a framework that does not require you to adhere to + restrictive coding rules. +- You are not interested in large-scale monolithic libraries like PEAR. +- You do not want to be forced to learn a templating language (although + a template parser is optionally available if you desire one). +- You eschew complexity, favoring simple solutions. +- You need clear, thorough documentation. diff --git a/user_guide_src/source/index.rst b/user_guide_src/source/index.rst index 6cdeb2442..c89b41c74 100644 --- a/user_guide_src/source/index.rst +++ b/user_guide_src/source/index.rst @@ -1,34 +1,95 @@ -Welcome to CodeIgniter -====================== - -CodeIgniter is an Application Development Framework - a toolkit - for -people who build web sites using PHP. Its goal is to enable you to -develop projects much faster than you could if you were writing code -from scratch, by providing a rich set of libraries for commonly needed -tasks, as well as a simple interface and logical structure to access -these libraries. CodeIgniter lets you creatively focus on your project -by minimizing the amount of code needed for a given task. - -Who is CodeIgniter For? -======================= - -CodeIgniter is right for you if: - -- You want a framework with a small footprint. -- You need exceptional performance. -- You need broad compatibility with standard hosting accounts that run - a variety of PHP versions and configurations. -- You want a framework that requires nearly zero configuration. -- You want a framework that does not require you to use the command - line. -- You want a framework that does not require you to adhere to - restrictive coding rules. -- You are not interested in large-scale monolithic libraries like PEAR. -- You do not want to be forced to learn a templating language (although - a template parser is optionally available if you desire one). -- You eschew complexity, favoring simple solutions. -- You need clear, thorough documentation. +###################### +CodeIgniter User Guide +###################### +- :doc:`License Agreement ` +- :doc:`Change Log ` + +.. contents:: + :local: + :depth: 2 + +******* +Welcome +******* + +- :doc:`general/welcome` + +********** +Basic Info +********** + +- :doc:`general/requirements` +- :doc:`general/credits` + +************ +Installation +************ + +- :doc:`installation/downloads` +- :doc:`installation/index` +- :doc:`installation/upgrading` +- :doc:`installation/troubleshooting` + +************ +Introduction +************ + +- :doc:`overview/getting_started` +- :doc:`overview/at_a_glance` +- :doc:`overview/cheatsheets` +- :doc:`overview/features` +- :doc:`overview/appflow` +- :doc:`overview/mvc` +- :doc:`overview/goals` + +******** +Tutorial +******** + +- :doc:`tutorial/index` +- :doc:`tutorial/static_pages` +- :doc:`tutorial/news_section` +- :doc:`tutorial/create_news_items` +- :doc:`tutorial/conclusion` + +************** +General Topics +************** + +.. toctree:: + :glob: + :titlesonly: + + general/index + +***************** +Library Reference +***************** + +.. toctree:: + :glob: + :titlesonly: + + libraries/index + +**************** +Driver Reference +**************** + +- :doc:`libraries/caching` +- :doc:`database/index` +- :doc:`libraries/javascript` + +**************** +Helper Reference +**************** + +.. toctree:: + :glob: + :titlesonly: + + helpers/index .. toctree:: :glob: -- cgit v1.2.3-24-g4f1b From 290f0046df6a1cf0e6f48f5b7f0043278475bea8 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 26 Jun 2012 11:13:53 +0300 Subject: Fix issue #1533 --- system/libraries/Form_validation.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index 4bb29e41b..484e306b9 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -1277,7 +1277,7 @@ class CI_Form_validation { */ public function is_natural_no_zero($str) { - return ($str !== 0 && preg_match('/^[0-9]+$/', $str)); + return ($str && preg_match('/^[0-9]+$/', $str)); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 4b84d62490e3c17c18f0d1681d713da57a2c82ba Mon Sep 17 00:00:00 2001 From: Marco Monteiro Date: Tue, 26 Jun 2012 11:53:20 +0100 Subject: Updated pagination library documentation with prefix and suffix --- user_guide_src/source/libraries/pagination.rst | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/user_guide_src/source/libraries/pagination.rst b/user_guide_src/source/libraries/pagination.rst index 15b3675df..6e1020be3 100644 --- a/user_guide_src/source/libraries/pagination.rst +++ b/user_guide_src/source/libraries/pagination.rst @@ -21,9 +21,9 @@ Here is a simple example showing how to create pagination in one of your $config['base_url'] = 'http://example.com/index.php/test/page/'; $config['total_rows'] = 200; - $config['per_page'] = 20; + $config['per_page'] = 20; - $this->pagination->initialize($config); + $this->pagination->initialize($config); echo $this->pagination->create_links(); @@ -115,9 +115,9 @@ configured using $config['query_string_segment'] = 'your_string' $config['reuse_query_string'] = FALSE; ==================================== -By default your Query String arguments (nothing to do with other -query string options) will be ignored. Setting this config to -TRUE will add existing query string arguments back into the +By default your Query String arguments (nothing to do with other +query string options) will be ignored. Setting this config to +TRUE will add existing query string arguments back into the URL after the URI segment and before the suffix :: @@ -127,6 +127,18 @@ URL after the URI segment and before the suffix This helps you mix together normal :doc:`URI Segments <../general/urls>` as well as query string arguments, which until 3.0 was not possible. +$config['prefix'] = ''; +================================== + +A custom prefix added to the path. The prefix value will be right before +the offset segment. + +$config['suffix'] = ''; +================================== + +A custom suffix added to the path. The sufix value will be right after +the offset segment. + *********************** Adding Enclosing Markup *********************** -- cgit v1.2.3-24-g4f1b From de6eff04445aeff78ad2e1bbdf7f6f1687653e3e Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 26 Jun 2012 18:13:13 +0300 Subject: Revert default config value of db pconnect to TRUE (issue #793) --- application/config/database.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/config/database.php b/application/config/database.php index 19498735c..cb6ebad10 100644 --- a/application/config/database.php +++ b/application/config/database.php @@ -43,7 +43,7 @@ | ['password'] The password used to connect to the database | ['database'] The name of the database you want to connect to | ['dbdriver'] The database type. e.g.: mysql. Currently supported: -| cubrid, interbase, mssql, mysql, mysqli, oci8, +| cubrid, interbase, mssql, mysql, mysqli, oci8, | odbc, pdo, postgre, sqlite, sqlite3, sqlsrv | ['dbprefix'] You can add an optional prefix, which will be added | to the table name when using the Query Builder class @@ -84,7 +84,7 @@ $db['default'] = array( 'database' => '', 'dbdriver' => 'mysqli', 'dbprefix' => '', - 'pconnect' => FALSE, + 'pconnect' => TRUE, 'db_debug' => TRUE, 'cache_on' => FALSE, 'cachedir' => '', -- cgit v1.2.3-24-g4f1b From b8b7dbe7a459c3fe705ca0da8600c1a8544b27cc Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Wed, 27 Jun 2012 03:05:35 +0700 Subject: Allow extra SPL autoloader --- tests/mocks/autoloader.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/mocks/autoloader.php b/tests/mocks/autoloader.php index e3ff7a8bd..1fcba788f 100644 --- a/tests/mocks/autoloader.php +++ b/tests/mocks/autoloader.php @@ -69,20 +69,25 @@ function autoload($class) } } - $file = isset($file) ? $file : $dir.$class.'.php'; + $file = (isset($file)) ? $file : $dir.$class.'.php'; if ( ! file_exists($file)) { $trace = debug_backtrace(); - // If the autoload call came from `class_exists` or `file_exists`, - // we skipped and return FALSE if ($trace[2]['function'] === 'class_exists' OR $trace[2]['function'] === 'file_exists') { + // If the autoload call came from `class_exists` or `file_exists`, + // we skipped and return FALSE + return FALSE; + } + elseif (($autoloader = spl_autoload_functions()) && end($autoloader) !== __FUNCTION__) + { + // If there was other custom autoloader, passed away return FALSE; } - throw new InvalidArgumentException("Unable to load {$class}."); + throw new InvalidArgumentException("Unable to load $class."); } include_once($file); -- cgit v1.2.3-24-g4f1b From eb22d544c4ea1993fcbdad0404ce9ec65d0410be Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 26 Jun 2012 23:16:35 +0300 Subject: Fix get_where() test --- system/database/DB_query_builder.php | 2 +- tests/codeigniter/database/query_builder/get_test.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php index 4c43fe3c3..3982885e8 100644 --- a/system/database/DB_query_builder.php +++ b/system/database/DB_query_builder.php @@ -1218,7 +1218,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { * @param string the offset clause * @return object */ - public function get_where($table = '', $where = null, $limit = null, $offset = null) + public function get_where($table = '', $where = NULL, $limit = NULL, $offset = NULL) { if ($table !== '') { diff --git a/tests/codeigniter/database/query_builder/get_test.php b/tests/codeigniter/database/query_builder/get_test.php index 699d2906a..156027537 100644 --- a/tests/codeigniter/database/query_builder/get_test.php +++ b/tests/codeigniter/database/query_builder/get_test.php @@ -41,7 +41,7 @@ class Get_test extends CI_TestCase { */ public function test_get_where() { - $job1 = $this->db->get('job', array('id' => 1))->result_array(); + $job1 = $this->db->get_where('job', array('id' => 1))->result_array(); // Dummy jobs contain 1 rows $this->assertCount(1, $job1); -- cgit v1.2.3-24-g4f1b From 8f490da4cb6ad4ffa2c75cfcbd0e7896cdb4cd8c Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Wed, 27 Jun 2012 03:31:22 +0700 Subject: Comply styleguide --- tests/mocks/autoloader.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/mocks/autoloader.php b/tests/mocks/autoloader.php index 1fcba788f..be1c2220c 100644 --- a/tests/mocks/autoloader.php +++ b/tests/mocks/autoloader.php @@ -87,7 +87,7 @@ function autoload($class) return FALSE; } - throw new InvalidArgumentException("Unable to load $class."); + throw new InvalidArgumentException("Unable to load {$class}."); } include_once($file); -- cgit v1.2.3-24-g4f1b From 1a24a9da3cfbacf8802ffd0b79f5494d30278007 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 27 Jun 2012 00:52:47 +0300 Subject: Fix issue #427 --- system/core/Security.php | 13 +++++++++++++ system/helpers/security_helper.php | 3 ++- system/libraries/Form_validation.php | 2 +- user_guide_src/source/changelog.rst | 5 ++++- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/system/core/Security.php b/system/core/Security.php index 4593a1090..227217e75 100644 --- a/system/core/Security.php +++ b/system/core/Security.php @@ -560,6 +560,19 @@ class CI_Security { // ---------------------------------------------------------------- + /** + * Strip Image Tags + * + * @param string + * @return string + */ + public function strip_image_tags($str) + { + return preg_replace(array('##', '##'), '\\1', $str); + } + + // ---------------------------------------------------------------- + /** * Compact Exploded Words * diff --git a/system/helpers/security_helper.php b/system/helpers/security_helper.php index 7968f9e9f..0e8e9f93d 100644 --- a/system/helpers/security_helper.php +++ b/system/helpers/security_helper.php @@ -108,7 +108,8 @@ if ( ! function_exists('strip_image_tags')) */ function strip_image_tags($str) { - return preg_replace(array('##', '##'), '\\1', $str); + $CI =& get_instance(); + return $CI->security->strip_image_tags($str); } } diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index 484e306b9..0d9c65f6f 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -1360,7 +1360,7 @@ class CI_Form_validation { */ public function strip_image_tags($str) { - return $this->CI->input->strip_image_tags($str); + return $this->CI->security->strip_image_tags($str); } // -------------------------------------------------------------------- diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 28e2f94bb..27381b49a 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -70,7 +70,8 @@ Release Date: Not Released - ``set_realpath()`` can now also handle file paths as opposed to just directories. - Added an optional paramater to ``delete_files()`` to enable it to skip deleting files such as .htaccess and index.html. - ``read_file()`` is now a deprecated alias of ``file_get_contents()``. - - :doc:`Date Helper ` Added optional fourth parameter to ``timezone_menu()`` that allows more attributes to be added to the generated select tag + - Added an optional parameter to :doc:`Date Helper ` function ``timezone_menu()`` that allows more attributes to be added to the generated select tag. + - :doc:`Security Helper ` function ``strip_image_tags()`` is now an alias for the same method in the :doc:`Security Library `. - Database @@ -190,6 +191,7 @@ Release Date: Not Released - $config['time_reference'] now supports all timezone strings supported by PHP. - Added support for HTTP code 303 ("See Other") in set_status_header(). - Changed :doc:`Config Library ` method site_url() to accept an array as well. + - Added method ``strip_image_tags()`` to the :doc:`Security Library `. Bug fixes for 3.0 ------------------ @@ -294,6 +296,7 @@ Bug fixes for 3.0 - Fixed a bug where :doc:`URL Helper ` function anchor_popup() ignored the attributes argument if it is not an array. - Fixed a bug (#1328) - :doc:`Form Validation Library ` didn't properly check the type of the form fields before processing them. - Fixed a bug (#79) - :doc:`Form Validation Library ` didn't properly validate array fields that use associative keys or have custom indexes. +- Fixed a bug (#427) - :doc:`Form Validation Library ` method ``strip_image_tags()`` was an alias to a non-existent method. Version 2.1.1 ============= -- cgit v1.2.3-24-g4f1b From e01db4bfe805f9c9293609089381aaa0cb7afab4 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 27 Jun 2012 00:55:59 +0300 Subject: Correct solution to #1533 --- system/libraries/Form_validation.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index 0d9c65f6f..e7b89d0c4 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -1277,7 +1277,7 @@ class CI_Form_validation { */ public function is_natural_no_zero($str) { - return ($str && preg_match('/^[0-9]+$/', $str)); + return ($str != 0 && preg_match('/^[0-9]+$/', $str)); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 2fce2a95e99c91c57f7d15b5e441b2cf89193da3 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 27 Jun 2012 01:07:56 +0300 Subject: URL Helper redirect() to utilize HTTP/1.1 response code 303 See Other --- system/helpers/url_helper.php | 14 +++++++++++--- user_guide_src/source/changelog.rst | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 40ce807df..39e6343a6 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -526,7 +526,7 @@ if ( ! function_exists('redirect')) * @param int * @return string */ - function redirect($uri = '', $method = 'auto', $http_response_code = 302) + function redirect($uri = '', $method = 'auto', $code = NULL) { if ( ! preg_match('#^https?://#i', $uri)) { @@ -538,14 +538,22 @@ if ( ! function_exists('redirect')) { $method = 'refresh'; } + elseif ($method !== 'refresh' && (empty($code) OR ! is_numeric($code))) + { + // Reference: http://en.wikipedia.org/wiki/Post/Redirect/Get + $code = (isset($_SERVER['REQUEST_METHOD'], $_SERVER['SERVER_PROTOCOL']) + && $_SERVER['REQUEST_METHOD'] === 'POST' + && $_SERVER['SERVER_PROTOCOL'] === 'HTTP/1.1') + ? 303 : 302; + } - switch($method) + switch ($method) { case 'refresh': header('Refresh:0;url='.$uri); break; default: - header('Location: '.$uri, TRUE, $http_response_code); + header('Location: '.$uri, TRUE, $code); break; } exit; diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 27381b49a..17fb6472a 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -57,6 +57,7 @@ Release Date: Not Released - ``url_title()`` will now trim extra dashes from beginning and end. - ``anchor_popup()`` will now fill the "href" attribute with the URL and its JS code will return false instead. - Added JS window name support to ``anchor_popup()`` function. + - Added support (auto-detection) for HTTP/1.1 response code 303 in ``redirect()``. - Added XHTML Basic 1.1 doctype to :doc:`HTML Helper `. - Changed ``humanize()`` to include a second param for the separator. - Refactored ``plural()`` and ``singular()`` to avoid double pluralization and support more words. -- cgit v1.2.3-24-g4f1b From a36fd63379cba76128ed4a0d88e9466abb4419d8 Mon Sep 17 00:00:00 2001 From: vlakoff Date: Wed, 27 Jun 2012 02:46:19 +0200 Subject: FTP Class documentation cleanup Since PHP 5 is required, setting permissions is always possible. --- user_guide_src/source/libraries/ftp.rst | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/libraries/ftp.rst b/user_guide_src/source/libraries/ftp.rst index 20b11a5c8..05a3fdcc8 100644 --- a/user_guide_src/source/libraries/ftp.rst +++ b/user_guide_src/source/libraries/ftp.rst @@ -26,7 +26,7 @@ Usage Examples In this example a connection is opened to the FTP server, and a local file is read and uploaded in ASCII mode. The file permissions are set to -755. Note: Setting permissions requires PHP 5. +755. :: @@ -136,8 +136,7 @@ Example:: **Mode options are:** ascii, binary, and auto (the default). If auto is used it will base the mode on the file extension of the source file. -Permissions are available if you are running PHP 5 and can be passed as -an octal value in the fourth parameter. +If set, permissions have to be passed as an octal value. $this->ftp->download() ====================== -- cgit v1.2.3-24-g4f1b From 625c43a2f451191d0195f6311dd3a7ea94439988 Mon Sep 17 00:00:00 2001 From: vlakoff Date: Wed, 27 Jun 2012 03:28:55 +0200 Subject: Fix a PHPDoc error in FTP Class The second parameter of the "chmod" method is an octal integer. --- system/libraries/Ftp.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/libraries/Ftp.php b/system/libraries/Ftp.php index 461e884fb..76f5e151a 100644 --- a/system/libraries/Ftp.php +++ b/system/libraries/Ftp.php @@ -445,7 +445,7 @@ class CI_FTP { * Set file permissions * * @param string the file path - * @param string the permissions + * @param int the permissions * @return bool */ public function chmod($path, $perm) -- cgit v1.2.3-24-g4f1b From acb962e5aa6fb607751dc2012ff6df25acbd518b Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 27 Jun 2012 12:04:24 +0300 Subject: Use ctype_* functions in Form_validation instead of PCRE when possible --- system/libraries/Form_validation.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index e7b89d0c4..8e03e91f3 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -1129,7 +1129,7 @@ class CI_Form_validation { */ public function alpha($str) { - return (bool) preg_match('/^[a-z]+$/i', $str); + return ctype_alpha($str); } // -------------------------------------------------------------------- @@ -1142,7 +1142,7 @@ class CI_Form_validation { */ public function alpha_numeric($str) { - return (bool) preg_match('/^[a-z0-9]+$/i', $str); + return ctype_alnum((string) $str); } // -------------------------------------------------------------------- @@ -1264,7 +1264,7 @@ class CI_Form_validation { */ public function is_natural($str) { - return (bool) preg_match('/^[0-9]+$/', $str); + return ctype_digit((string) $str); } // -------------------------------------------------------------------- @@ -1277,7 +1277,7 @@ class CI_Form_validation { */ public function is_natural_no_zero($str) { - return ($str != 0 && preg_match('/^[0-9]+$/', $str)); + return ($str != 0 && ctype_digit((string) $str)); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From b66664b5decd68de50ae6c239c8d995d6c088d94 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 27 Jun 2012 14:22:10 +0300 Subject: Utilize query()'s return_object parameter --- system/database/DB_driver.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index a99444167..739b25187 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -295,7 +295,7 @@ abstract class CI_DB_driver { * @param array An array of binding data * @return mixed */ - public function query($sql, $binds = FALSE, $return_object = TRUE) + public function query($sql, $binds = FALSE, $return_object = NULL) { if ($sql === '') { @@ -303,6 +303,10 @@ abstract class CI_DB_driver { return ($this->db_debug) ? $this->display_error('db_invalid_query') : FALSE; } + elseif ( ! is_bool($return_object)) + { + $return_object = ! $this->is_write_type($sql); + } // Verify table prefix and replace if necessary if ($this->dbprefix !== '' && $this->swap_pre !== '' && $this->dbprefix !== $this->swap_pre) @@ -319,7 +323,7 @@ abstract class CI_DB_driver { // Is query caching enabled? If the query is a "read type" // we will load the caching class and return the previously // cached query if it exists - if ($this->cache_on === TRUE && stripos($sql, 'SELECT') !== FALSE && $this->_cache_init()) + if ($this->cache_on === TRUE && $return_object === TRUE && $this->_cache_init()) { $this->load_rdriver(); if (FALSE !== ($cache = $this->CACHE->read($sql))) @@ -328,7 +332,7 @@ abstract class CI_DB_driver { } } - // Save the query for debugging + // Save the query for debugging if ($this->save_queries === TRUE) { $this->queries[] = $sql; @@ -352,7 +356,7 @@ abstract class CI_DB_driver { $error = $this->error(); // Log errors - log_message('error', 'Query error: '.$error['message'] . ' - Invalid query: ' . $sql); + log_message('error', 'Query error: '.$error['message'].' - Invalid query: '.$sql); if ($this->db_debug) { @@ -381,12 +385,10 @@ abstract class CI_DB_driver { // Increment the query counter $this->query_count++; - // Was the query a "write" type? - // If so we'll simply return true - if ($this->is_write_type($sql) === TRUE) + // Will we have a result object instantiated? If not - we'll simply return TRUE + if ($return_object !== TRUE) { - // If caching is enabled we'll auto-cleanup any - // existing files related to this particular URI + // If caching is enabled we'll auto-cleanup any existing files related to this particular URI if ($this->cache_on === TRUE && $this->cache_autodel === TRUE && $this->_cache_init()) { $this->CACHE->delete(); @@ -396,8 +398,6 @@ abstract class CI_DB_driver { } // Return TRUE if we don't need to create a result object - // Currently only the Oracle driver uses this when stored - // procedures are used if ($return_object !== TRUE) { return TRUE; -- cgit v1.2.3-24-g4f1b From 384b34217b3709d3b3f11dbda3ac5c53274ff117 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Wed, 27 Jun 2012 08:06:06 -0400 Subject: Update other email validation methods --- system/libraries/Email.php | 2 +- system/libraries/Form_validation.php | 2 +- user_guide_src/source/changelog.rst | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/system/libraries/Email.php b/system/libraries/Email.php index dd5477e05..5e6f69842 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -708,7 +708,7 @@ class CI_Email { */ public function valid_email($address) { - return (bool) preg_match('/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix', $address); + return filter_var($email, FILTER_VALIDATE_EMAIL); } // -------------------------------------------------------------------- diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index 8e03e91f3..9ef58724c 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -1076,7 +1076,7 @@ class CI_Form_validation { */ public function valid_email($str) { - return (bool) preg_match('/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix', $str); + return filter_var($email, FILTER_VALIDATE_EMAIL); } // -------------------------------------------------------------------- diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index c0fa9d7f7..cc6220253 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -73,6 +73,7 @@ Release Date: Not Released - ``read_file()`` is now a deprecated alias of ``file_get_contents()``. - Added an optional parameter to :doc:`Date Helper ` function ``timezone_menu()`` that allows more attributes to be added to the generated select tag. - :doc:`Security Helper ` function ``strip_image_tags()`` is now an alias for the same method in the :doc:`Security Library `. + - Updated email validation methods to use filter_var so they are more accurate. - Database -- cgit v1.2.3-24-g4f1b From d37f0e9cfe106ff1a15b8f09df27e4f3a004b907 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Wed, 27 Jun 2012 08:21:59 -0400 Subject: Correct variable names --- system/libraries/Email.php | 2 +- system/libraries/Form_validation.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/system/libraries/Email.php b/system/libraries/Email.php index 5e6f69842..0fcdbd83e 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -706,7 +706,7 @@ class CI_Email { * @param string * @return bool */ - public function valid_email($address) + public function valid_email($email) { return filter_var($email, FILTER_VALIDATE_EMAIL); } diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index 9ef58724c..f3087f883 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -1076,7 +1076,7 @@ class CI_Form_validation { */ public function valid_email($str) { - return filter_var($email, FILTER_VALIDATE_EMAIL); + return filter_var($str, FILTER_VALIDATE_EMAIL); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 580388bc79e340ddf44f52853524ecc03b9d339c Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 27 Jun 2012 15:43:46 +0300 Subject: valid_email() to always return boolean --- system/helpers/email_helper.php | 2 +- system/libraries/Email.php | 2 +- system/libraries/Form_validation.php | 2 +- user_guide_src/source/changelog.rst | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/system/helpers/email_helper.php b/system/helpers/email_helper.php index 628667d4d..2a63b36c9 100644 --- a/system/helpers/email_helper.php +++ b/system/helpers/email_helper.php @@ -47,7 +47,7 @@ if ( ! function_exists('valid_email')) */ function valid_email($email) { - return filter_var($email, FILTER_VALIDATE_EMAIL); + return (bool) filter_var($email, FILTER_VALIDATE_EMAIL); } } diff --git a/system/libraries/Email.php b/system/libraries/Email.php index 0fcdbd83e..fdb9be4da 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -708,7 +708,7 @@ class CI_Email { */ public function valid_email($email) { - return filter_var($email, FILTER_VALIDATE_EMAIL); + return (bool) filter_var($email, FILTER_VALIDATE_EMAIL); } // -------------------------------------------------------------------- diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index f3087f883..353624100 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -1076,7 +1076,7 @@ class CI_Form_validation { */ public function valid_email($str) { - return filter_var($str, FILTER_VALIDATE_EMAIL); + return (bool) filter_var($str, FILTER_VALIDATE_EMAIL); } // -------------------------------------------------------------------- diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index cc6220253..70d0c80a9 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -48,6 +48,7 @@ Release Date: Not Released - Global config files are loaded first, then environment ones. Environment config keys overwrite base ones, allowing to only set the keys we want changed per environment. - Changed detection of ``$view_folder`` so that if it's not found in the current path, it will now also be searched for under the application folder. - Path constants BASEPATH, APPPATH and VIEWPATH are now (internally) defined as absolute paths. + - Updated email validation methods to use filter_var() instead of PCRE. - Helpers @@ -73,7 +74,6 @@ Release Date: Not Released - ``read_file()`` is now a deprecated alias of ``file_get_contents()``. - Added an optional parameter to :doc:`Date Helper ` function ``timezone_menu()`` that allows more attributes to be added to the generated select tag. - :doc:`Security Helper ` function ``strip_image_tags()`` is now an alias for the same method in the :doc:`Security Library `. - - Updated email validation methods to use filter_var so they are more accurate. - Database -- cgit v1.2.3-24-g4f1b From d580999cead0aa37d705c2f32e02712a2d522deb Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 28 Jun 2012 14:06:54 +0300 Subject: Fix issue #1545 --- system/database/drivers/oci8/oci8_driver.php | 18 ++++++++++++------ user_guide_src/source/changelog.rst | 1 + 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php index 67bb0403b..691247fee 100644 --- a/system/database/drivers/oci8/oci8_driver.php +++ b/system/database/drivers/oci8/oci8_driver.php @@ -158,6 +158,8 @@ class CI_DB_oci8_driver extends CI_DB { $this->dsn = ''; } + // -------------------------------------------------------------------- + /** * Non-persistent database connection * @@ -179,9 +181,9 @@ class CI_DB_oci8_driver extends CI_DB { */ public function db_pconnect() { - return ( ! empty($this->char_set)) - ? @oci_pconnect($this->username, $this->password, $this->dsn, $this->char_set) - : @oci_pconnect($this->username, $this->password, $this->dsn); + return empty($this->char_set) + ? @oci_pconnect($this->username, $this->password, $this->dsn) + : @oci_pconnect($this->username, $this->password, $this->dsn, $this->char_set); } // -------------------------------------------------------------------- @@ -217,6 +219,8 @@ class CI_DB_oci8_driver extends CI_DB { return @oci_execute($this->stmt_id, $this->commit_mode); } + // -------------------------------------------------------------------- + /** * Generate a statement ID * @@ -236,7 +240,7 @@ class CI_DB_oci8_driver extends CI_DB { /** * Get cursor. Returns a cursor from the database * - * @return cursor id + * @return resource */ public function get_cursor() { @@ -300,6 +304,7 @@ class CI_DB_oci8_driver extends CI_DB { /** * Bind parameters * + * @param array * @return void */ protected function _bind_params($params) @@ -328,6 +333,7 @@ class CI_DB_oci8_driver extends CI_DB { /** * Begin Transaction * + * @param bool * @return bool */ public function trans_begin($test_mode = FALSE) @@ -636,8 +642,8 @@ class CI_DB_oci8_driver extends CI_DB { protected function _limit($sql, $limit, $offset) { $this->limit_used = TRUE; - return 'SELECT * FROM (SELECT inner_query.*, rownum rnum FROM ('.$sql.') inner_query WHERE rownum < '.($offset + $limit).')' - .($offset ? ' WHERE rnum >= '.$offset : ''); + return 'SELECT * FROM (SELECT inner_query.*, rownum rnum FROM ('.$sql.') inner_query WHERE rownum < '.($offset + $limit + 1).')' + .($offset ? ' WHERE rnum >= '.($offset + 1): ''); } // -------------------------------------------------------------------- diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 70d0c80a9..d2774ca12 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -299,6 +299,7 @@ Bug fixes for 3.0 - Fixed a bug (#1328) - :doc:`Form Validation Library ` didn't properly check the type of the form fields before processing them. - Fixed a bug (#79) - :doc:`Form Validation Library ` didn't properly validate array fields that use associative keys or have custom indexes. - Fixed a bug (#427) - :doc:`Form Validation Library ` method ``strip_image_tags()`` was an alias to a non-existent method. +- Fixed a bug (#1545) - :doc:`Query Builder ` method ``limit()`` wasn't executed properly under Oracle. Version 2.1.1 ============= -- cgit v1.2.3-24-g4f1b