summaryrefslogtreecommitdiffstats
path: root/user_guide_src/source
diff options
context:
space:
mode:
authorMelounek <petr@heralecky.cz>2012-10-05 15:50:00 +0200
committerMelounek <petr@heralecky.cz>2012-10-05 15:50:00 +0200
commitcc7c7c691ad16beb5040a8a1d07064e61b5e2167 (patch)
treef0ed98dc9f580bf38cfb13b72d8ab2cddfd69a3f /user_guide_src/source
parent58dfc089bf5b0ca35c2ff244e5bfdff726f9adcd (diff)
parent6123b61e8ec95ac91f67bfbf442e34021c922319 (diff)
update devel version
Diffstat (limited to 'user_guide_src/source')
-rw-r--r--user_guide_src/source/DCO.rst27
-rw-r--r--user_guide_src/source/_themes/eldocs/layout.html68
-rw-r--r--user_guide_src/source/_themes/eldocs/searchbox.html21
-rw-r--r--user_guide_src/source/_themes/eldocs/static/asset/css/common.css87
-rw-r--r--user_guide_src/source/changelog.rst200
-rw-r--r--user_guide_src/source/conf.py1
-rw-r--r--user_guide_src/source/contributing/index.rst105
-rw-r--r--user_guide_src/source/database/configuration.rst129
-rw-r--r--user_guide_src/source/database/connecting.rst34
-rw-r--r--user_guide_src/source/database/results.rst4
-rw-r--r--user_guide_src/source/general/models.rst61
-rw-r--r--user_guide_src/source/general/reserved_names.rst2
-rw-r--r--user_guide_src/source/general/welcome.rst32
-rw-r--r--user_guide_src/source/helpers/array_helper.rst34
-rw-r--r--user_guide_src/source/helpers/captcha_helper.rst2
-rw-r--r--user_guide_src/source/helpers/date_helper.rst174
-rw-r--r--user_guide_src/source/helpers/form_helper.rst4
-rw-r--r--user_guide_src/source/helpers/url_helper.rst19
-rw-r--r--user_guide_src/source/images/codeigniter_1.7.1_library_reference.pngbin111744 -> 111747 bytes
-rw-r--r--user_guide_src/source/index.rst136
-rw-r--r--user_guide_src/source/installation/downloads.rst8
-rw-r--r--user_guide_src/source/installation/upgrade_210.rst16
-rw-r--r--user_guide_src/source/installation/upgrade_211.rst33
-rw-r--r--user_guide_src/source/installation/upgrade_212.rst22
-rw-r--r--user_guide_src/source/installation/upgrade_300.rst162
-rw-r--r--user_guide_src/source/installation/upgrading.rst4
-rw-r--r--user_guide_src/source/libraries/config.rst2
-rw-r--r--user_guide_src/source/libraries/email.rst10
-rw-r--r--user_guide_src/source/libraries/file_uploading.rst1
-rw-r--r--user_guide_src/source/libraries/form_validation.rst6
-rw-r--r--user_guide_src/source/libraries/ftp.rst5
-rw-r--r--user_guide_src/source/libraries/image_lib.rst23
-rw-r--r--user_guide_src/source/libraries/loader.rst73
-rw-r--r--user_guide_src/source/libraries/migration.rst134
-rw-r--r--user_guide_src/source/libraries/pagination.rst4
-rw-r--r--user_guide_src/source/libraries/sessions.rst338
-rw-r--r--user_guide_src/source/libraries/trackback.rst2
-rw-r--r--user_guide_src/source/license_afl.rst245
-rw-r--r--user_guide_src/source/overview/cheatsheets.rst15
39 files changed, 1692 insertions, 551 deletions
diff --git a/user_guide_src/source/DCO.rst b/user_guide_src/source/DCO.rst
new file mode 100644
index 000000000..c8f9b49c6
--- /dev/null
+++ b/user_guide_src/source/DCO.rst
@@ -0,0 +1,27 @@
+#####################################
+Developer's Certificate of Origin 1.1
+#####################################
+
+By making a contribution to this project, I certify that:
+
+(1) The contribution was created in whole or in part by me and I
+ have the right to submit it under the open source license
+ indicated in the file; or
+
+(2) The contribution is based upon previous work that, to the best
+ of my knowledge, is covered under an appropriate open source
+ license and I have the right under that license to submit that
+ work with modifications, whether created in whole or in part
+ by me, under the same open source license (unless I am
+ permitted to submit under a different license), as indicated
+ in the file; or
+
+(3) The contribution was provided directly to me by some other
+ person who certified (1), (2) or (3) and I have not modified
+ it.
+
+(4) I understand and agree that this project and the contribution
+ are public and that a record of the contribution (including all
+ personal information I submit with it, including my sign-off) is
+ maintained indefinitely and may be redistributed consistent with
+ this project or the open source license(s) involved.
diff --git a/user_guide_src/source/_themes/eldocs/layout.html b/user_guide_src/source/_themes/eldocs/layout.html
index 4b1a0221c..51d61b849 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'] %}
<html>
<head>
@@ -85,36 +88,29 @@
<div id="brand" class="{{ project_abbreviation }}">
<a href="http://{{ project_domain }}/"><img src="{{ pathto('_static/asset/img/' + project_abbreviation + '-logo.gif', 1) }}" alt="{{ project }}"></a>
<p>{{ release }} User Guide</p>
- {%- if show_source and has_source and sourcename %}
- <p><a href="{{ pathto('_sources/' + sourcename, true)|e }}"
- rel="nofollow">{{ _('Show Source') }}</a></p>
- {%- endif %}
</div><!-- /#brand -->
<div id="header">
- <form method="get" action="http://www.google.com/search">
- <fieldset>
- <input type="text" name="q" id="q" value="">
- <input type="hidden" name="as_sitesearch" id="as_sitesearch" value="{{ project_domain }}/user_guide/" />
- <input class="grades" type="submit" value="search">
- </fieldset>
- </form>
+ {%- include "searchbox.html" %}
<ul>
{%- block rootrellink %}
- <li><a href="{{ pathto(master_doc) }}">Home</a>&nbsp;&nbsp;{{ reldelim1 }}</li>
- <li><a id="toc-link" href="{{ pathto(master_doc) }}">Table of Contents</a>&nbsp;&nbsp;{{ reldelim1 }}</li>
+ <li><a href="{{ pathto(master_doc) }}">User Guide Home</a>{%- if pagename != 'index' %}&nbsp;&nbsp;{{ reldelim1 }}{%- endif %}</li>
{%- endblock %}
{%- for parent in parents %}
<li><a href="{{ parent.link|e }}" {% if loop.last %}{{ accesskey("U") }}{% endif %}>{{ parent.title }}</a>&nbsp;&nbsp; {{ reldelim1 }}</li>
{%- endfor %}
+ {%- if pagename != 'index' %}
<li><strong>{{ title }}</strong></li>
+ {%- endif %}
</ul>
</div><!-- /#header -->
- <div class="section" id="content">
+ <div class="section body" id="content">
+ {%- block body %}
{{ body }}
+ {%- endblock %}
</div>
{%- endblock %}
@@ -124,49 +120,9 @@
{%- block footer %}
<div id="footer">
- <p class="top">
- {% if prev %}
- <span class="prev">Previous Topic: <a href="{{ prev.link }}">{{ prev.title }}</a></span>
- {% endif %}
- {% if next %}
- <span class="next">Next Topic: <a href="{{ next.link }}">{{ next.title }}</a></span>
- {% endif %}
- <a href="#header" title="Return to top">Return to top</a>
- </p>
- <p><a href="{{ project_url }}">{{ project }}</a> &ndash; Copyright &copy; {{ copyright }}</a> &ndash; Last updated: {{ last_updated }}</p>
+ <p class="top"><a href="#header" title="Return to top">Return to top</a></p>
+ <p><a href="http://{{ project_domain }}/">{{ project }}</a> &ndash; Copyright &copy; {{ copyright }}</a></p>
</div><!-- /#footer -->
{%- endblock %}
-
- <script src="{{ pathto('_static/asset/js/jquery-ui-min.js', 1) }}" type="text/javascript" charset="utf-8" async></script>
- <script type="text/javascript" charset="utf-8">
- $('#toc-link').click(function(){
- $('#table-contents').animate({ left: '0' },1000);
- return false;
- });
- $('html').click(function(){
- if ($('#table-contents').css("left") == '0px'){
- $('#table-contents').animate({ left: '-520' },1000);
- }
- });
- $('#table-contents').click(function(event){
- event.stopPropagation();
- });
-/* $('*:not(#table-contents,#toc-link)').click(function(){
- if ($('#table-contents').css("left") == '0px'){
- $('#table-contents').animate({ left: '-520' },1000);
- }
- });
-/* $("#toc-link").click(function () {
- $('#table-contents').show("slide", { direction: "left" }, 100);
- event.stopPropagation();
- return false;
- });
- $('*:not(#table-contents,#toc-link)').click(function () {
- if ($('#table-contents').is(":visible")) {
- $('#table-contents').hide("slide", { direction: "left" }, 100);
- event.stopPropagation();
- }
- }); */
- </script>
</body>
</html> \ No newline at end of file
diff --git a/user_guide_src/source/_themes/eldocs/searchbox.html b/user_guide_src/source/_themes/eldocs/searchbox.html
new file mode 100644
index 000000000..039590bd9
--- /dev/null
+++ b/user_guide_src/source/_themes/eldocs/searchbox.html
@@ -0,0 +1,21 @@
+<!--
+ --------------------------------
+ Original Google search box block
+ --------------------------------
+
+<form method="get" action="http://www.google.com/search">
+ <fieldset>
+ <input type="text" name="q" id="q" value="">
+ <input type="hidden" name="as_sitesearch" id="as_sitesearch" value="{{ project_domain }}/user_guide/" />
+ <input class="grades" type="submit" value="search">
+ </fieldset>
+</form>
+-->
+
+
+<form class="search" action="{{ pathto('search') }}" method="get">
+ <input type="text" name="q" id="q" value="" />
+ <input type="submit" value="search" />
+ <input type="hidden" name="check_keywords" value="yes" />
+ <input type="hidden" name="area" value="default" />
+</form>
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..0a63871c5 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,35 @@ img{ display: block; max-width: 100%; }
fieldset{ border: 0; }
.top{ float: right; }
-.next{ padding: 0 20px 0 10px; }
-.prev{ padding-right: 10px; }
-.highlight-ci,
+.highlight{ overflow-x: auto; }
+
+.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);
- }
+.highlight-ci{ background-color: #FEFEFE; border-color: #E5E5E5; }
- .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;
@@ -183,6 +185,8 @@ fieldset{ border: 0; }
}
.admonition-title:after{ content: ': '; }
+
+.highlighted{ background-color: #FFF09B; }
#table-contents{
bottom: 0;
@@ -295,6 +299,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 +351,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/changelog.rst b/user_guide_src/source/changelog.rst
index 4f5915de8..c5a9353c2 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -22,7 +22,7 @@ Release Date: Not Released
- ``$_SERVER['CI_ENV']`` can now be set to control the ``ENVIRONMENT`` constant.
- Added an optional backtrace to php-error template.
- Added Android to the list of user agents.
- - Added Windows 7, Android, Blackberry and iOS to the list of user platforms.
+ - Added Windows 7, Windows 8, Android, Blackberry, iOS and PlayStation 3 to the list of user platforms.
- Added Fennec (Firefox for mobile) to the list of mobile user agents.
- Ability to log certain error types, not all under a threshold.
- Added support for pem, p10, p12, p7a, p7c, p7m, p7r, p7s, crt, crl, der, kdb, rsa, cer, sst, csr Certs to mimes.php.
@@ -34,8 +34,10 @@ Release Date: Not Released
- Added support for rar archives to mimes.php.
- Updated support for xml ('application/xml') and xsl ('application/xml', 'text/xsl') files in mimes.php.
- Updated support for doc files in mimes.php.
+ - Updated support for docx files in mimes.php.
- Updated support for php files in mimes.php.
- Updated support for zip files in mimes.php.
+ - Updated support for csv files in mimes.php.
- Added some more doctypes.
- Added Romanian and Greek characters in foreign_characters.php.
- Changed logger to only chmod when file is first created.
@@ -48,20 +50,28 @@ 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.
+ - Changed environment defaults to report all errors in *development* and only fatal ones in *testing*, *production* but only display them in *development*.
+ - Updated *ip_address* database field lengths from 16 to 45 for supporting IPv6 address on :doc:`Trackback Library <libraries/trackback>` and :doc:`Captcha Helper <helpers/captcha_helper>`.
- Helpers
- - :doc:`Date Helper <helpers/date_helper>` function now() now works with all timezone strings supported by PHP.
+ - :doc:`Date Helper <helpers/date_helper>` changes include:
+ - ``now()`` now works with all timezone strings supported by PHP.
+ - Added an optional third parameter to ``timespan()`` that constrains the number of time units displayed.
+ - Added an optional parameter to ``timezone_menu()`` that allows more attributes to be added to the generated select tag.
+ - Deprecated ``standard_date()``, which now just uses the native ``date()`` with `DateTime constants <http://bg2.php.net/manual/en/class.datetime.php#datetime.constants.types>`_.
- ``create_captcha()`` accepts additional colors parameter, allowing for color customization.
- :doc:`URL Helper <helpers/url_helper>` changes include:
- ``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()``.
+ - "auto" method in ``redirect()`` now chooses the "refresh" method only on IIS servers, instead of all servers on Windows.
- Added XHTML Basic 1.1 doctype to :doc:`HTML Helper <helpers/html_helper>`.
- Changed ``humanize()`` to include a second param for the separator.
- Refactored ``plural()`` and ``singular()`` to avoid double pluralization and support more words.
- Added an optional third parameter to ``force_download()`` that enables/disables sending the actual file MIME type in the Content-Type header (disabled by default).
- - Added an optional third parameter to ``timespan()`` that constrains the number of time units displayed.
- Added a work-around in ``force_download()`` for a bug Android <= 2.1, where the filename extension needs to be in uppercase.
- ``form_dropdown()`` will now also take an array for unity with other form helpers.
- ``do_hash()`` now uses PHP's native ``hash()`` function (supporting more algorithms) and is deprecated.
@@ -70,7 +80,7 @@ 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 <helpers/date_helper>` Added optional fourth parameter to ``timezone_menu()`` that allows more attributes to be added to the generated select tag
+ - :doc:`Security Helper <helpers/security_helper>` function ``strip_image_tags()`` is now an alias for the same method in the :doc:`Security Library <libraries/security>`.
- Database
@@ -90,17 +100,18 @@ Release Date: Not Released
- Added support for backup() in :doc:`Database Utilities <database/utilities>`.
- Added 'dsn' configuration setting for drivers that support DSN strings (PDO, PostgreSQL, Oracle, ODBC, CUBRID).
- Improved PDO database support.
- - Added Interbase/Firebird database support via the "interbase" driver.
+ - Added Interbase/Firebird database support via the 'ibase' driver.
- Added an optional database name parameter to db_select().
- Replaced the _error_message() and _error_number() methods with error(), that returns an array containing the last database error code and message.
- Improved version() implementation so that drivers that have a native function to get the version number don't have to be defined in the core DB_driver class.
- Improved support of the PostgreSQL driver, including:
- - pg_version() is now used to get the database version number, when possible.
- - Added db_set_charset() support.
- - Added support for optimize_table() in :doc:`Database Utilities <database/utilities>` (rebuilds table indexes).
- - Added boolean data type support in escape().
- - Added update_batch() support.
- - Removed limit() and order_by() support for UPDATE and DELETE queries in as PostgreSQL does not support those features.
+ - ``pg_version()`` is now used to get the database version number, when possible.
+ - Added ``db_set_charset()`` support.
+ - Added support for ``optimize_table()`` in :doc:`Database Utilities <database/utilities>` (rebuilds table indexes).
+ - Added boolean data type support in ``escape()``.
+ - Added ``update_batch()`` support.
+ - Removed ``limit()`` and ``order_by()`` support for UPDATE and DELETE queries as PostgreSQL does not support those features.
+ - Added a work-around for dead persistent connections to be re-created after a database restart.
- Added a constructor to the DB_result class and moved all driver-specific properties and logic out of the base DB_driver class to allow better abstraction.
- Removed protect_identifiers() and renamed internal method _protect_identifiers() to it instead - it was just an alias.
- Renamed internal method _escape_identifiers() to escape_identifiers().
@@ -123,7 +134,6 @@ Release Date: Not Released
- Added support for drop_table() in :doc:`Database Forge <database/forge>`.
- Added support for list_databases() in :doc:`Database Utilities <database/utilities>`.
- Generally improved for speed and cleaned up all of its components.
- - *Row* result methods now really only fetch only the needed number of rows, instead of depending entirely on result().
- num_rows() is now only called explicitly by the developer and no longer re-executes statements.
- Improved support of the SQLite driver, including:
- Added support for replace() in :doc:`Query Builder <database/query_builder>`.
@@ -131,26 +141,42 @@ Release Date: Not Released
- Added ODBC support for create_database(), drop_database() and drop_table() in :doc:`Database Forge <database/forge>`.
- Added PDO support for create_database(), drop_database and drop_table() in :doc:`Database Forge <database/forge>`.
- Added unbuffered_row() method for getting a row without prefetching whole result (consume less memory).
+ - Added PDO support for ``list_fields()`` in :doc:`Database Results <database/results>`.
+ - Added capability for packages to hold database.php config files
+ - Added subdrivers support (currently only used by PDO).
+ - Added client compression support for MySQL and MySQLi.
+ - Removed :doc:`Loader Class <libraries/loader>` from Database error tracing to better find the likely culprit.
- Libraries
- - Added max_filename_increment config setting for Upload library.
- - CI_Loader::_ci_autoloader() is now a protected method.
- - Added custom filename to Email::attach() as $this->email->attach($filename, $disposition, $newname).
- - Added possibility to send attachment as buffer string in Email::attach() as $this->email->attach($buffer, $disposition, $newname, $mime).
- - Added third parameter $return_path for method Email::from().
+ - :doc:`Session Library <libraries/sessions>` changes include:
+ - Library changed to :doc:`Driver <general/drivers>` with classic Cookie driver as default.
+ - Added Native PHP Session driver to work with $_SESSION.
+ - Custom session drivers can be added anywhere in package paths and loaded with Session library.
+ - Session drivers interchangeable on the fly.
+ - New tempdata feature allows setting user data items with an expiration time.
+ - Added default $config['sess_driver'] and $config['sess_valid_drivers'] items to config.php file.
+ - Cookie driver now respects php.ini's session.gc_probability and session.gc_divisor
+ - Changed the Cookie driver to select only one row when using database sessions.
+ - Cookie driver now only writes to database at end of request when using database.
+ - Cookie driver now uses PHP functions for faster array manipulation when using database.
+ - Added ``all_flashdata()`` method to session class. Returns an associative array of only flashdata.
+ - Added ``has_userdata()`` method to verify existence of userdata item.
+ - Added ``tempdata()``, ``set_tempdata()``, and ``unset_tempdata()`` methods for manipulating tempdata.
+ - :doc:`File Uploading Library <libraries/upload>` changes include:
+ - Added *max_filename_increment* config setting.
+ - Added an "index" parameter to the ``data()`` method.
- :doc:`Cart library <libraries/cart>` 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 compatibility.
- :doc:`Image Manipulation library <libraries/image_lib>` changes include:
- The initialize() method now only sets existing class properties.
- - Added support for 3-length hex color values for wm_font_color and wm_shadow_color properties, as well as validation for them.
- - Class properties wm_font_color, wm_shadow_color and wm_use_drop_shadow are now protected, to avoid breaking the text_watermark() method if they are set manually after initialization.
- - If property maintain_ratio is set to TRUE, image_reproportion() now doesn't need both width and height to be specified.
- - Removed SHA1 function in the :doc:`Encryption Library <libraries/encryption>`.
- - Added $config['csrf_regeneration'] to the CSRF protection in the :doc:`Security library <libraries/security>`, which makes token regeneration optional.
- - Added $config['csrf_exclude_uris'] to the CSRF protection in the :doc:`Security library <libraries/security>`, which allows you list URIs which will not have the CSRF validation functions run.
+ - Added support for 3-length hex color values for *wm_font_color* and *wm_shadow_color* properties, as well as validation for them.
+ - Class properties *wm_font_color*, *wm_shadow_color* and *wm_use_drop_shadow* are now protected, to avoid breaking the ``text_watermark()`` method if they are set manually after initialization.
+ - If property *maintain_ratio* is set to TRUE, ``image_reproportion()`` now doesn't need both width and height to be specified.
+ - Property *maintain_ratio* is now taken into account when resizing images using ImageMagick library.
+ - Added support for maintaining transparency for PNG images in method ``text_watermark()``.
- :doc:`Form Validation library <libraries/form_validation>` changes include:
- Added method error_array() to return all error messages as an array.
- Added method set_data() to set an alternative data array to be validated instead of the default $_POST.
@@ -160,37 +186,57 @@ Release Date: Not Released
- Removed method is_numeric() as it exists as a native PHP function and _execute() will find and use that (the 'is_numeric' rule itself is deprecated since 1.6.1).
- Native PHP functions used as rules can now accept an additional parameter, other than the data itself.
- Updated set_rules() to accept an array of rules as well as a string.
- - Changed the :doc:`Session Library <libraries/sessions>` to select only one row when using database sessions.
- - Added all_flashdata() method to session class. Returns an associative array of only flashdata.
- - Allowed for setting table class defaults in a config file.
+ - Fields that have empty rules set no longer run through validation (and therefore are not considered erroneous).
+ - Added support for setting :doc:`Table <libraries/table>` class defaults in a config file.
- Added a Wincache driver to the :doc:`Caching Library <libraries/caching>`.
- Added a Redis driver to the :doc:`Caching Library <libraries/caching>`.
- - Added dsn (delivery status notification) option to the :doc:`Email Library <libraries/email>`.
- - Renamed method _set_header() to set_header() and made it public to enable adding custom headers in the :doc:`Email Library <libraries/email>`.
- - Added an "index" parameter to the data() method in the :doc:`Upload Library <libraries/file_uploading>`.
+ - :doc:`Email library <libraries/email>` changes include:
+ - Added custom filename to ``Email::attach()`` as ``$this->email->attach($filename, $disposition, $newname)``.
+ - Added possibility to send attachment as buffer string in ``Email::attach()`` as ``$this->email->attach($buffer, $disposition, $newname, $mime)``.
+ - Added dsn (delivery status notification) option.
+ - Renamed method _set_header() to set_header() and made it public to enable adding custom headers in the :doc:`Email Library <libraries/email>`.
+ - Successfully sent emails will automatically clear the parameters.
+ - Added third parameter $return_path in method Email::from().
- :doc:`Pagination Library <libraries/pagination>` changes include:
- Added support for the anchor "rel" attribute.
- Added support for setting custom attributes.
- Deprecated usage of the "anchor_class" setting (use the new "attributes" setting instead).
- Added $config['reuse_query_string'] to allow automatic repopulation of query string arguments, combined with normal URI segments.
+ - Removed the default ``&nbsp;`` from a number of the configuration variables.
+ - Added the ability to use a proxy with the :doc:`XML-RPC Library <libraries/xmlrpc>`.
+ - :doc:`Encryption Library <libraries/encrypt>` changes include:
+ - Added support for hashing algorithms other than SHA1 and MD5.
+ - Removed previously deprecated ``sha1()`` method.
- Core
- Changed private methods in the :doc:`URI Library <libraries/uri>` to protected so MY_URI can override them.
- - Removed CI_CORE boolean constant from CodeIgniter.php (no longer Reactor and Core versions).
- - Added method get_vars() to the :doc:`Loader Library <libraries/loader>` to retrieve all variables loaded with $this->load->vars().
- - is_loaded() function from system/core/Commons.php now returns a reference.
+ - Removed ``CI_CORE`` boolean constant from CodeIgniter.php (no longer Reactor and Core versions).
+ - :doc:`Loader Library <libraries/loader>` changes include:
+ - Added method get_vars() to the Loader to retrieve all variables loaded with $this->load->vars().
+ - CI_Loader::_ci_autoloader() is now a protected method.
+ - Added autoloading of drivers with $autoload['drivers'].
+ - CI_Loader::library() will now load drivers as well, for backward compatibility of converted libraries (like Session).
+ - ``is_loaded()`` function from *system/core/Commons.php* now returns a reference.
- $config['rewrite_short_tags'] now has no effect when using PHP 5.4 as *<?=* will always be available.
- - Added method() to the :doc:`Input Library <libraries/input>` to retrieve $_SERVER['REQUEST_METHOD'].
+ - Added ``method()`` to the :doc:`Input Library <libraries/input>` to retrieve ``$_SERVER['REQUEST_METHOD']``.
- Modified valid_ip() to use PHP's filter_var() in the :doc:`Input Library <libraries/input>`.
- - Added support for HTTP-Only cookies with new config option ``cookie_httponly`` (default FALSE).
+ - Added support for HTTP-Only cookies with new config option *cookie_httponly* (default FALSE).
- Renamed method _call_hook() to call_hook() in the :doc:`Hooks Library <general/hooks>`.
- - Added get_content_type() method to the :doc:`Output Library <libraries/output>`.
- - Added get_mimes() function to system/core/Commons.php to return the config/mimes.php array.
- - Added a second argument to set_content_type() in the :doc:`Output Library <libraries/output>` that allows setting the document charset as well.
- - $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 <libraries/config>` method site_url() to accept an array as well.
+ - :doc:`Output Library <libraries/output>` changes include:
+ - Added method ``get_content_type()``.
+ - Added a second argument to method ``set_content_type()`` that allows setting the document charset as well.
+ - Added ``get_mimes()`` function to *system/core/Commons.php* to return the *config/mimes.php* array.
+ - ``$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 <libraries/config>` method ``site_url()`` to accept an array as well.
+ - :doc:`Security Library <libraries/security>` changes include:
+ - Added method ``strip_image_tags()``.
+ - Added ``$config['csrf_regeneration']``, which makes token regeneration optional.
+ - Added ``$config['csrf_exclude_uris']``, which allows you list URIs which will not have the CSRF validation methods run.
+ - Changed ``_exception_handler()`` to respect php.ini 'display_errors' setting.
+ - Removed redundant conditional to determine HTTP server protocol in ``set_status_header()``.
+ - Added support for IPv4 range masks (e.g. 192.168.1.1/24) to specify ranges of IP addresses for use with the *proxy_ips* setting.
Bug fixes for 3.0
------------------
@@ -274,12 +320,12 @@ Bug fixes for 3.0
- Fixed a bug (#666) - :doc:`Output library <libraries/output>`'s set_content_type() method didn't set the document charset.
- Fixed a bug (#784, #861) - :doc:`Database Forge <database/forge>` method ``create_table()`` used to accept constraints for MSSQL/SQLSRV integer-type columns.
- Fixed a bug (#706) - SQLSRV/MSSSQL didn't escape field names.
-- Fixed a bug (#1452) - protect_identifiers() didn't properly detect identifiers with spaces in their names.
-- Fixed a bug where protect_identifiers() ignored it's extra arguments when the value passed to it is an array.
-- Fixed a bug where _has_operator() didn't detect BETWEEN.
-- Fixed a bug in :doc:`Query Builder <database/query_builder>`'s join() method where it failed with identifiers containing dashes.
+- Fixed a bug (#1452) - ``protect_identifiers()`` didn't properly detect identifiers with spaces in their names.
+- Fixed a bug where ``protect_identifiers()`` ignored it's extra arguments when the value passed to it is an array.
+- Fixed a bug where ``_has_operator()`` didn't detect BETWEEN.
+- Fixed a bug in :doc:`Query Builder <database/query_builder>`'s ``join()`` method where it failed with identifiers containing dashes.
- Fixed a bug (#1264) - :doc:`Database Forge <database/forge>` and :doc:`Database Utilities <database/utilities>` didn't update/reset the databases and tables list cache when a table or a database is created, dropped or renamed.
-- Fixed a bug (#7) - :doc:`Query Builder <database/query_builder>`'s join() method only escaped one set of conditions.
+- Fixed a bug (#7) - :doc:`Query Builder <database/query_builder>`'s ``join()`` method only escaped one set of conditions.
- Fixed a bug (#1321) - Core Exceptions class couldn't find the errors/ folder in some cases.
- Fixed a bug in the File-based :doc:`Cache Library <libraries/caching>` driver's get_metadata() method where a non-existent array key was accessed for the TTL value.
- Fixed a bug (#1202) - :doc:`Encryption Library <libraries/encryption>` encode_from_legacy() didn't set back the encrypt mode on failure.
@@ -295,11 +341,31 @@ Bug fixes for 3.0
- Fixed a bug where :doc:`URL Helper <helpers/url_helper>` function anchor_popup() ignored the attributes argument if it is not an array.
- Fixed a bug (#1328) - :doc:`Form Validation Library <libraries/form_validation>` didn't properly check the type of the form fields before processing them.
- Fixed a bug (#79) - :doc:`Form Validation Library <libraries/form_validation>` didn't properly validate array fields that use associative keys or have custom indexes.
+- Fixed a bug (#427) - :doc:`Form Validation Library <libraries/form_validation>` method ``strip_image_tags()`` was an alias to a non-existent method.
+- Fixed a bug (#1545) - :doc:`Query Builder <database/query_builder>` method ``limit()`` wasn't executed properly under Oracle.
+- Fixed a bug (#1551) - :doc:`Date Helper <helpers/date_helper>` function ``standard_date()`` didn't properly format *W3C* and *ATOM* standard dates.
+- Fixed a bug in :doc:`Query Builder <database/query_builder>` method join() where literal values were escaped as if they were fields.
+- Fixed a bug (#135) - PHP Error logging was impossible without the errors being displayed.
+- Fixed a bug (#1613) - :doc:`Form Helper <helpers/form_helper>` functions ``form_multiselect()``, ``form_dropdown()`` didn't properly handle empty array option groups.
+- Fixed a bug (#1605) - :doc:`Pagination Library <libraries/pagination>` produced incorrect *previous* and *next* link values.
+- Fixed a bug in SQLSRV's ``affected_rows()`` method where an erroneous function name was used.
+- Fixed a bug (#1000) - Change syntax of ``$view_file`` to ``$_ci_view_file`` to prevent being overwritten by application.
+- Fixed a bug (#1757) - :doc:`Directory Helper <helpers/directory_helper>` function ``directory_map()`` was skipping files and directories named *0*.
+- Fixed a bug (#1789) - :doc:`Database Library <libraries/database>` method ``escape_str()`` escaped quote characters in LIKE conditions twice under MySQL.
+- Fixed a bug (#395) - :doc:`Unit Testing Library <libraries/unit_testing>` method ``result()`` didn't properly check array result columns when called from ``report()``.
+
+Version 2.1.2
+=============
+
+Release Date: June 29, 2012
+
+- General Changes
+ - Improved security in ``xss_clean()``.
Version 2.1.1
=============
-Release Date: June 13, 2012
+Release Date: June 12, 2012
- General Changes
- Fixed support for docx, xlsx files in mimes.php.
@@ -310,20 +376,20 @@ Release Date: June 13, 2012
- Added support for the IP format parameter to the :doc:`Form Validation Library <libraries/form_validation>`.
- Helpers
- - url_title() performance and output improved. You can now use any string as the word delimiter, but 'dash' and 'underscore' are still supported.
+ - ``url_title()`` performance and output improved. You can now use any string as the word delimiter, but 'dash' and 'underscore' are still supported.
Bug fixes for 2.1.1
-------------------
-- Fixed a bug (#697) - A wrong array key was used in the Upload library to check for mime-types.
-- Fixed a bug - form_open() compared $action against site_url() instead of base_url().
-- Fixed a bug - CI_Upload::_file_mime_type() could've failed if mime_content_type() is used for the detection and returns FALSE.
+- Fixed a bug (#697) - A wrong array key was used in the :doc:`File Uploading Library <libraries/file_uploading>` to check for mime-types.
+- Fixed a bug - ``form_open()`` compared $action against ``site_url()`` instead of ``base_url()``.
+- Fixed a bug - ``CI_Upload::_file_mime_type()`` could've failed if ``mime_content_type()`` is used for the detection and returns FALSE.
- Fixed a bug (#538) - Windows paths were ignored when using the :doc:`Image Manipulation Library <libraries/image_lib>` to create a new file.
- Fixed a bug - When database caching was enabled, $this->db->query() checked the cache before binding variables which resulted in cached queries never being found.
- Fixed a bug - CSRF cookie value was allowed to be any (non-empty) string before being written to the output, making code injection a risk.
- Fixed a bug (#726) - PDO put a 'dbname' argument in it's connection string regardless of the database platform in use, which made it impossible to use SQLite.
-- Fixed a bug - CI_DB_pdo_driver::num_rows() was not returning properly value with SELECT queries, cause it was relying on PDOStatement::rowCount().
-- Fixed a bug (#1059) - CI_Image_lib::clear() was not correctly clearing all necessary object properties, namely width and height.
+- Fixed a bug - ``CI_DB_pdo_driver::num_rows()`` was not returning properly value with SELECT queries, cause it was relying on ``PDOStatement::rowCount()``.
+- Fixed a bug (#1059) - ``CI_Image_lib::clear()`` was not correctly clearing all necessary object properties, namely width and height.
Version 2.1.0
=============
@@ -359,7 +425,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 <database/active_record>`.
+ Driver <database/query_builder>`.
- Added $this->db->insert_batch() support to the OCI8 (Oracle) driver.
- Added failover if the main connections in the config should fail
@@ -1633,27 +1699,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"
@@ -1761,7 +1827,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
@@ -2337,9 +2403,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
@@ -2364,7 +2430,7 @@ Release Date: April 3, 2006
- Added support for :doc:`Models <general/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
@@ -2397,7 +2463,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/conf.py b/user_guide_src/source/conf.py
index e972a388b..f68405b36 100644
--- a/user_guide_src/source/conf.py
+++ b/user_guide_src/source/conf.py
@@ -167,6 +167,7 @@ html_last_updated_fmt = '%b %d, %Y'
# Output file base name for HTML help builder.
htmlhelp_basename = 'CodeIgniterdoc'
+html_copy_source = False
# -- Options for LaTeX output --------------------------------------------------
diff --git a/user_guide_src/source/contributing/index.rst b/user_guide_src/source/contributing/index.rst
new file mode 100644
index 000000000..2ede0e6e5
--- /dev/null
+++ b/user_guide_src/source/contributing/index.rst
@@ -0,0 +1,105 @@
+###########################
+Contributing to CodeIgniter
+###########################
+
+CodeIgniter is a community driven project and accepts contributions of code
+and documentation from the community. These contributions are made in the form
+of Issues or `Pull Requests <http://help.github.com/send-pull-requests/>`_ on
+the `EllisLab CodeIgniter repository
+<https://github.com/EllisLab/CodeIgniter>`_ on GitHub.
+
+Issues are a quick way to point out a bug. If you find a bug or documentation
+error in CodeIgniter then please check a few things first:
+
+- There is not already an open Issue
+- The issue has already been fixed (check the develop branch, or look for
+ closed Issues)
+- Is it something really obvious that you fix it yourself?
+
+Reporting issues is helpful but an even better approach is to send a Pull
+Request, which is done by "Forking" the main repository and committing to your
+own copy. This will require you to use the version control system called Git.
+
+**********
+Guidelines
+**********
+
+Before we look into how, here are the guidelines. If your Pull Requests fail
+to pass these guidelines it will be declined and you will need to re-submit
+when you’ve made the changes. This might sound a bit tough, but it is required
+for us to maintain quality of the code-base.
+
+PHP Style
+=========
+
+All code must meet the `Style Guide
+<http://codeigniter.com/user_guide/general/styleguide.html>`_, which is
+essentially the `Allman indent style
+<http://en.wikipedia.org/wiki/Indent_style#Allman_style>`_, underscores and
+readable operators. This makes certain that all code is the same format as the
+existing code and means it will be as readable as possible.
+
+Documentation
+=============
+
+If you change anything that requires a change to documentation then you will
+need to add it. New classes, methods, parameters, changing default values, etc
+are all things that will require a change to documentation. The change-log
+must also be updated for every change. Also PHPDoc blocks must be maintained.
+
+Compatibility
+=============
+
+CodeIgniter is compatible with PHP 5.2.4 so all code supplied must stick to
+this requirement. If PHP 5.3 or 5.4 functions or features are used then there
+must be a fallback for PHP 5.2.4.
+
+Branching
+=========
+
+CodeIgniter uses the `Git-Flow
+<http://nvie.com/posts/a-successful-git-branching-model/>`_ branching model
+which requires all pull requests to be sent to the "develop" branch. This is
+where the next planned version will be developed. The "master" branch will
+always contain the latest stable version and is kept clean so a "hotfix" (e.g:
+an emergency security patch) can be applied to master to create a new version,
+without worrying about other features holding it up. For this reason all
+commits need to be made to "develop" and any sent to "master" will be closed
+automatically. If you have multiple changes to submit, please place all
+changes into their own branch on your fork.
+
+One thing at a time: A pull request should only contain one change. That does
+not mean only one commit, but one change - however many commits it took. The
+reason for this is that if you change X and Y but send a pull request for both
+at the same time, we might really want X but disagree with Y, meaning we
+cannot merge the request. Using the Git-Flow branching model you can create
+new branches for both of these features and send two requests.
+
+Signing
+=======
+You must sign your work, certifying that you either wrote the work or
+otherwise have the right to pass it on to an open source project. git makes
+this trivial as you merely have to use `--signoff` on your commits to your
+CodeIgniter fork.
+
+.. code-block:: bash
+
+ git commit --signoff
+
+or simply
+
+.. code-block:: bash
+
+ git commit -s
+
+This will sign your commits with the information setup in your git config, e.g.
+
+ Signed-off-by: John Q Public <john.public@example.com>
+
+If you are using Tower there is a "Sign-Off" checkbox in the commit window. You
+could even alias git commit to use the -s flag so you don’t have to think about
+it.
+
+By signing your work in this manner, you certify to a "Developer's Certificate
+or Origin". The current version of this certificate is in the :doc:`/DCO` file
+in the root of this documentation.
diff --git a/user_guide_src/source/database/configuration.rst b/user_guide_src/source/database/configuration.rst
index 7a19c840f..636b5b5b2 100644
--- a/user_guide_src/source/database/configuration.rst
+++ b/user_guide_src/source/database/configuration.rst
@@ -12,26 +12,45 @@ it the respective environment config folder.
The config settings are stored in a multi-dimensional array with this
prototype::
- $db['default']['hostname'] = "localhost";
- $db['default']['username'] = "root";
- $db['default']['password'] = "";
- $db['default']['database'] = "database_name";
- $db['default']['dbdriver'] = "mysql";
- $db['default']['dbprefix'] = "";
- $db['default']['pconnect'] = TRUE;
- $db['default']['db_debug'] = FALSE;
- $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;
-
-If you use PDO as your dbdriver, you can specify the full DSN string describe a connection to the database like this::
-
+ $db['default'] = array(
+ 'dsn' => '',
+ 'hostname' => 'localhost',
+ 'username' => 'root',
+ 'password' => '',
+ 'database' => 'database_name',
+ 'dbdriver' => 'mysqli',
+ 'dbprefix' => '',
+ 'pconnect' => TRUE,
+ 'db_debug' => TRUE,
+ 'cache_on' => FALSE,
+ 'cachedir' => '',
+ 'char_set' => 'utf8',
+ 'dbcollat' => 'utf8_general_ci',
+ 'swap_pre' => '',
+ 'autoinit' => TRUE,
+ 'compress' => TRUE,
+ 'stricton' => FALSE,
+ 'failover' => array()
+ );
+
+Some database drivers (such as PDO, PostgreSQL, Oracle, ODBC) might
+require a full DSN string to be provided. If that is the case, you
+should use the 'dsn' configuration setting, as if you're using the
+driver's underlying native PHP extension, like this::
+
+ // PDO
$db['default']['dsn'] = 'pgsql:host=localhost;port=5432;dbname=database_name';
+ // Oracle
+ $db['default']['dsn'] = '//localhost/XE';
+
+.. note:: If you do not specify a DSN string for a driver that requires it, CodeIgniter
+ will try to build it with the rest of the provided settings.
+
+.. note:: If you provide a DSN string and it is missing some valid settings (e.g. the
+ database character set), which are present in the rest of the configuration
+ fields, CodeIgniter will append them.
+
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::
@@ -41,7 +60,7 @@ These failovers can be specified by setting the failover for a connection like t
'username' => '',
'password' => '',
'database' => '',
- 'dbdriver' => 'mysql',
+ 'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => TRUE,
'db_debug' => TRUE,
@@ -51,6 +70,7 @@ These failovers can be specified by setting the failover for a connection like t
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'autoinit' => TRUE,
+ 'compress' => TRUE,
'stricton' => FALSE
),
array(
@@ -58,7 +78,7 @@ These failovers can be specified by setting the failover for a connection like t
'username' => '',
'password' => '',
'database' => '',
- 'dbdriver' => 'mysql',
+ 'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => TRUE,
'db_debug' => TRUE,
@@ -68,6 +88,7 @@ These failovers can be specified by setting the failover for a connection like t
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'autoinit' => TRUE,
+ 'compress' => TRUE,
'stricton' => FALSE
)
);
@@ -81,30 +102,35 @@ production, test, etc.) under a single installation, you can set up a
connection group for each, then switch between groups as needed. For
example, to set up a "test" environment you would do this::
- $db['test']['hostname'] = "localhost";
- $db['test']['username'] = "root";
- $db['test']['password'] = "";
- $db['test']['database'] = "database_name";
- $db['test']['dbdriver'] = "mysql";
- $db['test']['dbprefix'] = "";
- $db['test']['pconnect'] = TRUE;
- $db['test']['db_debug'] = FALSE;
- $db['test']['cache_on'] = FALSE;
- $db['test']['cachedir'] = "";
- $db['test']['char_set'] = "utf8";
- $db['test']['dbcollat'] = "utf8_general_ci";
- $db['test']['swap_pre'] = "";
- $db['test']['autoinit'] = TRUE;
- $db['test']['stricton'] = FALSE;
+ $db['test'] = array(
+ 'dsn' => '',
+ 'hostname' => 'localhost',
+ 'username' => 'root',
+ 'password' => '',
+ 'database' => 'database_name',
+ 'dbdriver' => 'mysqli',
+ 'dbprefix' => '',
+ 'pconnect' => TRUE,
+ 'db_debug' => TRUE,
+ 'cache_on' => FALSE,
+ 'cachedir' => '',
+ 'char_set' => 'utf8',
+ 'dbcollat' => 'utf8_general_ci',
+ 'swap_pre' => '',
+ 'autoinit' => TRUE,
+ 'compress' => TRUE,
+ 'stricton' => FALSE,
+ 'failover' => array()
+ );
Then, to globally tell the system to use that group you would set this
variable located in the config file::
- $active_group = "test";
+ $active_group = 'test';
-Note: The name "test" is arbitrary. It can be anything you want. By
-default we've used the word "default" for the primary connection, but it
-too can be renamed to something more relevant to your project.
+.. note:: The name 'test' is arbitrary. It can be anything you want. By
+ default we've used the word "default" for the primary connection,
+ but it too can be renamed to something more relevant to your project.
Query Builder
-------------
@@ -119,8 +145,8 @@ when the database classes are initialized.
$query_builder = TRUE;
-.. note:: that some CodeIgniter classes such as Sessions require Active
- Records be enabled to access certain functionality.
+.. note:: that some CodeIgniter classes such as Sessions require Query
+ Builder to be enabled to access certain functionality.
Explanation of Values:
----------------------
@@ -128,11 +154,12 @@ Explanation of Values:
====================== ==================================================================================================
Name Config Description
====================== ==================================================================================================
-**hostname** The hostname of your database server. Often this is "localhost".
+**dsn** The DSN connect string (an all-in-one configuration sequence).
+**hostname** The hostname of your database server. Often this is 'localhost'.
**username** The username used to connect to the database.
**password** The password used to connect to the database.
**database** The name of the database you want to connect to.
-**dbdriver** The database type. ie: mysql, postgre, odbc, etc. Must be specified in lower case.
+**dbdriver** The database type. ie: mysqli, postgre, odbc, etc. Must be specified in lower case.
**dbprefix** An optional table prefix which will added to the table name when running :doc:
`Query Builder <query_builder>` queries. This permits multiple CodeIgniter installations
to share one database.
@@ -144,30 +171,24 @@ Explanation of Values:
**char_set** The character set used in communicating with the database.
**dbcollat** The character collation used in communicating with the database
- .. note:: For MySQL and MySQLi databases, this setting is only used
- as a backup if your server is running PHP < 5.2.3 or MySQL < 5.0.7
- (and in table creation queries made with DB Forge). There is an
- incompatibility in PHP with mysql_real_escape_string() which can
- make your site vulnerable to SQL injection if you are using a
- multi-byte character set and are running versions lower than these.
- Sites using Latin-1 or UTF-8 database character set and collation are
- unaffected.
+ .. note:: Only used in the 'mysql' and 'mysqli' drivers.
**swap_pre** A default table prefix that should be swapped with dbprefix. This is useful for distributed
applications where you might run manually written queries, and need the prefix to still be
customizable by the end user.
**autoinit** Whether or not to automatically connect to the database when the library loads. If set to false,
the connection will take place prior to executing the first query.
+**compress** Whether or not to use client compression for MySQL or MySQLi.
**stricton** TRUE/FALSE (boolean) - Whether to force "Strict Mode" connections, good for ensuring strict SQL
while developing an application.
**port** The database port number. To use this value you have to add a line to the database config array.
::
-
- $db['default']['port'] = 5432;
+
+ $db['default']['port'] = 5432;
====================== ==================================================================================================
.. note:: Depending on what database platform you are using (MySQL, PostgreSQL,
etc.) not all values will be needed. For example, when using SQLite you
will not need to supply a username or password, and the database name
will be the path to your database file. The information above assumes
- you are using MySQL.
+ you are using MySQL. \ No newline at end of file
diff --git a/user_guide_src/source/database/connecting.rst b/user_guide_src/source/database/connecting.rst
index 5822ca62c..9b8117076 100644
--- a/user_guide_src/source/database/connecting.rst
+++ b/user_guide_src/source/database/connecting.rst
@@ -57,25 +57,28 @@ file.
To connect manually to a desired database you can pass an array of
values::
- $config['hostname'] = "localhost";
- $config['username'] = "myusername";
- $config['password'] = "mypassword";
- $config['database'] = "mydatabase";
- $config['dbdriver'] = "mysql";
- $config['dbprefix'] = "";
- $config['pconnect'] = FALSE;
- $config['db_debug'] = TRUE;
- $config['cache_on'] = FALSE;
- $config['cachedir'] = "";
- $config['char_set'] = "utf8";
- $config['dbcollat'] = "utf8_general_ci";
+ $config['hostname'] = 'localhost';
+ $config['username'] = 'myusername';
+ $config['password'] = 'mypassword';
+ $config['database'] = 'mydatabase';
+ $config['dbdriver'] = 'mysqli';
+ $config['dbprefix'] = '';
+ $config['pconnect'] = FALSE;
+ $config['db_debug'] = TRUE;
+ $config['cache_on'] = FALSE;
+ $config['cachedir'] = '';
+ $config['char_set'] = 'utf8';
+ $config['dbcollat'] = 'utf8_general_ci';
$this->load->database($config);
For information on each of these values please see the :doc:`configuration
page <configuration>`.
-.. note:: For the PDO driver, $config['hostname'] should look like
- this: 'mysql:host=localhost'
+.. note:: For the PDO driver, you should use the $config['dsn'] setting
+ instead of 'hostname' and 'database':
+
+ |
+ | $config['dsn'] = 'mysql:host=localhost;dbname=mydatabase';
Or you can submit your database values as a Data Source Name. DSNs must
have this prototype::
@@ -149,5 +152,4 @@ connections, you can explicitly close the connection.
::
- $this->db->close();
-
+ $this->db->close(); \ No newline at end of file
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/general/models.rst b/user_guide_src/source/general/models.rst
index 2e1e025ee..4e52a9648 100644
--- a/user_guide_src/source/general/models.rst
+++ b/user_guide_src/source/general/models.rst
@@ -72,10 +72,11 @@ The basic prototype for a model class is this::
class Model_name extends CI_Model {
- function __construct()
- {
- parent::__construct();
- }
+ public function __construct()
+ {
+ parent::__construct();
+ }
+
}
Where **Model_name** is the name of your class. Class names **must** have
@@ -87,10 +88,11 @@ example, if your class is this::
class User_model extends CI_Model {
- function __construct()
- {
- parent::__construct();
- }
+ public function __construct()
+ {
+ parent::__construct();
+ }
+
}
Your file will be this::
@@ -102,7 +104,7 @@ Loading a Model
Your models will typically be loaded and called from within your
:doc:`controller <controllers>` functions. To load a model you will use
-the following function::
+the following method::
$this->load->model('model_name');
@@ -112,33 +114,34 @@ application/models/blog/queries.php you'll load it using::
$this->load->model('blog/queries');
-Once loaded, you will access your model functions using an object with
-the same name as your class::
+Once loaded, you will access your model methods using an object with the
+same name as your class::
$this->load->model('model_name');
- $this->model_name->function();
+ $this->model_name->method();
If you would like your model assigned to a different object name you can
-specify it via the second parameter of the loading function::
+specify it via the second parameter of the loading method::
- $this->load->model('model_name', 'fubar');
+ $this->load->model('model_name', 'foobar');
- $this->fubar->function();
+ $this->foobar->method();
Here is an example of a controller, that loads a model, then serves a
view::
class Blog_controller extends CI_Controller {
- function blog()
- {
- $this->load->model('blog');
+ public function blog()
+ {
+ $this->load->model('blog');
- $data['query'] = $this->Blog->get_last_ten_entries();
+ $data['query'] = $this->Blog->get_last_ten_entries();
+
+ $this->load->view('blog', $data);
+ }
- $this->load->view('blog', $data);
- }
}
@@ -170,15 +173,13 @@ database. The following options for connecting are available to you:
- You can manually pass database connectivity settings via the third
parameter::
- $config['hostname'] = "localhost";
- $config['username'] = "myusername";
- $config['password'] = "mypassword";
- $config['database'] = "mydatabase";
- $config['dbdriver'] = "mysql";
- $config['dbprefix'] = "";
+ $config['hostname'] = 'localhost';
+ $config['username'] = 'myusername';
+ $config['password'] = 'mypassword';
+ $config['database'] = 'mydatabase';
+ $config['dbdriver'] = 'mysqli';
+ $config['dbprefix'] = '';
$config['pconnect'] = FALSE;
$config['db_debug'] = TRUE;
- $this->load->model('Model_name', '', $config);
-
-
+ $this->load->model('Model_name', '', $config); \ No newline at end of file
diff --git a/user_guide_src/source/general/reserved_names.rst b/user_guide_src/source/general/reserved_names.rst
index 5ce7fc2ff..3354375c5 100644
--- a/user_guide_src/source/general/reserved_names.rst
+++ b/user_guide_src/source/general/reserved_names.rst
@@ -45,11 +45,11 @@ Constants
---------
- ENVIRONMENT
-- EXT
- FCPATH
- SELF
- BASEPATH
- APPPATH
+- VIEWPATH
- CI_VERSION
- FILE_READ_MODE
- FILE_WRITE_MODE
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/helpers/array_helper.rst b/user_guide_src/source/helpers/array_helper.rst
index 4308753bb..15b5e17c4 100644
--- a/user_guide_src/source/helpers/array_helper.rst
+++ b/user_guide_src/source/helpers/array_helper.rst
@@ -21,17 +21,17 @@ The following functions are available:
element()
=========
-.. php:method:: element($item, $array, $default = FALSE)
+.. php:method:: element($item, $array, $default = NULL)
:param string $item: Item to fetch from the array
:param array $array: Input array
:param boolean $default: What to return if the array isn't valid
- :returns: FALSE on failure or the array item.
+ :returns: NULL on failure or the array item.
Lets you fetch an item from an array. The function tests whether the
array index is set and whether it has a value. If a value exists it is
-returned. If a value does not exist it returns FALSE, or whatever you've
+returned. If a value does not exist it returns NULL, or whatever you've
specified as the default value via the third parameter. Example
::
@@ -43,31 +43,31 @@ specified as the default value via the third parameter. Example
);
echo element('color', $array); // returns "red"
- echo element('size', $array, NULL); // returns NULL
+ echo element('size', $array, 'foobar'); // returns "foobar"
elements()
==========
Lets you fetch a number of items from an array. The function tests
whether each of the array indices is set. If an index does not exist it
-is set to FALSE, or whatever you've specified as the default value via
+is set to NULL, or whatever you've specified as the default value via
the third parameter.
-.. php:method:: elements($items, $array, $default = FALSE)
+.. php:method:: elements($items, $array, $default = NULL)
:param string $item: Item to fetch from the array
:param array $array: Input array
:param boolean $default: What to return if the array isn't valid
- :returns: FALSE on failure or the array item.
+ :returns: NULL on failure or the array item.
Example
::
$array = array(
- 'color' => 'red',  
- 'shape' => 'round',     
- 'radius' => '10',     
+ 'color' => 'red',
+ 'shape' => 'round',
+ 'radius' => '10',
'diameter' => '20'
);
@@ -78,25 +78,25 @@ The above will return the following array
::
array(
- 'color' => 'red',     
- 'shape' => 'round',     
- 'height' => FALSE
+ 'color' => 'red',
+ 'shape' => 'round',
+ 'height' => NULL
);
You can set the third parameter to any default value you like
::
- $my_shape = elements(array('color', 'shape', 'height'), $array, NULL);
+ $my_shape = elements(array('color', 'shape', 'height'), $array, 'foobar');
The above will return the following array
::
array(     
- 'color' => 'red',     
- 'shape' => 'round',     
- 'height' => NULL
+ 'color' => 'red',
+ 'shape' => 'round',
+ 'height' => 'foobar'
);
This is useful when sending the $_POST array to one of your Models.
diff --git a/user_guide_src/source/helpers/captcha_helper.rst b/user_guide_src/source/helpers/captcha_helper.rst
index 48095a11d..90244739b 100644
--- a/user_guide_src/source/helpers/captcha_helper.rst
+++ b/user_guide_src/source/helpers/captcha_helper.rst
@@ -102,7 +102,7 @@ Here is a table prototype
CREATE TABLE captcha (  
captcha_id bigint(13) unsigned NOT NULL auto_increment,  
captcha_time int(10) unsigned NOT NULL,  
- ip_address varchar(16) default '0' NOT NULL,  
+ ip_address varchar(45) NOT NULL,  
word varchar(20) NOT NULL,  
PRIMARY KEY `captcha_id` (`captcha_id`),  
KEY `word` (`word`)
diff --git a/user_guide_src/source/helpers/date_helper.rst b/user_guide_src/source/helpers/date_helper.rst
index ba079394d..e332a913f 100644
--- a/user_guide_src/source/helpers/date_helper.rst
+++ b/user_guide_src/source/helpers/date_helper.rst
@@ -40,7 +40,7 @@ If a timezone is not provided, it will return time() based on "time_reference" s
mdate()
=======
-This function is identical to PHPs `date() <http://www.php.net/date>`_
+This function is identical to PHP's `date() <http://www.php.net/date>`_
function, except that it lets you use MySQL style date codes, where each
code letter is preceded with a percent sign: %Y %m %d etc.
@@ -85,32 +85,29 @@ Example
The first parameter must contain the format, the second parameter must
contain the date as a Unix timestamp.
-Supported formats:
+.. note:: This function is DEPRECATED. Use the native ``date()`` combined
+ with `DateTime's format constants <http://www.php.net/manual/en/class.datetime.php#datetime.constants.types>`_
+ instead:
+
+ |
+ | echo date(DATE_RFC822, time());
-+----------------+------------------------+-----------------------------------+
-| 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 |
-+----------------+------------------------+-----------------------------------+
+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
+=============== ======================= ======================================
local_to_gmt()
==============
@@ -421,86 +418,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/form_helper.rst b/user_guide_src/source/helpers/form_helper.rst
index a110f3c14..fa7b3dbf9 100644
--- a/user_guide_src/source/helpers/form_helper.rst
+++ b/user_guide_src/source/helpers/form_helper.rst
@@ -543,3 +543,7 @@ This function is identical to the **set_checkbox()** function above.
<input type="radio" name="myradio" value="1" <?php echo set_radio('myradio', '1', TRUE); ?> />
<input type="radio" name="myradio" value="2" <?php echo set_radio('myradio', '2'); ?> />
+.. note:: If you are using the Form Validation class, you must always specify a rule for your field,
+ even if empty, in order for the set_*() functions to work. This is because if a Form Validation object
+ is defined, the control for set_*() is handed over to a method of the class instead of the generic helper
+ function. \ 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..1987dfb72 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
::
@@ -207,7 +207,12 @@ Creates a standard HTML email link. Usage example
echo mailto('me@my-site.com', 'Click Here to Contact Me');
As with the anchor() tab above, you can set attributes using the third
-parameter.
+parameter:
+
+::
+
+ $attributes = array('title' => 'Mail me');
+ echo mailto('me@my-site.com', 'Contact Me', $attributes);
safe_mailto()
=============
@@ -298,7 +303,7 @@ link. The function will build the URL based on your config file values.
The optional second parameter allows you to force a particular redirection
method. The available methods are "location" or "refresh", with location
-being faster but less reliable on Windows servers. The default is "auto",
+being faster but less reliable on IIS servers. The default is "auto",
which will attempt to intelligently choose the method based on the server
environment.
@@ -320,3 +325,7 @@ engine purposes. The default Response Code is 302. The third parameter is
.. note:: For very fine grained control over headers, you should use the
`Output Library </libraries/output>` set_header() function.
+
+.. note:: To IIS users: if you hide the `Server` HTTP header, the "auto"
+ method won't detect IIS, in that case it is advised you explicitly
+ use the "refresh" method.
diff --git a/user_guide_src/source/images/codeigniter_1.7.1_library_reference.png b/user_guide_src/source/images/codeigniter_1.7.1_library_reference.png
index 554ae2eed..7f054f95f 100644
--- a/user_guide_src/source/images/codeigniter_1.7.1_library_reference.png
+++ b/user_guide_src/source/images/codeigniter_1.7.1_library_reference.png
Binary files differ
diff --git a/user_guide_src/source/index.rst b/user_guide_src/source/index.rst
index 6cdeb2442..35089703f 100644
--- a/user_guide_src/source/index.rst
+++ b/user_guide_src/source/index.rst
@@ -1,34 +1,107 @@
-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 <license>`
+- :doc:`Change Log <changelog>`
+
+.. 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`
+- :doc:`libraries/sessions`
+
+****************
+Helper Reference
+****************
+
+.. toctree::
+ :glob:
+ :titlesonly:
+
+ helpers/index
+
+***************************
+Contributing to CodeIgniter
+***************************
+
+.. toctree::
+ :glob:
+ :titlesonly:
+
+ contributing/index
+ DCO
.. toctree::
:glob:
@@ -38,6 +111,7 @@ CodeIgniter is right for you if:
*
overview/index
general/requirements
+ general/welcome
installation/index
general/index
libraries/index
@@ -46,4 +120,4 @@ CodeIgniter is right for you if:
documentation/index
tutorial/index
general/quick_reference
- general/credits \ No newline at end of file
+ general/credits
diff --git a/user_guide_src/source/installation/downloads.rst b/user_guide_src/source/installation/downloads.rst
index a4a6b7fbe..45a8f80a7 100644
--- a/user_guide_src/source/installation/downloads.rst
+++ b/user_guide_src/source/installation/downloads.rst
@@ -2,9 +2,15 @@
Downloading CodeIgniter
#######################
-- `CodeIgniter V 2.1.0 (Current
+- `CodeIgniter V 3.0.0 (Current
version) <http://codeigniter.com/downloads/>`_
- `CodeIgniter V
+ 2.1.2 <http://codeigniter.com/download_files/reactor/CodeIgniter_2.1.2.zip>`_
+- `CodeIgniter V
+ 2.1.1 <http://codeigniter.com/download_files/reactor/CodeIgniter_2.1.1.zip>`_
+- `CodeIgniter V
+ 2.1.0 <http://codeigniter.com/download_files/reactor/CodeIgniter_2.1.0.zip>`_
+- `CodeIgniter V
2.0.3 <http://codeigniter.com/download_files/reactor/CodeIgniter_2.0.3.zip>`_
- `CodeIgniter V
2.0.2 <http://codeigniter.com/download_files/reactor/CodeIgniter_2.0.2.zip>`_
diff --git a/user_guide_src/source/installation/upgrade_210.rst b/user_guide_src/source/installation/upgrade_210.rst
index 9d7e1a265..5874bfc86 100644
--- a/user_guide_src/source/installation/upgrade_210.rst
+++ b/user_guide_src/source/installation/upgrade_210.rst
@@ -8,15 +8,19 @@ replacing the index.php file with a static one.
Step 1: Update your CodeIgniter files
=====================================
-Replace all files and directories in your "system" folder and replace
-your index.php file. If any modifications were made to your index.php
-they will need to be made fresh in this new one.
+Replace all files and directories in your "system" folder.
+
+.. note:: If you have any custom developed files in these folders please
+ make copies of them first.
Step 2: Replace config/user_agents.php
======================================
This config file has been updated to contain more user agent types,
-please copy it to application/config/user_agents.php.
+please copy it to _application/config/user_agents.php*.
-.. note:: If you have any custom developed files in these folders please
- make copies of them first. \ No newline at end of file
+Step 3: Update your user guide
+==============================
+
+Please also replace your local copy of the user guide with the new
+version. \ No newline at end of file
diff --git a/user_guide_src/source/installation/upgrade_211.rst b/user_guide_src/source/installation/upgrade_211.rst
new file mode 100644
index 000000000..59faca8e6
--- /dev/null
+++ b/user_guide_src/source/installation/upgrade_211.rst
@@ -0,0 +1,33 @@
+#############################
+Upgrading from 2.1.0 to 2.1.1
+#############################
+
+Before performing an update you should take your site offline by
+replacing the index.php file with a static one.
+
+Step 1: Update your CodeIgniter files
+=====================================
+
+Replace all files and directories in your "system" folder and replace
+your index.php file. If any modifications were made to your index.php
+they will need to be made fresh in this new one.
+
+.. note:: If you have any custom developed files in these folders please
+ make copies of them first.
+
+Step 2: Replace config/mimes.php
+================================
+
+This config file has been updated to contain more user mime-types, please copy
+it to _application/config/mimes.php*.
+
+Step 3: Update your IP address tables
+=====================================
+
+This upgrade adds support for IPv6 IP addresses. In order to store them, you need
+to enlarge your ip_address columns to 45 characters. For example, CodeIgniter's
+session table will need to change
+
+::
+
+ ALTER TABLE ci_sessions CHANGE ip_address ip_address varchar(45) default '0' NOT NULL \ No newline at end of file
diff --git a/user_guide_src/source/installation/upgrade_212.rst b/user_guide_src/source/installation/upgrade_212.rst
new file mode 100644
index 000000000..205ad8622
--- /dev/null
+++ b/user_guide_src/source/installation/upgrade_212.rst
@@ -0,0 +1,22 @@
+#############################
+Upgrading from 2.1.1 to 2.1.2
+#############################
+
+Before performing an update you should take your site offline by
+replacing the index.php file with a static one.
+
+Step 1: Update your CodeIgniter files
+=====================================
+
+Replace all files and directories in your "system" folder and replace
+your index.php file. If any modifications were made to your index.php
+they will need to be made fresh in this new one.
+
+.. note:: If you have any custom developed files in these folders please
+ make copies of them first.
+
+Step 2: Update your user guide
+==============================
+
+Please also replace your local copy of the user guide with the new
+version. \ No newline at end of file
diff --git a/user_guide_src/source/installation/upgrade_300.rst b/user_guide_src/source/installation/upgrade_300.rst
index c70737cff..31a5c0761 100644
--- a/user_guide_src/source/installation/upgrade_300.rst
+++ b/user_guide_src/source/installation/upgrade_300.rst
@@ -1,15 +1,14 @@
#############################
-Upgrading from 2.1.0 to 3.0.0
+Upgrading from 2.1.2 to 3.0.0
#############################
.. note:: These upgrade notes are for a version that is yet to be released.
+Before performing an update you should take your site offline by replacing the index.php file with a static one.
-Before performing an update you should take your site offline by
-replacing the index.php file with a static one.
-
+*************************************
Step 1: Update your CodeIgniter files
-=====================================
+*************************************
Replace all files and directories in your "system" folder and replace
your index.php file. If any modifications were made to your index.php
@@ -18,31 +17,154 @@ they will need to be made fresh in this new one.
.. note:: If you have any custom developed files in these folders please
make copies of them first.
-Step 2: Change References to the SHA Library
-============================================
-
-The previously deprecated SHA library has been removed in CodeIgniter 3.0.
-Alter your code to use the native `sha1()` PHP function to generate a sha1 hash.
+********************************
+Step 2: Replace config/mimes.php
+********************************
-Additionally, the `sha1()` method in the :doc:`Encryption Library <../libraries/encryption>` has been removed.
+This config file has been updated to contain more user mime-types, please copy
+it to _application/config/mimes.php*.
+**************************************************************
Step 3: Remove $autoload['core'] from your config/autoload.php
-==============================================================
+**************************************************************
+
+Use of the ``$autoload['core']`` config array has been deprecated as of CodeIgniter 1.4.1 and is now removed.
+Move any entries that you might have listed there to ``$autoload['libraries']`` instead.
+
+**************************************************************
+Step 4: Add new session driver items to your config/config.php
+**************************************************************
+
+With the change from a single Session Library to the new Session Driver, two new config items have been added:
-Use of the `$autoload['core']` config array has been deprecated as of CodeIgniter 1.4.1 and is now removed.
-Move any entries that you might have listed there to `$autoload['libraries']` instead.
+ - ``$config['sess_driver']`` selects which driver to initially load. Options are:
+ - 'cookie' (the default) for classic CodeIgniter cookie-based sessions
+ - 'native' for native PHP Session support
+ - the name of a custom driver you have provided (see :doc:`Session Driver <../libraries/sessions>` for more info)
+ - ``$config['sess_valid_drivers']`` provides an array of additional custom drivers to make available for loading
-Step 4: Update your config/database.php
-=======================================
+As the new Session Driver library loads the classic Cookie driver by default and always makes 'cookie' and 'native'
+available as valid drivers, neither of these configuration items are required. However, it is recommended that you
+add them for clarity and ease of configuration in the future.
-Due to 3.0.0's renaming of Active Record to Query Builder, inside your _config/database.php_, you will
+***************************************
+Step 5: 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
need to rename the `$active_record` variable to `$query_builder`.
$active_group = 'default';
// $active_record = TRUE;
$query_builder = TRUE;
-Step 5: Move your errors folder
-===============================
+*******************************
+Step 6: Move your errors folder
+*******************************
+
+In version 3.0.0, the errors folder has been moved from _application/errors* to _application/views/errors*.
+
+****************************************************************************
+Step 7: Check the calls to Array Helper's element() and elements() functions
+****************************************************************************
+
+The default return value of these functions, when the required elements
+don't exist, has been changed from FALSE to NULL.
+
+***************************************************************
+Step 8: Remove usage of (previously) deprecated functionalities
+***************************************************************
+
+In addition to the ``$autoload['core']`` configuration setting, there's a number of other functionalities
+that have been removed in CodeIgniter 3.0.0:
+
+The SHA1 library
+================
+
+The previously deprecated SHA1 library has been removed, alter your code to use PHP's native
+``sha1()`` function to generate a SHA1 hash.
+
+Additionally, the ``sha1()`` method in the :doc:`Encryption Library <../libraries/encryption>` has been removed.
+
+The EXT constant
+================
+
+Usage of the ``EXT`` constant has been deprecated since dropping support for PHP 4. There's no
+longer a need to maintain different filename extensions and in this new CodeIgniter version,
+the ``EXT`` constant has been removed. Use just '.php' instead.
+
+Smiley helper js_insert_smiley()
+================================
+
+:doc:`Smiley Helper <../helpers/smiley_helper>` function ``js_insert_smiley()`` has been deprecated
+since CodeIgniter 1.7.2 and is now removed. You'll need to switch to ``smiley_js()`` instead.
+
+Security helper do_hash()
+=========================
+
+:doc:`Security Helper <../helpers/security_helper>` function ``do_hash()`` is now just an alias for
+PHP's native ``hash()`` function. It is deprecated and scheduled for removal in CodeIgniter 3.1+.
+
+.. note:: This function is still available, but you're strongly encouraged to remove it's usage sooner
+ rather than later.
+
+File helper read_file()
+=======================
+
+:doc:`File Helper <../helpers/file_helper>` function ``read_file()`` is now just an alias for
+PHP's native ``file_get_contents()`` function. It is deprecated and scheduled for removal in
+CodeIgniter 3.1+.
+
+.. note:: This function is still available, but you're strongly encouraged to remove it's usage sooner
+ rather than later.
+
+Date helper standard_date()
+===========================
+
+:doc:`Date Helper <../helpers/date_helper>` function ``standard_date()`` is being deprecated due
+to the availability of native PHP `constants <http://www.php.net/manual/en/class.datetime.php#datetime.constants.types>`_,
+which when combined with ``date()`` provide the same functionality. Furthermore, they have the
+exact same names as the ones supported by ``standard_date()``. Here are examples of how to replace
+it's usage:
+
+::
+
+ // Old way
+ standard_date(); // defaults to standard_date('DATE_RFC822', now());
+
+ // Replacement
+ date(DATE_RFC822, now());
+
+ // Old way
+ standard_date('DATE_ATOM', $time);
+
+ // Replacement
+ date(DATE_ATOM, $time);
+
+.. note:: This function is still available, but you're strongly encouraged to remove its' usage sooner
+ rather than later as it is scheduled for removal in CodeIgniter 3.1+.
+
+Pagination library 'anchor_class' setting
+=========================================
+
+The :doc:`Pagination Library <../libraries/pagination>` now supports adding pretty much any HTML
+attribute to your anchors via the 'attributes' configuration setting. This includes passing the
+'class' attribute and using the separate 'anchor_class' setting no longer makes sense.
+As a result of that, the 'anchor_class' setting is now deprecated and scheduled for removal in
+CodeIgniter 3.1+.
+
+.. note:: This setting is still available, but you're strongly encouraged to remove its' usage sooner
+ rather than later.
+
+Email library
+=============
+
+The :doc:`Email library <../libraries/email>` will automatically clear the set parameters after successfully sending
+emails. To override this behaviour, pass FALSE as the first parameter in the ``send()`` function:
+
+::
-In version 3.0.0, the errors folder has been moved from _application/errors_ to _application/views/errors_. \ No newline at end of file
+ if ($this->email->send(FALSE))
+ {
+ // Parameters won't be cleared
+ }
diff --git a/user_guide_src/source/installation/upgrading.rst b/user_guide_src/source/installation/upgrading.rst
index 255c6a557..545f344ee 100644
--- a/user_guide_src/source/installation/upgrading.rst
+++ b/user_guide_src/source/installation/upgrading.rst
@@ -5,8 +5,10 @@ Upgrading From a Previous Version
Please read the upgrade notes corresponding to the version you are
upgrading from.
-- :doc:`Upgrading from 2.1.1 to 3.0.0 <upgrade_300>`
+- :doc:`Upgrading from 2.1.2 to 3.0.0 <upgrade_300>`
+- :doc:`Upgrading from 2.1.1 to 2.1.2 <upgrade_212>`
- :doc:`Upgrading from 2.1.0 to 2.1.1 <upgrade_211>`
+- :doc:`Upgrading from 2.0.3 to 2.1.0 <upgrade_210>`
- :doc:`Upgrading from 2.0.2 to 2.0.3 <upgrade_203>`
- :doc:`Upgrading from 2.0.1 to 2.0.2 <upgrade_202>`
- :doc:`Upgrading from 2.0 to 2.0.1 <upgrade_201>`
diff --git a/user_guide_src/source/libraries/config.rst b/user_guide_src/source/libraries/config.rst
index 694896353..08d9c2905 100644
--- a/user_guide_src/source/libraries/config.rst
+++ b/user_guide_src/source/libraries/config.rst
@@ -175,7 +175,7 @@ This function retrieves the URL to your site, plus an optional path such
as to a stylesheet or image.
The two functions above are normally accessed via the corresponding
-functions in the :doc:`URL Helper <helpers/url_helper>`.
+functions in the :doc:`URL Helper </helpers/url_helper>`.
$this->config->system_url();
*****************************
diff --git a/user_guide_src/source/libraries/email.rst b/user_guide_src/source/libraries/email.rst
index 8d2549d11..fc324ffc9 100644
--- a/user_guide_src/source/libraries/email.rst
+++ b/user_guide_src/source/libraries/email.rst
@@ -190,7 +190,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::
@@ -233,6 +233,14 @@ success or failure, enabling it to be used conditionally::
// Generate error
}
+This function will automatically clear all parameters if the request was
+successful. To stop this behaviour pass FALSE::
+
+ if ($this->email->send(FALSE))
+ {
+ // Parameters won't be cleared
+ }
+
$this->email->attach()
----------------------
diff --git a/user_guide_src/source/libraries/file_uploading.rst b/user_guide_src/source/libraries/file_uploading.rst
index 65cd5c722..1698dcbb9 100644
--- a/user_guide_src/source/libraries/file_uploading.rst
+++ b/user_guide_src/source/libraries/file_uploading.rst
@@ -197,6 +197,7 @@ Preference Default Value Options Descripti
Separate multiple types with a pipe.
**file_name** None Desired file name If set CodeIgniter will rename the uploaded file to this name. The
extension provided in the file name must also be an allowed file type.
+ If no extension is provided in the original file_name will be used.
**overwrite** FALSE TRUE/FALSE (boolean) If set to true, if a file with the same name as the one you are
uploading exists, it will be overwritten. If set to false, a number will
be appended to the filename if another with the same name exists.
diff --git a/user_guide_src/source/libraries/form_validation.rst b/user_guide_src/source/libraries/form_validation.rst
index 3bcad7ba6..faf221981 100644
--- a/user_guide_src/source/libraries/form_validation.rst
+++ b/user_guide_src/source/libraries/form_validation.rst
@@ -861,8 +861,9 @@ Rule Parameter Description
========================= ========== ============================================================================================= =======================
**required** No Returns FALSE if the form element is empty.
**matches** Yes Returns FALSE if the form element does not match the one in the parameter. matches[form_item]
-**is_unique** Yes Returns FALSE if the form element is not unique to the is_unique[table.field]
- table and field name in the parameter. is_unique[table.field]
+**is_unique** Yes Returns FALSE if the form element is not unique to the table and field name in the is_unique[table.field]
+ parameter. Note: This rule requires :doc:`Query Builder <database/query_builder>` to be
+ enabled in order to work.
**max_length** Yes Returns FALSE if the form element is longer then the parameter value. max_length[12]
**exact_length** Yes Returns FALSE if the form element is not exactly the parameter value. exact_length[8]
**greater_than** Yes Returns FALSE if the form element is less than or equal to the parameter value or not greater_than[8]
@@ -884,7 +885,6 @@ Rule Parameter Description
0, 1, 2, 3, etc.
**is_natural_no_zero** No Returns FALSE if the form element contains anything other than a natural
number, but not zero: 1, 2, 3, etc.
-**is_unique** Yes Returns FALSE if the form element is not unique in a database table. is_unique[table.field]
**valid_email** No Returns FALSE if the form element does not contain a valid email address.
**valid_emails** No Returns FALSE if any value provided in a comma separated list is not a valid email.
**valid_ip** No Returns FALSE if the supplied IP is not valid.
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()
======================
diff --git a/user_guide_src/source/libraries/image_lib.rst b/user_guide_src/source/libraries/image_lib.rst
index ed6575c62..dcdccbd92 100644
--- a/user_guide_src/source/libraries/image_lib.rst
+++ b/user_guide_src/source/libraries/image_lib.rst
@@ -91,9 +91,9 @@ error upon failure, like this::
echo $this->image_lib->display_errors();
}
-Note: You can optionally specify the HTML formatting to be applied to
-the errors, by submitting the opening/closing tags in the function, like
-this::
+.. note:: You can optionally specify the HTML formatting to be applied to
+ the errors, by submitting the opening/closing tags in the function,
+ like this::
$this->image_lib->display_errors('<p>', '</p>');
@@ -225,8 +225,7 @@ pixels) specifying where to crop, like this::
$config['y_axis'] = '40';
All preferences listed in the table above are available for this
-function except these: rotation_angle, width, height, create_thumb,
-new_image.
+function except these: rotation_angle, create_thumb, new_image.
Here's an example showing how you might crop an image::
@@ -243,11 +242,11 @@ Here's an example showing how you might crop an image::
echo $this->image_lib->display_errors();
}
-Note: Without a visual interface it is difficult to crop images, so this
-function is not very useful unless you intend to build such an
-interface. That's exactly what we did using for the photo gallery module
-in ExpressionEngine, the CMS we develop. We added a JavaScript UI that
-lets the cropping area be selected.
+.. note:: Without a visual interface it is difficult to crop images, so this
+ function is not very useful unless you intend to build such an
+ interface. That's exactly what we did using for the photo gallery module
+ in ExpressionEngine, the CMS we develop. We added a JavaScript UI that
+ lets the cropping area be selected.
$this->image_lib->rotate()
===========================
@@ -338,8 +337,8 @@ The above example will use a 16 pixel True Type font to create the text
bottom/center of the image, 20 pixels from the bottom of the image.
.. note:: In order for the image class to be allowed to do any
- processing, the image file must have "write" file permissions. For
- example, 777.
+ processing, the image file must have "write" file permissions
+ For example, 777.
Watermarking Preferences
========================
diff --git a/user_guide_src/source/libraries/loader.rst b/user_guide_src/source/libraries/loader.rst
index aadf9740a..615aba1c2 100644
--- a/user_guide_src/source/libraries/loader.rst
+++ b/user_guide_src/source/libraries/loader.rst
@@ -4,6 +4,7 @@ Loader Class
Loader, as the name suggests, is used to load elements. These elements
can be libraries (classes) :doc:`View files <../general/views>`,
+:doc:`Drivers <../general/drivers>`,
:doc:`Helpers <../general/helpers>`,
:doc:`Models <../general/models>`, or your own files.
@@ -74,6 +75,70 @@ Assigning a Library to a different object name
If the third (optional) parameter is blank, the library will usually be
assigned to an object with the same name as the library. For example, if
+the library is named Calendar, it will be assigned to a variable named
+$this->calendar.
+
+If you prefer to set your own class names you can pass its value to the
+third parameter::
+
+ $this->load->library('calendar', '', 'my_calendar');
+
+ // Calendar class is now accessed using:
+
+ $this->my_calendar
+
+Please take note, when multiple libraries are supplied in an array for
+the first parameter, this parameter is discarded.
+
+$this->load->driver('parent_name', $config, 'object name')
+===========================================================
+
+This function is used to load driver libraries. Where parent_name is the
+name of the parent class you want to load.
+
+As an example, if you would like to use sessions with CodeIgniter, the first
+step is to load the session driver within your controller::
+
+ $this->load->driver('session');
+
+Once loaded, the library will be ready for use, using
+$this->session->*some_function*().
+
+Driver files must be stored in a subdirectory within the main
+"libraries" folder, or within your personal application/libraries
+folder. The subdirectory must match the parent class name. Read the
+:doc:`Drivers <../general/drivers>` description for details.
+
+Additionally, multiple driver libraries can be loaded at the same time by
+passing an array of drivers to the load function.
+
+::
+
+ $this->load->driver(array('session', 'cache'));
+
+Setting options
+---------------
+
+The second (optional) parameter allows you to optionally pass
+configuration settings. You will typically pass these as an array::
+
+ $config = array (
+ 'sess_driver' => 'cookie',
+ 'sess_encrypt_cookie' => true,
+ 'encryption_key' => 'mysecretkey'
+ );
+
+ $this->load->driver('session', $config);
+
+Config options can usually also be set via a config file. Each library
+is explained in detail in its own page, so please read the information
+regarding each one you would like to use.
+
+Assigning a Driver to a different object name
+----------------------------------------------
+
+If the third (optional) parameter is blank, the library will be assigned
+to an object with the same name as the parent class. For example, if
the library is named Session, it will be assigned to a variable named
$this->session.
@@ -86,8 +151,8 @@ third parameter::
$this->my_session
-Please take note, when multiple libraries are supplied in an array for
-the first parameter, this parameter is discarded.
+.. note:: Driver libraries may also be loaded with the library() method,
+ but it is faster to use driver()
$this->load->view('file_name', $data, true/false)
==================================================
@@ -279,6 +344,6 @@ calling add_package_path().
$this->load->remove_package_path(APPPATH.'my_app');
// Again without the second parameter:
- $this->load->add_package_path(APPPATH.'my_app', TRUE);
+ $this->load->add_package_path(APPPATH.'my_app');
$this->load->view('my_app_index'); // Loads
- $this->load->view('welcome_message'); // Loads \ No newline at end of file
+ $this->load->view('welcome_message'); // Loads
diff --git a/user_guide_src/source/libraries/migration.rst b/user_guide_src/source/libraries/migration.rst
index 5192f1f29..cb7d96a6d 100644
--- a/user_guide_src/source/libraries/migration.rst
+++ b/user_guide_src/source/libraries/migration.rst
@@ -2,4 +2,136 @@
Migrations Class
################
-Coming soon. \ No newline at end of file
+Migrations are a convenient way for you to alter your database in a
+structured and organized manner. You could edit fragments of SQL by hand
+but you would then be responsible for telling other developers that they
+need to go and run them. You would also have to keep track of which changes
+need to be run against the production machines next time you deploy.
+
+The database table **migration** tracks which migrations have already been
+run so all you have to do is update your application files and
+call **$this->migrate->current()** to work out which migrations should be run.
+The current version is found in **config/migration.php**.
+
+******************
+Create a Migration
+******************
+
+.. note:: Each Migration is run in numerical order forward or backwards
+ depending on the method taken. Use a prefix of 3 numbers followed by an
+ underscore for the filename of your migration.
+
+This will be the first migration for a new site which has a blog. All
+migrations go in the folder **application/migrations/** and have names such
+as: **001_add_blog.php**.::
+
+ defined('BASEPATH') OR exit('No direct script access allowed');
+
+ class Migration_Add_blog extends CI_Migration {
+
+ public function up()
+ {
+ $this->dbforge->add_field(array(
+ 'blog_id' => array(
+ 'type' => 'INT',
+ 'constraint' => 5,
+ 'unsigned' => TRUE,
+ 'auto_increment' => TRUE
+ ),
+ 'blog_title' => array(
+ 'type' => 'VARCHAR',
+ 'constraint' => '100',
+ ),
+ 'blog_description' => array(
+ 'type' => 'TEXT',
+ 'null' => TRUE,
+ ),
+ ));
+
+ $this->dbforge->create_table('blog');
+ }
+
+ public function down()
+ {
+ $this->dbforge->drop_table('blog');
+ }
+
+Then in **application/config/migration.php** set **$config['migration_version'] = 1;**.
+
+*************
+Usage Example
+*************
+
+In this example some simple code is placed in **application/controllers/migrate.php**
+to update the schema.::
+
+ $this->load->library('migration');
+
+ if ( ! $this->migration->current())
+ {
+ show_error($this->migration->error_string());
+ }
+
+******************
+Function Reference
+******************
+
+There are five available methods for the Migration class:
+
+- $this->migration->current();
+- $this->migration->error_string();
+- $this->migration->find_migrations();
+- $this->migration->latest();
+- $this->migration->version();
+
+$this->migration->current()
+============================
+
+The current migration is whatever is set for **$config['migration_version']** in
+**application/config/migration.php**.
+
+$this->migration->error_string()
+=================================
+
+This returns a string of errors while performing a migration.
+
+$this->migration->find_migrations()
+====================================
+
+An array of migration filenames are returned that are found in the **migration_path**
+property.
+
+$this->migration->latest()
+===========================
+
+This works much the same way as current() but instead of looking for
+the **$config['migration_version']** the Migration class will use the very
+newest migration found in the filesystem.
+
+$this->migration->version()
+============================
+
+Version can be used to roll back changes or step forwards programmatically to
+specific versions. It works just like current but ignores **$config['migration_version']**.::
+
+ $this->load->library('migration');
+
+ $this->migration->version(5);
+
+*********************
+Migration Preferences
+*********************
+
+The following is a table of all the config options for migrations.
+
+========================== ====================== ============= =============================================
+Preference Default Options Description
+========================== ====================== ============= =============================================
+**migration_enabled** FALSE TRUE / FALSE Enable or disable migrations.
+**migration_path** APPPATH.'migrations/' None The path to your migrations folder.
+**migration_version** 0 None The current version your database should use.
+**migration_table** migrations None The table name for storing the shema
+ version number.
+**migration_auto_latest** FALSE TRUE / FALSE Enable or disable automatically
+ running migrations.
+========================== ====================== ============= =============================================
diff --git a/user_guide_src/source/libraries/pagination.rst b/user_guide_src/source/libraries/pagination.rst
index 6e1020be3..00554c1c7 100644
--- a/user_guide_src/source/libraries/pagination.rst
+++ b/user_guide_src/source/libraries/pagination.rst
@@ -80,7 +80,7 @@ The number of "digit" links you would like before and after the selected
page number. For example, the number 2 will place two digits on either
side, as in the example links at the very top of this page.
-$config['use_page_number'] = TRUE;
+$config['use_page_numbers'] = TRUE;
==================================
By default, the URI segment will use the starting index for the items
@@ -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
diff --git a/user_guide_src/source/libraries/sessions.rst b/user_guide_src/source/libraries/sessions.rst
index 5400524a9..dd9e8cbb4 100644
--- a/user_guide_src/source/libraries/sessions.rst
+++ b/user_guide_src/source/libraries/sessions.rst
@@ -1,29 +1,19 @@
-#############
-Session Class
-#############
+##############
+Session Driver
+##############
The Session class permits you maintain a user's "state" and track their
-activity while they browse your site. The Session class stores session
-information for each user as serialized (and optionally encrypted) data
-in a cookie. It can also store the session data in a database table for
-added security, as this permits the session ID in the user's cookie to
-be matched against the stored session ID. By default only the cookie is
-saved. If you choose to use the database option you'll need to create
-the session table as indicated below.
-
-.. note:: The Session class does **not** utilize native PHP sessions. It
- generates its own session data, offering more flexibility for
- developers.
-
-.. note:: Even if you are not using encrypted sessions, you must set
- an :doc:`encryption key <./encryption>` in your config file which is used
- to aid in preventing session data manipulation.
+activity while they browse your site. CodeIgniter offers two default
+session drivers: the classic `Cookie Driver`_, and the `Native Driver`_,
+which supports usage of the native PHP Session mechanism. In addition,
+you may create your own `Custom Drivers`_ to store session data however
+you wish, while still taking advantage of the features of the Session class.
Initializing a Session
======================
Sessions will typically run globally with each page load, so the session
-class must either be :doc:`initialized <../general/libraries>` in your
+class must either be :doc:`initialized <../general/drivers>` in your
:doc:`controller <../general/controllers>` constructors, or it can be
:doc:`auto-loaded <../general/autoloader>` by the system. For the most
part the session class will run unattended in the background, so simply
@@ -31,22 +21,25 @@ initializing the class will cause it to read, create, and update
sessions.
To initialize the Session class manually in your controller constructor,
-use the $this->load->library function::
+use the $this->load->driver function::
- $this->load->library('session');
+ $this->load->driver('session');
Once loaded, the Sessions library object will be available using:
$this->session
+.. note:: For backward compatibility, the Session class may stil be loaded
+ using the $this->load->library function, but converting your applications
+ to use $this->load->driver is strongly recommended.
+
How do Sessions work?
=====================
When a page is loaded, the session class will check to see if valid
-session data exists in the user's session cookie. If sessions data does
-**not** exist (or if it has expired) a new session will be created and
-saved in the cookie. If a session does exist, its information will be
-updated and the cookie will be updated. With each update, the
-session_id will be regenerated.
+session data exists in the user's session. If sessions data does **not**
+exist (or if it has expired) a new session will be created and saved.
+If a session does exist, its information will be updated. With each update,
+the session_id will be regenerated.
It's important for you to understand that once initialized, the Session
class runs automatically. There is nothing you need to do to cause the
@@ -79,19 +72,12 @@ prototype::
'last_activity' => timestamp
)
-If you have the encryption option enabled, the serialized array will be
-encrypted before being stored in the cookie, making the data highly
-secure and impervious to being read or altered by someone. More info
-regarding encryption can be :doc:`found here <encryption>`, although
-the Session class will take care of initializing and encrypting the data
-automatically.
-
-Note: Session cookies are only updated every five minutes by default to
-reduce processor load. If you repeatedly reload a page you'll notice
-that the "last activity" time only updates if five minutes or more has
-passed since the last time the cookie was written. This time is
-configurable by changing the $config['sess_time_to_update'] line in
-your system/config/config.php file.
+.. note:: Sessions are only updated every five minutes by default to
+ reduce processor load. If you repeatedly reload a page you'll notice
+ that the "last activity" time only updates if five minutes or more has
+ passed since the last time the cookie was written. This time is
+ configurable by changing the $config['sess_time_to_update'] line in
+ your system/config/config.php file.
Retrieving Session Data
=======================
@@ -106,7 +92,7 @@ fetch. For example, to fetch the session ID you will do this::
$session_id = $this->session->userdata('session_id');
-.. note:: The function returns FALSE (boolean) if the item you are
+.. note:: The function returns NULL if the item you are
trying to access does not exist.
Adding Custom Session Data
@@ -117,7 +103,7 @@ to it and it will be stored in the user's cookie. Why would you want to
do this? Here's one example:
Let's say a particular user logs into your site. Once authenticated, you
-could add their username and email address to the session cookie, making
+could add their username and email address to the session, making
that data globally available to you without having to run a database
query when you need it.
@@ -144,11 +130,11 @@ supports this syntax.
$this->session->set_userdata('some_name', 'some_value');
+If you want to verify that a userdata value exists, call has_userdata().
-.. note:: Cookies can only hold 4KB of data, so be careful not to exceed
- the capacity. The encryption process in particular produces a longer
- data string than the original so keep careful track of how much data you
- are storing.
+::
+
+ $this->session->has_userdata('some_name');
Retrieving All Session Data
===========================
@@ -195,8 +181,8 @@ available for the next server request, and are then automatically
cleared. These can be very useful, and are typically used for
informational or status messages (for example: "record 2 deleted").
-Note: Flash variables are prefaced with "flash\_" so avoid this prefix
-in your own session names.
+.. note:: Flash variables are prefaced with "flash\_" so avoid this prefix
+ in your own session names.
To add flashdata::
@@ -222,9 +208,162 @@ additional request, you can do so using the keep_flashdata() function.
$this->session->keep_flashdata('item');
+Tempdata
+========
+
+CodeIgniter also supports "tempdata", or session data with a specific
+expiration time. After the value expires, or the session expires or is
+deleted, the value is automatically removed.
+
+To add tempdata::
+
+ $expire = 300; // Expire in 5 minutes
+
+ $this->session->set_tempdata('item', 'value', $expire);
+
+You can also pass an array to set_tempdata()::
+
+ $tempdata = array('newuser' => TRUE, 'message' => 'Thanks for joining!');
+
+ $this->session->set_tempdata($tempdata, '', $expire);
+
+.. note:: If the expiration is omitted or set to 0, the default expiration of
+ 5 minutes will be used.
+
+To read a tempdata variable::
+
+ $this->session->tempdata('item');
+
+If you need to remove a tempdata value before it expires,
+use unset_tempdata()::
+
+ $this->session->unset_tempdata('item');
+
+Destroying a Session
+====================
+
+To clear the current session::
+
+ $this->session->sess_destroy();
+
+.. note:: This function should be the last one called, and even flash
+ variables will no longer be available. If you only want some items
+ destroyed and not all, use unset_userdata().
+
+Session Preferences
+===================
+
+You'll find the following Session related preferences in your
+application/config/config.php file:
+
+=========================== =============== =========================== ==========================================================================
+Preference Default Options Description
+=========================== =============== =========================== ==========================================================================
+**sess_driver** cookie cookie/native/*custom* The initial session driver to load.
+**sess_valid_drivers** cookie, native None Additional valid drivers which may be loaded.
+**sess_cookie_name** ci_session None The name you want the session cookie saved as (data for Cookie driver or
+ session ID for Native driver).
+**sess_expiration** 7200 None The number of seconds you would like the session to last. The default
+ value is 2 hours (7200 seconds). If you would like a non-expiring
+ session set the value to zero: 0
+**sess_expire_on_close** FALSE TRUE/FALSE (boolean) Whether to cause the session to expire automatically when the browser
+ window is closed.
+**sess_encrypt_cookie** FALSE TRUE/FALSE (boolean) Whether to encrypt the session data (Cookie driver only).
+**sess_use_database** FALSE TRUE/FALSE (boolean) Whether to save the session data to a database. You must create the
+ table before enabling this option (Cookie driver only).
+**sess_table_name** ci_sessions Any valid SQL table name The name of the session database table (Cookie driver only).
+**sess_time_to_update** 300 Time in seconds This options controls how often the session class will regenerate itself
+ and create a new session id.
+**sess_match_ip** FALSE TRUE/FALSE (boolean) Whether to match the user's IP address when reading the session data.
+ Note that some ISPs dynamically changes the IP, so if you want a
+ non-expiring session you will likely set this to FALSE.
+**sess_match_useragent** TRUE TRUE/FALSE (boolean) Whether to match the User Agent when reading the session data.
+=========================== =============== =========================== ==========================================================================
+
+In addition to the values above, the cookie and native drivers apply the
+following configuration values shared by the :doc:`Input <input>` and
+:doc:`Security <security>` classes:
+
+=========================== =============== ==========================================================================
+Preference Default Description
+=========================== =============== ==========================================================================
+**cookie_prefix** '' Set a cookie name prefix in order to avoid name collisions
+**cookie_domain** '' The domain for which the session is applicable
+**cookie_path** / The path to which the session is applicable
+=========================== =============== ==========================================================================
+
+Session Drivers
+===============
+
+By default, the `Cookie Driver`_ is loaded when a session is initialized.
+However, any valid driver may be selected with the $config['sess_driver']
+line in your config.php file.
+
+The session driver library comes with the cookie and native drivers
+installed, and `Custom Drivers`_ may also be installed by the user.
+
+Typically, only one driver will be used at a time, but CodeIgniter does
+support loading multiple drivers. If a specific valid driver is called, it
+will be automatically loaded. Or, an additional driver may be explicitly
+loaded by calling load_driver()::
+
+ $this->session->load_driver('native');
+
+The Session library keeps track of the most recently selected driver to call
+for driver methods. Normally, session class methods are called directly on
+the parent class, as illustrated above. However, any methods called through
+a specific driver will select that driver before invoking the parent method.
+
+So, alternation between multiple drivers can be achieved by specifying which
+driver to use for each call::
+
+ $this->session->native->set_userdata('foo', 'bar');
+
+ $this->session->cookie->userdata('foo');
+
+ $this->session->native->unset_userdata('foo');
+
+Notice in the previous example that the *native* userdata value 'foo'
+would be set to 'bar', which would NOT be returned by the call for
+the *cookie* userdata 'foo', nor would the *cookie* value be unset by
+the call to unset the *native* 'foo' value. The drivers maintain independent
+sets of values, regardless of key names.
+
+A specific driver may also be explicitly selected for use by pursuant
+methods with the select_driver() call::
+
+ $this->session->select_driver('native');
+
+ $this->session->userdata('item'); // Uses the native driver
+
+Cookie Driver
+-------------
+
+The Cookie driver stores session information for each user as serialized
+(and optionally encrypted) data in a cookie. It can also store the session
+data in a database table for added security, as this permits the session ID
+in the user's cookie to be matched against the stored session ID. By default
+only the cookie is saved. If you choose to use the database option you'll
+need to create the session table as indicated below.
+
+If you have the encryption option enabled, the serialized array will be
+encrypted before being stored in the cookie, making the data highly
+secure and impervious to being read or altered by someone. More info
+regarding encryption can be :doc:`found here <encryption>`, although
+the Session class will take care of initializing and encrypting the data
+automatically.
+
+.. note:: Even if you are not using encrypted sessions, you must set
+ an :doc:`encryption key <./encryption>` in your config file which is used
+ to aid in preventing session data manipulation.
+
+.. note:: Cookies can only hold 4KB of data, so be careful not to exceed
+ the capacity. The encryption process in particular produces a longer
+ data string than the original so keep careful track of how much data you
+ are storing.
Saving Session Data to a Database
-=================================
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
While the session data array stored in the user's cookie contains a
Session ID, unless you store session data in a database there is no way
@@ -267,44 +406,83 @@ session class::
$config['sess_table_name'] = 'ci_sessions';
-.. note:: The Session class has built-in garbage collection which clears
+.. note:: The Cookie driver has built-in garbage collection which clears
out expired sessions so you do not need to write your own routine to do
it.
-Destroying a Session
-====================
+Native Driver
+-------------
-To clear the current session::
+The Native driver relies on native PHP sessions to store data in the
+$_SESSION superglobal array. All stored values continue to be available
+through $_SESSION, but flash- and temp- data items carry special prefixes.
- $this->session->sess_destroy();
+Custom Drivers
+--------------
-.. note:: This function should be the last one called, and even flash
- variables will no longer be available. If you only want some items
- destroyed and not all, use unset_userdata().
+You may also :doc:`create your own <../general/creating_drivers>` custom
+session drivers. A session driver basically manages an array of name/value
+pairs with some sort of storage mechanism.
-Session Preferences
-===================
+To make a new driver, extend CI_Session_driver. Overload the initialize()
+method and read or create session data. Then implement a save handler to
+write changed data to storage (sess_save), a destroy handler to remove
+deleted data (sess_destroy), a regenerate handler to make a new session ID
+(sess_regenerate), and an access handler to expose the data (get_userdata).
+Your initial class might look like::
-You'll find the following Session related preferences in your
-application/config/config.php file:
+ class CI_Session_custom extends CI_Session_driver {
+ protected function initialize()
+ {
+ // Read existing session data or create a new one
+ }
+
+ public function sess_save()
+ {
+ // Save current data to storage
+ }
+
+ public function sess_destroy()
+ {
+ // Destroy the current session and clean up storage
+ }
+
+ public function sess_regenerate()
+ {
+ // Create new session ID
+ }
+
+ public function &get_userdata()
+ {
+ // Return a reference to your userdata array
+ }
+ }
+
+Notice that get_userdata() returns a reference so the parent library is
+accessing the same array the driver object is using. This saves memory
+and avoids synchronization issues during usage.
+
+Put your driver in the libraries/Session/drivers folder anywhere in your
+package paths. This includes the application directory, the system directory,
+or any path you add with $CI->load->add_package_path(). Your driver must be
+named CI_Session_<name>, and your filename must be Session_<name>.php,
+preferably also capitalized, such as::
+
+ CI_Session_foo in libraries/Session/drivers/Session_foo.php
+
+Then specify the driver by setting 'sess_driver' in your config.php file or as a
+parameter when loading the CI_Session object::
+
+ $config['sess_driver'] = 'foo';
+
+OR::
+
+ $CI->load->driver('session', array('sess_driver' => 'foo'));
+
+The driver specified by 'sess_driver' is automatically included as a valid
+driver. However, if you want to make a custom driver available as an option
+without making it the initially loaded driver, set 'sess_valid_drivers' in
+your config.php file to an array including your driver name::
+
+ $config['sess_valid_drivers'] = array('sess_driver');
-=========================== =============== =========================== ==========================================================================
-Preference Default Options Description
-=========================== =============== =========================== ==========================================================================
-**sess_cookie_name** ci_session None The name you want the session cookie saved as.
-**sess_expiration** 7200 None The number of seconds you would like the session to last. The default
- value is 2 hours (7200 seconds). If you would like a non-expiring
- session set the value to zero: 0
-**sess_expire_on_close** FALSE TRUE/FALSE (boolean) Whether to cause the session to expire automatically when the browser
- window is closed.
-**sess_encrypt_cookie** FALSE TRUE/FALSE (boolean) Whether to encrypt the session data.
-**sess_use_database** FALSE TRUE/FALSE (boolean) Whether to save the session data to a database. You must create the
- table before enabling this option.
-**sess_table_name** ci_sessions Any valid SQL table name The name of the session database table.
-**sess_time_to_update** 300 Time in seconds This options controls how often the session class will regenerate itself
- and create a new session id.
-**sess_match_ip** FALSE TRUE/FALSE (boolean) Whether to match the user's IP address when reading the session data.
- Note that some ISPs dynamically changes the IP, so if you want a
- non-expiring session you will likely set this to FALSE.
-**sess_match_useragent** TRUE TRUE/FALSE (boolean) Whether to match the User Agent when reading the session data.
-=========================== =============== =========================== ========================================================================== \ No newline at end of file
diff --git a/user_guide_src/source/libraries/trackback.rst b/user_guide_src/source/libraries/trackback.rst
index 07b2b2177..f9e0df882 100644
--- a/user_guide_src/source/libraries/trackback.rst
+++ b/user_guide_src/source/libraries/trackback.rst
@@ -114,7 +114,7 @@ store them. Here is a basic prototype for such a table::
excerpt text NOT NULL,
blog_name varchar(100) NOT NULL,
tb_date int(10) NOT NULL,
- ip_address varchar(16) NOT NULL,
+ ip_address varchar(45) NOT NULL,
PRIMARY KEY `tb_id` (`tb_id`),
KEY `entry_id` (`entry_id`)
);
diff --git a/user_guide_src/source/license_afl.rst b/user_guide_src/source/license_afl.rst
new file mode 100644
index 000000000..ca39be9b6
--- /dev/null
+++ b/user_guide_src/source/license_afl.rst
@@ -0,0 +1,245 @@
+###################################
+Academic Free License ("AFL") v 3.0
+###################################
+
+This Academic Free License (the "License") applies to any original work of
+authorship (the "Original Work") whose owner (the "Licensor") has placed the
+following licensing notice adjacent to the copyright notice for the Original
+Work:
+
+*Licensed under the Academic Free License version 3.0*
+
+
+*****************************
+1) Grant of Copyright License
+*****************************
+
+Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable
+license, for the duration of the copyright, to do the following:
+
+ *a)* to reproduce the Original Work in copies, either alone or as part of
+ a collective work;
+
+ *b)* to translate, adapt, alter, transform, modify, or arrange the
+ Original Work, thereby creating derivative works ("Derivative Works")
+ based upon the Original Work;
+
+ *c)* to distribute or communicate copies of the Original Work and
+ Derivative Works to the public, *under any license of your choice that
+ does not contradict the terms and conditions, including Licensor's
+ reserved rights and remedies, in this Academic Free License*;
+
+ *d)* to perform the Original Work publicly; and
+
+ *e)* to display the Original Work publicly.
+
+
+**************************
+2) Grant of Patent License
+**************************
+
+Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable
+license, under patent claims owned or controlled by the Licensor that are
+embodied in the Original Work as furnished by the Licensor, for the duration
+of the patents, to make, use, sell, offer for sale, have made, and import the
+Original Work and Derivative Works.
+
+
+*******************************
+3) Grant of Source Code License
+*******************************
+
+The term "Source Code" means the preferred form of the Original Work for
+making modifications to it and all available documentation describing how to
+modify the Original Work. Licensor agrees to provide a machine-readable copy
+of the Source Code of the Original Work along with each copy of the Original
+Work that Licensor distributes. Licensor reserves the right to satisfy this
+obligation by placing a machine-readable copy of the Source Code in an
+information repository reasonably calculated to permit inexpensive and
+convenient access by You for as long as Licensor continues to distribute the
+Original Work.
+
+
+********************************
+4) Exclusions From License Grant
+********************************
+
+Neither the names of Licensor, nor the names of any contributors to the
+Original Work, nor any of their trademarks or service marks, may be used to
+endorse or promote products derived from this Original Work without express
+prior permission of the Licensor. Except as expressly stated herein, nothing
+in this License grants any license to Licensor's trademarks, copyrights,
+patents, trade secrets or any other intellectual property. No patent license
+is granted to make, use, sell, offer for sale, have made, or import
+embodiments of any patent claims other than the licensed claims defined in
+Section 2) No license is granted to the trademarks of Licensor even if such
+marks are included in the Original Work. Nothing in this License shall be
+interpreted to prohibit Licensor from licensing under terms different from
+this License any Original Work that Licensor otherwise would have a right to
+license.
+
+
+**********************
+5) External Deployment
+**********************
+
+The term "External Deployment" means the use, distribution, or communication
+of the Original Work or Derivative Works in any way such that the Original
+Work or Derivative Works may be used by anyone other than You, whether those
+works are distributed or communicated to those persons or made available as an
+application intended for use over a network. As an express condition for the
+grants of license hereunder, You must treat any External Deployment by You of
+the Original Work or a Derivative Work as a distribution under section 1(c).
+
+
+*********************
+6) Attribution Rights
+*********************
+
+You must retain, in the Source Code of any Derivative Works that You create,
+all copyright, patent, or trademark notices from the Source Code of the
+Original Work, as well as any notices of licensing and any descriptive text
+identified therein as an "Attribution Notice." You must cause the Source Code
+for any Derivative Works that You create to carry a prominent Attribution
+Notice reasonably calculated to inform recipients that You have modified the
+Original Work.
+
+
+****************************************************
+7) Warranty of Provenance and Disclaimer of Warranty
+****************************************************
+
+Licensor warrants that the copyright in and to the Original Work and the
+patent rights granted herein by Licensor are owned by the Licensor or are
+sublicensed to You under the terms of this License with the permission of the
+contributor(s) of those copyrights and patent rights. Except as expressly
+stated in the immediately preceding sentence, the Original Work is provided
+under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or
+implied, including, without limitation, the warranties of non-infringement,
+merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE
+QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY
+constitutes an essential part of this License. No license to the Original Work
+is granted by this License except under this disclaimer.
+
+
+**************************
+8) Limitation of Liability
+**************************
+
+Under no circumstances and under no legal theory, whether in tort (including
+negligence), contract, or otherwise, shall the Licensor be liable to anyone
+for any indirect, special, incidental, or consequential damages of any
+character arising as a result of this License or the use of the Original Work
+including, without limitation, damages for loss of goodwill, work stoppage,
+computer failure or malfunction, or any and all other commercial damages or
+losses. This limitation of liability shall not apply to the extent applicable
+law prohibits such limitation.
+
+
+*****************************
+9) Acceptance and Termination
+*****************************
+
+If, at any time, You expressly assented to this License, that assent indicates
+your clear and irrevocable acceptance of this License and all of its terms and
+conditions. If You distribute or communicate copies of the Original Work or a
+Derivative Work, You must make a reasonable effort under the circumstances to
+obtain the express assent of recipients to the terms of this License. This
+License conditions your rights to undertake the activities listed in Section
+1, including your right to create Derivative Works based upon the Original
+Work, and doing so without honoring these terms and conditions is prohibited
+by copyright law and international treaty. Nothing in this License is intended
+to affect copyright exceptions and limitations (including "fair use" or "fair
+dealing"). This License shall terminate immediately and You may no longer
+exercise any of the rights granted to You by this License upon your failure to
+honor the conditions in Section 1(c).
+
+
+*********************************
+10) Termination for Patent Action
+*********************************
+
+This License shall terminate automatically and You may no longer exercise any
+of the rights granted to You by this License as of the date You commence an
+action, including a cross-claim or counterclaim, against Licensor or any
+licensee alleging that the Original Work infringes a patent. This termination
+provision shall not apply for an action alleging patent infringement by
+combinations of the Original Work with other software or hardware.
+
+
+*****************************************
+11) Jurisdiction, Venue and Governing Law
+*****************************************
+
+Any action or suit relating to this License may be brought only in the courts
+of a jurisdiction wherein the Licensor resides or in which Licensor conducts
+its primary business, and under the laws of that jurisdiction excluding its
+conflict-of-law provisions. The application of the United Nations Convention
+on Contracts for the International Sale of Goods is expressly excluded. Any
+use of the Original Work outside the scope of this License or after its
+termination shall be subject to the requirements and penalties of copyright or
+patent law in the appropriate jurisdiction. This section shall survive the
+termination of this License.
+
+
+*******************
+12) Attorneys' Fees
+*******************
+
+In any action to enforce the terms of this License or seeking damages relating
+thereto, the prevailing party shall be entitled to recover its costs and
+expenses, including, without limitation, reasonable attorneys' fees and costs
+incurred in connection with such action, including any appeal of such action.
+This section shall survive the termination of this License.
+
+
+*****************
+13) Miscellaneous
+*****************
+
+If any provision of this License is held to be unenforceable, such provision
+shall be reformed only to the extent necessary to make it enforceable.
+
+
+***************************************
+14) Definition of "You" in This License
+***************************************
+
+"You" throughout this License, whether in upper or lower case, means an
+individual or a legal entity exercising rights under, and complying with all
+of the terms of, this License. For legal entities, "You" includes any entity
+that controls, is controlled by, or is under common control with you. For
+purposes of this definition, "control" means (i) the power, direct or
+indirect, to cause the direction or management of such entity, whether by
+contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
+outstanding shares, or (iii) beneficial ownership of such entity.
+
+
+****************
+15) Right to Use
+****************
+
+You may use the Original Work in all ways not otherwise restricted or
+conditioned by this License or by law, and Licensor promises not to interfere
+with or be responsible for such uses by You.
+
+
+********************************
+16) Modification of This License
+********************************
+
+This License is Copyright © 2005 Lawrence Rosen. Permission is granted to
+copy, distribute, or communicate this License without modification. Nothing in
+this License permits You to modify this License as applied to the Original
+Work or to Derivative Works. However, You may modify the text of this License
+and copy, distribute or communicate your modified version (the "Modified
+License") and apply it to other original works of authorship subject to the
+following conditions: (i) You may not indicate in any way that your Modified
+License is the "Academic Free License" or "AFL" and you may not use those
+names in the name of your Modified License; (ii) You must replace the notice
+specified in the first paragraph above with the notice "Licensed under <insert
+your license name here>" or with a notice of your own that is not confusingly
+similar to the notice in this License; and (iii) You may not claim that your
+original works are open source software unless your Modified License has been
+approved by Open Source Initiative (OSI) and You comply with its license
+review and certification process. \ No newline at end of file
diff --git a/user_guide_src/source/overview/cheatsheets.rst b/user_guide_src/source/overview/cheatsheets.rst
index 2e277aa9a..80c3112c4 100644
--- a/user_guide_src/source/overview/cheatsheets.rst
+++ b/user_guide_src/source/overview/cheatsheets.rst
@@ -5,12 +5,19 @@ CodeIgniter Cheatsheets
Library Reference
=================
-`|CodeIgniter Library
-Reference| <../images/codeigniter_1.7.1_library_reference.pdf>`_
+|CodeIgniter Library Reference|
+
+- :download:`Download PDF <../images/codeigniter_1.7.1_library_reference.pdf>`
+
Helpers Reference
=================
-`|image1| <../images/codeigniter_1.7.1_helper_reference.pdf>`_
+|CodeIgniter Helper Reference|
+
+- :download:`Download PDF <../images/codeigniter_1.7.1_helper_reference.pdf>`
+
.. |CodeIgniter Library Reference| image:: ../images/codeigniter_1.7.1_library_reference.png
-.. |image1| image:: ../images/codeigniter_1.7.1_helper_reference.png
+ :target: ../_downloads/codeigniter_1.7.1_library_reference.pdf
+.. |CodeIgniter Helper Reference| image:: ../images/codeigniter_1.7.1_helper_reference.png
+ :target: ../_downloads/codeigniter_1.7.1_helper_reference.pdf