diff options
author | DiederikLascaris <info@runesa.nl> | 2017-01-22 21:45:15 +0100 |
---|---|---|
committer | DiederikLascaris <info@runesa.nl> | 2017-01-22 21:45:15 +0100 |
commit | 312efeba32d532878c536fd28e75f39d61a9dade (patch) | |
tree | 71ae4aaca33a9d34a789d6d375acd2594160123a /user_guide_src | |
parent | 947f1a06093a52a32b703ee795e52c22cd66363a (diff) | |
parent | 44c7af639ac1726780b64fb5a6cb6fca2df8b651 (diff) |
Merge branch 'develop' of git://github.com/bcit-ci/CodeIgniter into develop
Diffstat (limited to 'user_guide_src')
89 files changed, 1700 insertions, 1731 deletions
diff --git a/user_guide_src/README.rst b/user_guide_src/README.rst index 188b42e88..d645adb73 100644 --- a/user_guide_src/README.rst +++ b/user_guide_src/README.rst @@ -24,7 +24,7 @@ Installation 1. Install `easy_install <http://peak.telecommunity.com/DevCenter/EasyInstall#installing-easy-install>`_ 2. ``easy_install "sphinx==1.2.3"`` -3. ``easy_install sphinxcontrib-phpdomain`` +3. ``easy_install "sphinxcontrib-phpdomain==0.1.3.post1"`` 4. Install the CI Lexer which allows PHP, HTML, CSS, and JavaScript syntax highlighting in code examples (see *cilexer/README*) 5. ``cd user_guide_src`` 6. ``make html`` @@ -60,4 +60,4 @@ Style Guideline *************** Please refer to source/documentation/index.rst for general guidelines for -using Sphinx to document CodeIgniter.
\ No newline at end of file +using Sphinx to document CodeIgniter. diff --git a/user_guide_src/cilexer/cilexer/cilexer.py b/user_guide_src/cilexer/cilexer/cilexer.py index 2580b0b30..4ecfd0bc4 100644 --- a/user_guide_src/cilexer/cilexer/cilexer.py +++ b/user_guide_src/cilexer/cilexer/cilexer.py @@ -1,11 +1,11 @@ # CodeIgniter -# http://codeigniter.com -# +# https://codeigniter.com +# # An open source application development framework for PHP -# +# # This content is released under the MIT License (MIT) # -# Copyright (c) 2014 - 2015, British Columbia Institute of Technology +# Copyright (c) 2014 - 2017, British Columbia Institute of Technology # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -25,8 +25,8 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # -# Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) -# Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) +# Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) +# Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) # # http://opensource.org/licenses/MIT MIT License diff --git a/user_guide_src/source/_themes/sphinx_rtd_theme/breadcrumbs.html b/user_guide_src/source/_themes/sphinx_rtd_theme/breadcrumbs.html index ff0938e5c..60343661a 100644 --- a/user_guide_src/source/_themes/sphinx_rtd_theme/breadcrumbs.html +++ b/user_guide_src/source/_themes/sphinx_rtd_theme/breadcrumbs.html @@ -2,18 +2,21 @@ <ul class="wy-breadcrumbs"> <li><a href="{{ pathto(master_doc) }}">Docs</a> »</li> {% for doc in parents %} - <li><a href="{{ doc.link|e }}">{{ doc.title }}</a> »</li> + <li><a href="{{ doc.link|e }}">{{ doc.title }}</a> »</li> {% endfor %} <li>{{ title }}</li> - <li class="wy-breadcrumbs-aside"> - {% if display_github %} - <a href="https://github.com/{{ github_user }}/{{ github_repo }}/blob/{{ github_version }}{{ conf_py_path }}{{ pagename }}{{ source_suffix }}" class="fa fa-github"> Edit on GitHub</a> - {% elif display_bitbucket %} - <a href="https://bitbucket.org/{{ bitbucket_user }}/{{ bitbucket_repo }}/src/{{ bitbucket_version}}{{ conf_py_path }}{{ pagename }}{{ source_suffix }}" class="fa fa-bitbucket"> Edit on Bitbucket</a> - {% elif show_source and has_source and sourcename %} - <a href="{{ pathto('_sources/' + sourcename, true)|e }}" rel="nofollow"> View page source</a> - {% endif %} - </li> + <li class="wy-breadcrumbs-aside"> + {% if display_github %} + <a href="https://github.com/{{ github_user }}/{{ github_repo }}/blob/{{ github_version }}{{ conf_py_path }}{{ pagename }}{{ source_suffix }}" class="fa fa-github"> Edit on GitHub</a> + {% elif display_bitbucket %} + <a href="https://bitbucket.org/{{ bitbucket_user }}/{{ bitbucket_repo }}/src/{{ bitbucket_version}}{{ conf_py_path }}{{ pagename }}{{ source_suffix }}" class="fa fa-bitbucket"> Edit on Bitbucket</a> + {% elif show_source and has_source and sourcename %} + <a href="{{ pathto('_sources/' + sourcename, true)|e }}" rel="nofollow"> View page source</a> + {% endif %} + </li> + <div style="float:right;margin-left:5px;" id="closeMe"> + <img title="Classic Layout" alt="classic layout" src="data:image/gif;base64,R0lGODlhFAAUAJEAAAAAADMzM////wAAACH5BAUUAAIALAAAAAAUABQAAAImlI+py+0PU5gRBRDM3DxbWoXis42X13USOLauUIqnlsaH/eY6UwAAOw==" /> + </div> </ul> <hr/> </div> diff --git a/user_guide_src/source/_themes/sphinx_rtd_theme/layout.html b/user_guide_src/source/_themes/sphinx_rtd_theme/layout.html index 1203b2f34..20ede7d32 100644 --- a/user_guide_src/source/_themes/sphinx_rtd_theme/layout.html +++ b/user_guide_src/source/_themes/sphinx_rtd_theme/layout.html @@ -77,6 +77,8 @@ <body class="wy-body-for-nav" role="document"> + {% include "pulldown.html" %} + <div class="wy-grid-for-nav"> {# SIDE NAV, TOGGLES ON MOBILE #} diff --git a/user_guide_src/source/_themes/sphinx_rtd_theme/pulldown.html b/user_guide_src/source/_themes/sphinx_rtd_theme/pulldown.html new file mode 100644 index 000000000..7877346d8 --- /dev/null +++ b/user_guide_src/source/_themes/sphinx_rtd_theme/pulldown.html @@ -0,0 +1,17 @@ +<div id="nav"> + <div id="nav_inner"> + {% block ciNav %} + {% set toctree = toctree(maxdepth=2, collapse=False, includehidden=False) %} + {% if toctree %} + <div id="pulldown-menu" class="ciNav"> + {{ toctree }} + </div> + {% endif %} + {% endblock %} + </div> +</div> +<div id="nav2"> + <a href="#" id="openToc"> + <img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAARgAA/+4ADkFkb2JlAGTAAAAAAf/bAIQABAMDAwMDBAMDBAYEAwQGBwUEBAUHCAYGBwYGCAoICQkJCQgKCgwMDAwMCgwMDQ0MDBERERERFBQUFBQUFBQUFAEEBQUIBwgPCgoPFA4ODhQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQU/8AAEQgAKwCaAwERAAIRAQMRAf/EAHsAAQAABwEBAAAAAAAAAAAAAAABAwQFBgcIAgkBAQAAAAAAAAAAAAAAAAAAAAAQAAEDAwICBwYEAgsAAAAAAAIBAwQAEQUSBiEHkROTVNQWGDFBUVIUCHEiMtOUFWGBobHRQlMkZIRVEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwDSC+ygkOOaUoKigUCgUCgUCgUCgUCgUCgUCgkuGguIP9FBMFb0Hqg7We+3jlmIqqYFf4ub+/QYlnOR/LqIBKGFUbf8qWv971BytQXXE7Y3Lnm3HsFhp2TaZJAdchRXpIgSpdEJWxJEW3xoKV7F5OMy7JkQn2o7D6w33XGjEAkoiqrJEqIiOIiKuhePCgqp22dyYyS3CyWHnQ5joG61HkRnmnTbaFSMhExRVQRRVJU9iUHjE7ez+fJ0MFipmUNhBV8YUd2SoIV9KkjQla9ltegttBdPLW4/qocL+UTfrMiHW4+P9M71shuyrqaHTcxsl7jegpsji8nh5ZwMvDfgTm0RTjSmjYdFCS6KoOIipdFunCgmNYTMv457MMY6U7iI6oMieDDhRm1VbIhuoOkbqtuK0Hpzb+eZcYZexUxt6UyUqK2cd0SdjtgrhOgijcgERUlJOCIl6CpgbP3blRI8XgMjNARAyKNDfeRBdFDBVUAXgQrqH4pxoJTu2NysY97LP4ac1io5q1InHFeGO24LnVKJuKOkSQ/yKir+rh7aCLG1dzypZQI2FnvTgccYOM3FeN0XWERXAUEFVQgQkUktdLpegm+Td3/Xli/L+S/mYNJIOF9G/wBeLKrZHFb0akG6W1WtQWSg3Dyg5e7V3fipE3O4/wCrktyzYA+ufas2LbZIlmnAT2kvuoN1wft95augilglX/tzP3qCu9O3LL/wV/i5v79BvmTADq14UGu91467Z6U9y0HzH/ncj/U/sT/CgynZG7I2NezpZGUjIycJkYkZSG+uQ81pbBNKLxJfjwoMqZ3/ALYHl35AJ7/cuwHcu5k7r1Q5pHetBjquqVVJWGxj9Zrtcl/Ggy3dHMvauR3HFZj5nHNxSyW5JISYDMoIwx8tFIGHZhPNaykGapr6rUAiicEoMG21lMRj8buPAz8xhJrr7uOeiPTCyAwXUaGR1mgozbTusOsFLEiJ7fbQa/h7gcjy2H3V6xppwDNtUSxCJIqp7valBuWVzJ22xuCROXNNZiJkMtms0DbjUkAZjzoDrTMd9dDRI44ZC2YsrYdKWP2WDT2S3N9dNdlRYrGMYc06IURXSYb0igrpWS485xVNS6nF4rwslkoMwnbpgZLB7bmt5uMweAhDEl4B5uSLzzqTnnyVpW2jaJHRMSIjdDiiotvy3DOE5rYTEbkl5yFn28k7JyG4c7AU2HtLH1uKfaiMPI40CdYbpNtmLdwTSn5rewLNld+7TLdeal4WarWBkbVKBjgdElMJJwAAY5fl4kB3b1fp4XvagsGS3FjJfLzDNtS8aeXx7LzT7TyzByQE5PccRGRC0ZRUDRV6y62vbjagzLmJzS2vuPK43JY6aP1TW6Jz+RIWyFtyC06y3EkiiinAo7YCqfq1AqqnGgsOH3lhZO8d1pmcpB8j5XIm9OYlBJSQ/FSS4427DKO0RC8AlcEMhFdViRR1WDWR5t3WXVuL1d106kG9vdeye2g60+1FDyW0shIcXVpyroXt8I8dfd+NB1vioAdWnD3UF1+gD4UFc6CEKpagxXN43rwJLUHz7yX2c8zokt9uHlsPIhA4aRnnHJTLptIS6CNsY7iASpxUUMkReGpfbQW0vtN5pitvrsN28rwtBD0nc0+/Yft5XhaB6TuaXfsP28rwtA9J3NPv2H7eV4Wgek7mn37D9vK8LQPSdzT79h+3leFoHpO5pd+w/byvC0D0nc0u/Yft5XhaB6TuaXfsP28rwtA9J3NLv2H7eV4Wgek7ml37D9vK8LQPSdzS79h+3leFoHpO5p9+w/byvC0E9r7Reazy2HIYVPxkS/CUHVn26cosxyv2g7h89LYmZSXOenvLEQ1YaQ222RATcQCP8rSGqqA8S02W2pQ6FhMoAIlqCtsnwoCpdKClejI4i3Sgtb+GBxVuNBSFt1pV/RQefLjPyUDy4z8lA8uM/JQPLjPyUDy4z8lA8uM/JQPLjPyUDy4z8lA8uM/JQPLjPyUDy4z8lA8utJ/koJ7WCbBU/LQXOPAFq1koK8B0pag90CggtBBf6qB0UDooHRQOigdFA6KB0UDooHRQOigdFA6KB0UDooI0EaBQf//Z" title="Toggle Table of Contents" alt="Toggle Table of Contents" /> + </a> +</div> diff --git a/user_guide_src/source/_themes/sphinx_rtd_theme/static/css/citheme.css b/user_guide_src/source/_themes/sphinx_rtd_theme/static/css/citheme.css index 10e7d04c6..a2a3b3e91 100644 --- a/user_guide_src/source/_themes/sphinx_rtd_theme/static/css/citheme.css +++ b/user_guide_src/source/_themes/sphinx_rtd_theme/static/css/citheme.css @@ -3,5 +3,86 @@ .highlighted { padding: 0px !important; font-weight: inherit !important; - background-color: #f1d40f !important; + background-color: #f1d40f !important; +} + +#nav { + background-color: #494949; + margin: 0; + padding: 0; + display: none; +} + +#nav2 { + background: url(data:image/jpeg;base64,/9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAARgAA/+4ADkFkb2JlAGTAAAAAAf/bAIQABAMDAwMDBAMDBAYEAwQGBwUEBAUHCAYGBwYGCAoICQkJCQgKCgwMDAwMCgwMDQ0MDBERERERFBQUFBQUFBQUFAEEBQUIBwgPCgoPFA4ODhQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQU/8AAEQgAMgAzAwERAAIRAQMRAf/EAFkAAQADAQAAAAAAAAAAAAAAAAABBQcIAQEAAAAAAAAAAAAAAAAAAAAAEAABAgYDAAAAAAAAAAAAAAAAAVERAtMEFJRVBxgRAQAAAAAAAAAAAAAAAAAAAAD/2gAMAwEAAhEDEQA/AMRAAAAAAAA7a87dZcCu3e1wHnbrLgV272uA87dZcCu3e1wHnbrLgV272uA87dZcCu3e1wHnbrLgV272uA87dZcCu3e1wN/wJGAYEjAMCRgGBIwDAkYBgSMAwJGAsoIwCCMAgjAIIwCCMAgjAIIwEgAAAAAAAAAAAAAAAAAAAAAAAH//2Q==) repeat-x scroll left top transparent; + margin: 0; + padding: 0 310px 0 0; + text-align: right; + display: none; +} + +#nav_inner { + background-color: transparent; + font-family: Lucida Grande,Verdana,Geneva,sans-serif; + font-size: 11px; + margin: 0; + padding: 8px 12px 0 20px; +} + +div#pulldown-menu { + -moz-column-count: 5; + -moz-column-gap: 20px; + -webkit-column-count: 5; + -webkit-column-gap: 20px; + column-count: 5; + column-gap: 20px; + -webkit-column-rule: 1px groove #b8b8b8; + -moz-column-rule: 1px groove #b8b8b8; + column-rule: 1px groove #b8b8b8; +} + +#pulldown-menu > ul { + padding-top: 10px; + padding-bottom: 10px; + -webkit-column-break-inside: avoid; /*Chrome, Safari*/ + display: table; /*Firefox*/ + break-inside: avoid; /*IE 10+ theoretically*/ +} + +#pulldown-menu ul li.toctree-l2 { + font-size: 0.82em; + margin-left: 20px; + list-style-image: url(data:image/gif;base64,R0lGODlhCwAJALMJAO7u7uTk5PLy8unp6fb29t7e3vj4+Li4uIWFheTk5AAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAAkALAAAAAALAAkAAAQoMJ1JqTQ4Z3SI98jHCWSJkByArCyiHkMsIzEX3DeCc0Xv+4hEa5iIAAA7); +} + +#pulldown-menu ul li.toctree-l1 a { + color: #ffffff; + text-decoration: none; + font-size: 12px; + font-family: "Roboto Slab","ff-tisa-web-pro","Georgia",Arial,sans-serif; + font-weight: 700; +} + +#pulldown-menu ul li.toctree-l2 a { + text-decoration: none; + font-size: 11px; + line-height: 1.4em; + font-weight: 300; + font-family: Lucida Grande,Verdana,Geneva,sans-serif; + color: #aaaaaa; +} + +/*hide pulldown menu on mobile devices*/ +@media (max-width: 768px) { /*tablet size defined by theme*/ + #closeMe { + display: none; + } + + #pulldown { + display: none; + } + + #openToc { + display: none; + } }
\ No newline at end of file diff --git a/user_guide_src/source/_themes/sphinx_rtd_theme/static/images/ci-icon.ico b/user_guide_src/source/_themes/sphinx_rtd_theme/static/images/ci-icon.ico Binary files differnew file mode 100644 index 000000000..c4246f8bf --- /dev/null +++ b/user_guide_src/source/_themes/sphinx_rtd_theme/static/images/ci-icon.ico diff --git a/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js b/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js index 66edf2fa2..081d77bdf 100644 --- a/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js +++ b/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js @@ -1,118 +1,131 @@ -$( document ).ready(function() { +$(document).ready(function () { // Shift nav in mobile when clicking the menu. - $(document).on('click', "[data-toggle='wy-nav-top']", function() { - $("[data-toggle='wy-nav-shift']").toggleClass("shift"); - $("[data-toggle='rst-versions']").toggleClass("shift"); + $(document).on('click', "[data-toggle='wy-nav-top']", function () { + $("[data-toggle='wy-nav-shift']").toggleClass("shift"); + $("[data-toggle='rst-versions']").toggleClass("shift"); }); // Close menu when you click a link. - $(document).on('click', ".wy-menu-vertical .current ul li a", function() { - $("[data-toggle='wy-nav-shift']").removeClass("shift"); - $("[data-toggle='rst-versions']").toggleClass("shift"); + $(document).on('click', ".wy-menu-vertical .current ul li a", function () { + $("[data-toggle='wy-nav-shift']").removeClass("shift"); + $("[data-toggle='rst-versions']").toggleClass("shift"); + }); + $(document).on('click', "[data-toggle='rst-current-version']", function () { + $("[data-toggle='rst-versions']").toggleClass("shift-up"); }); - $(document).on('click', "[data-toggle='rst-current-version']", function() { - $("[data-toggle='rst-versions']").toggleClass("shift-up"); - }); // Make tables responsive - $("table.docutils:not(.field-list)").wrap("<div class='wy-table-responsive'></div>"); - // --- - // START DOC MODIFICATION BY RUFNEX - // v1.0 04.02.2015 - // Add ToogleButton to get FullWidth-View by Johannes Gamperl codeigniter.de - var ciNav = '<style >#nav { background-color: #494949; margin: 0; padding: 0;display:none;}#nav2 { background: url(data:image/jpeg;base64,/9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAARgAA/+4ADkFkb2JlAGTAAAAAAf/bAIQABAMDAwMDBAMDBAYEAwQGBwUEBAUHCAYGBwYGCAoICQkJCQgKCgwMDAwMCgwMDQ0MDBERERERFBQUFBQUFBQUFAEEBQUIBwgPCgoPFA4ODhQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQU/8AAEQgAMgAzAwERAAIRAQMRAf/EAFkAAQADAQAAAAAAAAAAAAAAAAABBQcIAQEAAAAAAAAAAAAAAAAAAAAAEAABAgYDAAAAAAAAAAAAAAAAAVERAtMEFJRVBxgRAQAAAAAAAAAAAAAAAAAAAAD/2gAMAwEAAhEDEQA/AMRAAAAAAAA7a87dZcCu3e1wHnbrLgV272uA87dZcCu3e1wHnbrLgV272uA87dZcCu3e1wHnbrLgV272uA87dZcCu3e1wN/wJGAYEjAMCRgGBIwDAkYBgSMAwJGAsoIwCCMAgjAIIwCCMAgjAIIwEgAAAAAAAAAAAAAAAAAAAAAAAH//2Q==) repeat-x scroll left top transparent; margin: 0; padding: 0 310px 0 0; text-align: right;display:none;}#nav_inner { background-color: transparent; font-family: Lucida Grande,Verdana,Geneva,sans-serif; font-size: 11px; margin: 0; padding: 8px 12px 0 20px;}table.ciNav { background-color: #494949; width: 100%; }table.ciNav ul { margin: 10px; margin-top:0; padding: 5px; }table.ciNav td li { font-size:0.82em; margin-left: 20px; list-style-image: url(data:image/gif;base64,R0lGODlhCwAJALMJAO7u7uTk5PLy8unp6fb29t7e3vj4+Li4uIWFheTk5AAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAAkALAAAAAALAAkAAAQoMJ1JqTQ4Z3SI98jHCWSJkByArCyiHkMsIzEX3DeCc0Xv+4hEa5iIAAA7); }table.ciNav h3 { margin:0; margin-left: 10px; }table.ciNav h3.first { margin-bottom: 20px; }table.ciNav h3 a { color:#fff;text-decoration: none; font-size:12px; }table.ciNav td li a { color:#fff;text-decoration: none; font-size:11px; line-height:1.4em; font-weight: 300; color: #aaa; }table.ciNav td.td_sep {padding-left:20px; background: url(data:image/jpeg;base64,/9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAARgAA/+4ADkFkb2JlAGTAAAAAAf/bAIQABAMDAwMDBAMDBAYEAwQGBwUEBAUHCAYGBwYGCAoICQkJCQgKCgwMDAwMCgwMDQ0MDBERERERFBQUFBQUFBQUFAEEBQUIBwgPCgoPFA4ODhQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQU/8AAEQgACAACAwERAAIRAQMRAf/EAEsAAQAAAAAAAAAAAAAAAAAAAAcBAQAAAAAAAAAAAAAAAAAAAAAQAQEAAAAAAAAAAAAAAAAAAADVEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwAesg//2Q==) repeat-y scroll left top transparent;}</style>'; - ciNav += '<div style="background:#494949;"><div id="nav"><div id="nav_inner">'; - ciNav += '<table class="ciNav"><tr><td valign="top"><h3 class="first"><a href="../general/welcome.html">Welcome to CodeIgniter</a></h3><h3><a href="../installation/index.html">Installation Instructions</a></h3><ul><li><a href="../installation/downloads.html">Downloading CodeIgniter</a></li><li><a href="../installation/index.html">Installation Instructions</a></li><li><a href="../installation/upgrading.html">Upgrading From a Previous Version</a></li><li><a href="../installation/troubleshooting.html">Troubleshooting</a></li></ul><h3><a href="../overview/index.html">CodeIgniter Overview</a></h3><ul><li><a href="../overview/getting_started.html">Getting Started</a></li><li><a href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li><li><a href="../overview/features.html">Supported Features</a></li><li><a href="../overview/appflow.html">Application Flow Chart</a></li><li><a href="../overview/mvc.html">Model-View-Controller</a></li><li><a href="../overview/goals.html">Architectural Goals</a></li></ul><h3><a href="../tutorial/index.html">Tutorial</a></h3><ul><li><a href="../tutorial/static_pages.html">Static pages</a></li><li><a href="../tutorial/news_section.html">News section</a></li><li><a href="../tutorial/create_news_items.html">Create news items</a></li><li><a href="../tutorial/conclusion.html">Conclusion</a></li></ul><h3><a href="../contributing/index.html">Contributing to CodeIgniter</a></h3><ul><li class="toctree-l2"><a href="../documentation/index.html">Writing CodeIgniter Documentation</a></li><li class="toctree-l2"><a href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li></ul></td><td valign="top" class="td_sep"><h3><a href="../general/index.html">General Topics</a></h3><ul><li><a href="../general/urls.html">CodeIgniter URLs</a></li><li><a href="../general/controllers.html">Controllers</a></li><li><a href="../general/reserved_names.html">Reserved Names</a></li><li><a href="../general/views.html">Views</a></li><li><a href="../general/models.html">Models</a></li><li><a href="../general/helpers.html">Helpers</a></li><li><a href="../general/libraries.html">Using CodeIgniter Libraries</a></li><li><a href="../general/creating_libraries.html">Creating Libraries</a></li><li><a href="../general/drivers.html">Using CodeIgniter Drivers</a></li><li><a href="../general/creating_drivers.html">Creating Drivers</a></li><li><a href="../general/core_classes.html">Creating Core System Classes</a></li><li><a href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li><li><a href="../general/hooks.html">Hooks - Extending the Framework Core</a></li><li><a href="../general/autoloader.html">Auto-loading Resources</a></li><li><a href="../general/common_functions.html">Common Functions</a></li><li><a href="../general/compatibility_functions.html">Compatibility Functions</a></li><li><a href="../general/routing.html">URI Routing</a></li><li><a href="../general/errors.html">Error Handling</a></li><li><a href="../general/caching.html">Caching</a></li><li><a href="../general/profiling.html">Profiling Your Application</a></li><li><a href="../general/cli.html">Running via the CLI</a></li><li><a href="../general/managing_apps.html">Managing your Applications</a></li><li><a href="../general/environments.html">Handling Multiple Environments</a></li><li><a href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li><li><a href="../general/security.html">Security</a></li><li><a href="../general/styleguide.html">PHP Style Guide</a></li></ul></td><td valign="top" class="td_sep"><h3><a href="../libraries/index.html">Libraries</a></h3><ul><li><a href="../libraries/benchmark.html">Benchmarking Class</a></li><li><a href="../libraries/caching.html">Caching Driver</a></li><li><a href="../libraries/calendar.html">Calendaring Class</a></li><li><a href="../libraries/cart.html">Shopping Cart Class</a></li><li><a href="../libraries/config.html">Config Class</a></li><li><a href="../libraries/email.html">Email Class</a></li><li><a href="../libraries/encrypt.html">Encrypt Class</a></li><li><a href="../libraries/encryption.html">Encryption Library</a></li><li><a href="../libraries/file_uploading.html">File Uploading Class</a></li><li><a href="../libraries/form_validation.html">Form Validation</a></li><li><a href="../libraries/ftp.html">FTP Class</a></li><li><a href="../libraries/image_lib.html">Image Manipulation Class</a></li><li><a href="../libraries/input.html">Input Class</a></li><li><a href="../libraries/javascript.html">Javascript Class</a></li><li><a href="../libraries/language.html">Language Class</a></li><li><a href="../libraries/loader.html">Loader Class</a></li><li><a href="../libraries/migration.html">Migrations Class</a></li><li><a href="../libraries/output.html">Output Class</a></li><li><a href="../libraries/pagination.html">Pagination Class</a></li><li><a href="../libraries/parser.html">Template Parser Class</a></li><li><a href="../libraries/security.html">Security Class</a></li><li><a href="../libraries/sessions.html">Session Library</a></li><li><a href="../libraries/table.html">HTML Table Class</a></li><li><a href="../libraries/trackback.html">Trackback Class</a></li><li><a href="../libraries/typography.html">Typography Class</a></li><li><a href="../libraries/unit_testing.html">Unit Testing Class</a></li><li><a href="../libraries/uri.html">URI Class</a></li><li><a href="../libraries/user_agent.html">User Agent Class</a></li><li><a href="../libraries/xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li><li><a href="../libraries/zip.html">Zip Encoding Class</a></li></ul></td><td valign="top" class="td_sep"><h3><a href="../database/index.html">Database Reference</a></h3><ul><li><a href="../database/examples.html">Quick Start: Usage Examples</a></li><li><a href="../database/configuration.html">Database Configuration</a></li><li><a href="../database/connecting.html">Connecting to a Database</a></li><li><a href="../database/queries.html">Running Queries</a></li><li><a href="../database/results.html">Generating Query Results</a></li><li><a href="../database/helpers.html">Query Helper Functions</a></li><li><a href="../database/query_builder.html">Query Builder Class</a></li><li><a href="../database/transactions.html">Transactions</a></li><li><a href="../database/metadata.html">Getting MetaData</a></li><li><a href="../database/call_function.html">Custom Function Calls</a></li><li><a href="../database/caching.html">Query Caching</a></li><li><a href="../database/forge.html">Database Manipulation with Database Forge</a></li><li><a href="../database/utilities.html">Database Utilities Class</a></li><li><a href="../database/db_driver_reference.html">Database Driver Reference</a></li></ul></td><td valign="top" class="td_sep"><h3><a href="../helpers/index.html">Helpers</a></h3><ul><li><a href="../helpers/array_helper.html">Array Helper</a></li><li><a href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li><li><a href="../helpers/cookie_helper.html">Cookie Helper</a></li><li><a href="../helpers/date_helper.html">Date Helper</a></li><li><a href="../helpers/directory_helper.html">Directory Helper</a></li><li><a href="../helpers/download_helper.html">Download Helper</a></li><li><a href="../helpers/email_helper.html">Email Helper</a></li><li><a href="../helpers/file_helper.html">File Helper</a></li><li><a href="../helpers/form_helper.html">Form Helper</a></li><li><a href="../helpers/html_helper.html">HTML Helper</a></li><li><a href="../helpers/inflector_helper.html">Inflector Helper</a></li><li><a href="../helpers/language_helper.html">Language Helper</a></li><li><a href="../helpers/number_helper.html">Number Helper</a></li><li><a href="../helpers/path_helper.html">Path Helper</a></li><li><a href="../helpers/security_helper.html">Security Helper</a></li><li><a href="../helpers/smiley_helper.html">Smiley Helper</a></li><li><a href="../helpers/string_helper.html">String Helper</a></li><li><a href="../helpers/text_helper.html">Text Helper</a></li><li><a href="../helpers/typography_helper.html">Typography Helper</a></li><li><a href="../helpers/url_helper.html">URL Helper</a></li><li><a href="../helpers/xml_helper.html">XML Helper</a></li></ul></td></tr></table>'; - ciNav += '</div></div><div id="nav2"><a name="top"></a><a href="#" id="openToc"><img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAARgAA/+4ADkFkb2JlAGTAAAAAAf/bAIQABAMDAwMDBAMDBAYEAwQGBwUEBAUHCAYGBwYGCAoICQkJCQgKCgwMDAwMCgwMDQ0MDBERERERFBQUFBQUFBQUFAEEBQUIBwgPCgoPFA4ODhQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQU/8AAEQgAKwCaAwERAAIRAQMRAf/EAHsAAQAABwEBAAAAAAAAAAAAAAABAwQFBgcIAgkBAQAAAAAAAAAAAAAAAAAAAAAQAAEDAwICBwYEAgsAAAAAAAIBAwQAEQUSBiEHkROTVNQWGDFBUVIUCHEiMtOUFWGBobHRQlMkZIRVEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwDSC+ygkOOaUoKigUCgUCgUCgUCgUCgUCgUCgkuGguIP9FBMFb0Hqg7We+3jlmIqqYFf4ub+/QYlnOR/LqIBKGFUbf8qWv971BytQXXE7Y3Lnm3HsFhp2TaZJAdchRXpIgSpdEJWxJEW3xoKV7F5OMy7JkQn2o7D6w33XGjEAkoiqrJEqIiOIiKuhePCgqp22dyYyS3CyWHnQ5joG61HkRnmnTbaFSMhExRVQRRVJU9iUHjE7ez+fJ0MFipmUNhBV8YUd2SoIV9KkjQla9ltegttBdPLW4/qocL+UTfrMiHW4+P9M71shuyrqaHTcxsl7jegpsji8nh5ZwMvDfgTm0RTjSmjYdFCS6KoOIipdFunCgmNYTMv457MMY6U7iI6oMieDDhRm1VbIhuoOkbqtuK0Hpzb+eZcYZexUxt6UyUqK2cd0SdjtgrhOgijcgERUlJOCIl6CpgbP3blRI8XgMjNARAyKNDfeRBdFDBVUAXgQrqH4pxoJTu2NysY97LP4ac1io5q1InHFeGO24LnVKJuKOkSQ/yKir+rh7aCLG1dzypZQI2FnvTgccYOM3FeN0XWERXAUEFVQgQkUktdLpegm+Td3/Xli/L+S/mYNJIOF9G/wBeLKrZHFb0akG6W1WtQWSg3Dyg5e7V3fipE3O4/wCrktyzYA+ufas2LbZIlmnAT2kvuoN1wft95augilglX/tzP3qCu9O3LL/wV/i5v79BvmTADq14UGu91467Z6U9y0HzH/ncj/U/sT/CgynZG7I2NezpZGUjIycJkYkZSG+uQ81pbBNKLxJfjwoMqZ3/ALYHl35AJ7/cuwHcu5k7r1Q5pHetBjquqVVJWGxj9Zrtcl/Ggy3dHMvauR3HFZj5nHNxSyW5JISYDMoIwx8tFIGHZhPNaykGapr6rUAiicEoMG21lMRj8buPAz8xhJrr7uOeiPTCyAwXUaGR1mgozbTusOsFLEiJ7fbQa/h7gcjy2H3V6xppwDNtUSxCJIqp7valBuWVzJ22xuCROXNNZiJkMtms0DbjUkAZjzoDrTMd9dDRI44ZC2YsrYdKWP2WDT2S3N9dNdlRYrGMYc06IURXSYb0igrpWS485xVNS6nF4rwslkoMwnbpgZLB7bmt5uMweAhDEl4B5uSLzzqTnnyVpW2jaJHRMSIjdDiiotvy3DOE5rYTEbkl5yFn28k7JyG4c7AU2HtLH1uKfaiMPI40CdYbpNtmLdwTSn5rewLNld+7TLdeal4WarWBkbVKBjgdElMJJwAAY5fl4kB3b1fp4XvagsGS3FjJfLzDNtS8aeXx7LzT7TyzByQE5PccRGRC0ZRUDRV6y62vbjagzLmJzS2vuPK43JY6aP1TW6Jz+RIWyFtyC06y3EkiiinAo7YCqfq1AqqnGgsOH3lhZO8d1pmcpB8j5XIm9OYlBJSQ/FSS4427DKO0RC8AlcEMhFdViRR1WDWR5t3WXVuL1d106kG9vdeye2g60+1FDyW0shIcXVpyroXt8I8dfd+NB1vioAdWnD3UF1+gD4UFc6CEKpagxXN43rwJLUHz7yX2c8zokt9uHlsPIhA4aRnnHJTLptIS6CNsY7iASpxUUMkReGpfbQW0vtN5pitvrsN28rwtBD0nc0+/Yft5XhaB6TuaXfsP28rwtA9J3NPv2H7eV4Wgek7mn37D9vK8LQPSdzT79h+3leFoHpO5pd+w/byvC0D0nc0u/Yft5XhaB6TuaXfsP28rwtA9J3NLv2H7eV4Wgek7ml37D9vK8LQPSdzS79h+3leFoHpO5p9+w/byvC0E9r7Reazy2HIYVPxkS/CUHVn26cosxyv2g7h89LYmZSXOenvLEQ1YaQ222RATcQCP8rSGqqA8S02W2pQ6FhMoAIlqCtsnwoCpdKClejI4i3Sgtb+GBxVuNBSFt1pV/RQefLjPyUDy4z8lA8uM/JQPLjPyUDy4z8lA8uM/JQPLjPyUDy4z8lA8uM/JQPLjPyUDy4z8lA8utJ/koJ7WCbBU/LQXOPAFq1koK8B0pag90CggtBBf6qB0UDooHRQOigdFA6KB0UDooHRQOigdFA6KB0UDooI0EaBQf//Z" title="Toggle Table of Contents" alt="Toggle Table of Contents" /></a></div></div>'; - $('body').prepend(ciNav); - // - var a = ['Index', 'CodeIgniter User Guide¶', 'Change Log¶', 'Developer’s Certificate of Origin 1.1¶', 'The MIT License (MIT)¶']; - if ($.inArray($('h1').text(), a) > 0 || $('h2').text() == 'Search Results') - { - $('table.ciNav a').each(function(){ - $(this).attr('href', $(this).attr("href").replace('../', '')); - }); - console.log(1111); - } - // - $('#openToc').click(function(){ - $('#nav').slideToggle(); - }); - $('.wy-breadcrumbs').append('<div style="float:right;"><div style="text-decoration:underline;color:blue;margin-left:5px;" id="closeMe"><img title="toc" alt="toc" src="data:image/gif;base64,R0lGODlhFAAUAJEAAAAAADMzM////wAAACH5BAUUAAIALAAAAAAUABQAAAImlI+py+0PU5gRBRDM3DxbWoXis42X13USOLauUIqnlsaH/eY6UwAAOw==" /></div></div>'); - $('#closeMe').toggle( - function() - { - setCookie('ciNav', true, 365); - $('#nav2').show(); - $('#topMenu').remove(); - $('body').css({ background:'none' }); - $('.wy-nav-content-wrap').css({ background:'none', 'margin-left':0 }); - $('.wy-breadcrumbs').append('<div style="float:right;"><div style="float:left;" id="topMenu">'+$('.wy-form').parent().html()+'</div></div>');$('.wy-nav-side').toggle(); - }, - function() - { - setCookie('ciNav', false, 365); - $('#topMenu').remove(); - $('#nav').hide(); - $('#nav2').hide(); - $('body').css({ background:'#edf0f2;' }); - $('.wy-nav-content-wrap').css({ background:'none repeat scroll 0 0 #fcfcfc;', 'margin-left':'300px' }); - $('.wy-nav-side').show(); - } - ); - if (getCookie('ciNav') == 'true') - { - $('#closeMe').trigger('click'); - //$('#nav').slideToggle(); - } - // END MODIFICATION --- + $("table.docutils:not(.field-list)").wrap("<div class='wy-table-responsive'></div>"); + // --- + // START DOC MODIFICATION BY RUFNEX + // v1.0 04.02.2015 + // Add ToogleButton to get FullWidth-View by Johannes Gamperl codeigniter.de + + $('#openToc').click(function () { + $('#nav').slideToggle(); + }); + $('#closeMe').toggle( + function () + { + setCookie('ciNav', 'yes', 365); + $('#nav2').show(); + $('#topMenu').remove(); + $('body').css({background: 'none'}); + $('.wy-nav-content-wrap').css({background: 'none', 'margin-left': 0}); + $('.wy-breadcrumbs').append('<div style="float:right;"><div style="float:left;" id="topMenu">' + $('.wy-form').parent().html() + '</div></div>'); + $('.wy-nav-side').toggle(); + }, + function () + { + setCookie('ciNav', 'no', 365); + $('#topMenu').remove(); + $('#nav').hide(); + $('#nav2').hide(); + $('body').css({background: '#edf0f2;'}); + $('.wy-nav-content-wrap').css({background: 'none repeat scroll 0 0 #fcfcfc;', 'margin-left': '300px'}); + $('.wy-nav-side').show(); + } + ); + if (getCookie('ciNav') == 'yes') + { + $('#closeMe').trigger('click'); + //$('#nav').slideToggle(); + } + // END MODIFICATION --- + }); // Rufnex Cookie functions -function setCookie(cname,cvalue,exdays) { +function setCookie(cname, cvalue, exdays) { + // expire the old cookie if existed to avoid multiple cookies with the same name + if (getCookie(cname)) { + document.cookie = cname + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT"; + } var d = new Date(); - d.setTime(d.getTime() + (exdays*24*60*60*1000)); + d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); var expires = "expires=" + d.toGMTString(); - document.cookie = cname+"="+cvalue+"; "+expires; + document.cookie = cname + "=" + cvalue + "; " + expires + "; path=/"; } function getCookie(cname) { var name = cname + "="; var ca = document.cookie.split(';'); - for(var i=0; i<ca.length; i++) { + for (var i = 0; i < ca.length; i++) { var c = ca[i]; - while (c.charAt(0)==' ') c = c.substring(1); + while (c.charAt(0) == ' ') + c = c.substring(1); if (c.indexOf(name) == 0) { return c.substring(name.length, c.length); } } - return false; + return ''; } // End +// resize window +$(window).on('resize', function(){ + // show side nav on small screens when pulldown is enabled + if (getCookie('ciNav') == 'yes' && $(window).width() <= 768) { // 768px is the tablet size defined by the theme + $('.wy-nav-side').show(); + } + // changing css with jquery seems to override the default css media query + // change margin + else if (getCookie('ciNav') == 'no' && $(window).width() <= 768) { + $('.wy-nav-content-wrap').css({'margin-left': 0}); + } + // hide side nav on large screens when pulldown is enabled + else if (getCookie('ciNav') == 'yes' && $(window).width() > 768) { + $('.wy-nav-side').hide(); + } + // change margin + else if (getCookie('ciNav') == 'no' && $(window).width() > 768) { + $('.wy-nav-content-wrap').css({'margin-left': '300px'}); + } +}); + window.SphinxRtdTheme = (function (jquery) { var stickyNav = (function () { var navBar, - win, - stickyNavCssClass = 'stickynav', - applyStickNav = function () { - if (navBar.height() <= win.height()) { - navBar.addClass(stickyNavCssClass); - } else { - navBar.removeClass(stickyNavCssClass); - } - }, - enable = function () { - applyStickNav(); - win.on('resize', applyStickNav); - }, - init = function () { - navBar = jquery('nav.wy-nav-side:first'); - win = jquery(window); - }; + win, + stickyNavCssClass = 'stickynav', + applyStickNav = function () { + if (navBar.height() <= win.height()) { + navBar.addClass(stickyNavCssClass); + } else { + navBar.removeClass(stickyNavCssClass); + } + }, + enable = function () { + applyStickNav(); + win.on('resize', applyStickNav); + }, + init = function () { + navBar = jquery('nav.wy-nav-side:first'); + win = jquery(window); + }; jquery(init); return { - enable : enable + enable: enable }; }()); return { - StickyNav : stickyNav + StickyNav: stickyNav }; }($)); diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 1b044cc5f..7e52a0eda 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -2,11 +2,451 @@ Change Log ########## -Version 3.0.1 +Version 3.2.0 ============= Release Date: Not Released +- General Changes + + - Officially dropped any kind of support for anything under PHP 5.4.8. + +- Core + + - Removed ``$config['rewrite_short_tags']`` (irrelevant on PHP 5.4+). + - Removed previously deprecated ``$config['global_xss_filtering']``. + - Removed previously deprecated :doc:`Routing Class <general/routing>` methods ``fetch_directory()``, ``fetch_class()`` and ``fetch_method()`` (use the respective class properties instead). + - Removed previously deprecated :doc:`Config Library <libraries/config>` method ``system_url()`` (encourages insecure practices). + - Changed :doc:`URI Library <libraries/uri>` to ignore the ``$config['url_suffix']``, ``$config['permitted_uri_chars']`` configuration settings for CLI requests. + + - :doc:`Input Library <libraries/input>` changes include: + + - Removed previously deprecated ``$config['allow_get_array']``. + - Removed previously deprecated ``$config['standardize_newlines']``. + - Removed previously deprecated method ``is_cli_request()`` (use :php:func:`is_cli()` instead). + - Changed the ``set_cookie()`` method's default expiry time to 0 (expires when browser is closed). + - Changed the ``set_cookie()`` method to delete the cookie if a negative expiry time is passed to it. + +- Libraries + + - Removed previously deprecated *Cart Library*. + - Removed previously deprecated *Javascript Library* (it was always experimental in the first place). + - Added UNIX socket connection support to :doc:`Session Library <libraries/sessions>` 'redis' driver. + + - :doc:`Cache Library <libraries/caching>` changes include: + + - Added UNIX socket connection support to the 'memcached' driver. + - Added 'database' configuration option to the 'redis' driver, allowing to auto-select another database. + - Changed the 'memcached' driver to ignore configurations that don't specify a hostname. + - Removed the *socket_type* configuration setting from the 'redis' driver. + - Changed data serialization logic in 'redis' driver for better performance. + + - :doc:`Form Validation Library <libraries/form_validation>` changes include: + + - Removed previously deprecated method ``prep_for_form()`` / rule *prep_for_form*. + - Changed method ``set_rules()`` to throw a ``BadMethodCallException`` when its first parameter is not an array and the ``$rules`` one is unused. + - Added rule **valid_mac**, which replicates PHP's native ``filter_var()`` with ``FILTER_VALIDATE_MAC``. + + - :doc:`HTML Table Library <libraries/table>` changes include: + + - Changed method ``clear()`` to also reset captions. + + - :doc:`Email Library <libraries/email>` changes include: + + - Changed the default value of the **validate** option to ``TRUE``. + +- :doc:`Database <database/index>` changes include: + + - Removed previously deprecated 'sqlite' driver (used for SQLite version 2; no longer shipped with PHP 5.4+). + - Removed method ``db_set_charset()`` and the ability to change a connection character set at runtime. + - Changed method ``initialize()`` to return void and instead throw a ``RuntimeException`` in case of failure. + - Changed method ``db_connect()`` to always set the connection character set (if supported by the driver) and to fail if it can't. + + - :doc:`Database Forge <database/forge>`: + + - Added support for declaring date/time type fields default values as ``CURRENT_TIMESTAMP`` and similar. + +- Helpers + + - Removed previously deprecated *Email Helper* (had only two functions, aliases for PHP's native ``filter_var()`` and ``mail()``). + - Removed previously deprecated *Smiley Helper*. + - Removed previously deprecated :doc:`Date Helper <helpers/date_helper>` function ``standard_date()`` (use PHP's native ``date()`` instead). + - Removed previously deprecated :doc:`Security Helper <helpers/security_helper>` function ``do_hash()`` (use PHP's native ``hash()`` instead). + - Removed previously deprecated :doc:`File Helper <helpers/file_helper>` function ``read_file()`` (use PHP's native ``file_get_contents()`` instead). + - Added new function :php:func:`ordinal_format()` to :doc:`Inflector Helper <helpers/inflector_helper>`. + - Added 'img_alt' option to :php:func`create_captcha()` :doc:`CAPTCHA Helper` with a default value of 'captcha'. + + - :doc:`Download Helper <helpers/download_helper>` changes include: + + - Updated :php:func:`force_download()` to allow existing files to be renamed for download. + - Updated :php:func:`force_download()` to better utilize available server memory. + + - :doc:`String Helper <helpers/string_helper>` changes include: + + - Removed previously deprecated function ``trim_slashes()`` (use PHP's native ``trim()`` with ``'/'`` instead). + - Removed previously deprecated function ``repeater()`` (use PHP's native ``str_repeat()`` instead). + + - :doc:`HTML Helper <helpers/html_helper>` changes include: + + - Removed previously deprecated function ``br()`` (use PHP's native ``str_repeat()`` with ``'<br />'`` instead). + - Removed previously deprecated function ``nbs()`` (use PHP's native ``str_repeat()`` with ``' '`` instead). + - Updated function :php:func:`meta()` with support for "charset" and "property" properties. + - Changed function :php:func:`doctype()` default document type to HTML 5. + + - :doc:`Form Helper <helpers/form_helper>` changes include: + + - Removed previously deprecated function ``form_prep()`` (use :php:func:`html_escape()` instead). + - Removed the second (out of three) parameter from the :php:func:`form_upload()` function (it was never used). + + +Version 3.1.4 +============= + +Release Date: Not Released + +- General Changes + + - Updated the :doc:`Image Manipulation Library <libraries/image_lib>` to work-around an issue with some JPEGs when using GD. + +Bug fixes for 3.1.4 +------------------- + +- Fixed a regression (#4975) - :doc:`Loader Library <libraries/loader>` couldn't handle objects passed as view variables. + +Version 3.1.3 +============= + +Release Date: Jan 09, 2017 + +- **Security** + + - Fixed an XSS vulnerability in :doc:`Security Library <libraries/security>` method ``xss_clean()``. + - Fixed a possible file inclusion vulnerability in :doc:`Loader Library <libraries/loader>` method ``vars()``. + - Fixed a possible remote code execution vulnerability in the :doc:`Email Library <libraries/email>` when 'mail' or 'sendmail' are used (thanks to Paul Buonopane from `NamePros <https://www.namepros.com/>`_). + - Added protection against timing side-channel attacks in :doc:`Security Library <libraries/security>` method ``csrf_verify()``. + - Added protection against BREACH attacks targeting the CSRF token field generated by :doc:`Form Helper <helpers/form_helper>` function :php:func:`form_open()`. + +- General Changes + + - Deprecated ``$config['allow_get_array']``. + - Deprecated ``$config['standardize_newlines']``. + - Deprecated :doc:`Date Helper <helpers/date_helper>` function :php:func:`nice_date()`. + +Bug fixes for 3.1.3 +------------------- + +- Fixed a bug (#4886) - :doc:`Database Library <database/index>` didn't differentiate bind markers inside double-quoted strings in queries. +- Fixed a bug (#4890) - :doc:`XML-RPC Library <libraries/xmlrpc>` didn't work on PHP 7. +- Fixed a regression (#4887) - :doc:`File Uploading Library <libraries/file_uploading>` triggered fatal errors due to numerous PHP distribution channels (XAMPP and cPanel confirmed) explicitly disabling ext/fileinfo by default. +- Fixed a bug (#4679) - :doc:`Input Library <libraries/input>` method ``ip_address()`` didn't properly resolve ``$config['proxy_ips']`` IPv6 addresses. +- Fixed a bug (#4902) - :doc:`Image Manipulation Library <libraries/image_lib>` processing via ImageMagick didn't work. +- Fixed a bug (#4905) - :doc:`Loader Library <libraries/loader>` didn't take into account possible user-provided directory paths when loading helpers. +- Fixed a bug (#4916) - :doc:`Session Library <libraries/sessions>` with ``sess_match_ip`` enabled was unusable for IPv6 clients when using the 'database' driver on MySQL 5.7.5+. +- Fixed a bug (#4917) - :doc:`Date Helper <helpers/date_helper>` function :php:func:`nice_date()` didn't handle YYYYMMDD inputs properly. +- Fixed a bug (#4923) - :doc:`Session Library <libraries/sessions>` could execute an erroneous SQL query with the 'database' driver, if the lock attempt times out. +- Fixed a bug (#4927) - :doc:`Output Library <libraries/output>` method ``get_header()`` returned the first matching header, regardless of whether it would be replaced by a second ``set_header()`` call. +- Fixed a bug (#4844) - :doc:`Email Library <libraries/email>` didn't apply ``escapeshellarg()`` to the while passing the Sendmail ``-f`` parameter through ``popen()``. +- Fixed a bug (#4928) - the bootstrap file didn't check if *config/constants.php* exists before trying to load it. +- Fixed a bug (#4937) - :doc:`Image Manipulation Library <libraries/image_lib>` method ``initialize()`` didn't translate *new_image* inputs to absolute paths. +- Fixed a bug (#4941) - :doc:`Query Builder <database/query_builder>` method ``order_by()`` didn't work with 'RANDOM' under the 'pdo/sqlite' driver. +- Fixed a regression (#4892) - :doc:`Query Builder <database/query_builder>` method ``update_batch()`` didn't properly handle identifier escaping. +- Fixed a bug (#4953) - :doc:`Database Forge <database/forge>` method ``create_table()`` didn't update an internal tables list cache if it exists but is empty. +- Fixed a bug (#4958) - :doc:`Query Builder <database/query_builder>` method ``count_all_results()`` didn't take into account cached ``ORDER BY`` clauses. +- Fixed a bug (#4804) - :doc:`Query Builder <database/query_builder>` method ``insert_batch()`` could fail if the input array pointer was modified. +- Fixed a bug (#4962) - :doc:`Database Force <database/forge>` method ``alter_table()`` would fail with the 'oci8' driver. +- Fixed a bug (#4457) - :doc:`Image Manipulation Library <libraries/image_lib>` method ``get_image_properties()`` didn't detect invalid images. +- Fixed a bug (#4765) - :doc:`Email Library <libraries/email>` didn't send the ``User-Agent`` header without a prior call to ``clear()``. + +Version 3.1.2 +============= + +Release Date: Oct 28, 2016 + +- **Security** + + - Fixed a number of new vulnerabilities in :doc:`Security Library <libraries/security>` method ``xss_clean()``. + +- General Changes + + - Allowed PHP 4-style constructors (``Matching_name::Matching_name()`` methods) to be used as routes, if there's a ``__construct()`` to override them. + +Bug fixes for 3.1.2 +------------------- + +- Fixed a regression (#4874) - :doc:`Session Library <libraries/sessions>` didn't take into account ``session.hash_bits_per_character`` when validating session IDs. +- Fixed a bug (#4871) - :doc:`Query Builder <database/query_builder>` method ``update_batch()`` didn't properly handle identifier escaping. +- Fixed a bug (#4884) - :doc:`Query Builder <database/query_builder>` didn't properly parse field names ending in 'is' when used inside WHERE and HAVING statements. +- Fixed a bug where ``CI_Log``, ``CI_Output``, ``CI_Email`` and ``CI_Zip`` didn't handle strings in a byte-safe manner when ``mbstring.func_override`` is enabled. + +Version 3.1.1 +============= + +Release Date: Oct 22, 2016 + +- **Security** + + - Fixed a flaw in :doc:`Security Library <libraries/security>` method ``entity_decode()`` (used by ``xss_clean()``) that affects HTML 5 entities when using PHP 5.3. + +- General Changes + + - Added ``E_PARSE`` to the list of error levels detected by the shutdown handler. + - Updated :doc:`Inflector Helper <helpers/inflector_helper>` :php:func:`is_countable()` with more words. + - Updated :doc:`common function <general/common_functions>` :php:func:`set_status_header()` with new status codes from IETF RFCs + `2817 <https://tools.ietf.org/html/rfc2817>`_ (426) + and `6585 <https://tools.ietf.org/html/rfc6585>`_ (428, 429, 431, 511). + +Bug fixes for 3.1.1 +------------------- + +- Fixed a bug (#4732) - :doc:`Session Library <libraries/sessions>` triggered errors while writing data for a newly-created sessions with the 'memcached' driver. +- Fixed a regression (#4736) - :doc:`Image Manipulation Library <libraries/image_lib>` processing via ImageMagick didn't work. +- Fixed a bug (#4737) - :doc:`Query Builder <database/query_builder>` didn't add an ``OFFSET`` when ``LIMIT`` is zero or unused. +- Fixed a regression (#4739) - :doc:`Email Library <libraries/email>` doesn't properly separate attachment bodies from headers. +- Fixed a bug (#4754) - :doc:`Unit Testing Library <libraries/unit_testing>` method ``result()`` didn't translate ``res_datatype``. +- Fixed a bug (#4759) - :doc:`Form Validation <libraries/form_validation>`, :doc:`Trackback <libraries/trackback>` and :doc:`XML-RPC <libraries/xmlrpc>` libraries treated URI schemes in a case-sensitive manner. +- Fixed a bug (#4762) - :doc:`Cache Library <libraries/caching>` 'file' driver method ``get_metadata()`` checked TTL time against ``mtime`` instead of the cache item's creation time. +- Fixed a bug where :doc:`File Uploading Library <libraries/file_uploading>` generated error messages on PHP 7.1. +- Fixed a bug (#4780) - :doc:`compatibility function <general/compatibility_functions>` ``hex2bin()`` didn't reject inputs of type "resource". +- Fixed a bug (#4787) - :doc:`Form Validation Library <libraries/form_validation>` method ``valid_email()`` triggered ``E_WARNING`` when input emails have empty domain names. +- Fixed a bug (#4805) - :doc:`Database <database/index>` driver 'mysqli' didn't use the ``MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT`` flag properly. +- Fixed a bug (#4808) - :doc:`Database <database/index>` method ``is_write_type()`` only looked at the first line of a queries using ``RETURNING`` with the 'postgre', 'pdo/pgsql', 'odbc' and 'pdo/odbc' drivers. +- Fixed a bug where :doc:`Query Builder <database/query_builder>` method ``insert_batch()`` tried to execute an unsupported SQL query with the 'ibase' and 'pdo/firebird' drivers. +- Fixed a bug (#4809) - :doc:`Database <database/index>` driver 'pdo/mysql' didn't turn off ``AUTOCOMMIT`` when starting a transaction. +- Fixed a bug (#4822) - :doc:`CAPTCHA Helper <helpers/captcha_helper>` didn't clear expired PNG images. +- Fixed a bug (#4823) - :doc:`Session Library <libraries/sessions>` 'files' driver could enter an infinite loop if ``mbstring.func_override`` is enabled. +- Fixed a bug (#4851) - :doc:`Database Forge <database/forge>` didn't quote schema names passed to its ``create_database()`` method. +- Fixed a bug (#4863) - :doc:`HTML Table Library <libraries/table>` method ``set_caption()`` was missing method chaining support. +- Fixed a bug (#4843) - :doc:`XML-RPC Library <libraries/xmlrpc>` client class didn't set a read/write socket timeout. +- Fixed a bug (#4865) - uncaught exceptions didn't set the HTTP Response status code to 500 unless ``display_errors`` was turned On. +- Fixed a bug (#4830) - :doc:`Session Library <libraries/sessions>` didn't take into account the new session INI settings in PHP 7.1. + +Version 3.1.0 +============= + +Release Date: July 26, 2016 + +- **Security** + + - Fixed an SQL injection in the 'odbc' database driver. + - Updated :php:func:`set_realpath()` :doc:`Path Helper <helpers/path_helper>` function to filter-out ``php://`` wrapper inputs. + - Officially dropped any kind of support for PHP 5.2.x and anything under 5.3.7. + +- General Changes + + - Updated :doc:`Image Manipulation Library <libraries/image_lib>` to validate *width* and *height* configuration values. + - Updated :doc:`Encryption Library <libraries/encryption>` to always prefer ``random_bytes()`` when it is available. + - Updated :doc:`Session Library <libraries/sessions>` to log 'debug' messages when using fallbacks to *session.save_path* (php.ini) or 'sess_use_database', 'sess_table_name' settings. + - Added a 'LONGTEXT' to 'STRING' alias to :doc:`Database Forge <database/forge>` for the 'cubrid', 'pdo/cubrid' drivers. + - Added 'TINYINT', 'MEDIUMINT', 'INT' and 'BIGINT' aliases to 'NUMBER' to :doc:`Database Forge <database/forge>` for the 'oci8', 'pdo/oci' drivers. + + - :php:func:`password_hash()` :doc:`compatibility function <general/compatibility_functions>` changes: + + - Changed salt-generation logic to prefer ``random_bytes()`` when it is available. + - Changed salt-generation logic to prefer direct access to */dev/urandom* over ``openssl_random_pseudo_bytes()``. + - Changed salt-generation logic to error if ``openssl_random_pseudo_bytes()`` sets its ``$crypto_strong`` flag to FALSE. + +Bug fixes for 3.1.0 +------------------- + +- Fixed a bug where :doc:`Image Manipulation Library <libraries/image_lib>` didn't escape image source paths passed to ImageMagick as shell arguments. +- Fixed a bug (#861) - :doc:`Database Forge <database/forge>` method ``create_table()`` incorrectly accepts field width constraints for MSSQL/SQLSRV integer-type columns. +- Fixed a bug (#4562) - :doc:`Cache Library <libraries/caching>` didn't check if ``Memcached::quit()`` is available before calling it. +- Fixed a bug (#4563) - :doc:`Input Library <libraries/input>` method ``request_headers()`` ignores ``$xss_clean`` parameter value after first call. +- Fixed a bug (#4605) - :doc:`Config Library <libraries/config>` method ``site_url()`` stripped trailing slashes from relative URIs passed to it. +- Fixed a bug (#4613) - :doc:`Email Library <libraries/config>` failed to send multiple emails via SMTP due to "already authenticated" errors when keep-alive is enabled. +- Fixed a bug (#4633) - :doc:`Form Validation Library <libraries/form_validation>` ignored multiple "callback" rules for empty, non-required fields. +- Fixed a bug (#4637) - :doc:`Database <database/index>` method ``error()`` returned ``FALSE`` with the 'oci8' driver if there was no error. +- Fixed a bug (#4647) - :doc:`Query Builder <database/query_builder>` method ``count_all_results()`` doesn't take into account ``GROUP BY`` clauses while deciding whether to do a subquery or not. +- Fixed a bug where :doc:`Session Library <libraries/sessions>` 'redis' driver didn't properly detect if a connection is properly closed on PHP 5.x. +- Fixed a bug (#4583) - :doc:`Email Library <libraries/email>` didn't properly handle inline attachments in HTML emails. +- Fixed a bug where :doc:`Database <database/index>` method ``db_select()`` didn't clear metadata cached for the previously used database. +- Fixed a bug (#4675) - :doc:`File Helper <helpers/file_helper>` function :php:func:`delete_files()` treated symbolic links as regular directories. +- Fixed a bug (#4674) - :doc:`Database <database/index>` driver 'dblib' triggered E_WARNING messages while connecting. +- Fixed a bug (#4678) - :doc:`Database Forge <database/forge>` tried to use unsupported ``IF NOT EXISTS`` clause when creating tables on Oracle. +- Fixed a bug (#4691) - :doc:`File Uploading Library <libraries/file_uploading>` method ``data()`` returns wrong 'raw_name' when the filename extension is also contained in the raw filename. +- Fixed a bug (#4679) - :doc:`Input Library <libraries/input>` method ``ip_address()`` errors with a matching ``$config['proxy_ips']`` IPv6 address. +- Fixed a bug (#4695) - :doc:`User Agent Library <libraries/user_agent>` didn't load the *config/user_agents.php* file when there's no ``User-Agent`` HTTP request header. +- Fixed a bug (#4713) - :doc:`Query Builder <database/query_builder>` methods ``insert_batch()``, ``update_batch()`` could return wrong affected rows count. +- Fixed a bug (#4712) - :doc:`Email Library <libraries/email>` doesn't sent ``RSET`` to SMTP servers after a failure and while using keep-alive. +- Fixed a bug (#4724) - :doc:`Common function <general/common_functions>` :php:func:`is_https()` compared the ``X-Forwarded-Proto`` HTTP header case-sensitively. +- Fixed a bug (#4725) - :doc:`Common function <general/common_functions>` :php:func:`remove_invisible_characters()` searched case-sensitively for URL-encoded characters. + +Version 3.0.6 +============= + +Release Date: March 21, 2016 + +- General Changes + + - Added a destructor to :doc:`Cache Library <libraries/caching>` 'memcached' driver to ensure that Memcache(d) connections are properly closed. + - Deprecated :doc:`Form Validation Library <libraries/form_validation>` method ``prep_for_form()``. + +Bug fixes for 3.0.6 +------------------- + +- Fixed a bug (#4516) - :doc:`Form Validation Library <libraries/form_validation>` always accepted empty array inputs. +- Fixed a bug where :doc:`Session Library <libraries/sessions>` allowed accessing ``$_SESSION`` values as class properties but ``isset()`` didn't work on them. +- Fixed a bug where :doc:`Form Validation Library <libraries/form_validation>` modified the ``$_POST`` array when the data being validated was actually provided via ``set_data()``. +- Fixed a bug (#4539) - :doc:`Migration Library <libraries/migration>` applied migrations before validating that all migrations within the requested version range are valid. +- Fixed a bug (#4539) - :doc:`Migration Library <libraries/migration>` triggered failures for migrations that are out of the requested version range. + +Version 3.0.5 +============= + +Release Date: March 11, 2016 + +- Core + + - Changed :doc:`Loader Library <libraries/loader>` to allow ``$autoload['drivers']`` assigning with custom property names. + - Changed :doc:`Loader Library <libraries/loader>` to ignore variables prefixed with '_ci_' when loading views. + +- General Changes + + - Updated the :doc:`Session Library <libraries/sessions>` to produce friendlier error messages on failures with drivers other than 'files'. + +- :doc:`Query Builder <database/query_builder>` + + - Added a ``$batch_size`` parameter to the ``insert_batch()`` method (defaults to 100). + - Added a ``$batch_size`` parameter to the ``update_batch()`` method (defaults to 100). + +Bug fixes for 3.0.5 +------------------- + +- Fixed a bug (#4391) - :doc:`Email Library <libraries/email>` method ``reply_to()`` didn't apply Q-encoding. +- Fixed a bug (#4384) - :doc:`Pagination Library <libraries/pagination>` ignored (possible) *cur_page* configuration value. +- Fixed a bug (#4395) - :doc:`Query Builder <database/query_builder>` method ``count_all_results()`` still fails if an ``ORDER BY`` condition is used. +- Fixed a bug (#4399) - :doc:`Query Builder <database/query_builder>` methods ``insert_batch()``, ``update_batch()`` produced confusing error messages when called with no data and *db_debug* is enabled. +- Fixed a bug (#4401) - :doc:`Query Builder <database/query_builder>` breaks ``WHERE`` and ``HAVING`` conditions that use ``IN()`` with strings containing a closing parenthesis. +- Fixed a regression in :doc:`Form Helper <helpers/form_helper>` functions :php:func:`set_checkbox()`, :php:func:`set_radio()` where "checked" inputs aren't recognized after a form submit. +- Fixed a bug (#4407) - :doc:`Text Helper <helpers/text_helper>` function :php:func:`word_censor()` doesn't work under PHP 7 if there's no custom replacement provided. +- Fixed a bug (#4415) - :doc:`Form Validation Library <libraries/form_validation>` rule **valid_url** didn't accept URLs with IPv6 addresses enclosed in square brackets under PHP 5 (upstream bug). +- Fixed a bug (#4427) - :doc:`CAPTCHA Helper <helpers/captcha_helper>` triggers an error if the provided character pool is too small. +- Fixed a bug (#4430) - :doc:`File Uploading Library <libraries/file_uploading>` option **file_ext_tolower** didn't work. +- Fixed a bug (#4431) - :doc:`Query Builder <database/query_builder>` method ``join()`` discarded opening parentheses. +- Fixed a bug (#4424) - :doc:`Session Library <libraries/sessions>` triggered a PHP warning when writing a newly created session with the 'redis' driver. +- Fixed a bug (#4437) - :doc:`Inflector Helper <helpers/inflector_helper>` function :php:func:`humanize()` didn't escape its ``$separator`` parameter while using it in a regular expression. +- Fixed a bug where :doc:`Session Library <libraries/sessions>` didn't properly handle its locks' statuses with the 'memcached' driver. +- Fixed a bug where :doc:`Session Library <libraries/sessions>` triggered a PHP warning when writing a newly created session with the 'memcached' driver. +- Fixed a bug (#4449) - :doc:`Query Builder <database/query_builder>` method ``join()`` breaks conditions containing ``IS NULL``, ``IS NOT NULL``. +- Fixed a bug (#4491) - :doc:`Session Library <libraries/sessions>` didn't clean-up internal variables for emulated locks with the 'redis' driver. +- Fixed a bug where :doc:`Session Library <libraries/sessions>` didn't clean-up internal variables for emulated locks with the 'memcached' driver. +- Fixed a bug where :doc:`Database <database/index>` transactions didn't work with the 'ibase' driver. +- Fixed a bug (#4475) - :doc:`Security Library <libraries/security>` method ``strip_image_tags()`` preserves only the first URL character from non-quoted *src* attributes. +- Fixed a bug where :doc:`Profiler Library <general/profiling>` didn't apply ``htmlspecialchars()`` to all displayed inputs. +- Fixed a bug (#4277) - :doc:`Cache Library <libraries/caching>` triggered fatal errors if accessing the Memcache(d) and/or Redis driver and they are not available on the system. +- Fixed a bug where :doc:`Cache Library <libraries/caching>` method ``is_supported()`` logged an error message when it returns ``FALSE`` for the APC and Wincache drivers. + +Version 3.0.4 +============= + +Release Date: January 13, 2016 + +- General Changes + + - Updated :doc:`Security Library <libraries/security>` method ``get_random_bytes()`` to use PHP 7's ``random_bytes()`` function when possible. + - Updated :doc:`Encryption Library <libraries/security>` method ``create_key()`` to use PHP 7's ``random_bytes()`` function when possible. + +- :doc:`Database <database/index>` + + - Added support for ``OFFSET-FETCH`` with Oracle 12c for the 'oci8' and 'pdo/oci' drivers. + - Added support for the new ``MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT`` constant from `PHP 5.6.16 <https://secure.php.net/ChangeLog-5.php#5.6.16>`_ for the 'mysqli' driver. + +Bug fixes for 3.0.4 +------------------- + +- Fixed a bug (#4212) - :doc:`Query Builder <database/query_builder>` method ``count_all_results()`` could fail if an ``ORDER BY`` condition is used. +- Fixed a bug where :doc:`Form Helper <helpers/form_helper>` functions :php:func:`set_checkbox()`, :php:func:`set_radio()` didn't "uncheck" inputs on a submitted form if the default state is "checked". +- Fixed a bug (#4217) - :doc:`Config Library <libraries/config>` method ``base_url()`` didn't use proper formatting for IPv6 when it falls back to ``$_SERVER['SERVER_ADDR']``. +- Fixed a bug where :doc:`CAPTCHA Helper <helpers/captcha_helper>` entered an infinite loop while generating a random string. +- Fixed a bug (#4223) - :doc:`Database <database/index>` method ``simple_query()`` blindly executes queries without checking if the connection was initialized properly. +- Fixed a bug (#4244) - :doc:`Email Library <libraries/email>` could improperly use "unsafe" US-ASCII characters during Quoted-printable encoding. +- Fixed a bug (#4245) - :doc:`Database Forge <database/forge>` couldn't properly handle ``SET`` and ``ENUM`` type fields with string values. +- Fixed a bug (#4283) - :doc:`String Helper <helpers/string_helper>` function :php:func:`alternator()` couldn't be called without arguments. +- Fixed a bug (#4306) - :doc:`Database <database/index>` method ``version()`` didn't work properly with the 'mssql' driver. +- Fixed a bug (#4039) - :doc:`Session Library <libraries/sessions>` could generate multiple (redundant) warnings in case of a read failure with the 'files' driver, due to a bug in PHP. +- Fixed a bug where :doc:`Session Library <libraries/sessions>` didn't have proper error handling on PHP 5 (due to a PHP bug). +- Fixed a bug (#4312) - :doc:`Form Validation Library <libraries/form_validation>` didn't provide error feedback for failed validation on empty requests. +- Fixed a bug where :doc:`Database <database/index>` method `version()` returned banner text instead of only the version number with the 'oci8' and 'pdo/oci' drivers. +- Fixed a bug (#4331) - :doc:`Database <database/index>` method ``error()`` didn't really work for connection errors with the 'mysqli' driver. +- Fixed a bug (#4343) - :doc:`Email Library <libraries/email>` failing with a *"More than one 'from' person"* message when using *sendmail*. +- Fixed a bug (#4350) - :doc:`Loader Library <libraries/loader>` method ``model()`` logic directly instantiated the ``CI_Model`` or ``MY_Model`` classes. +- Fixed a bug (#4337) - :doc:`Database <database/index>` method ``query()`` didn't return a result set for queries with the ``RETURNING`` statement on PostgreSQL. +- Fixed a bug (#4362) - :doc:`Session Library <libraries/sessions>` doesn't properly maintain its state after ID regeneration with the 'redis' and 'memcached' drivers on PHP 7. +- Fixed a bug (#4349) - :doc:`Database <database/index>` drivers 'mysql', 'mysqli', 'pdo/mysql' discard other ``sql_mode`` flags when "stricton" is enabled. +- Fixed a bug (#4349) - :doc:`Database <database/index>` drivers 'mysql', 'mysqli', 'pdo/mysql' don't turn off ``STRICT_TRANS_TABLES`` on MySQL 5.7+ when "stricton" is disabled. +- Fixed a bug (#4374) - :doc:`Session Library <libraries/sessions>` with the 'database' driver could be affected by userspace :doc:`Query Builder <database/query_builder>` conditions. + +Version 3.0.3 +============= + +Release Date: October 31, 2015 + +- **Security** + + - Fixed an XSS attack vector in :doc:`Security Library <libraries/security>` method ``xss_clean()``. + - Changed :doc:`Config Library <libraries/config>` method ``base_url()`` to fallback to ``$_SERVER['SERVER_ADDR']`` when ``$config['base_url']`` is empty in order to avoid *Host* header injections. + - Changed :doc:`CAPTCHA Helper <helpers/captcha_helper>` to use the operating system's PRNG when possible. + +- :doc:`Database <database/index>` + + - Optimized :doc:`Database Utility <database/utilities>` method ``csv_from_result()`` for speed with larger result sets. + - Added proper return values to :doc:`Database Transactions <database/transactions>` method ``trans_start()``. + +Bug fixes for 3.0.3 +------------------- + +- Fixed a bug (#4170) - :doc:`Database <database/index>` method ``insert_id()`` could return an identity from the wrong scope with the 'sqlsrv' driver. +- Fixed a bug (#4179) - :doc:`Session Library <libraries/sessions>` doesn't properly maintain its state after ID regeneration with the 'database' driver on PHP 7. +- Fixed a bug (#4173) - :doc:`Database Forge <database/forge>` method ``add_key()`` didn't allow creation of non-PRIMARY composite keys after the "bugfix" for #3968. +- Fixed a bug (#4171) - :doc:`Database Transactions <database/transactions>` didn't work with nesting in methods ``trans_begin()``, ``trans_commit()``, ``trans_rollback()``. +- Fixed a bug where :doc:`Database Transaction <database/transactions>` methods ``trans_begin()``, ``trans_commit()``, ``trans_rollback()`` ignored failures. +- Fixed a bug where all :doc:`Database Transaction <database/transactions>` methods returned TRUE while transactions are actually disabled. +- Fixed a bug where :doc:`common function <general/common_functions>` :php:func:`html_escape()` modified keys of its array inputs. +- Fixed a bug (#4192) - :doc:`Email Library <libraries/email>` wouldn't always have proper Quoted-printable encoding due to a bug in PHP's own ``mb_mime_encodeheader()`` function. + +Version 3.0.2 +============= + +Release Date: October 8, 2015 + +- **Security** + + - Fixed a number of XSS attack vectors in :doc:`Security Library <libraries/security>` method ``xss_clean()`` (thanks to Frans Rosén from `Detectify <https://detectify.com/>`_). + +- General Changes + + - Updated the *application/config/constants.php* file to check if constants aren't already defined before doing that. + - Changed :doc:`Loader Library <libraries/loader>` method ``model()`` to only apply ``ucfirst()`` and not ``strtolower()`` to the requested class name. + - Changed :doc:`Config Library <libraries/config>` methods ``base_url()``, ``site_url()`` to allow protocol-relative URLs by passing an empty string as the protocol. + +Bug fixes for 3.0.2 +------------------- + +- Fixed a bug (#2284) - :doc:`Database <database/index>` method ``protect_identifiers()`` breaks when :doc:`Query Builder <database/query_builder>` isn't enabled. +- Fixed a bug (#4052) - :doc:`Routing <general/routing>` with anonymous functions didn't work for routes that don't use regular expressions. +- Fixed a bug (#4056) - :doc:`Input Library <libraries/input>` method ``get_request_header()`` could not return a value unless ``request_headers()`` was called beforehand. +- Fixed a bug where the :doc:`Database Class <database/index>` entered an endless loop if it fails to connect with the 'sqlsrv' driver. +- Fixed a bug (#4065) - :doc:`Database <database/index>` method ``protect_identifiers()`` treats a traling space as an alias separator if the input doesn't contain ' AS '. +- Fixed a bug (#4066) - :doc:`Cache Library <libraries/caching>` couldn't fallback to a backup driver if the primary one is Memcache(d) or Redis. +- Fixed a bug (#4073) - :doc:`Email Library <libraries/email>` method ``send()`` could return TRUE in case of an actual failure when an SMTP command fails. +- Fixed a bug (#4086) - :doc:`Query Builder <database/query_builder>` didn't apply *dbprefix* to LIKE conditions if the pattern included spaces. +- Fixed a bug (#4091) - :doc:`Cache Library <libraries/caching>` 'file' driver could be tricked into accepting empty cache item IDs. +- Fixed a bug (#4093) - :doc:`Query Builder <database/query_builder>` modified string values containing 'AND', 'OR' while compiling WHERE conditions. +- Fixed a bug (#4096) - :doc:`Query Builder <database/query_builder>` didn't apply *dbprefix* when compiling BETWEEN conditions. +- Fixed a bug (#4105) - :doc:`Form Validation Library <libraries/form_validation>` didn't allow pipe characters inside "bracket parameters" when using a string ruleset. +- Fixed a bug (#4109) - :doc:`Routing <general/routing>` to *default_controller* didn't work when *enable_query_strings* is set to TRUE. +- Fixed a bug (#4044) - :doc:`Cache Library <libraries/caching>` 'redis' driver didn't catch ``RedisException`` that could be thrown during authentication. +- Fixed a bug (#4120) - :doc:`Database <database/index>` method ``error()`` didn't return error info when called after ``query()`` with the 'mssql' driver. +- Fixed a bug (#4116) - :doc:`Pagination Library <libraries/pagination>` set the wrong page number on the "data-ci-pagination-page" attribute in generated links. +- Fixed a bug where :doc:`Pagination Library <libraries/pagination>` added the 'rel="start"' attribute to the first displayed link even if it's not actually linking the first page. +- Fixed a bug (#4137) - :doc:`Error Handling <general/errors>` breaks for the new ``Error`` exceptions under PHP 7. +- Fixed a bug (#4126) - :doc:`Form Validation Library <libraries/form_validation>` method ``reset_validation()`` discarded validation rules from config files. + +Version 3.0.1 +============= + +Release Date: August 7, 2015 + - Core - Added DoS mitigation to :php:func:`hash_pbkdf2()` :doc:`compatibility function <general/compatibility_functions>`. @@ -77,6 +517,8 @@ Bug fixes for 3.0.1 - Fixed a bug (#4012) - :doc:`Query Builder <database/query_builder>` methods ``where_in()``, ``or_where_in()``, ``where_not_in()``, ``or_where_not_in()`` didn't take into account previously cached WHERE conditions when query cache is in use. - Fixed a bug (#4015) - :doc:`Email Library <libraries/email>` method ``set_header()`` didn't support method chaining, although it was advertised. - Fixed a bug (#4027) - :doc:`Routing <general/routing>` with HTTP verbs only worked if the route request method was declared in all-lowercase letters. +- Fixed a bug (#4026) - :doc:`Database Transactions <database/transactions>` always rollback if any previous ``query()`` call fails. +- Fixed a bug (#4023) - :doc:`String Helper <helpers/string_helper>` function ``increment_string()`` didn't escape its ``$separator`` parameter. Version 3.0.0 ============= @@ -180,15 +622,15 @@ Release Date: March 30, 2015 - :doc:`Form Helper <helpers/form_helper>` changes include: - :php:func:`form_dropdown()` will now also take an array for unity with other form helpers. - - :php:func:`form_prep()` is now DEPRECATED and only acts as an alias for :doc:`common function <general/common_functions>` :php:func:`html_escape()`. + - ``form_prep()`` is now DEPRECATED and only acts as an alias for :doc:`common function <general/common_functions>` :php:func:`html_escape()`. - :php:func:`set_value()` will now also accept a third argument, allowing to turn off HTML escaping of the value. - :doc:`Security Helper <helpers/security_helper>` changes include: - - :php:func:`do_hash()` now uses PHP's native ``hash()`` function (supporting more algorithms) and is deprecated. + - ``do_hash()`` now uses PHP's native ``hash()`` function (supporting more algorithms) and is deprecated. - :php:func:`strip_image_tags()` is now an alias for the same method in the :doc:`Security Library <libraries/security>`. - - :doc:`Smiley Helper <helpers/smiley_helper>` changes include: + - *Smiley Helper* changes include: - Deprecated the whole helper as too specific for CodeIgniter. - Removed previously deprecated function ``js_insert_smiley()``. @@ -224,7 +666,7 @@ Release Date: March 30, 2015 - :doc:`Directory Helper <helpers/directory_helper>` :php:func:`directory_map()` will now append ``DIRECTORY_SEPARATOR`` to directory names in the returned array. - :doc:`Array Helper <helpers/array_helper>` :php:func:`element()` and :php:func:`elements()` now return NULL instead of FALSE when the required elements don't exist. - :doc:`Language Helper <helpers/language_helper>` :php:func:`lang()` now accepts an optional list of additional HTML attributes. - - Deprecated the :doc:`Email Helper <helpers/email_helper>` as its ``valid_email()``, ``send_email()`` functions are now only aliases for PHP native functions ``filter_var()`` and ``mail()`` respectively. + - Deprecated the *Email Helper* as its ``valid_email()``, ``send_email()`` functions are now only aliases for PHP native functions ``filter_var()`` and ``mail()`` respectively. - Database @@ -399,7 +841,7 @@ Release Date: March 30, 2015 - Added support for templating via an array in addition to the encoded string. - Changed method ``get_total_days()`` to be an alias for :doc:`Date Helper <helpers/date_helper>` :php:func:`days_in_month()`. - - :doc:`Cart Library <libraries/cart>` changes include: + - *Cart Library* changes include: - Deprecated the library as too specific for CodeIgniter. - Added method ``remove()`` to remove a cart item, updating with quantity of 0 seemed like a hack but has remained to retain compatibility. @@ -668,7 +1110,7 @@ Bug fixes for 3.0 - Fixed a bug where :doc:`Database Forge <database/forge>` method ``create_table()`` with PostgreSQL database could lead to fetching the whole table. - Fixed a bug (#795) - :doc:`Form Helper <helpers/form_helper>` :php:func:`form_open()` didn't add the default form *method* and *accept-charset* when an empty array is passed to it. - Fixed a bug (#797) - :doc:`Date Helper <helpers/date_helper>` :php:func:`timespan()` was using incorrect seconds for year and month. -- Fixed a bug in :doc:`Cart Library <libraries/cart>` method ``contents()`` where if called without a TRUE (or equal) parameter, it would fail due to a typo. +- Fixed a bug in *Cart Library* method ``contents()`` where if called without a TRUE (or equal) parameter, it would fail due to a typo. - Fixed a bug (#406) - SQLSRV DB driver not returning resource on ``db_pconnect()``. - Fixed a bug in :doc:`Image Manipulation Library <libraries/image_lib>` method ``gd_loaded()`` where it was possible for the script execution to end or a PHP E_WARNING message to be emitted. - Fixed a bug in the :doc:`Pagination library <libraries/pagination>` where when use_page_numbers=TRUE previous link and page 1 link did not have the same url. @@ -750,7 +1192,7 @@ Bug fixes for 3.0 - 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 :php:func:`standard_date()` didn't properly format *W3C* and *ATOM* standard dates. +- 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 where :doc:`Query Builder <database/query_builder>` method ``join()`` escaped literal values 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 :php:func:`form_multiselect()`, :php:func:`form_dropdown()` didn't properly handle empty array option groups. @@ -805,7 +1247,7 @@ Bug fixes for 3.0 - Fixed a bug (#2298) - :doc:`Database Results <database/results>` method ``next_row()`` kept returning the last row, allowing for infinite loops. - Fixed a bug (#2236, #2639) - :doc:`Form Helper <helpers/form_helper>` functions :php:func:`set_value()`, :php:func:`set_select()`, :php:func:`set_radio()`, :php:func:`set_checkbox()` didn't parse array notation for keys if the rule was not present in the :doc:`Form Validation Library <libraries/form_validation>`. - Fixed a bug (#2353) - :doc:`Query Builder <database/query_builder>` erroneously prefixed literal strings with **dbprefix**. -- Fixed a bug (#78) - :doc:`Cart Library <libraries/cart>` didn't allow non-English letters in product names. +- Fixed a bug (#78) - *Cart Library* didn't allow non-English letters in product names. - Fixed a bug (#77) - :doc:`Database Class <database/index>` didn't properly handle the transaction "test mode" flag. - Fixed a bug (#2380) - :doc:`URI Routing <general/routing>` method ``fetch_method()`` returned 'index' if the requested method name matches its controller name. - Fixed a bug (#2388) - :doc:`Email Library <libraries/email>` used to ignore attachment errors, resulting in broken emails being sent. @@ -1040,9 +1482,8 @@ Release Date: November 14, 2011 - Libraries - - Changed ``$this->cart->insert()`` in the :doc:`Cart - Library <libraries/cart>` to return the Row ID if a single - item was inserted successfully. + - Changed ``$this->cart->insert()`` in the *Cart Library* + to return the Row ID if a single item was inserted successfully. - Added support to set an optional parameter in your callback rules of validation using the :doc:`Form Validation Library <libraries/form_validation>`. @@ -1150,9 +1591,8 @@ Release Date: August 20, 2011 string. See upgrade notes if using database sessions. - Added $this->db->set_dbprefix() to the :doc:`Database Driver <database/queries>`. - - Changed $this->cart->insert() in the :doc:`Cart - Library <libraries/cart>` to return the Row ID if a single - item was inserted successfully. + - Changed ``$this->cart->insert()`` in the *Cart Library* + to return the Row ID if a single item was inserted successfully. - Added $this->load->get_var() to the :doc:`Loader library <libraries/loader>` to retrieve global vars set with $this->load->view() and $this->load->vars(). @@ -1177,8 +1617,8 @@ Bug fixes for 2.0.3 properly escaped. - Fixed issue #199 - Attributes passed as string does not include a space between it and the opening tag. -- Fixed a bug where the method $this->cart->total_items() from :doc:`Cart - Library <libraries/cart>` now returns the sum of the quantity +- Fixed a bug where the method ``$this->cart->total_items()`` from + *Cart Library* now returns the sum of the quantity of all items in the cart instead of your total count. - Fixed a bug where not setting 'null' when adding fields in db_forge for mysql and mysqli drivers would default to NULL instead of NOT @@ -1214,8 +1654,8 @@ Hg Tag: v2.0.2 - Helpers - - Removed the previously deprecated dohash() from the :doc:`Security - helper <./helpers/security_helper>`; use do_hash() instead. + - Removed the previously deprecated ``dohash()`` from the :doc:`Security + helper <./helpers/security_helper>`; use ``do_hash()`` instead. - Changed the 'plural' function so that it doesn't ruin the captalization of your string. It also take into consideration acronyms which are all caps. @@ -1457,7 +1897,7 @@ Hg Tag: v2.0.0 helper <./helpers/text_helper>`. - Added accept-charset to the list of inserted attributes of form_open() in the :doc:`Form Helper <helpers/form_helper>`. - - Deprecated the dohash() function in favour of do_hash() for + - Deprecated the ``dohash()`` function in favour of ``do_hash()`` for naming consistency. - Non-backwards compatible change made to get_dir_file_info() in the :doc:`File Helper <helpers/file_helper>`. No longer recurses @@ -1477,7 +1917,7 @@ Hg Tag: v2.0.0 string already has a scheme. - Modified get_file_info in the file helper, changing filectime() to filemtime() for dates. - - Modified smiley_js() to add optional third parameter to return + - Modified ``smiley_js()`` to add optional third parameter to return only the javascript with no script tags. - The img() function of the :doc:`HTML helper <./helpers/html_helper>` will now generate an empty @@ -1597,7 +2037,7 @@ Hg Tag: v1.7.2 - Libraries - - Added a new :doc:`Cart Class <libraries/cart>`. + - Added a new *Cart Class*. - Added the ability to pass $config['file_name'] for the :doc:`File Uploading Class <libraries/file_uploading>` and rename the uploaded file. @@ -1624,7 +2064,7 @@ Hg Tag: v1.7.2 - Modified form_hidden() in the :doc:`Form helper <helpers/form_helper>` to accept multi-dimensional arrays. - - Modified form_prep() in the :doc:`Form + - Modified ``form_prep()`` in the :doc:`Form helper <helpers/form_helper>` to keep track of prepped fields to avoid multiple prep/mutation from subsequent calls which can occur when using Form Validation and form helper functions to @@ -1632,7 +2072,7 @@ Hg Tag: v1.7.2 - Modified directory_map() in the :doc:`Directory helper <helpers/directory_helper>` to allow the inclusion of hidden files, and to return FALSE on failure to read directory. - - Modified the :doc:`Smiley helper <helpers/smiley_helper>` to work + - Modified the *Smiley helper* to work with multiple fields and insert the smiley at the last known cursor position. @@ -1683,7 +2123,7 @@ Bug fixes for 1.7.2 - Fixed a case sensitive string replacement in xss_clean() - Fixed a bug in form_textarea() where form data was not prepped correctly. -- Fixed a bug in form_prep() causing it to not preserve entities in +- Fixed a bug in ``form_prep()`` causing it to not preserve entities in the user's original input when called back into a form element - Fixed a bug in _protect_identifiers() where the swap prefix ($swap_pre) was not being observed. @@ -2376,7 +2816,7 @@ Release Date: January 30, 2008 class. <./libraries/sessions>` - Removed 'last_visit' from the Session class. - Added a language entry for valid_ip validation error. - - Modified prep_for_form() in the Validation class to accept + - Modified ``prep_for_form()`` in the Validation class to accept arrays, adding support for POST array validation (via callbacks only) - Added an "integer" rule into the Validation library. @@ -2400,8 +2840,7 @@ Release Date: January 30, 2008 helper. <./helpers/html_helper>` - Added img() to the :doc:`HTML helper. <./helpers/html_helper>` - Added ability to :doc:`"extend" Helpers <./general/helpers>`. - - Added an :doc:`email helper <./helpers/email_helper>` into core - helpers. + - Added an *Email Helper* into core helpers. - Added strip_quotes() function to :doc:`string helper <./helpers/string_helper>`. - Added reduce_multiples() function to :doc:`string @@ -2602,7 +3041,7 @@ Release Date: July 12, 2007 - Fixed various doc typos. - Documented two functions from the :doc:`String helper <./helpers/string_helper>` that were missing from the - user guide: trim_slashes() and reduce_double_slashes(). + user guide: ``trim_slashes()`` and ``reduce_double_slashes()``. - Docs now validate to XHTML 1 transitional - Updated the XSS Filtering to take into account the IE expression() ability and improved certain deletions to prevent possible exploits @@ -2633,7 +3072,7 @@ Release Date: April 15, 2007 - Added array to string into the profiler - Code Igniter references updated to CodeIgniter - pMachine references updated to EllisLab -- Fixed a bug in the repeater function of :doc:`string +- Fixed a bug in the ``repeater()`` function of :doc:`string helper <./helpers/string_helper>`. - Fixed a bug in ODBC driver - Fixed a bug in result_array() that was returning an empty array when @@ -2732,8 +3171,7 @@ Release Date: October 30, 2006 - Added :doc:`Download Helper <./helpers/download_helper>`. - Added :doc:`simple_query() <./database/queries>` function to the database classes -- Added :doc:`standard_date() <./helpers/date_helper>` function to - the Date Helper. +- Added ``standard_date()`` function function to the :doc:`Date Helper <helpers/date_helper>`. - Added :doc:`$query->free_result() <./database/results>` to database class. - Added :doc:`$query->list_fields() <./database/metadata>` function to @@ -2741,7 +3179,7 @@ Release Date: October 30, 2006 - Added :doc:`$this->db->platform() <./database/helpers>` function - Added new :doc:`File Helper <./helpers/file_helper>`: get_filenames() -- Added new helper: :doc:`Smiley Helper <./helpers/smiley_helper>` +- Added new helper: *Smiley Helper* - Added support for <ul> and <ol> lists in the :doc:`HTML Helper <./helpers/html_helper>` - Added the ability to rewrite :doc:`short @@ -2774,7 +3212,7 @@ Release Date: October 30, 2006 - Fixed a bug in the validation class. - Fixed a bug in the typography helper that was incorrectly wrapping block level elements in paragraph tags. -- Fixed a problem in the form_prep() function that was double encoding +- Fixed a problem in the ``form_prep()`` function that was double encoding entities. - Fixed a bug that affects some versions of PHP when output buffering is nested. @@ -3136,7 +3574,7 @@ Release Date: March 10, 2006 - Fixed a pagination problem in the scaffolding. - Fixed a bug in the mysql class "where" function. - Fixed a regex problem in some code that trimmed duplicate slashes. -- Fixed a bug in the br() function in the HTML helper +- Fixed a bug in the ``br()`` function in the HTML helper - Fixed a syntax mistake in the form_dropdown function in the Form Helper. - Removed the "style" attributes form the form helpers. diff --git a/user_guide_src/source/conf.py b/user_guide_src/source/conf.py index 1704654b6..e0312d3c1 100644 --- a/user_guide_src/source/conf.py +++ b/user_guide_src/source/conf.py @@ -41,16 +41,16 @@ master_doc = 'index' # General information about the project. project = u'CodeIgniter' -copyright = u'2014 - 2015, British Columbia Institute of Technology' +copyright = u'2014 - 2017, British Columbia Institute of Technology' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = '3.0.1' +version = '3.2.0-dev' # The full version, including alpha/beta/rc tags. -release = '3.0.0-dev' +release = '3.2.0-dev' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -229,7 +229,7 @@ man_pages = [ epub_title = u'CodeIgniter' epub_author = u'British Columbia Institute of Technology' epub_publisher = u'British Columbia Institute of Technology' -epub_copyright = u'2014 - 2015, British Columbia Institute of Technology' +epub_copyright = u'2014 - 2017, British Columbia Institute of Technology' # The language of the text. It defaults to the language option # or en if the language is not set. diff --git a/user_guide_src/source/contributing/index.rst b/user_guide_src/source/contributing/index.rst index 0112ca065..e102b8848 100644 --- a/user_guide_src/source/contributing/index.rst +++ b/user_guide_src/source/contributing/index.rst @@ -29,12 +29,24 @@ own copy. This will require you to use the version control system called Git. Support ******* -Note that GitHub is not for general support questions! +Please note that GitHub is not for general support questions! If you are +having trouble using a feature of CodeIgniter, ask for help on our +`forums <http://forum.codeigniter.com/>`_ instead. -If you are having trouble using a feature of CodeIgniter, ask for help on the forum. +If you are not sure whether you are using something correctly or if you +have found a bug, again - please ask on the forums first. -If you are wondering if you are using -something correctly or if you have found a bug, ask on the forum first. +******** +Security +******** + +Did you find a security issue in CodeIgniter? + +Please *don't* disclose it publicly, but e-mail us at security@codeigniter.com, +or report it via our page on `HackerOne <https://hackerone.com/codeigniter>`_. + +If you've found a critical vulnerability, we'd be happy to credit you in our +`ChangeLog <../changelog>`. **************************** Tips for a Good Issue Report @@ -74,9 +86,9 @@ PHP Style ========= All code must meet the `Style Guide -<http://www.codeigniter.com/userguide3/general/styleguide.html>`_, which is +<https://codeigniter.com/userguide3/general/styleguide.html>`_, which is essentially the `Allman indent style -<http://en.wikipedia.org/wiki/Indent_style#Allman_style>`_, underscores and +<https://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. @@ -91,10 +103,10 @@ must also be updated for every change. Also PHPDoc blocks must be maintained. Compatibility ============= -CodeIgniter recommends PHP 5.4 or newer to be used, but it should be -compatible with PHP 5.2.4 so all code supplied must stick to this -requirement. If PHP 5.3 (and above) functions or features are used then -there must be a fallback for PHP 5.2.4. +CodeIgniter recommends PHP 5.6 or newer to be used, but it should be +compatible with PHP 5.4.8 so all code supplied must stick to this +requirement. If PHP 5.5 (and above) functions or features are used then +there must be a fallback for PHP 5.4.8. Branching ========= @@ -143,5 +155,5 @@ could even alias git commit to use the -s flag so you don’t have to think abou 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 +of 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 8026be63a..e231a7d6a 100644 --- a/user_guide_src/source/database/configuration.rst +++ b/user_guide_src/source/database/configuration.rst @@ -7,7 +7,7 @@ connection values (username, password, database name, etc.). The config file is located at application/config/database.php. You can also set database connection values for specific :doc:`environments <../libraries/config>` by placing **database.php** -it the respective environment config folder. +in the respective environment config folder. The config settings are stored in a multi-dimensional array with this prototype:: diff --git a/user_guide_src/source/database/db_driver_reference.rst b/user_guide_src/source/database/db_driver_reference.rst index 005e6b3dc..6f2fa5fb1 100644 --- a/user_guide_src/source/database/db_driver_reference.rst +++ b/user_guide_src/source/database/db_driver_reference.rst @@ -17,8 +17,8 @@ This article is intended to be a reference for them. .. php:method:: initialize() - :returns: TRUE on success, FALSE on failure - :rtype: bool + :rtype: void + :throws: RuntimeException In case of failure Initialize database settings, establish a connection to the database. @@ -61,14 +61,6 @@ This article is intended to be a reference for them. Select / switch the current database. - .. php:method:: db_set_charset($charset) - - :param string $charset: Character set name - :returns: TRUE on success, FALSE on failure - :rtype: bool - - Set client character set. - .. php:method:: platform() :returns: Platform name @@ -83,7 +75,7 @@ This article is intended to be a reference for them. Database version number. - .. php:method:: query($sql[, $binds = FALSE[, $return_object = NULL]]]) + .. php:method:: query($sql[, $binds = FALSE[, $return_object = NULL]]) :param string $sql: The SQL statement to execute :param array $binds: An array of binding data @@ -116,6 +108,16 @@ This article is intended to be a reference for them. for use when you don't need to get a result object or to just send a query to the database and not care for the result. + .. php:method:: affected_rows() + + :returns: Number of rows affected + :rtype: int + + Returns the number of rows *changed* by the last executed query. + + Useful for checking how much rows were created, updated or deleted + during the last executed query. + .. php:method:: trans_strict([$mode = TRUE]) :param bool $mode: Strict mode flag @@ -124,8 +126,8 @@ This article is intended to be a reference for them. Enable/disable transaction "strict" mode. When strict mode is enabled, if you are running multiple - groups of transactions and one group fails, all groups - will be rolled back. + groups of transactions and one group fails, all subsequent + groups will be rolled back. If strict mode is disabled, each group is treated autonomously, meaning a failure of one group will not @@ -140,13 +142,15 @@ This article is intended to be a reference for them. .. php:method:: trans_start([$test_mode = FALSE]) :param bool $test_mode: Test mode flag - :rtype: void + :returns: TRUE on success, FALSE on failure + :rtype: bool Start a transaction. .. php:method:: trans_complete() - :rtype: void + :returns: TRUE on success, FALSE on failure + :rtype: bool Complete Transaction. @@ -232,6 +236,13 @@ This article is intended to be a reference for them. and ``_`` wildcard characters, so that they don't cause false-positives in LIKE conditions. + .. important:: The ``escape_like_str()`` method uses '!' (exclamation mark) + to escape special characters for *LIKE* conditions. Because this + method escapes partial strings that you would wrap in quotes + yourself, it cannot automatically add the ``ESCAPE '!'`` + condition for you, and so you'll have to manually do that. + + .. php:method:: primary($table) :param string $table: Table name diff --git a/user_guide_src/source/database/examples.rst b/user_guide_src/source/database/examples.rst index 8b3cc4701..5fd7fccfa 100644 --- a/user_guide_src/source/database/examples.rst +++ b/user_guide_src/source/database/examples.rst @@ -55,23 +55,6 @@ Standard Query With Multiple Results (Array Version) The above result_array() function returns an array of standard array indexes. Example: $row['title'] -Testing for Results -=================== - -If you run queries that might **not** produce a result, you are -encouraged to test for a result first using the num_rows() function:: - - $query = $this->db->query("YOUR QUERY"); - if ($query->num_rows() > 0) - { - foreach ($query->result() as $row) - { - echo $row->title; - echo $row->name; - echo $row->body; - } - } - Standard Query With Single Result ================================= diff --git a/user_guide_src/source/database/forge.rst b/user_guide_src/source/database/forge.rst index 646e3a56e..5af4f2248 100644 --- a/user_guide_src/source/database/forge.rst +++ b/user_guide_src/source/database/forge.rst @@ -97,6 +97,7 @@ Additionally, the following key/values can be used: - auto_increment/true : generates an auto_increment flag on the field. Note that the field type must be a type that supports this, such as integer. +- unique/true : to generate a unique key for the field definition. :: @@ -110,6 +111,7 @@ Additionally, the following key/values can be used: 'blog_title' => array( 'type' => 'VARCHAR', 'constraint' => '100', + 'unique' => TRUE, ), 'blog_author' => array( 'type' =>'VARCHAR', @@ -175,14 +177,14 @@ below is for MySQL. $this->dbforge->add_key('blog_id', TRUE); // gives PRIMARY KEY `blog_id` (`blog_id`) - + $this->dbforge->add_key('blog_id', TRUE); $this->dbforge->add_key('site_id', TRUE); // gives PRIMARY KEY `blog_id_site_id` (`blog_id`, `site_id`) - + $this->dbforge->add_key('blog_name'); // gives KEY `blog_name` (`blog_name`) - + $this->dbforge->add_key(array('blog_name', 'blog_label')); // gives KEY `blog_name_blog_label` (`blog_name`, `blog_label`) @@ -261,7 +263,7 @@ number of additional fields. $fields = array( 'preferences' => array('type' => 'TEXT') ); - $this->dbforge->add_column('table_name', $fields); + $this->dbforge->add_column('table_name', $fields); // Executes: ALTER TABLE table_name ADD preferences TEXT If you are using MySQL or CUBIRD, then you can take advantage of their diff --git a/user_guide_src/source/database/queries.rst b/user_guide_src/source/database/queries.rst index 43a0a30bf..f626f1e83 100644 --- a/user_guide_src/source/database/queries.rst +++ b/user_guide_src/source/database/queries.rst @@ -123,7 +123,13 @@ this: $search = '20% raise'; $sql = "SELECT id FROM table WHERE column LIKE '%" . - $this->db->escape_like_str($search)."%'"; + $this->db->escape_like_str($search)."%' ESCAPE '!'"; + +.. important:: The ``escape_like_str()`` method uses '!' (exclamation mark) + to escape special characters for *LIKE* conditions. Because this + method escapes partial strings that you would wrap in quotes + yourself, it cannot automatically add the ``ESCAPE '!'`` + condition for you, and so you'll have to manually do that. ************** @@ -159,7 +165,7 @@ Handling Errors **$this->db->error();** -If you need to get the last error that has occured, the error() method +If you need to get the last error that has occurred, the error() method will return an array containing its code and message. Here's a quick example:: diff --git a/user_guide_src/source/database/query_builder.rst b/user_guide_src/source/database/query_builder.rst index 9c3ff306f..3135f76da 100644 --- a/user_guide_src/source/database/query_builder.rst +++ b/user_guide_src/source/database/query_builder.rst @@ -1018,7 +1018,7 @@ Here's a usage example:: .. note:: The following statements can be cached: select, from, join, - where, like, group_by, having, order_by, set + where, like, group_by, having, order_by *********************** @@ -1433,15 +1433,20 @@ Class Reference Compiles and executes an INSERT statement. - .. php:method:: insert_batch([$table = ''[, $set = NULL[, $escape = NULL]]]) + .. php:method:: insert_batch($table[, $set = NULL[, $escape = NULL[, $batch_size = 100]]]) :param string $table: Table name :param array $set: Data to insert :param bool $escape: Whether to escape values and identifiers + :param int $batch_size: Count of rows to insert at once :returns: Number of rows inserted or FALSE on failure :rtype: mixed - Compiles and executes batch INSERT statements. + Compiles and executes batch ``INSERT`` statements. + + .. note:: When more than ``$batch_size`` rows are provided, multiple + ``INSERT`` queries will be executed, each trying to insert + up to ``$batch_size`` rows. .. php:method:: set_insert_batch($key[, $value = ''[, $escape = NULL]]) @@ -1464,15 +1469,20 @@ Class Reference Compiles and executes an UPDATE statement. - .. php:method:: update_batch([$table = ''[, $set = NULL[, $value = NULL]]]) + .. php:method:: update_batch($table[, $set = NULL[, $value = NULL[, $batch_size = 100]]]) :param string $table: Table name :param array $set: Field name, or an associative array of field/value pairs :param string $value: Field value, if $set is a single field + :param int $batch_size: Count of conditions to group in a single query :returns: Number of rows updated or FALSE on failure :rtype: mixed - Compiles and executes batch UPDATE statements. + Compiles and executes batch ``UPDATE`` statements. + + .. note:: When more than ``$batch_size`` field/value pairs are provided, + multiple queries will be executed, each handling up to + ``$batch_size`` field/value pairs. .. php:method:: set_update_batch($key[, $value = ''[, $escape = NULL]]) diff --git a/user_guide_src/source/database/transactions.rst b/user_guide_src/source/database/transactions.rst index 2e6d4b477..cfd6a566d 100644 --- a/user_guide_src/source/database/transactions.rst +++ b/user_guide_src/source/database/transactions.rst @@ -75,12 +75,11 @@ debugging is turned off, you can manage your own errors like this:: // generate an error... or use the log_message() function to log your error } -Enabling Transactions -===================== +Disabling Transactions +====================== -Transactions are enabled automatically the moment you use -$this->db->trans_start(). If you would like to disable transactions you -can do so using $this->db->trans_off():: +If you would like to disable transactions you can do so using +``$this->db->trans_off()``:: $this->db->trans_off(); @@ -88,8 +87,9 @@ can do so using $this->db->trans_off():: $this->db->query('AN SQL QUERY...'); $this->db->trans_complete(); -When transactions are disabled, your queries will be auto-commited, just -as they are when running queries without transactions. +When transactions are disabled, your queries will be auto-committed, just as +they are when running queries without transactions, practically ignoring +any calls to ``trans_start()``, ``trans_complete()``, etc. Test Mode ========= diff --git a/user_guide_src/source/documentation/index.rst b/user_guide_src/source/documentation/index.rst index 60c6b4ed6..aaac33ecb 100644 --- a/user_guide_src/source/documentation/index.rst +++ b/user_guide_src/source/documentation/index.rst @@ -18,7 +18,7 @@ It is created automatically by inserting the following: .. raw:: html - <div class="custom-index container"></div> + <div class="custom-index container"></div> .. contents:: :local: @@ -43,7 +43,7 @@ Pygments, so that code blocks can be properly highlighted. .. code-block:: bash easy_install "sphinx==1.2.3" - easy_install sphinxcontrib-phpdomain + easy_install "sphinxcontrib-phpdomain==0.1.3.post1" Then follow the directions in the README file in the :samp:`cilexer` folder inside the documentation repository to install the CI Lexer. @@ -199,4 +199,4 @@ It creates the following display: .. php:method:: should_do_something() :returns: Whether or not something should be done - :rtype: bool
\ No newline at end of file + :rtype: bool diff --git a/user_guide_src/source/general/cli.rst b/user_guide_src/source/general/cli.rst index b45be1aa8..764a6b835 100644 --- a/user_guide_src/source/general/cli.rst +++ b/user_guide_src/source/general/cli.rst @@ -47,11 +47,11 @@ in it:: Then save the file to your *application/controllers/* folder. -Now normally you would visit the your site using a URL similar to this:: +Now normally you would visit the site using a URL similar to this:: example.com/index.php/tools/message/to -Instead, we are going to open Terminal in Mac/Linux or go to Run > "cmd" +Instead, we are going to open the terminal in Mac/Linux or go to Run > "cmd" in Windows and navigate to our CodeIgniter project. .. code-block:: bash @@ -75,4 +75,4 @@ That's it! That, in a nutshell, is all there is to know about controllers on the command line. Remember that this is just a normal controller, so routing -and ``_remap()`` works fine.
\ No newline at end of file +and ``_remap()`` works fine. diff --git a/user_guide_src/source/general/common_functions.rst b/user_guide_src/source/general/common_functions.rst index 6d6744cf7..77b0df14e 100644 --- a/user_guide_src/source/general/common_functions.rst +++ b/user_guide_src/source/general/common_functions.rst @@ -24,9 +24,9 @@ loading any libraries or helpers. Example:: - if (is_php('5.3')) + if (is_php('5.5')) { - $str = quoted_printable_encode($str); + echo json_last_error_msg(); } Returns boolean TRUE if the installed version of PHP is equal to or @@ -101,7 +101,7 @@ loading any libraries or helpers. .. php:function:: set_status_header($code[, $text = '']) - :param int $code: HTTP Reponse status code + :param int $code: HTTP Response status code :param string $text: A custom message to set with the status code :rtype: void @@ -185,4 +185,4 @@ loading any libraries or helpers. .. note:: This function was introduced because Suhosin terminated script execution, but this turned out to be a bug. A fix has been available for some time (version 0.9.34), but is - unfortunately not released yet.
\ No newline at end of file + unfortunately not released yet. diff --git a/user_guide_src/source/general/compatibility_functions.rst b/user_guide_src/source/general/compatibility_functions.rst index 434b0982f..522e43f60 100644 --- a/user_guide_src/source/general/compatibility_functions.rst +++ b/user_guide_src/source/general/compatibility_functions.rst @@ -10,7 +10,7 @@ Being custom implementations, these functions will also have some set of dependencies on their own, but are still useful if your PHP setup doesn't offer them natively. -.. note:: Much like the `common functions <common_functions>`, the +.. note:: Much like the :doc:`common functions <common_functions>`, the compatibility functions are always available, as long as their dependencies are met. @@ -32,7 +32,6 @@ that is otherwise available only since PHP 5.5. Dependencies ============ -- PHP 5.3.7 - ``CRYPT_BLOWFISH`` support for ``crypt()`` Constants @@ -221,44 +220,3 @@ Function reference For more information, please refer to the `PHP manual for array_column() <http://php.net/array_column>`_. - -.. php:function:: array_replace(array $array1[, ...]) - - :param array $array1: Array in which to replace elements - :param array ...: Array (or multiple ones) from which to extract elements - :returns: Modified array - :rtype: array - - For more information, please refer to the `PHP manual for - array_replace() <http://php.net/array_replace>`_. - -.. php:function:: array_replace_recursive(array $array1[, ...]) - - :param array $array1: Array in which to replace elements - :param array ...: Array (or multiple ones) from which to extract elements - :returns: Modified array - :rtype: array - - For more information, please refer to the `PHP manual for - array_replace_recursive() <http://php.net/array_replace_recursive>`_. - - .. important:: Only PHP's native function can detect endless recursion. - Unless you are running PHP 5.3+, be careful with references! - -.. php:function:: hex2bin($data) - - :param array $data: Hexadecimal representation of data - :returns: Binary representation of the given data - :rtype: string - - For more information, please refer to the `PHP manual for hex2bin() - <http://php.net/hex2bin>`_. - -.. php:function:: quoted_printable_encode($str) - - :param string $str: Input string - :returns: 8bit-encoded string - :rtype: string - - For more information, please refer to the `PHP manual for - quoted_printable_encode() <http://php.net/quoted_printable_encode>`_.
\ No newline at end of file diff --git a/user_guide_src/source/general/controllers.rst b/user_guide_src/source/general/controllers.rst index 7ab5a7f6a..5a111d8dc 100644 --- a/user_guide_src/source/general/controllers.rst +++ b/user_guide_src/source/general/controllers.rst @@ -140,9 +140,12 @@ file and set this variable:: $route['default_controller'] = 'blog'; -Where Blog is the name of the controller class you want used. If you now +Where 'blog' is the name of the controller class you want used. If you now load your main index.php file without specifying any URI segments you'll -see your Hello World message by default. +see your "Hello World" message by default. + +For more information, please refer to the "Reserved Routes" section of the +:doc:`URI Routing <routing>` documentation. Remapping Method Calls ====================== @@ -263,12 +266,12 @@ Trying to access it via the URL, like this, will not work:: Organizing Your Controllers into Sub-directories ================================================ -If you are building a large application you might find it convenient to -organize your controllers into sub-directories. CodeIgniter permits you -to do this. +If you are building a large application you might want to hierarchically +organize or structure your controllers into sub-directories. CodeIgniter +permits you to do this. -Simply create folders within your *application/controllers/* directory -and place your controller classes within them. +Simply create sub-directories under the main *application/controllers/* +one and place your controller classes within them. .. note:: When using this feature the first segment of your URI must specify the folder. For example, let's say you have a controller located @@ -281,8 +284,9 @@ and place your controller classes within them. example.com/index.php/products/shoes/show/123 Each of your sub-directories may contain a default controller which will be -called if the URL contains only the sub-folder. Simply name your default -controller as specified in your *application/config/routes.php* file. +called if the URL contains *only* the sub-directory. Simply put a controller +in there that matches the name of your 'default_controller' as specified in +your *application/config/routes.php* file. CodeIgniter also permits you to remap your URIs using its :doc:`URI Routing <routing>` feature. diff --git a/user_guide_src/source/general/core_classes.rst b/user_guide_src/source/general/core_classes.rst index 07c0b00ba..79f73ef06 100644 --- a/user_guide_src/source/general/core_classes.rst +++ b/user_guide_src/source/general/core_classes.rst @@ -101,6 +101,7 @@ your new class in your application controller's constructors. public function __construct() { parent::__construct(); + // Your own constructor code } public function index() diff --git a/user_guide_src/source/general/errors.rst b/user_guide_src/source/general/errors.rst index 9c190feb1..a1cc3517a 100644 --- a/user_guide_src/source/general/errors.rst +++ b/user_guide_src/source/general/errors.rst @@ -78,11 +78,10 @@ The following functions let you generate errors: CodeIgniter automatically logs any ``show_404()`` calls. Setting the optional second parameter to FALSE will skip logging. -.. php:function:: log_message($level, $message, $php_error = FALSE) +.. php:function:: log_message($level, $message) :param string $level: Log level: 'error', 'debug' or 'info' :param string $message: Message to log - :param bool $php_error: Whether we're logging a native PHP error message :rtype: void This function lets you write messages to your log files. You must diff --git a/user_guide_src/source/general/hooks.rst b/user_guide_src/source/general/hooks.rst index ffe3fef39..6cc3407a3 100644 --- a/user_guide_src/source/general/hooks.rst +++ b/user_guide_src/source/general/hooks.rst @@ -56,8 +56,8 @@ defined in your associative hook array: - **params** Any parameters you wish to pass to your script. This item is optional. -If you're running PHP 5.3+, you can also use lambda/anoymous functions -(or closures) as hooks, with a simpler syntax:: +You can also use lambda/anoymous functions (or closures) as hooks, with +a simpler syntax:: $hook['post_controller'] = function() { diff --git a/user_guide_src/source/general/models.rst b/user_guide_src/source/general/models.rst index 1cfe736de..eb842e927 100644 --- a/user_guide_src/source/general/models.rst +++ b/user_guide_src/source/general/models.rst @@ -22,12 +22,6 @@ model class might look like:: public $content; public $date; - public function __construct() - { - // Call the CI_Model constructor - parent::__construct(); - } - public function get_last_ten_entries() { $query = $this->db->get('entries', 10); @@ -76,6 +70,7 @@ The basic prototype for a model class is this:: public function __construct() { parent::__construct(); + // Your own constructor code } } @@ -91,6 +86,7 @@ The file name must match the class name. For example, if this is your class:: public function __construct() { parent::__construct(); + // Your own constructor code } } diff --git a/user_guide_src/source/general/requirements.rst b/user_guide_src/source/general/requirements.rst index f90cdd30d..982a6014f 100644 --- a/user_guide_src/source/general/requirements.rst +++ b/user_guide_src/source/general/requirements.rst @@ -2,9 +2,9 @@ Server Requirements ################### -`PHP <http://php.net/>`_ version 5.4 or newer is recommended. +`PHP <http://php.net/>`_ version 5.6 or newer is recommended. -It should work on 5.2.4 as well, but we strongly advise you NOT to run +It should work on 5.4.8 as well, but we strongly advise you NOT to run such old versions of PHP, because of potential security and performance issues, as well as missing features. @@ -15,7 +15,7 @@ Currently supported databases are: - Oracle via the *oci8* and *pdo* drivers - PostgreSQL via the *postgre* and *pdo* drivers - MS SQL via the *mssql*, *sqlsrv* (version 2005 and above only) and *pdo* drivers - - SQLite via the *sqlite* (version 2), *sqlite3* (version 3) and *pdo* drivers + - SQLite via the *sqlite3* and *pdo* drivers - CUBRID via the *cubrid* and *pdo* drivers - Interbase/Firebird via the *ibase* and *pdo* drivers - - ODBC via the *odbc* and *pdo* drivers (you should know that ODBC is actually an abstraction layer)
\ No newline at end of file + - ODBC via the *odbc* and *pdo* drivers (you should know that ODBC is actually an abstraction layer) diff --git a/user_guide_src/source/general/routing.rst b/user_guide_src/source/general/routing.rst index 766e0b2ab..b53a85d31 100644 --- a/user_guide_src/source/general/routing.rst +++ b/user_guide_src/source/general/routing.rst @@ -113,18 +113,19 @@ A typical RegEx route might look something like this:: In the above example, a URI similar to products/shirts/123 would instead call the "shirts" controller class and the "id_123" method. -With regular expressions, you can also catch a segment containing a -forward slash ('/'), which would usually represent the delimiter between -multiple segments. - +With regular expressions, you can also catch multiple segments at once. For example, if a user accesses a password protected area of your web application and you wish to be able to redirect them back to the same page after they log in, you may find this example useful:: $route['login/(.+)'] = 'auth/login/$1'; +.. note:: In the above example, if the ``$1`` placeholder contains a + slash, it will still be split into multiple parameters when + passed to ``Auth::login()``. + For those of you who don't know regular expressions and want to learn -more about them, `regular-expressions.info <http://www.regular-expressions.info/>` +more about them, `regular-expressions.info <http://www.regular-expressions.info/>`_ might be a good starting point. .. note:: You can also mix and match wildcards with regular expressions. @@ -132,8 +133,8 @@ might be a good starting point. Callbacks ========= -If you are using PHP >= 5.3 you can use callbacks in place of the normal -routing rules to process the back-references. Example:: +You can also use callbacks in place of the normal routing rules to process +the back-references. Example:: $route['products/([a-zA-Z]+)/edit/(\d+)'] = function ($product_type, $id) { @@ -170,11 +171,16 @@ There are three reserved routes:: $route['default_controller'] = 'welcome'; -This route indicates which controller class should be loaded if the URI -contains no data, which will be the case when people load your root URL. -In the above example, the "welcome" class would be loaded. You are -encouraged to always have a default route otherwise a 404 page will -appear by default. +This route points to the action that should be executed if the URI contains +no data, which will be the case when people load your root URL. +The setting accepts a **controller/method** value and ``index()`` would be +the default method if you don't specify one. In the above example, it is +``Welcome::index()`` that would be called. + +.. note:: You can NOT use a directory as a part of this setting! + +You are encouraged to always have a default route as otherwise a 404 page +will appear by default. :: @@ -182,11 +188,13 @@ appear by default. This route indicates which controller class should be loaded if the requested controller is not found. It will override the default 404 -error page. It won't affect to the ``show_404()`` function, which will +error page. Same per-directory rules as with 'default_controller' +apply here as well. + +It won't affect to the ``show_404()`` function, which will continue loading the default *error_404.php* file at *application/views/errors/error_404.php*. - :: $route['translate_uri_dashes'] = FALSE; diff --git a/user_guide_src/source/general/security.rst b/user_guide_src/source/general/security.rst index d4120d162..744a2c934 100644 --- a/user_guide_src/source/general/security.rst +++ b/user_guide_src/source/general/security.rst @@ -5,6 +5,9 @@ Security This page describes some "best practices" regarding web security, and details CodeIgniter's internal security features. +.. note:: If you came here looking for a security contact, please refer to + our `Contribution Guide <../contributing/index>`. + URI Security ============ @@ -130,12 +133,7 @@ with that. Please read below. in PHP's own `Password Hashing <http://php.net/password>`_ functions. Please use them, even if you're not running PHP 5.5+, CodeIgniter - provides them for you as long as you're running at least PHP version - 5.3.7 (and if you don't meet that requirement - please, upgrade). - - If you're one of the really unlucky people who can't even upgrade to a - more recent PHP version, use `hash_pbkdf() <http://php.net/hash_pbkdf2>`, - which we also provide in our compatibility layer. + provides them for you. - DO NOT ever display or send a password in plain-text format! diff --git a/user_guide_src/source/general/styleguide.rst b/user_guide_src/source/general/styleguide.rst index 7704a59c5..5f25a5ae4 100644 --- a/user_guide_src/source/general/styleguide.rst +++ b/user_guide_src/source/general/styleguide.rst @@ -345,8 +345,8 @@ inability for CodeIgniter to send proper headers. Compatibility ============= -CodeIgniter recommends PHP 5.4 or newer to be used, but it should be -compatible with PHP 5.2.4. Your code must either be compatible with this +CodeIgniter recommends PHP 5.6 or newer to be used, but it should be +compatible with PHP 5.4.8. Your code must either be compatible with this requirement, provide a suitable fallback, or be an optional feature that dies quietly without affecting a user's application. @@ -633,4 +633,4 @@ Whenever appropriate, provide function argument defaults, which helps prevent PHP errors with mistaken calls and provides common fallback values which can save a few lines of code. Example:: - function foo($bar = '', $baz = FALSE)
\ No newline at end of file + function foo($bar = '', $baz = FALSE) diff --git a/user_guide_src/source/helpers/cookie_helper.rst b/user_guide_src/source/helpers/cookie_helper.rst index da26151cb..71e40a33c 100644 --- a/user_guide_src/source/helpers/cookie_helper.rst +++ b/user_guide_src/source/helpers/cookie_helper.rst @@ -25,7 +25,7 @@ Available Functions The following functions are available: -.. php:function:: set_cookie($name[, $value = ''[, $expire = ''[, $domain = ''[, $path = '/'[, $prefix = ''[, $secure = FALSE[, $httponly = FALSE]]]]]]]]) +.. php:function:: set_cookie($name[, $value = ''[, $expire = ''[, $domain = ''[, $path = '/'[, $prefix = ''[, $secure = FALSE[, $httponly = FALSE]]]]]]]) :param mixed $name: Cookie name *or* associative array of all of the parameters available to this function :param string $value: Cookie value @@ -42,7 +42,7 @@ The following functions are available: a description of its use, as this function is an alias for ``CI_Input::set_cookie()``. -.. php:function:: get_cookie($index[, $xss_clean = NULL]]) +.. php:function:: get_cookie($index[, $xss_clean = FALSE]) :param string $index: Cookie name :param bool $xss_clean: Whether to apply XSS filtering to the returned value @@ -56,7 +56,7 @@ The following functions are available: the ``$config['cookie_prefix']`` that you might've set in your *application/config/config.php* file. -.. php:function:: delete_cookie($name[, $domain = ''[, $path = '/'[, $prefix = '']]]]) +.. php:function:: delete_cookie($name[, $domain = ''[, $path = '/'[, $prefix = '']]]) :param string $name: Cookie name :param string $domain: Cookie domain (usually: .yourdomain.com) diff --git a/user_guide_src/source/helpers/date_helper.rst b/user_guide_src/source/helpers/date_helper.rst index a85da26a4..2f44cb923 100644 --- a/user_guide_src/source/helpers/date_helper.rst +++ b/user_guide_src/source/helpers/date_helper.rst @@ -31,7 +31,7 @@ The following functions are available: :rtype: int Returns the current time as a UNIX timestamp, referenced either to your server's - local time or any PHP suported timezone, based on the "time reference" setting + local time or any PHP supported timezone, based on the "time reference" setting in your config file. If you do not intend to set your master time reference to any other PHP supported timezone (which you'll typically do if you run a site that lets each user set their own timezone settings) there is no benefit to using @@ -67,45 +67,6 @@ The following functions are available: If a timestamp is not included in the second parameter the current time will be used. -.. php:function:: standard_date([$fmt = 'DATE_RFC822'[, $time = NULL]]) - - :param string $fmt: Date format - :param int $time: UNIX timestamp - :returns: Formatted date or FALSE on invalid format - :rtype: string - - Lets you generate a date string in one of several standardized formats. - - Example:: - - $format = 'DATE_RFC822'; - $time = time(); - echo standard_date($format, $time); - - .. note:: This function is DEPRECATED. Use the native ``date()`` combined with - `DateTime's format constants - <http://php.net/manual/en/class.datetime.php#datetime.constants.types>`_ - instead:: - - echo date(DATE_RFC822, time()); - - **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 - =============== ======================= ====================================== - .. php:function:: local_to_gmt([$time = '']) :param int $time: UNIX timestamp @@ -220,6 +181,9 @@ The following functions are available: // Should Produce: 2001-09-11 $better_date = nice_date($bad_date, 'Y-m-d'); + .. note:: This function is DEPRECATED. Use PHP's native `DateTime class + <https://secure.php.net/datetime>`_ instead. + .. php:function:: timespan([$seconds = 1[, $time = ''[, $units = '']]]) :param int $seconds: Number of seconds @@ -434,4 +398,4 @@ 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 -=========== =====================================================================
\ No newline at end of file +=========== ===================================================================== diff --git a/user_guide_src/source/helpers/download_helper.rst b/user_guide_src/source/helpers/download_helper.rst index 1a4065073..e11d92a14 100644 --- a/user_guide_src/source/helpers/download_helper.rst +++ b/user_guide_src/source/helpers/download_helper.rst @@ -26,7 +26,7 @@ The following functions are available: .. php:function:: force_download([$filename = ''[, $data = ''[, $set_mime = FALSE]]]) - :param string $filename: Filename + :param mixed $filename: Filename :param mixed $data: File contents :param bool $set_mime: Whether to try to send the actual MIME type :rtype: void @@ -37,8 +37,11 @@ The following functions are available: file data. If you set the second parameter to NULL and ``$filename`` is an existing, readable - file path, then its content will be read instead. - + file path, then its content will be read instead. You may also set ``$filename`` + as an associative array with a single element, where the key of that element would be + the local file you are trying to read and where the value is the name of the downloadable + file that will be sent to browser. An example of this is provided below. + If you set the third parameter to boolean TRUE, then the actual file MIME type (based on the filename extension) will be sent, so that if your browser has a handler for that type - it can use it. @@ -53,4 +56,10 @@ The following functions are available: do the following:: // Contents of photo.jpg will be automatically read - force_download('/path/to/photo.jpg', NULL);
\ No newline at end of file + force_download('/path/to/photo.jpg', NULL); + + If you want to download an existing file from your server, but change the name + of the actual file sent to browser, you will need this:: + + // Contents of photo.jpg will be automatically read and sent as my-photo.jpg + force_download(array('/path/to/photo.jpg' => 'my-photo.jpg'), NULL);
\ No newline at end of file diff --git a/user_guide_src/source/helpers/email_helper.rst b/user_guide_src/source/helpers/email_helper.rst deleted file mode 100644 index 1ee97d902..000000000 --- a/user_guide_src/source/helpers/email_helper.rst +++ /dev/null @@ -1,75 +0,0 @@ -############ -Email Helper -############ - -The Email Helper provides some assistive functions for working with -Email. For a more robust email solution, see CodeIgniter's :doc:`Email -Class <../libraries/email>`. - -.. important:: The Email helper is DEPRECATED and is currently - only kept for backwards compatibility. - -.. contents:: - :local: - -.. raw:: html - - <div class="custom-index container"></div> - -Loading this Helper -=================== - -This helper is loaded using the following code:: - - $this->load->helper('email'); - -Available Functions -=================== - -The following functions are available: - - -.. php:function:: valid_email($email) - - :param string $email: E-mail address - :returns: TRUE if a valid email is supplied, FALSE otherwise - :rtype: bool - - Checks if the input is a correctly formatted e-mail address. Note that is - doesn't actually prove that the address will be able recieve mail, but - simply that it is a validly formed address. - - Example:: - - if (valid_email('email@somesite.com')) - { - echo 'email is valid'; - } - else - { - echo 'email is not valid'; - } - - .. note:: All that this function does is to use PHP's native ``filter_var()``:: - - (bool) filter_var($email, FILTER_VALIDATE_EMAIL); - -.. php:function:: send_email($recipient, $subject, $message) - - :param string $recipient: E-mail address - :param string $subject: Mail subject - :param string $message: Message body - :returns: TRUE if the mail was successfully sent, FALSE in case of an error - :rtype: bool - - Sends an email using PHP's native `mail() <http://php.net/function.mail>`_ - function. - - .. note:: All that this function does is to use PHP's native ``mail`` - - :: - - mail($recipient, $subject, $message); - - For a more robust email solution, see CodeIgniter's :doc:`Email Library - <../libraries/email>`.
\ No newline at end of file diff --git a/user_guide_src/source/helpers/file_helper.rst b/user_guide_src/source/helpers/file_helper.rst index 833cddea4..dcf3a2340 100644 --- a/user_guide_src/source/helpers/file_helper.rst +++ b/user_guide_src/source/helpers/file_helper.rst @@ -23,32 +23,6 @@ Available Functions The following functions are available: - -.. php:function:: read_file($file) - - :param string $file: File path - :returns: File contents or FALSE on failure - :rtype: string - - Returns the data contained in the file specified in the path. - - Example:: - - $string = read_file('./path/to/file.php'); - - The path can be a relative or full server path. Returns FALSE (boolean) on failure. - - .. note:: The path is relative to your main site index.php file, NOT your - controller or view files. CodeIgniter uses a front controller so paths - are always relative to the main site index. - - .. note:: This function is DEPRECATED. Use the native ``file_get_contents()`` - instead. - - .. important:: If your server is running an **open_basedir** restriction this - function might not work if you are trying to access a file above the - calling script. - .. php:function:: write_file($path, $data[, $mode = 'wb']) :param string $path: File path @@ -199,4 +173,4 @@ The following functions are available: :: - echo octal_permissions(fileperms('./index.php')); // 644
\ No newline at end of file + echo octal_permissions(fileperms('./index.php')); // 644 diff --git a/user_guide_src/source/helpers/form_helper.rst b/user_guide_src/source/helpers/form_helper.rst index d3ee3ffb6..97595c90b 100644 --- a/user_guide_src/source/helpers/form_helper.rst +++ b/user_guide_src/source/helpers/form_helper.rst @@ -108,7 +108,7 @@ The following functions are available: <input type="hidden" name="member_id" value="234" /> -.. php:function:: form_open_multipart([$action = ''[, $attributes = array()[, $hidden = array()]]) +.. php:function:: form_open_multipart([$action = ''[, $attributes = array()[, $hidden = array()]]]) :param string $action: Form action/target URI string :param array $attributes: HTML attributes @@ -187,7 +187,7 @@ The following functions are available: <input type="hidden" name="email" value="john@example.com" id="hiddenemail" class="hiddenemail" /> */ -.. php:function:: form_input([$data = ''[, $value = ''[, $extra = '']]) +.. php:function:: form_input([$data = ''[, $value = ''[, $extra = '']]]) :param array $data: Field attributes data :param string $value: Field value @@ -243,10 +243,9 @@ The following functions are available: function above except that it uses the "password" input type. -.. php:function:: form_upload([$data = ''[, $value = ''[, $extra = '']]]) +.. php:function:: form_upload([$data = '', $extra = '']]) :param array $data: Field attributes data - :param string $value: Field value :param mixed $extra: Extra attributes to be added to the tag either as an array or a literal string :returns: An HTML file upload input field tag :rtype: string @@ -461,12 +460,12 @@ The following functions are available: fourth parameter:: $js = 'onClick="some_function()"'; - echo form_checkbox('newsletter', 'accept', TRUE, $js) + echo form_checkbox('newsletter', 'accept', TRUE, $js); Or you can pass it as an array:: $js = array('onClick' => 'some_function();'); - echo form_checkbox('newsletter', 'accept', TRUE, $js) + echo form_checkbox('newsletter', 'accept', TRUE, $js); .. php:function:: form_radio([$data = ''[, $value = ''[, $checked = FALSE[, $extra = '']]]]) @@ -724,20 +723,3 @@ The following functions are available: <span class="error">The "password" field doesn't match the "repeat_password" field!</span> */ - -.. php:function:: form_prep($str) - - :param string $str: Value to escape - :returns: Escaped value - :rtype: string - - Allows you to safely use HTML and characters such as quotes within form - elements without breaking out of the form. - - .. note:: If you use any of the form helper functions listed in this page the form - values will be prepped automatically, so there is no need to call this - function. Use it only if you are creating your own form elements. - - .. note:: This function is DEPRECATED and is just an alias for - :doc:`common function <../general/common_functions>` - :func:`html_escape()` - please use that instead. diff --git a/user_guide_src/source/helpers/html_helper.rst b/user_guide_src/source/helpers/html_helper.rst index 2c748bea0..734b4465c 100644 --- a/user_guide_src/source/helpers/html_helper.rst +++ b/user_guide_src/source/helpers/html_helper.rst @@ -286,7 +286,7 @@ The following functions are available: // Generates: <meta name="description" content="My Great Site" /> echo meta('Content-type', 'text/html; charset=utf-8', 'equiv'); - // Note the third parameter. Can be "equiv" or "name" + // Note the third parameter. Can be "charset", "http-equiv", "name" or "property" // Generates: <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> echo meta(array('name' => 'robots', 'content' => 'no-cache')); @@ -310,8 +310,13 @@ The following functions are available: 'content' => 'no-cache' ), array( - 'name' => 'Content-type', - 'content' => 'text/html; charset=utf-8', 'type' => 'equiv' + 'name' => 'Content-Type', + 'type' => 'http-equiv', + 'content' => 'text/html; charset=utf-8' + ), + array( + 'name' => 'UTF-8', + 'type' => 'charset' ) ); @@ -321,21 +326,22 @@ The following functions are available: // <meta name="description" content="My Great Site" /> // <meta name="keywords" content="love, passion, intrigue, deception" /> // <meta name="robots" content="no-cache" /> - // <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> + // <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + // <meta charset="UTF-8" /> -.. php:function:: doctype([$type = 'xhtml1-strict']) +.. php:function:: doctype([$type = 'html5']) :param string $type: Doctype name :returns: HTML DocType tag :rtype: string - Helps you generate document type declarations, or DTD's. XHTML 1.0 - Strict is used by default, but many doctypes are available. + Helps you generate document type declarations, or DTD's. HTML 5 + is used by default, but many doctypes are available. Example:: - echo doctype(); // <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + echo doctype(); // <!DOCTYPE html> echo doctype('html4-trans'); // <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> @@ -365,43 +371,3 @@ The following functions are available: XHTML+RDFa 1.0 xhtml-rdfa-1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd"> XHTML+RDFa 1.1 xhtml-rdfa-2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd"> =============================== =================== ================================================================================================================================================== - -.. php:function:: br([$count = 1]) - - :param int $count: Number of times to repeat the tag - :returns: HTML line break tag - :rtype: string - - Generates line break tags (<br />) based on the number you submit. - Example:: - - echo br(3); - - The above would produce: - - .. code-block:: html - - <br /><br /><br /> - - .. note:: This function is DEPRECATED. Use the native ``str_repeat()`` - in combination with ``<br />`` instead. - -.. php:function:: nbs([$num = 1]) - - :param int $num: Number of space entities to produce - :returns: A sequence of non-breaking space HTML entities - :rtype: string - - Generates non-breaking spaces ( ) based on the number you submit. - Example:: - - echo nbs(3); - - The above would produce: - - .. code-block:: html - - - - .. note:: This function is DEPRECATED. Use the native ``str_repeat()`` - in combination with `` `` instead. diff --git a/user_guide_src/source/helpers/inflector_helper.rst b/user_guide_src/source/helpers/inflector_helper.rst index ed1e2b30f..76cce6f4d 100644 --- a/user_guide_src/source/helpers/inflector_helper.rst +++ b/user_guide_src/source/helpers/inflector_helper.rst @@ -3,7 +3,7 @@ Inflector Helper ################ The Inflector Helper file contains functions that permits you to change -words to plural, singular, camel case, etc. +**English** words to plural, singular, camel case, etc. .. contents:: :local: @@ -38,7 +38,7 @@ The following functions are available: .. php:function:: plural($str) :param string $str: Input string - :returns: A plular word + :returns: A plural word :rtype: string Changes a singular word to plural. Example:: @@ -93,4 +93,20 @@ The following functions are available: Checks if the given word has a plural version. Example:: - is_countable('equipment'); // Returns FALSE
\ No newline at end of file + is_countable('equipment'); // Returns FALSE + +.. php:function:: ordinal_format($number) + + :param int $number: non-negative natural number to be converted + :returns: Ordinal numeral for given number or original value on failure + :rtype: string + + Returns the ordinal numeral (1st, 2nd, 3rd etc.) for a + non-negative natural number. If the input is not a natural number + greater than 0, the function will return the original value. Examples:: + + echo ordinal_format(1); // Returns 1st + echo ordinal_format(3); // Returns 3rd + echo ordinal_format(21); // Returns 21st + echo ordinal_format(102); // Returns 102nd + echo ordinal_format(-5); // Invalid input, will return -5 diff --git a/user_guide_src/source/helpers/language_helper.rst b/user_guide_src/source/helpers/language_helper.rst index cadf3c0ce..cfbd6c057 100644 --- a/user_guide_src/source/helpers/language_helper.rst +++ b/user_guide_src/source/helpers/language_helper.rst @@ -27,17 +27,20 @@ The following functions are available: .. php:function:: lang($line[, $for = ''[, $attributes = array()]]) - :param string $line: Language line key - :param string $for: HTML "for" attribute (ID of the element we're creating a label for) - :param array $attributes: Any additional HTML attributes - :returns: HTML-formatted language line label + :param string $line: Language line key + :param string $for: HTML "for" attribute (ID of the element we're creating a label for) + :param array $attributes: Any additional HTML attributes + :returns: The language line; in an HTML label tag, if the ``$for`` parameter is not empty :rtype: string This function returns a line of text from a loaded language file with simplified syntax that may be more desirable for view files than ``CI_Lang::line()``. - Example:: + Examples:: + + echo lang('language_key'); + // Outputs: Language line echo lang('language_key', 'form_item_id', array('class' => 'myClass')); // Outputs: <label for="form_item_id" class="myClass">Language line</label>
\ No newline at end of file diff --git a/user_guide_src/source/helpers/security_helper.rst b/user_guide_src/source/helpers/security_helper.rst index 103880cf9..e981bc6b6 100644 --- a/user_guide_src/source/helpers/security_helper.rst +++ b/user_guide_src/source/helpers/security_helper.rst @@ -48,31 +48,6 @@ The following functions are available: For more info, please see the :doc:`Security Library <../libraries/security>` documentation. - -.. php:function:: do_hash($str[, $type = 'sha1']) - - :param string $str: Input - :param string $type: Algorithm - :returns: Hex-formatted hash - :rtype: string - - Permits you to create one way hashes suitable for encrypting - passwords. Will use SHA1 by default. - - See `hash_algos() <http://php.net/function.hash_algos>`_ - for a full list of supported algorithms. - - Examples:: - - $str = do_hash($str); // SHA1 - $str = do_hash($str, 'md5'); // MD5 - - .. note:: This function was formerly named ``dohash()``, which has been - removed in favor of ``do_hash()``. - - .. note:: This function is DEPRECATED. Use the native ``hash()`` instead. - - .. php:function:: strip_image_tags($str) :param string $str: Input string @@ -103,4 +78,4 @@ The following functions are available: Example:: - $string = encode_php_tags($string);
\ No newline at end of file + $string = encode_php_tags($string); diff --git a/user_guide_src/source/helpers/smiley_helper.rst b/user_guide_src/source/helpers/smiley_helper.rst deleted file mode 100644 index 3e7669942..000000000 --- a/user_guide_src/source/helpers/smiley_helper.rst +++ /dev/null @@ -1,169 +0,0 @@ -############# -Smiley Helper -############# - -The Smiley Helper file contains functions that let you manage smileys -(emoticons). - -.. important:: The Smiley helper is DEPRECATED and should not be used. - It is currently only kept for backwards compatibility. - -.. contents:: - :local: - -.. raw:: html - - <div class="custom-index container"></div> - -Loading this Helper -=================== - -This helper is loaded using the following code:: - - $this->load->helper('smiley'); - -Overview -======== - -The Smiley helper has a renderer that takes plain text smileys, like -:-) and turns them into a image representation, like |smile!| - -It also lets you display a set of smiley images that when clicked will -be inserted into a form field. For example, if you have a blog that -allows user commenting you can show the smileys next to the comment -form. Your users can click a desired smiley and with the help of some -JavaScript it will be placed into the form field. - -Clickable Smileys Tutorial -========================== - -Here is an example demonstrating how you might create a set of clickable -smileys next to a form field. This example requires that you first -download and install the smiley images, then create a controller and the -View as described. - -.. important:: Before you begin, please `download the smiley images - <https://ellislab.com/asset/ci_download_files/smileys.zip>`_ - and put them in a publicly accessible place on your server. - This helper also assumes you have the smiley replacement array - located at `application/config/smileys.php` - -The Controller --------------- - -In your **application/controllers/** directory, create a file called -Smileys.php and place the code below in it. - -.. important:: Change the URL in the :php:func:`get_clickable_smileys()` - function below so that it points to your smiley folder. - -You'll notice that in addition to the smiley helper, we are also using -the :doc:`Table Class <../libraries/table>`:: - - <?php - - class Smileys extends CI_Controller { - - public function index() - { - $this->load->helper('smiley'); - $this->load->library('table'); - - $image_array = get_clickable_smileys('http://example.com/images/smileys/', 'comments'); - $col_array = $this->table->make_columns($image_array, 8); - - $data['smiley_table'] = $this->table->generate($col_array); - $this->load->view('smiley_view', $data); - } - - } - -In your **application/views/** directory, create a file called **smiley_view.php** -and place this code in it:: - - <html> - <head> - <title>Smileys</title> - <?php echo smiley_js(); ?> - </head> - <body> - <form name="blog"> - <textarea name="comments" id="comments" cols="40" rows="4"></textarea> - </form> - <p>Click to insert a smiley!</p> - <?php echo $smiley_table; ?> </body> </html> - When you have created the above controller and view, load it by visiting http://www.example.com/index.php/smileys/ - </body> - </html> - -Field Aliases -------------- - -When making changes to a view it can be inconvenient to have the field -id in the controller. To work around this, you can give your smiley -links a generic name that will be tied to a specific id in your view. - -:: - - $image_array = get_smiley_links("http://example.com/images/smileys/", "comment_textarea_alias"); - -To map the alias to the field id, pass them both into the -:func:`smiley_js()` function:: - - $image_array = smiley_js("comment_textarea_alias", "comments"); - -Available Functions -=================== - -.. php:function:: get_clickable_smileys($image_url[, $alias = ''[, $smileys = NULL]]) - - :param string $image_url: URL path to the smileys directory - :param string $alias: Field alias - :returns: An array of ready to use smileys - :rtype: array - - Returns an array containing your smiley images wrapped in a clickable - link. You must supply the URL to your smiley folder and a field id or - field alias. - - Example:: - - $image_array = get_clickable_smileys('http://example.com/images/smileys/', 'comment'); - -.. php:function:: smiley_js([$alias = ''[, $field_id = ''[, $inline = TRUE]]]) - - :param string $alias: Field alias - :param string $field_id: Field ID - :param bool $inline: Whether we're inserting an inline smiley - :returns: Smiley-enabling JavaScript code - :rtype: string - - Generates the JavaScript that allows the images to be clicked and - inserted into a form field. If you supplied an alias instead of an id - when generating your smiley links, you need to pass the alias and - corresponding form id into the function. This function is designed to be - placed into the <head> area of your web page. - - Example:: - - <?php echo smiley_js(); ?> - -.. php:function:: parse_smileys([$str = ''[, $image_url = ''[, $smileys = NULL]]]) - - :param string $str: Text containing smiley codes - :param string $image_url: URL path to the smileys directory - :param array $smileys: An array of smileys - :returns: Parsed smileys - :rtype: string - - Takes a string of text as input and replaces any contained plain text - smileys into the image equivalent. The first parameter must contain your - string, the second must contain the URL to your smiley folder - - Example:: - - $str = 'Here are some smileys: :-) ;-)'; - $str = parse_smileys($str, 'http://example.com/images/smileys/'); - echo $str; - -.. |smile!| image:: ../images/smile.gif
\ No newline at end of file diff --git a/user_guide_src/source/helpers/string_helper.rst b/user_guide_src/source/helpers/string_helper.rst index a1acb215c..7a45dc95b 100644 --- a/user_guide_src/source/helpers/string_helper.rst +++ b/user_guide_src/source/helpers/string_helper.rst @@ -5,6 +5,9 @@ String Helper The String Helper file contains functions that assist in working with strings. +.. important:: Please note that these functions are NOT intended, nor + suitable to be used for any kind of security-related logic. + .. contents:: :local: @@ -24,7 +27,6 @@ Available Functions The following functions are available: - .. php:function:: random_string([$type = 'alnum'[, $len = 8]]) :param string $type: Randomization type @@ -99,24 +101,6 @@ The following functions are available: .. note:: To use multiple separate calls to this function simply call the function with no arguments to re-initialize. -.. php:function:: repeater($data[, $num = 1]) - - :param string $data: Input - :param int $num: Number of times to repeat - :returns: Repeated string - :rtype: string - - Generates repeating copies of the data you submit. Example:: - - $string = "\n"; - echo repeater($string, 30); - - The above would generate 30 newlines. - - .. note:: This function is DEPRECATED. Use the native ``str_repeat()`` - instead. - - .. php:function:: reduce_double_slashes($str) :param string $str: Input string @@ -131,7 +115,6 @@ The following functions are available: $string = "http://example.com//index.php"; echo reduce_double_slashes($string); // results in "http://example.com/index.php" - .. php:function:: strip_slashes($data) :param mixed $data: Input string or an array of strings @@ -160,21 +143,6 @@ The following functions are available: and handle string inputs. This however makes it just an alias for ``stripslashes()``. -.. php:function:: trim_slashes($str) - - :param string $str: Input string - :returns: Slash-trimmed string - :rtype: string - - Removes any leading/trailing slashes from a string. Example:: - - $string = "/this/that/theother/"; - echo trim_slashes($string); // results in this/that/theother - - .. note:: This function is DEPRECATED. Use the native ``trim()`` instead: - | - | trim($str, '/'); - .. php:function:: reduce_multiples($str[, $character = ''[, $trim = FALSE]]) :param string $str: Text to search in @@ -183,7 +151,7 @@ The following functions are available: :returns: Reduced string :rtype: string - Reduces multiple instances of a particular character occuring directly + Reduces multiple instances of a particular character occurring directly after each other. Example:: $string = "Fred, Bill,, Joe, Jimmy"; @@ -217,4 +185,4 @@ The following functions are available: Removes single and double quotes from a string. Example:: $string = "Joe's \"dinner\""; - $string = strip_quotes($string); //results in "Joes dinner"
\ No newline at end of file + $string = strip_quotes($string); //results in "Joes dinner" diff --git a/user_guide_src/source/helpers/typography_helper.rst b/user_guide_src/source/helpers/typography_helper.rst index 7eb4fceec..89730b03d 100644 --- a/user_guide_src/source/helpers/typography_helper.rst +++ b/user_guide_src/source/helpers/typography_helper.rst @@ -35,7 +35,7 @@ The following functions are available: Formats text so that it is semantically and typographically correct HTML. - This function is an alias for ``CI_Typography::auto_typography``. + This function is an alias for ``CI_Typography::auto_typography()``. For more info, please see the :doc:`Typography Library <../libraries/typography>` documentation. @@ -45,7 +45,7 @@ The following functions are available: .. note:: Typographic formatting can be processor intensive, particularly if you have a lot of content being formatted. If you choose to use this - function you may want to consider `caching <../general/caching>` your + function you may want to consider :doc:`caching <../general/caching>` your pages. diff --git a/user_guide_src/source/helpers/url_helper.rst b/user_guide_src/source/helpers/url_helper.rst index 64deae240..435a21df4 100644 --- a/user_guide_src/source/helpers/url_helper.rst +++ b/user_guide_src/source/helpers/url_helper.rst @@ -18,11 +18,11 @@ This helper is loaded using the following code:: $this->load->helper('url'); -The following functions are available: - Available Functions =================== +The following functions are available: + .. php:function:: site_url([$uri = ''[, $protocol = NULL]]) :param string $uri: URI string @@ -277,7 +277,7 @@ Available Functions :param string $str: Input string :param string $separator: Word separator - :param string $lowercase: Whether to transform the output string to lower-case + :param bool $lowercase: Whether to transform the output string to lower-case :returns: URL-formatted string :rtype: string @@ -360,7 +360,7 @@ Available Functions is outputted to the browser since it utilizes server headers. .. note:: For very fine grained control over headers, you should use the - `Output Library </libraries/output>` ``set_header()`` method. + :doc:`Output Library </libraries/output>` ``set_header()`` method. .. 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 @@ -370,4 +370,4 @@ Available Functions will *automatically* be selected when the page is currently accessed via POST and HTTP/1.1 is used. - .. important:: This function will terminate script execution.
\ No newline at end of file + .. important:: This function will terminate script execution. diff --git a/user_guide_src/source/images/smile.gif b/user_guide_src/source/images/smile.gif Binary files differdeleted file mode 100644 index bf0922504..000000000 --- a/user_guide_src/source/images/smile.gif +++ /dev/null diff --git a/user_guide_src/source/index.rst b/user_guide_src/source/index.rst index 8d8aa9438..615c27f3c 100644 --- a/user_guide_src/source/index.rst +++ b/user_guide_src/source/index.rst @@ -54,6 +54,16 @@ Tutorial tutorial/index +*************************** +Contributing to CodeIgniter +*************************** + +.. toctree:: + :glob: + :titlesonly: + + contributing/index + ************** General Topics ************** @@ -94,16 +104,6 @@ Helper Reference helpers/index -*************************** -Contributing to CodeIgniter -*************************** - -.. toctree:: - :glob: - :titlesonly: - - contributing/index - .. toctree:: :glob: :titlesonly: @@ -116,7 +116,7 @@ Contributing to CodeIgniter installation/index general/index libraries/index - helpers/index database/index + helpers/index tutorial/index general/credits diff --git a/user_guide_src/source/installation/downloads.rst b/user_guide_src/source/installation/downloads.rst index 16c8e537a..d36296e35 100644 --- a/user_guide_src/source/installation/downloads.rst +++ b/user_guide_src/source/installation/downloads.rst @@ -2,7 +2,18 @@ Downloading CodeIgniter ####################### -- `CodeIgniter v3.0.1-dev (Current version) <https://codeload.github.com/bcit-ci/CodeIgniter/zip/develop>`_ +- `CodeIgniter v3.2.0-dev (Current version) <https://codeload.github.com/bcit-ci/CodeIgniter/zip/develop>`_ +- `CodeIgniter v3.1.4-dev <https://codeload.github.com/bcit-ci/CodeIgniter/zip/3.1-stable>`_ +- `CodeIgniter v3.1.3 <https://codeload.github.com/bcit-ci/CodeIgniter/zip/3.1.3>`_ +- `CodeIgniter v3.1.2 <https://codeload.github.com/bcit-ci/CodeIgniter/zip/3.1.2>`_ +- `CodeIgniter v3.1.1 <https://codeload.github.com/bcit-ci/CodeIgniter/zip/3.1.1>`_ +- `CodeIgniter v3.1.0 <https://codeload.github.com/bcit-ci/CodeIgniter/zip/3.1.0>`_ +- `CodeIgniter v3.0.6 <https://codeload.github.com/bcit-ci/CodeIgniter/zip/3.0.6>`_ +- `CodeIgniter v3.0.5 <https://codeload.github.com/bcit-ci/CodeIgniter/zip/3.0.5>`_ +- `CodeIgniter v3.0.4 <https://codeload.github.com/bcit-ci/CodeIgniter/zip/3.0.4>`_ +- `CodeIgniter v3.0.3 <https://codeload.github.com/bcit-ci/CodeIgniter/zip/3.0.3>`_ +- `CodeIgniter v3.0.2 <https://codeload.github.com/bcit-ci/CodeIgniter/zip/3.0.2>`_ +- `CodeIgniter v3.0.1 <https://codeload.github.com/bcit-ci/CodeIgniter/zip/3.0.1>`_ - `CodeIgniter v3.0.0 <https://codeload.github.com/bcit-ci/CodeIgniter/zip/3.0.0>`_ - `CodeIgniter v2.2.3 <https://codeload.github.com/bcit-ci/CodeIgniter/zip/2.2.3>`_ - `CodeIgniter v2.2.2 <https://codeload.github.com/bcit-ci/CodeIgniter/zip/2.2.2>`_ @@ -25,4 +36,4 @@ Please note that while every effort is made to keep this code base functional, we cannot guarantee the functionality of code taken from the develop branch. -Beginning with version 2.0.3, stable versions are also available via `GitHub Releases <https://github.com/bcit-ci/CodeIgniter/releases>`_.
\ No newline at end of file +Beginning with version 2.0.3, stable versions are also available via `GitHub Releases <https://github.com/bcit-ci/CodeIgniter/releases>`_. diff --git a/user_guide_src/source/installation/index.rst b/user_guide_src/source/installation/index.rst index 50493bbbd..fbf6ecee1 100644 --- a/user_guide_src/source/installation/index.rst +++ b/user_guide_src/source/installation/index.rst @@ -6,37 +6,37 @@ CodeIgniter is installed in four steps: #. Unzip the package. #. Upload the CodeIgniter folders and files to your server. Normally the - index.php file will be at your root. -#. Open the application/config/config.php file with a text editor and + *index.php* file will be at your root. +#. Open the *application/config/config.php* file with a text editor and set your base URL. If you intend to use encryption or sessions, set your encryption key. #. If you intend to use a database, open the - application/config/database.php file with a text editor and set your + *application/config/database.php* file with a text editor and set your database settings. If you wish to increase security by hiding the location of your CodeIgniter files you can rename the system and application folders to something more private. If you do rename them, you must open your main -index.php file and set the $system_path and $application_folder +*index.php* file and set the ``$system_path`` and ``$application_folder`` variables at the top of the file with the new name you've chosen. For the best security, both the system and any application folders should be placed above web root so that they are not directly accessible -via a browser. By default, .htaccess files are included in each folder +via a browser. By default, *.htaccess* files are included in each folder to help prevent direct access, but it is best to remove them from public access entirely in case the web server configuration changes or doesn't -abide by the .htaccess. +abide by the *.htaccess*. If you would like to keep your views public it is also possible to move the views folder out of your application folder. After moving them, open your main index.php file and set the -$system_path, $application_folder and $view_folder variables, -preferably with a full path, e.g. '/www/MyUser/system'. +``$system_path``, ``$application_folder`` and ``$view_folder`` variables, +preferably with a full path, e.g. '*/www/MyUser/system*'. One additional measure to take in production environments is to disable PHP error reporting and any other development-only functionality. In -CodeIgniter, this can be done by setting the ENVIRONMENT constant, which +CodeIgniter, this can be done by setting the ``ENVIRONMENT`` constant, which is more fully described on the :doc:`security page <../general/security>`. diff --git a/user_guide_src/source/installation/troubleshooting.rst b/user_guide_src/source/installation/troubleshooting.rst index e874bb0ec..cca290763 100644 --- a/user_guide_src/source/installation/troubleshooting.rst +++ b/user_guide_src/source/installation/troubleshooting.rst @@ -5,11 +5,11 @@ Troubleshooting If you find that no matter what you put in your URL only your default page is loading, it might be that your server does not support the REQUEST_URI variable needed to serve search-engine friendly URLs. As a -first step, open your application/config/config.php file and look for +first step, open your *application/config/config.php* file and look for the URI Protocol information. It will recommend that you try a couple alternate settings. If it still doesn't work after you've tried this you'll need to force CodeIgniter to add a question mark to your URLs. To -do this open your **application/config/config.php** file and change this:: +do this open your *application/config/config.php* file and change this:: $config['index_page'] = "index.php"; diff --git a/user_guide_src/source/installation/upgrade_150.rst b/user_guide_src/source/installation/upgrade_150.rst index bfe01ebba..50eb5eae5 100644 --- a/user_guide_src/source/installation/upgrade_150.rst +++ b/user_guide_src/source/installation/upgrade_150.rst @@ -49,8 +49,8 @@ Open your application/config/config.php file and ADD these new items:: | This item allows you to set the filename/classname prefix when extending | native libraries. For more information please see the user guide: | - | http://codeigniter.com/user_guide/general/core_classes.html - | http://codeigniter.com/user_guide/general/creating_libraries.html + | https://codeigniter.com/user_guide/general/core_classes.html + | https://codeigniter.com/user_guide/general/creating_libraries.html | */ $config['subclass_prefix'] = 'MY_'; diff --git a/user_guide_src/source/installation/upgrade_210.rst b/user_guide_src/source/installation/upgrade_210.rst index 5874bfc86..421435452 100644 --- a/user_guide_src/source/installation/upgrade_210.rst +++ b/user_guide_src/source/installation/upgrade_210.rst @@ -13,14 +13,14 @@ 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 -====================================== +Step 2: Replace config/mimes.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/mimes.php*. 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 +version. diff --git a/user_guide_src/source/installation/upgrade_300.rst b/user_guide_src/source/installation/upgrade_300.rst index 971f9e484..4e2ff8ab2 100644 --- a/user_guide_src/source/installation/upgrade_300.rst +++ b/user_guide_src/source/installation/upgrade_300.rst @@ -65,7 +65,7 @@ Step 3: Replace config/mimes.php ******************************** This config file has been updated to contain more user mime-types, please copy -it to _application/config/mimes.php*. +it to *application/config/mimes.php*. ************************************************************** Step 4: Remove $autoload['core'] from your config/autoload.php @@ -111,7 +111,7 @@ that you should make: - Set your ``$config['sess_driver']`` value - It will default to 'files', unles you've previously used + It will default to 'files', unless you've previously used ``$config['sess_use_database']``, in which case it will be set to 'database'. @@ -206,13 +206,13 @@ Step 8: Replace your error templates ************************************ In CodeIgniter 3.0, the error templates are now considered as views and have been moved to the -_application/views/errors* directory. +*application/views/errors* directory. Furthermore, we've added support for CLI error templates in plain-text format that unlike HTML, is suitable for the command line. This of course requires another level of separation. -It is safe to move your old templates from _application/errors* to _application/views/errors/html*, -but you'll have to copy the new _application/views/errors/cli* directory from the CodeIgniter archive. +It is safe to move your old templates from *application/errors* to *application/views/errors/html*, +but you'll have to copy the new *application/views/errors/cli* directory from the CodeIgniter archive. ****************************************** Step 9: Update your config/routes.php file @@ -266,8 +266,7 @@ cause your 'Main' controller to be loaded. However, what happens if you have an *application/controllers/admin/* directory and the user visits ``http://example.com/admin/``? In CodeIgniter 3, the router will look for a 'Main' controller under the -admin/ directory as well. If not found, it will fallback to the parent -(*application/controllers/*) directory, like in version 2.x. +admin/ directory as well. If not found, a Not Found (404) will be triggered. The same rule applies to the '404_override' setting. @@ -465,8 +464,51 @@ files and error messages format: Therefore you're encouraged to update its usage sooner rather than later. +************************************************************ +Step 19: Make sure your 'base_url' config value is not empty +************************************************************ + +When ``$config['base_url']`` is not set, CodeIgniter tries to automatically +detect what your website's base URL is. This is done purely for convenience +when you are starting development of a new application. + +Auto-detection is never reliable and also has security implications, which +is why you should **always** have it manually configured! + +One of the changes in CodeIgniter 3.0.3 is how this auto-detection works, +and more specifically it now falls back to the server's IP address instead +of the hostname requested by the client. Therefore, if you've ever relied +on auto-detection, it will change how your website works now. + +In case you need to allow e.g. multiple domains, or both http:// and +https:// prefixes to be dynamically used depending on the request, +remember that *application/config/config.php* is still a PHP script, in +which you can create this logic with a few lines of code. For example:: + + $allowed_domains = array('domain1.tld', 'domain2.tld'); + $default_domain = 'domain1.tld'; + + if (in_array($_SERVER['HTTP_HOST'], $allowed_domains, TRUE)) + { + $domain = $_SERVER['HTTP_HOST']; + } + else + { + $domain = $default_domain; + } + + if ( ! empty($_SERVER['HTTPS'])) + { + $config['base_url'] = 'https://'.$domain; + } + else + { + $config['base_url'] = 'http://'.$domain; + } + + **************************************************************** -Step 19: Remove usage of (previously) deprecated functionalities +Step 20: Remove usage of (previously) deprecated functionalities **************************************************************** In addition to the ``$autoload['core']`` configuration setting, there's a @@ -490,9 +532,9 @@ the ``EXT`` constant has been removed. Use just '.php' instead. Smiley helper ============= -The :doc:`Smiley Helper <../helpers/smiley_helper>` is a legacy feature from EllisLab's -ExpressionEngine product. However, it is too specific for a general purpose framework like -CodeIgniter and as such it is now deprecated. +The *Smiley Helper* is a legacy feature from EllisLab's ExpressionEngine product. +However, it is too specific for a general purpose framework like CodeIgniter +and as such it is now deprecated. Also, the previously deprecated ``js_insert_smiley()`` (since version 1.7.2) is now removed. @@ -517,12 +559,12 @@ implemented cryptographic functions. The Cart library ================ -The :doc:`Cart Library <../libraries/cart>`, similarly to the :doc:`Smiley Helper -<../helpers/smiley_helper>` is too specific for CodeIgniter. It is now deprecated -and scheduled for removal in CodeIgniter 3.1+. +The *Cart Library*, similarly to the *Smiley Helper* is too specific for +CodeIgniter. It is now deprecated and scheduled for removal in +CodeIgniter 3.1+. -.. note:: The library is still available, but you're strongly encouraged to remove its usage sooner - rather than later. +.. note:: The library is still available, but you're strongly encouraged to + remove its usage sooner rather than later. Database drivers 'mysql', 'sqlite', 'mssql', 'pdo/dblib' ======================================================== @@ -582,7 +624,7 @@ CodeIgniter 3.1+. String helper repeater() ======================== -:doc:`String Helper <../helpers/string_helper>` function :php:func:`repeater()` is now just an alias for +:doc:`String Helper <../helpers/string_helper>` function ``repeater()`` is now just an alias for PHP's native ``str_repeat()`` 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 its usage sooner @@ -591,7 +633,7 @@ PHP's native ``str_repeat()`` function. It is deprecated and scheduled for remov String helper trim_slashes() ============================ -:doc:`String Helper <../helpers/string_helper>` function :php:func:`trim_slashes()` is now just an alias +:doc:`String Helper <../helpers/string_helper>` function ``trim_slashes()`` is now just an alias for PHP's native ``trim()`` function (with a slash passed as its second argument). It is deprecated and scheduled for removal in CodeIgniter 3.1+. @@ -601,8 +643,8 @@ scheduled for removal in CodeIgniter 3.1+. Form helper form_prep() ======================= -:doc:`Form Helper <../helpers/form_helper>` function :php:func:`form_prep()` -is now just an alias for :doc:`common function </general/common_functions>` +:doc:`Form Helper <../helpers/form_helper>` function ``form_prep()`` is now +just an alias for :doc:`common function </general/common_functions>` :func:`html_escape()`. It is deprecated and will be removed in the future. Please use :php:func:`html_escape()` instead. @@ -613,14 +655,13 @@ Please use :php:func:`html_escape()` instead. Email helper functions ====================== -:doc:`Email Helper <../helpers/email_helper>` only has two functions +The *Email Helper* only has two functions: - - :php:func:`valid_email()` - - :php:func:`send_email()` + - ``valid_email()`` + - ``send_email()`` Both of them are now aliases for PHP's native ``filter_var()`` and ``mail()`` functions, respectively. -Therefore the :doc:`Email Helper <../helpers/email_helper>` altogether is being deprecated and -is scheduled for removal in CodeIgniter 3.1+. +Therefore, the *Email Helper* altogether is being deprecated and is scheduled for removal in CodeIgniter 3.1+. .. note:: These functions are still available, but you're strongly encouraged to remove their usage sooner rather than later. @@ -800,20 +841,38 @@ CodeIgniter 3.1+. .. note:: This method is still available, but you're strongly encouraged to remove its usage sooner rather than later. -====================== The Javascript library ====================== -The :doc:`Javascript Library <../libraries/javascript>` has always had an -'experimental' status and was never really useful, nor a proper solution. +The *Javascript Library* has always had an 'experimental' status and was +never really useful, nor a proper solution. It is now deprecated and scheduled for removal in CodeIgniter 3.1+. .. note:: This library is still available, but you're strongly encouraged to remove its usage sooner rather than later. +Form Validation method prep_for_form() +====================================== + +The :doc:`Form Validation Library <../libraries/form_validation>` has a +``prep_for_form()`` method, which is/can also be used as a rule in +``set_rules()`` to automatically perform HTML encoding on input data. + +Automatically encoding input (instead of output) data is a bad practice in +the first place, and CodeIgniter and PHP itself offer other alternatives +to this method anyway. +For example, :doc:`Form Helper <../helpers/form_helper>` functions will +automatically perform HTML escaping when necessary. + +Therefore, the *prep_for_form* method/rule is pretty much useless and is now +deprecated and scheduled for removal in 3.1+. + +.. note:: The method is still available, but you're strongly encouraged to + remove its usage sooner rather than later. + *********************************************************** -Step 20: Check your usage of Text helper highlight_phrase() +Step 21: Check your usage of Text helper highlight_phrase() *********************************************************** The default HTML tag used by :doc:`Text Helper <../helpers/text_helper>` function diff --git a/user_guide_src/source/installation/upgrade_301.rst b/user_guide_src/source/installation/upgrade_301.rst index f38d34008..450cdb288 100644 --- a/user_guide_src/source/installation/upgrade_301.rst +++ b/user_guide_src/source/installation/upgrade_301.rst @@ -16,4 +16,4 @@ Replace all files and directories in your *system/* directory. Step 2: Update your CLI error templates ======================================= -Replace all files under your *application/errors/cli/* directory.
\ No newline at end of file +Replace all files under your *application/views/errors/cli/* directory. diff --git a/user_guide_src/source/installation/upgrade_302.rst b/user_guide_src/source/installation/upgrade_302.rst new file mode 100644 index 000000000..93d87ac41 --- /dev/null +++ b/user_guide_src/source/installation/upgrade_302.rst @@ -0,0 +1,24 @@ +############################# +Upgrading from 3.0.1 to 3.0.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/* directory. + +.. note:: If you have any custom developed files in these directories, + please make copies of them first. + +Step 2: Update your application/config/constants.php file +========================================================= + +The *application/config/constants.php* file has been updated to check +if constants aren't already defined before doing that, making it easier +to add an environment-specific configuration. + +.. note:: If you've made modifications to this file, please make a + backup first and cross-check the differences first.
\ No newline at end of file diff --git a/user_guide_src/source/installation/upgrade_303.rst b/user_guide_src/source/installation/upgrade_303.rst new file mode 100644 index 000000000..d13a0fe46 --- /dev/null +++ b/user_guide_src/source/installation/upgrade_303.rst @@ -0,0 +1,55 @@ +############################# +Upgrading from 3.0.2 to 3.0.3 +############################# + +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/* directory. + +.. note:: If you have any custom developed files in these directories, + please make copies of them first. + +Step 2: Make sure your 'base_url' config value is not empty +=========================================================== + +When ``$config['base_url']`` is not set, CodeIgniter tries to automatically +detect what your website's base URL is. This is done purely for convenience +when you are starting development of a new application. + +Auto-detection is never reliable and also has security implications, which +is why you should **always** have it manually configured! + +One of the changes in CodeIgniter 3.0.3 is how this auto-detection works, +and more specifically it now falls back to the server's IP address instead +of the hostname requested by the client. Therefore, if you've ever relied +on auto-detection, it will change how your website works now. + +In case you need to allow e.g. multiple domains, or both http:// and +https:// prefixes to be dynamically used depending on the request, +remember that *application/config/config.php* is still a PHP script, in +which you can create this logic with a few lines of code. For example:: + + $allowed_domains = array('domain1.tld', 'domain2.tld'); + $default_domain = 'domain1.tld'; + + if (in_array($_SERVER['HTTP_HOST'], $allowed_domains, TRUE)) + { + $domain = $_SERVER['HTTP_HOST']; + } + else + { + $domain = $default_domain; + } + + if ( ! empty($_SERVER['HTTPS'])) + { + $config['base_url'] = 'https://'.$domain; + } + else + { + $config['base_url'] = 'http://'.$domain; + } diff --git a/user_guide_src/source/installation/upgrade_304.rst b/user_guide_src/source/installation/upgrade_304.rst new file mode 100644 index 000000000..4d5bd2bb0 --- /dev/null +++ b/user_guide_src/source/installation/upgrade_304.rst @@ -0,0 +1,14 @@ +############################# +Upgrading from 3.0.3 to 3.0.4 +############################# + +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/* directory. + +.. note:: If you have any custom developed files in these directories, + please make copies of them first. diff --git a/user_guide_src/source/installation/upgrade_305.rst b/user_guide_src/source/installation/upgrade_305.rst new file mode 100644 index 000000000..a47982481 --- /dev/null +++ b/user_guide_src/source/installation/upgrade_305.rst @@ -0,0 +1,14 @@ +############################# +Upgrading from 3.0.4 to 3.0.5 +############################# + +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/* directory. + +.. note:: If you have any custom developed files in these directories, + please make copies of them first. diff --git a/user_guide_src/source/installation/upgrade_306.rst b/user_guide_src/source/installation/upgrade_306.rst new file mode 100644 index 000000000..3863e0afa --- /dev/null +++ b/user_guide_src/source/installation/upgrade_306.rst @@ -0,0 +1,48 @@ +############################# +Upgrading from 3.0.5 to 3.0.6 +############################# + +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/* directory. + +.. note:: If you have any custom developed files in these directories, + please make copies of them first. + +Step 2: Update your index.php file (optional) +============================================= + +We've made some tweaks to the index.php file, mostly related to proper +usage of directory separators (i.e. use the ``DIRECTORY_SEPARATOR`` +constant instead of a hard coded forward slash "/"). + +Nothing will break if you skip this step, but if you're running Windows +or just want to be up to date with every change - we do recommend that +you update your index.php file. + +*Tip: Just copy the ``ENVIRONMENT``, ``$system_path``, ``$application_folder`` +and ``$view_folder`` declarations from the old file and put them into the +new one, replacing the defaults.* + +Step 3: Remove 'prep_for_form' usage (deprecation) +================================================== + +The :doc:`Form Validation Library <../libraries/form_validation>` has a +``prep_for_form()`` method, which is/can also be used as a rule in +``set_rules()`` to automatically perform HTML encoding on input data. + +Automatically encoding input (instead of output) data is a bad practice in +the first place, and CodeIgniter and PHP itself offer other alternatives +to this method anyway. +For example, :doc:`Form Helper <../helpers/form_helper>` functions will +automatically perform HTML escaping when necessary. + +Therefore, the *prep_for_form* method/rule is pretty much useless and is now +deprecated and scheduled for removal in 3.1+. + +.. note:: The method is still available, but you're strongly encouraged to + remove its usage sooner rather than later. diff --git a/user_guide_src/source/installation/upgrade_310.rst b/user_guide_src/source/installation/upgrade_310.rst new file mode 100644 index 000000000..cae814327 --- /dev/null +++ b/user_guide_src/source/installation/upgrade_310.rst @@ -0,0 +1,38 @@ +############################# +Upgrading from 3.0.6 to 3.1.0 +############################# + +Before performing an update you should take your site offline by +replacing the index.php file with a static one. + +Step 1: Update your CodeIgniter files +===================================== + +Replace all files and directories in your *system/* directory. + +.. note:: If you have any custom developed files in these directories, + please make copies of them first. + +Step 2: Check your PHP version +============================== + +We recommend always running versions that are `currently supported +<https://secure.php.net/supported-versions.php>`_, which right now is at least PHP 5.6. + +PHP 5.2.x versions are now officially not supported by CodeIgniter, and while 5.3.7+ +may be at least runnable, we strongly discourage you from using any PHP versions below +the ones listed on the `PHP.net Supported Versions <https://secure.php.net/supported-versions.php>`_ +page. + +Step 3: If you're using the 'odbc' database driver, check for usage of Query Builder +==================================================================================== + +:doc:`Query Builder <../database/query_builder>` functionality and ``escape()`` can +no longer be used with the 'odbc' database driver. + +This is because, due to its nature, the `ODBC extension for PHP <https://secure.php.net/odbc>`_ +does not provide a function that allows to safely escape user-supplied strings for usage +inside an SQL query (which our :doc:`Query Builder <../database/query_builder>` relies on). + +Thus, user inputs MUST be bound, as shown in :doc:`Running Queries <../database/queries>`, +under the "Query Bindings" section. diff --git a/user_guide_src/source/installation/upgrade_311.rst b/user_guide_src/source/installation/upgrade_311.rst new file mode 100644 index 000000000..a36e72323 --- /dev/null +++ b/user_guide_src/source/installation/upgrade_311.rst @@ -0,0 +1,14 @@ +############################# +Upgrading from 3.1.0 to 3.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/* directory. + +.. note:: If you have any custom developed files in these directories, + please make copies of them first. diff --git a/user_guide_src/source/installation/upgrade_312.rst b/user_guide_src/source/installation/upgrade_312.rst new file mode 100644 index 000000000..e0b2191dd --- /dev/null +++ b/user_guide_src/source/installation/upgrade_312.rst @@ -0,0 +1,40 @@ +############################# +Upgrading from 3.1.1 to 3.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/* directory. + +.. note:: If you have any custom developed files in these directories, + please make copies of them first. + +Step 2: Update your "ci_sessions" database table +================================================ + +If you're using the :doc:`Session Library </libraries/sessions>` with the +'database' driver, you may have to ``ALTER`` your sessions table for your +sessions to continue to work. + +.. note:: The table in question is not necessarily named "ci_sessions". + It is what you've set as your ``$config['sess_save_path']``. + +This will only affect you if you've changed your ``session.hash_function`` +*php.ini* setting to something like 'sha512'. Or if you've been running +an older CodeIgniter version on PHP 7.1+. + +It is recommended that you do this anyway, just to avoid potential issues +in the future if you do change your configuration. + +Just execute the one of the following SQL queries, depending on your +database:: + + // MySQL: + ALTER TABLE ci_sessions CHANGE id id varchar(128) NOT NULL; + + // PostgreSQL + ALTER TABLE ci_sessions ALTER COLUMN id SET DATA TYPE varchar(128); diff --git a/user_guide_src/source/installation/upgrade_313.rst b/user_guide_src/source/installation/upgrade_313.rst new file mode 100644 index 000000000..13af775a1 --- /dev/null +++ b/user_guide_src/source/installation/upgrade_313.rst @@ -0,0 +1,46 @@ +############################# +Upgrading from 3.1.2 to 3.1.3 +############################# + +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/* directory. + +.. note:: If you have any custom developed files in these directories, + please make copies of them first. + +Step 2: Remove usage of nice_date() helper (deprecation) +======================================================== + +The :doc:`Date Helper <../helpers/date_helper>` function ``nice_date()`` is +no longer useful since the introduction of PHP's `DateTime classes +<https://secure.php.net/datetime>`_ + +You can replace it with the following: +:: + + DateTime::createFromFormat($input_format, $input_date)->format($desired_output_format); + +Thus, ``nice_date()`` is now deprecated and scheduled for removal in +CodeIgniter 3.2+. + +.. note:: The function is still available, but you're strongly encouraged + to remove its usage sooner rather than later. + +Step 3: Remove usage of $config['standardize_newlines'] +======================================================= + +The :doc:`Input Library <../libraries/input>` would optionally replace +occurrences of `\r\n`, `\r`, `\n` in input data with whatever the ``PHP_EOL`` +value is on your system - if you've set ``$config['standardize_newlines']`` +to ``TRUE`` in your *application/config/config.php*. + +This functionality is now deprecated and scheduled for removal in +CodeIgniter 3.2.+. + +.. note:: The functionality is still available, but you're strongly + encouraged to remove its usage sooner rather than later. diff --git a/user_guide_src/source/installation/upgrade_314.rst b/user_guide_src/source/installation/upgrade_314.rst new file mode 100644 index 000000000..3f2da6564 --- /dev/null +++ b/user_guide_src/source/installation/upgrade_314.rst @@ -0,0 +1,14 @@ +############################# +Upgrading from 3.1.3 to 3.1.4 +############################# + +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/* directory. + +.. note:: If you have any custom developed files in these directories, + please make copies of them first. diff --git a/user_guide_src/source/installation/upgrade_320.rst b/user_guide_src/source/installation/upgrade_320.rst new file mode 100644 index 000000000..18f8717f8 --- /dev/null +++ b/user_guide_src/source/installation/upgrade_320.rst @@ -0,0 +1,210 @@ +############################# +Upgrading from 3.1.x to 3.2.x +############################# + +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/* directory. + +.. note:: If you have any custom developed files in these directories, + please make copies of them first. + +Step 2: Check your PHP version +============================== + +We recommend always running versions that are `currently supported +<https://secure.php.net/supported-versions.php>`_, which right now is at least PHP 5.6. + +PHP 5.3.x versions are now officially not supported by CodeIgniter, and while 5.4.8+ +may be at least runnable, we strongly discourage you from using any PHP versions below +the ones listed on the `PHP.net Supported Versions <https://secure.php.net/supported-versions.php>`_ +page. + +Step 3: Change database connection handling +=========================================== + +"Loading" a database, whether by using the *config/autoload.php* settings +or manually via calling ``$this->load->database()`` or the less-known +``DB()`` function, will now throw a ``RuntimeException`` in case of a +failure. + +In addition, being unable to set the configured character set is now also +considered a connection failure. + +.. note:: This has been the case for most database drivers in the in the + past as well (i.e. all but the 'mysql', 'mysqli' and 'postgre' + drivers). + +What this means is that if you're unable to connect to a database, or +have an erroneous character set configured, CodeIgniter will no longer +fail silently, but will throw an exception instead. + +You may choose to explicitly catch it (and for that purpose you can't use +*config/autoload.php* to load the :doc:`Database Class <../database/index>`) +:: + + try + { + $this->load->database(); + } + catch (RuntimeException $e) + { + // Handle the failure + } + +Or you may leave it to CodeIgniter's default exception handler, which would +log the error message and display an error screen if you're running in +development mode. + +Remove db_set_charset() calls +----------------------------- + +With the above-mentioned changes, the purpose of the ``db_set_charset()`` +method would now only be to change the connection character set at runtime. +That doesn't make sense and that's the reason why most database drivers +don't support it at all. +Thus, ``db_set_charset()`` is no longer necessary and is removed. + +Step 4: Check logic related to URI parsing of CLI requests +========================================================== + +When running a CodeIgniter application from the CLI, the +:doc:`URI Library <../libraries/uri>` will now ignore the +``$config['url_suffix']`` and ``$config['permitted_uri_chars']`` +configuration settings. + +These two options don't make sense under the command line (which is why +this change was made) and therefore you shouldn't be affected by this, but +if you've relied on them for some reason, you'd probably have to make some +changes to your code. + +Step 5: Check Cache Library configurations for Redis, Memcache(d) +================================================================= + +The new improvements for the 'redis' and 'memcached' drivers of the +:doc:`Cache Library <../libraries/caching>` may require some small +adjustments to your configuration values ... + +Redis +----- + +If you're using the 'redis' driver with a UNIX socket connection, you'll +have to move the socket path from ``$config['socket']`` to +``$config['host']`` instead. + +The ``$config['socket_type']`` option is also removed, although that won't +affect your application - it will be ignored and the connection type will +be determined by the format used for ``$config['host']`` instead. + +Memcache(d) +----------- + +The 'memcached' will now ignore configurations that don't specify a ``host`` +value (previously, it just set the host to the default '127.0.0.1'). + +Therefore, if you've added a configuration that only sets e.g. a ``port``, +you will now have to explicitly set the ``host`` to '127.0.0.1' as well. + +Step 6: Check usage of the Email library +======================================== + +The :doc:`Email Library <../libraries/email>` will now by default check the +validity of all e-mail addresses passed to it. This check used to be Off by +default, and required explicitly setting the **validate** option to ``TRUE`` +in order to enable it. + +Naturally, a validity check should not result in any problems, but this is +technically a backwards-compatibility break and you should check that +everything works fine. +If something indeed goes wrong with that, please report it as a bug to us, +and you can disable the **validate** option to revert to the old behavior. + +Step 7: Check usage of doctype() HTML helper +============================================ + +The :doc:`HTML Helper <../helpers/html_helper>` function +:php:func:`doctype()` used to default to 'xhtml1-strict' (XHTML 1.0 Strict) +when no document type was specified. That default value is now changed to +'html5', which obviously stands for the modern HTML 5 standard. + +Nothing should be really broken by this change, but if your application +relies on the default value, you should double-check it and either +explicitly set the desired format, or adapt your front-end to use proper +HTML 5 formatting. + +Step 8: Check usage of form_upload() Form helper +================================================ + +The :doc:`Form Helper <../helpers/form_helper>` function +:php:func:`form_upload()` used to have 3 parameters, the second of which +(``$value``) was never used, as it doesn't make sense for an HTML ``input`` +tag of the "file" type. + +That dead parameter is now removed, and so if you've used the third one +(``$extra``), having code like this:: + + form_upload('name', 'irrelevant value', $extra); + +You should change it to:: + + form_upload('name', $extra); + +Step 9: Remove usage of previously deprecated functionalities +============================================================= + +The following is a list of functionalities deprecated in previous +CodeIgniter versions that have been removed in 3.2.0: + +- ``$config['allow_get_array']`` (use ``$_GET = array();`` instead) +- ``$config['standardize_newlines']`` +- ``$config['rewrite_short_tags']`` (no impact; irrelevant on PHP 5.4+) + +- 'sqlite' database driver (no longer shipped with PHP 5.4+; 'sqlite3' is still available) + +- ``CI_Input::is_cli_request()`` (use :php:func:`is_cli()` instead) +- ``CI_Router::fetch_directory()`` (use ``CI_Router::$directory`` instead) +- ``CI_Router::fetch_class()`` (use ``CI_Router::$class`` instead) +- ``CI_Router::fetch_method()`` (use ``CI_Router::$method`` instead) +- ``CI_Config::system_url()`` (encourages insecure practices) +- ``CI_Form_validation::prep_for_form()`` (the *prep_for_form* rule) + +- ``standard_date()`` :doc:`Date Helper <../helpers/date_helper>` function (use ``date()`` instead) +- ``do_hash()`` :doc:`Security Helper <../helpers/security_helper>` function (use ``hash()`` instead) +- ``br()`` :doc:`HTML Helper <../helpers/html_helper>` function (use ``str_repeat()`` with ``'<br />'`` instead) +- ``nbs()`` :doc:`HTML Helper <../helpers/html_helper>` function (use ``str_repeat()`` with ``' '`` instead) +- ``trim_slashes()`` :doc:`String Helper <../helpers/string_helper>` function (use ``trim()`` with ``'/'`` instead) +- ``repeater()`` :doc:`String Helper <../helpers/string_helper>` function (use ``str_repeat()`` instead) +- ``read_file()`` :doc:`File Helper <../helpers/file_helper>` function (use ``file_get_contents()`` instead) +- ``form_prep()`` :doc:`Form Helper <../helpers/form_helper>` function (use :php:func:`html_escape()` instead) + +- The entire *Cart Library* (an archived version is available on GitHub: `bcit-ci/ci3-cart-library <https://github.com/bcit-ci/ci3-cart-library>`_) +- The entire *Javascript Library* (it was always experimental in the first place) + +- The entire *Email Helper*, which only had two functions: + + - ``valid_email()`` (use ``filter_var($email, FILTER_VALIDATE_EMAIL)`` instead) + - ``send_email()`` (use ``mail()`` instead) + +- The entire *Smiley Helper* (an archived version is available on GitHub: `bcit-ci/ci3-smiley-helper <https://github.com/bcit-ci/ci3-smiley-helper>`_) + +Step 10: Make sure you're validating all user inputs +==================================================== + +The :doc:`Input Library <../libraries/input>` used to (often +unconditionally) filter and/or sanitize user input in the ``$_GET``, +``$_POST`` and ``$_COOKIE`` superglobals. + +This was a legacy feature from older times, when things like +`register_globals <https://secure.php.net/register_globals>`_ and +`magic_quotes_gpc <https://secure.php.net/magic_quotes_gpc>`_ existed in +PHP. +It was a necessity back then, but this is no longer the case and reliance +on global filters is a bad practice, giving you a false sense of security. + +This functionality is now removed, and so if you've relied on it for +whatever reasons, you should double-check that you are properly validating +all user inputs in your application (as you always should do). diff --git a/user_guide_src/source/installation/upgrading.rst b/user_guide_src/source/installation/upgrading.rst index e0f0dd5b7..ca7677ba9 100644 --- a/user_guide_src/source/installation/upgrading.rst +++ b/user_guide_src/source/installation/upgrading.rst @@ -8,6 +8,17 @@ upgrading from. .. toctree:: :titlesonly: + Upgrading from 3.1.3+ to 3.2.x <upgrade_320> + Upgrading from 3.1.3 to 3.1.4 <upgrade_314> + Upgrading from 3.1.2 to 3.1.3 <upgrade_313> + Upgrading from 3.1.1 to 3.1.2 <upgrade_312> + Upgrading from 3.1.0 to 3.1.1 <upgrade_311> + Upgrading from 3.0.6 to 3.1.0 <upgrade_310> + Upgrading from 3.0.5 to 3.0.6 <upgrade_306> + Upgrading from 3.0.4 to 3.0.5 <upgrade_305> + Upgrading from 3.0.3 to 3.0.4 <upgrade_304> + Upgrading from 3.0.2 to 3.0.3 <upgrade_303> + Upgrading from 3.0.1 to 3.0.2 <upgrade_302> Upgrading from 3.0.0 to 3.0.1 <upgrade_301> Upgrading from 2.2.x to 3.0.x <upgrade_300> Upgrading from 2.2.2 to 2.2.3 <upgrade_223> diff --git a/user_guide_src/source/libraries/caching.rst b/user_guide_src/source/libraries/caching.rst index a7081ec6b..81019c015 100644 --- a/user_guide_src/source/libraries/caching.rst +++ b/user_guide_src/source/libraries/caching.rst @@ -255,8 +255,6 @@ To use it, you need `Redis server and phpredis PHP extension <https://github.com Config options to connect to redis server must be stored in the application/config/redis.php file. Available options are:: - $config['socket_type'] = 'tcp'; //`tcp` or `unix` - $config['socket'] = '/var/run/redis.sock'; // in case of `unix` socket type $config['host'] = '127.0.0.1'; $config['password'] = NULL; $config['port'] = 6379; diff --git a/user_guide_src/source/libraries/calendar.rst b/user_guide_src/source/libraries/calendar.rst index 52883d297..8fdacf1d7 100644 --- a/user_guide_src/source/libraries/calendar.rst +++ b/user_guide_src/source/libraries/calendar.rst @@ -60,10 +60,10 @@ parameter of the calendar generating function. Consider this example:: $this->load->library('calendar'); $data = array( - 3 => 'http://example.com/news/article/2006/03/', - 7 => 'http://example.com/news/article/2006/07/', - 13 => 'http://example.com/news/article/2006/13/', - 26 => 'http://example.com/news/article/2006/26/' + 3 => 'http://example.com/news/article/2006/06/03/', + 7 => 'http://example.com/news/article/2006/06/07/', + 13 => 'http://example.com/news/article/2006/06/13/', + 26 => 'http://example.com/news/article/2006/06/26/' ); echo $this->calendar->generate(2006, 6, $data); @@ -179,7 +179,7 @@ will be placed within a pair of pseudo-variables as shown here:: {cal_cell_blank} {/cal_cell_blank} - {cal_cell_other}{day}{cal_cel_other} + {cal_cell_other}{day}{/cal_cel_other} {cal_cell_end}</td>{/cal_cell_end} {cal_cell_end_today}</td>{/cal_cell_end_today} @@ -304,4 +304,4 @@ Class Reference :rtype: CI_Calendar Harvests the data within the template ``{pseudo-variables}`` used to - display the calendar.
\ No newline at end of file + display the calendar. diff --git a/user_guide_src/source/libraries/cart.rst b/user_guide_src/source/libraries/cart.rst deleted file mode 100644 index be343320d..000000000 --- a/user_guide_src/source/libraries/cart.rst +++ /dev/null @@ -1,398 +0,0 @@ -################### -Shopping Cart Class -################### - -The Cart Class permits items to be added to a session that stays active -while a user is browsing your site. These items can be retrieved and -displayed in a standard "shopping cart" format, allowing the user to -update the quantity or remove items from the cart. - -.. important:: The Cart library is DEPRECATED and should not be used. - It is currently only kept for backwards compatibility. - -Please note that the Cart Class ONLY provides the core "cart" -functionality. It does not provide shipping, credit card authorization, -or other processing components. - -.. contents:: - :local: - -.. raw:: html - - <div class="custom-index container"></div> - -******************** -Using the Cart Class -******************** - -Initializing the Shopping Cart Class -==================================== - -.. important:: The Cart class utilizes CodeIgniter's :doc:`Session - Class <sessions>` to save the cart information to a database, so - before using the Cart class you must set up a database table as - indicated in the :doc:`Session Documentation <sessions>`, and set the - session preferences in your application/config/config.php file to - utilize a database. - -To initialize the Shopping Cart Class in your controller constructor, -use the ``$this->load->library()`` method:: - - $this->load->library('cart'); - -Once loaded, the Cart object will be available using:: - - $this->cart - -.. note:: The Cart Class will load and initialize the Session Class - automatically, so unless you are using sessions elsewhere in your - application, you do not need to load the Session class. - -Adding an Item to The Cart -========================== - -To add an item to the shopping cart, simply pass an array with the -product information to the ``$this->cart->insert()`` method, as shown -below:: - - $data = array( - 'id' => 'sku_123ABC', - 'qty' => 1, - 'price' => 39.95, - 'name' => 'T-Shirt', - 'options' => array('Size' => 'L', 'Color' => 'Red') - ); - - $this->cart->insert($data); - -.. important:: The first four array indexes above (id, qty, price, and - name) are **required**. If you omit any of them the data will not be - saved to the cart. The fifth index (options) is optional. It is intended - to be used in cases where your product has options associated with it. - Use an array for options, as shown above. - -The five reserved indexes are: - -- **id** - Each product in your store must have a unique identifier. - Typically this will be an "sku" or other such identifier. -- **qty** - The quantity being purchased. -- **price** - The price of the item. -- **name** - The name of the item. -- **options** - Any additional attributes that are needed to identify - the product. These must be passed via an array. - -In addition to the five indexes above, there are two reserved words: -rowid and subtotal. These are used internally by the Cart class, so -please do NOT use those words as index names when inserting data into -the cart. - -Your array may contain additional data. Anything you include in your -array will be stored in the session. However, it is best to standardize -your data among all your products in order to make displaying the -information in a table easier. - -:: - - $data = array( - 'id' => 'sku_123ABC', - 'qty' => 1, - 'price' => 39.95, - 'name' => 'T-Shirt', - 'coupon' => 'XMAS-50OFF' - ); - - $this->cart->insert($data); - -The ``insert()`` method will return the $rowid if you successfully insert a -single item. - -Adding Multiple Items to The Cart -================================= - -By using a multi-dimensional array, as shown below, it is possible to -add multiple products to the cart in one action. This is useful in cases -where you wish to allow people to select from among several items on the -same page. - -:: - - $data = array( - array( - 'id' => 'sku_123ABC', - 'qty' => 1, - 'price' => 39.95, - 'name' => 'T-Shirt', - 'options' => array('Size' => 'L', 'Color' => 'Red') - ), - array( - 'id' => 'sku_567ZYX', - 'qty' => 1, - 'price' => 9.95, - 'name' => 'Coffee Mug' - ), - array( - 'id' => 'sku_965QRS', - 'qty' => 1, - 'price' => 29.95, - 'name' => 'Shot Glass' - ) - ); - - $this->cart->insert($data); - -Displaying the Cart -=================== - -To display the cart you will create a :doc:`view -file </general/views>` with code similar to the one shown below. - -Please note that this example uses the :doc:`form -helper </helpers/form_helper>`. - -:: - - <?php echo form_open('path/to/controller/update/method'); ?> - - <table cellpadding="6" cellspacing="1" style="width:100%" border="0"> - - <tr> - <th>QTY</th> - <th>Item Description</th> - <th style="text-align:right">Item Price</th> - <th style="text-align:right">Sub-Total</th> - </tr> - - <?php $i = 1; ?> - - <?php foreach ($this->cart->contents() as $items): ?> - - <?php echo form_hidden($i.'[rowid]', $items['rowid']); ?> - - <tr> - <td><?php echo form_input(array('name' => $i.'[qty]', 'value' => $items['qty'], 'maxlength' => '3', 'size' => '5')); ?></td> - <td> - <?php echo $items['name']; ?> - - <?php if ($this->cart->has_options($items['rowid']) == TRUE): ?> - - <p> - <?php foreach ($this->cart->product_options($items['rowid']) as $option_name => $option_value): ?> - - <strong><?php echo $option_name; ?>:</strong> <?php echo $option_value; ?><br /> - - <?php endforeach; ?> - </p> - - <?php endif; ?> - - </td> - <td style="text-align:right"><?php echo $this->cart->format_number($items['price']); ?></td> - <td style="text-align:right">$<?php echo $this->cart->format_number($items['subtotal']); ?></td> - </tr> - - <?php $i++; ?> - - <?php endforeach; ?> - - <tr> - <td colspan="2">Â </td> - <td class="right"><strong>Total</strong></td> - <td class="right">$<?php echo $this->cart->format_number($this->cart->total()); ?></td> - </tr> - - </table> - - <p><?php echo form_submit('', 'Update your Cart'); ?></p> - -Updating The Cart -================= - -To update the information in your cart, you must pass an array -containing the Row ID and one or more pre-defined properties to the -``$this->cart->update()`` method. - -.. note:: If the quantity is set to zero, the item will be removed from - the cart. - -:: - - $data = array( - 'rowid' => 'b99ccdf16028f015540f341130b6d8ec', - 'qty' => 3 - ); - - $this->cart->update($data); - - // Or a multi-dimensional array - - $data = array( - array( - 'rowid' => 'b99ccdf16028f015540f341130b6d8ec', - 'qty' => 3 - ), - array( - 'rowid' => 'xw82g9q3r495893iajdh473990rikw23', - 'qty' => 4 - ), - array( - 'rowid' => 'fh4kdkkkaoe30njgoe92rkdkkobec333', - 'qty' => 2 - ) - ); - - $this->cart->update($data); - -You may also update any property you have previously defined when -inserting the item such as options, price or other custom fields. - -:: - - $data = array( - 'rowid' => 'b99ccdf16028f015540f341130b6d8ec', - 'qty' => 1, - 'price' => 49.95, - 'coupon' => NULL - ); - - $this->cart->update($data); - -What is a Row ID? -***************** - -The row ID is a unique identifier that is generated by the cart code -when an item is added to the cart. The reason a unique ID is created -is so that identical products with different options can be managed -by the cart. - -For example, let's say someone buys two identical t-shirts (same product -ID), but in different sizes. The product ID (and other attributes) will -be identical for both sizes because it's the same shirt. The only -difference will be the size. The cart must therefore have a means of -identifying this difference so that the two sizes of shirts can be -managed independently. It does so by creating a unique "row ID" based on -the product ID and any options associated with it. - -In nearly all cases, updating the cart will be something the user does -via the "view cart" page, so as a developer, it is unlikely that you -will ever have to concern yourself with the "row ID", other than making -sure your "view cart" page contains this information in a hidden form -field, and making sure it gets passed to the ``update()`` method when -the update form is submitted. Please examine the construction of the -"view cart" page above for more information. - - -*************** -Class Reference -*************** - -.. php:class:: CI_Cart - - .. attribute:: $product_id_rules = '\.a-z0-9_-' - - These are the regular expression rules that we use to validate the product - ID - alpha-numeric, dashes, underscores, or periods by default - - .. attribute:: $product_name_rules = '\w \-\.\:' - - These are the regular expression rules that we use to validate the product ID and product name - alpha-numeric, dashes, underscores, colons or periods by - default - - .. attribute:: $product_name_safe = TRUE - - Whether or not to only allow safe product names. Default TRUE. - - - .. php:method:: insert([$items = array()]) - - :param array $items: Items to insert into the cart - :returns: TRUE on success, FALSE on failure - :rtype: bool - - Insert items into the cart and save it to the session table. Returns TRUE - on success and FALSE on failure. - - - .. php:method:: update([$items = array()]) - - :param array $items: Items to update in the cart - :returns: TRUE on success, FALSE on failure - :rtype: bool - - This method permits changing the properties of a given item. - Typically it is called from the "view cart" page if a user makes changes - to the quantity before checkout. That array must contain the rowid - for each item. - - .. php:method:: remove($rowid) - - :param int $rowid: ID of the item to remove from the cart - :returns: TRUE on success, FALSE on failure - :rtype: bool - - Allows you to remove an item from the shopping cart by passing it the - ``$rowid``. - - .. php:method:: total() - - :returns: Total amount - :rtype: int - - Displays the total amount in the cart. - - - .. php:method:: total_items() - - :returns: Total amount of items in the cart - :rtype: int - - Displays the total number of items in the cart. - - - .. php:method:: contents([$newest_first = FALSE]) - - :param bool $newest_first: Whether to order the array with newest items first - :returns: An array of cart contents - :rtype: array - - Returns an array containing everything in the cart. You can sort the - order by which the array is returned by passing it TRUE where the contents - will be sorted from newest to oldest, otherwise it is sorted from oldest - to newest. - - .. php:method:: get_item($row_id) - - :param int $row_id: Row ID to retrieve - :returns: Array of item data - :rtype: array - - Returns an array containing data for the item matching the specified row - ID, or FALSE if no such item exists. - - .. php:method:: has_options($row_id = '') - - :param int $row_id: Row ID to inspect - :returns: TRUE if options exist, FALSE otherwise - :rtype: bool - - Returns TRUE (boolean) if a particular row in the cart contains options. - This method is designed to be used in a loop with ``contents()``, since - you must pass the rowid to this method, as shown in the Displaying - the Cart example above. - - .. php:method:: product_options([$row_id = '']) - - :param int $row_id: Row ID - :returns: Array of product options - :rtype: array - - Returns an array of options for a particular product. This method is - designed to be used in a loop with ``contents()``, since you - must pass the rowid to this method, as shown in the Displaying the - Cart example above. - - .. php:method:: destroy() - - :rtype: void - - Permits you to destroy the cart. This method will likely be called - when you are finished processing the customer's order.
\ No newline at end of file diff --git a/user_guide_src/source/libraries/config.rst b/user_guide_src/source/libraries/config.rst index a45cacdf5..2431abf93 100644 --- a/user_guide_src/source/libraries/config.rst +++ b/user_guide_src/source/libraries/config.rst @@ -211,7 +211,7 @@ Class Reference .. php:method:: load([$file = ''[, $use_sections = FALSE[, $fail_gracefully = FALSE]]]) :param string $file: Configuration file name - :param bool $use_sections: Whether config values shoud be loaded into their own section (index of the main config array) + :param bool $use_sections: Whether config values should be loaded into their own section (index of the main config array) :param bool $fail_gracefully: Whether to return FALSE or to display an error message :returns: TRUE on success, FALSE on failure :rtype: bool @@ -239,14 +239,3 @@ Class Reference This method is normally accessed via the corresponding functions in the :doc:`URL Helper </helpers/url_helper>`. - - .. php:method:: system_url() - - :returns: URL pointing at your CI system/ directory - :rtype: string - - This method retrieves the URL to your CodeIgniter system/ directory. - - .. note:: This method is DEPRECATED because it encourages usage of - insecure coding practices. Your *system/* directory shouldn't - be publicly accessible.
\ No newline at end of file diff --git a/user_guide_src/source/libraries/email.rst b/user_guide_src/source/libraries/email.rst index eadfcfd5c..bd416ba3b 100644 --- a/user_guide_src/source/libraries/email.rst +++ b/user_guide_src/source/libraries/email.rst @@ -108,7 +108,7 @@ Preference Default Value Options Descript page. Make sure you don't have any relative links or relative image paths otherwise they will not work. **charset** ``$config['charset']`` Character set (utf-8, iso-8859-1, etc.). -**validate** FALSE TRUE or FALSE (boolean) Whether to validate the email address. +**validate** TRUE TRUE or FALSE (boolean) Whether to validate the email address. **priority** 3 1, 2, 3, 4, 5 Email Priority. 1 = highest. 5 = lowest. 3 = normal. **crlf** \\n "\\r\\n" or "\\n" or "\\r" Newline character. (Use "\\r\\n" to comply with RFC 822). **newline** \\n "\\r\\n" or "\\n" or "\\r" Newline character. (Use "\\r\\n" to comply with RFC 822). @@ -348,7 +348,7 @@ Class Reference $this->email->attach('http://example.com/filename.pdf'); - If you'd like to use a custom file name, you can use the third paramater:: + If you'd like to use a custom file name, you can use the third parameter:: $this->email->attach('filename.pdf', 'attachment', 'report.pdf'); @@ -374,7 +374,7 @@ Class Reference { $this->email->to($address); $cid = $this->email->attachment_cid($filename); - $this->email->message('<img src='cid:". $cid ."' alt="photo1" />'); + $this->email->message('<img src="cid:'. $cid .'" alt="photo1" />'); $this->email->send(); } @@ -387,7 +387,7 @@ Class Reference :rtype: string Returns a string containing any server messages, the email headers, and - the email messsage. Useful for debugging. + the email message. Useful for debugging. You can optionally specify which parts of the message should be printed. Valid options are: **headers**, **subject**, **body**. @@ -402,4 +402,4 @@ Class Reference // Will only print the email headers, excluding the message subject and body $this->email->print_debugger(array('headers')); - .. note:: By default, all of the raw data will be printed.
\ No newline at end of file + .. note:: By default, all of the raw data will be printed. diff --git a/user_guide_src/source/libraries/encryption.rst b/user_guide_src/source/libraries/encryption.rst index 599be4df0..b16511d4d 100644 --- a/user_guide_src/source/libraries/encryption.rst +++ b/user_guide_src/source/libraries/encryption.rst @@ -13,7 +13,7 @@ unfortunately not always available on all systems. You must meet one of the following dependencies in order to use this library: -- `OpenSSL <http://php.net/openssl>`_ (and PHP 5.3.3) +- `OpenSSL <http://php.net/openssl>`_ - `MCrypt <http://php.net/mcrypt>`_ (and `MCRYPT_DEV_URANDOM` availability) If neither of the above dependencies is met, we simply cannot offer @@ -75,7 +75,7 @@ process that allows you to be the only one who is able to decrypt data that you've decided to hide from the eyes of the public. After one key is used to encrypt data, that same key provides the **only** means to decrypt it, so not only must you chose one carefully, but you -must not lose it or you will also use the encrypted data. +must not lose it or you will also lose access to the data. It must be noted that to ensure maximum security, such key *should* not only be as strong as possible, but also often changed. Such behavior @@ -382,7 +382,7 @@ the hood: #. Check if the string is long enough, separate the HMAC out of it and validate if it is correct (this is done in a way that - prevents timing attacks agains it). Return FALSE if either of + prevents timing attacks against it). Return FALSE if either of the checks fails. #. Base64-decode the string. diff --git a/user_guide_src/source/libraries/form_validation.rst b/user_guide_src/source/libraries/form_validation.rst index be6d1f233..6a92cc983 100644 --- a/user_guide_src/source/libraries/form_validation.rst +++ b/user_guide_src/source/libraries/form_validation.rst @@ -116,7 +116,7 @@ this code and save it to your application/views/ folder:: The Controller ============== -Using a text editor, create a controller called form.php. In it, place +Using a text editor, create a controller called Form.php. In it, place this code and save it to your application/controllers/ folder:: <?php @@ -175,7 +175,7 @@ The form (myform.php) is a standard web form with a couple exceptions: This function will return any error messages sent back by the validator. If there are no messages it returns an empty string. -The controller (form.php) has one method: ``index()``. This method +The controller (Form.php) has one method: ``index()``. This method initializes the validation class and loads the form helper and URL helper used by your view files. It also runs the validation routine. Based on whether the validation was successful it either presents the @@ -205,7 +205,7 @@ The above method takes **three** parameters as input: .. note:: If you would like the field name to be stored in a language file, please see :ref:`translating-field-names`. -Here is an example. In your controller (form.php), add this code just +Here is an example. In your controller (Form.php), add this code just below the validation initialization method:: $this->form_validation->set_rules('username', 'Username', 'required'); @@ -465,7 +465,7 @@ for you to process. To invoke a callback just put the method name in a rule, with "callback\_" as the rule **prefix**. If you need to receive an extra parameter in your callback method, just add it normally after the -method name between square brackets, as in: "callback_foo**[bar]**", +method name between square brackets, as in: ``callback_foo[bar]``, then it will be passed as the second argument of your callback method. .. note:: You can also process the form data that is passed to your @@ -495,8 +495,7 @@ The above code would use the ``valid_username()`` method from your This is just an example of course, and callbacks aren't limited to models. You can use any object/method that accepts the field value as its' first -parameter. Or if you're running PHP 5.3+, you can also use an anonymous -function:: +parameter. You can also use an anonymous function:: $this->form_validation->set_rules( 'username', 'Username', @@ -522,7 +521,7 @@ the second element of an array, with the first one being the rule name:: ) ); -Anonymous function (PHP 5.3+) version:: +Anonymous function version:: $this->form_validation->set_rules( 'username', 'Username', @@ -547,7 +546,10 @@ All of the native error messages are located in the following language file: **system/language/english/form_validation_lang.php** To set your own global custom message for a rule, you can either -edit that file, or use the following method:: +extend/override the language file by creating your own in +**application/language/english/form_validation_lang.php** (read more +about this in the :doc:`Language Class <language>` documentation), +or use the following method:: $this->form_validation->set_message('rule', 'Error Message'); @@ -983,8 +985,9 @@ Rule Parameter Description **valid_url** No Returns FALSE if the form element does not contain a valid URL. **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. +**valid_ip** Yes Returns FALSE if the supplied IP address is not valid. Accepts an optional parameter of 'ipv4' or 'ipv6' to specify an IP format. +**valid_mac** No Returns FALSE if the supplied MAC address is not valid. **valid_base64** No Returns FALSE if the supplied string contains anything other than valid Base64 characters. ========================= ========== ============================================================================================= ======================= @@ -1004,14 +1007,13 @@ Prepping Reference The following is a list of all the prepping methods that are available to use: -==================== ========= ======================================================================================================= +==================== ========= ============================================================================================================== Name Parameter Description -==================== ========= ======================================================================================================= -**prep_for_form** No Converts special characters so that HTML data can be shown in a form field without breaking it. +==================== ========= ============================================================================================================== **prep_url** No Adds "\http://" to URLs if missing. **strip_image_tags** No Strips the HTML from image tags leaving the raw URL. **encode_php_tags** No Converts PHP tags to entities. -==================== ========= ======================================================================================================= +==================== ========= ============================================================================================================== .. note:: You can also use any native PHP functions that permits one parameter, like ``trim()``, ``htmlspecialchars()``, ``urldecode()``, @@ -1025,12 +1027,14 @@ Class Reference .. php:class:: CI_Form_validation - .. php:method:: set_rules($field[, $label = ''[, $rules = '']]) + .. php:method:: set_rules($field[, $label = null[, $rules = null[, $errors = array()]]]) :param string $field: Field name :param string $label: Field label :param mixed $rules: Validation rules, as a string list separated by a pipe "|", or as an array or rules + :param array $errors: A list of custom error messages :returns: CI_Form_validation instance (method chaining) + :throws: BadMethodCallException If $field is not an array and $rules was not used :rtype: CI_Form_validation Permits you to set validation rules, as described in the tutorial @@ -1137,4 +1141,4 @@ the following functions: - :php:func:`set_radio()` Note that these are procedural functions, so they **do not** require you -to prepend them with ``$this->form_validation``.
\ No newline at end of file +to prepend them with ``$this->form_validation``. diff --git a/user_guide_src/source/libraries/ftp.rst b/user_guide_src/source/libraries/ftp.rst index ddd4442fd..2a015256d 100644 --- a/user_guide_src/source/libraries/ftp.rst +++ b/user_guide_src/source/libraries/ftp.rst @@ -2,7 +2,7 @@ FTP Class ######### -CodeIgniter's FTP Class permits files to be transfered to a remote +CodeIgniter's FTP Class permits files to be transferred to a remote server. Remote files can also be moved, renamed, and deleted. The FTP class also includes a "mirroring" function that permits an entire local directory to be recreated remotely via FTP. diff --git a/user_guide_src/source/libraries/image_lib.rst b/user_guide_src/source/libraries/image_lib.rst index e5f7c000f..442541bf6 100644 --- a/user_guide_src/source/libraries/image_lib.rst +++ b/user_guide_src/source/libraries/image_lib.rst @@ -63,7 +63,8 @@ called *mypic.jpg* located in the source_image folder, then create a thumbnail that is 75 X 50 pixels using the GD2 image_library. Since the maintain_ratio option is enabled, the thumb will be as close to the target width and height as possible while preserving the original aspect -ratio. The thumbnail will be called *mypic_thumb.jpg* +ratio. The thumbnail will be called *mypic_thumb.jpg* and located at +the same level as *source_image*. .. note:: In order for the image class to be allowed to do any processing, the folder containing the image files must have write @@ -282,7 +283,7 @@ Preference Default Value Options Description **wm_shadow_color** None None The color of the drop shadow, specified in hex. If you leave this blank a drop shadow will not be used. Both the full 6-length (ie, 993300) and the short three character abbreviated version (ie, fff) are supported. -**wm_shadow_distance** 3 None The distance (in pixels) from the font that the drop shadow should +**wm_shadow_distance** 2 None The distance (in pixels) from the font that the drop shadow should appear. ======================= =================== =================== ========================================================================== @@ -407,7 +408,7 @@ Class Reference method 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. + lets the cropping area be selected. (from EllisLab) .. php:method:: rotate() @@ -471,4 +472,4 @@ Class Reference Returns all detected errors formatted as a string. :: - echo $this->image_lib->diplay_errors();
\ No newline at end of file + echo $this->image_lib->display_errors(); diff --git a/user_guide_src/source/libraries/input.rst b/user_guide_src/source/libraries/input.rst index d9c6c2dd1..8a0b5f286 100644 --- a/user_guide_src/source/libraries/input.rst +++ b/user_guide_src/source/libraries/input.rst @@ -2,10 +2,8 @@ Input Class ########### -The Input Class serves two purposes: - -#. It pre-processes global input data for security. -#. It provides some helper methods for fetching input data and pre-processing it. +The Input Class provides some helper methods for accessing input data +and pre-processing it. .. note:: This class is initialized automatically by the system so there is no need to do it manually. @@ -17,49 +15,9 @@ The Input Class serves two purposes: <div class="custom-index container"></div> -*************** -Input Filtering -*************** - -Security Filtering -================== - -The security filtering method is called automatically when a new -:doc:`controller <../general/controllers>` is invoked. It does the -following: - -- If ``$config['allow_get_array']`` is FALSE (default is TRUE), destroys - the global GET array. -- Destroys all global variables in the event register_globals is - turned on. -- Filters the GET/POST/COOKIE array keys, permitting only alpha-numeric - (and a few other) characters. -- Provides XSS (Cross-site Scripting Hacks) filtering. This can be - enabled globally, or upon request. -- Standardizes newline characters to ``PHP_EOL`` (\\n in UNIX-based OSes, - \\r\\n under Windows). This is configurable. - -XSS Filtering -============= - -The Input class has the ability to filter input automatically to prevent -cross-site scripting attacks. If you want the filter to run -automatically every time it encounters POST or COOKIE data you can -enable it by opening your *application/config/config.php* file and setting -this:: - - $config['global_xss_filtering'] = TRUE; - -Please refer to the :doc:`Security class <security>` documentation for -information on using XSS Filtering in your application. - -.. important:: The 'global_xss_filtering' setting is DEPRECATED and kept - solely for backwards-compatibility purposes. XSS escaping should - be performed on *output*, not *input*! - -******************* -Accessing form data -******************* +******************** +Accessing input data +******************** Using POST, GET, COOKIE, or SERVER Data ======================================= @@ -130,7 +88,7 @@ Class Reference The property can be read multiple times. - .. php:method:: post([$index = NULL[, $xss_clean = NULL]]) + .. php:method:: post([$index = NULL[, $xss_clean = FALSE]]) :param mixed $index: POST parameter name :param bool $xss_clean: Whether to apply XSS filtering @@ -147,7 +105,6 @@ Class Reference The second optional parameter lets you run the data through the XSS filter. It's enabled by setting the second parameter to boolean TRUE - or by setting your ``$config['global_xss_filtering']`` to TRUE. :: $this->input->post('some_data', TRUE); @@ -167,13 +124,13 @@ Class Reference $this->input->post(array('field1', 'field2')); - Same rule applied here, to retrive the parameters with XSS filtering enabled, set the + Same rule applied here, to retrieve the parameters with XSS filtering enabled, set the second parameter to boolean TRUE. :: $this->input->post(array('field1', 'field2'), TRUE); - .. php:method:: get([$index = NULL[, $xss_clean = NULL]]) + .. php:method:: get([$index = NULL[, $xss_clean = FALSE]]) :param mixed $index: GET parameter name :param bool $xss_clean: Whether to apply XSS filtering @@ -200,13 +157,13 @@ Class Reference $this->input->get(array('field1', 'field2')); - Same rule applied here, to retrive the parameters with XSS filtering enabled, set the + Same rule applied here, to retrieve the parameters with XSS filtering enabled, set the second parameter to boolean TRUE. :: $this->input->get(array('field1', 'field2'), TRUE); - .. php:method:: post_get($index[, $xss_clean = NULL]) + .. php:method:: post_get($index[, $xss_clean = FALSE]) :param string $index: POST/GET parameter name :param bool $xss_clean: Whether to apply XSS filtering @@ -219,7 +176,7 @@ Class Reference $this->input->post_get('some_data', TRUE); - .. php:method:: get_post($index[, $xss_clean = NULL]) + .. php:method:: get_post($index[, $xss_clean = FALSE]) :param string $index: GET/POST parameter name :param bool $xss_clean: Whether to apply XSS filtering @@ -234,7 +191,7 @@ Class Reference .. note:: This method used to act EXACTLY like ``post_get()``, but it's behavior has changed in CodeIgniter 3.0. - .. php:method:: cookie([$index = NULL[, $xss_clean = NULL]]) + .. php:method:: cookie([$index = NULL[, $xss_clean = FALSE]]) :param mixed $index: COOKIE name :param bool $xss_clean: Whether to apply XSS filtering @@ -257,7 +214,7 @@ Class Reference function :php:func:`get_cookie()`, this method does NOT prepend your configured ``$config['cookie_prefix']`` value. - .. php:method:: server($index[, $xss_clean = NULL]) + .. php:method:: server($index[, $xss_clean = FALSE]) :param mixed $index: Value name :param bool $xss_clean: Whether to apply XSS filtering @@ -275,7 +232,7 @@ Class Reference $this->input->server(array('SERVER_PROTOCOL', 'REQUEST_URI')); - .. php:method:: input_stream([$index = NULL[, $xss_clean = NULL]]) + .. php:method:: input_stream([$index = NULL[, $xss_clean = FALSE]]) :param mixed $index: Key name :param bool $xss_clean: Whether to apply XSS filtering @@ -285,7 +242,7 @@ Class Reference This method is identical to ``get()``, ``post()`` and ``cookie()``, only it fetches the *php://input* stream data. - .. php:method:: set_cookie($name = ''[, $value = ''[, $expire = ''[, $domain = ''[, $path = '/'[, $prefix = ''[, $secure = FALSE[, $httponly = FALSE]]]]]]]) + .. php:method:: set_cookie($name = ''[, $value = ''[, $expire = 0[, $domain = ''[, $path = '/'[, $prefix = ''[, $secure = FALSE[, $httponly = FALSE]]]]]]]) :param mixed $name: Cookie name or an array of parameters :param string $value: Cookie value @@ -310,7 +267,7 @@ Class Reference $cookie = array( 'name' => 'The Cookie Name', 'value' => 'The Value', - 'expire' => '86500', + 'expire' => 86500, 'domain' => '.some-domain.com', 'path' => '/', 'prefix' => 'myprefix_', @@ -321,8 +278,8 @@ Class Reference **Notes** - Only the name and value are required. To delete a cookie set it with the - expiration blank. + Only the name and value are required. To delete a cookie set the expiry + time to a negative, or non-numeric value. The expiration is set in **seconds**, which will be added to the current time. Do not include the time, but rather only the number of seconds @@ -390,7 +347,7 @@ Class Reference Accepts an optional second string parameter of 'ipv4' or 'ipv6' to specify an IP format. The default checks for both formats. - .. php:method:: user_agent([$xss_clean = NULL]) + .. php:method:: user_agent([$xss_clean = FALSE]) :returns: User agent string or NULL if not set :param bool $xss_clean: Whether to apply XSS filtering @@ -440,25 +397,6 @@ Class Reference Checks to see if the HTTP_X_REQUESTED_WITH server header has been set, and returns boolean TRUE if it is or FALSE if not. - .. php:method:: is_cli_request() - - :returns: TRUE if it is a CLI request, FALSE if not - :rtype: bool - - Checks to see if the application was run from the command-line - interface. - - .. note:: This method checks both the PHP SAPI name currently in use - and if the ``STDIN`` constant is defined, which is usually a - failsafe way to see if PHP is being run via the command line. - - :: - - $this->input->is_cli_request() - - .. note:: This method is DEPRECATED and is now just an alias for the - :func:`is_cli()` function. - .. php:method:: method([$upper = FALSE]) :param bool $upper: Whether to return the request method name in upper or lower case diff --git a/user_guide_src/source/libraries/javascript.rst b/user_guide_src/source/libraries/javascript.rst deleted file mode 100644 index e91b9ad78..000000000 --- a/user_guide_src/source/libraries/javascript.rst +++ /dev/null @@ -1,322 +0,0 @@ -################ -Javascript Class -################ - -CodeIgniter provides a library to help you with certain common functions -that you may want to use with Javascript. Please note that CodeIgniter -does not require the jQuery library to run, and that any scripting -library will work equally well. The jQuery library is simply presented -as a convenience if you choose to use it. - -.. important:: This library is DEPRECATED and should not be used. It has always - been with an 'experimental' status and is now no longer supported. - Currently only kept for backwards compatibility. - -.. contents:: - :local: - -.. raw:: html - - <div class="custom-index container"></div> - -************************** -Using the Javascript Class -************************** - -Initializing the Class -====================== - -To initialize the Javascript class manually in your controller -constructor, use the ``$this->load->library()`` method. Currently, -the only available library is jQuery, which will automatically be -loaded like this:: - - $this->load->library('javascript'); - -The Javascript class also accepts parameters: - -- js_library_driver (string) *default: 'jquery'* -- autoload (bool) *default: TRUE* - -You may override the defaults by sending an associative array:: - - $this->load->library( - 'javascript', - array( - 'js_library_driver' => 'scripto', - 'autoload' => FALSE - ) - ); - -Again, presently only 'jquery' is available. You may wish to set -autoload to FALSE, though, if you do not want the jQuery library to -automatically include a script tag for the main jQuery script file. This -is useful if you are loading it from a location outside of CodeIgniter, -or already have the script tag in your markup. - -Once loaded, the jQuery library object will be available using: - - $this->javascript - -Setup and Configuration -======================= - -Set these variables in your view --------------------------------- - -As a Javascript library, your files must be available to your -application. - -As Javascript is a client side language, the library must be able to -write content into your final output. This generally means a view. -You'll need to include the following variables in the ``<head>`` -sections of your output. - -:: - - <?php echo $library_src;?> - <?php echo $script_head;?> - - -``$library_src``, is where the actual library file will be loaded, as -well as any subsequent plugin script calls; $script_head is where -specific events, functions and other commands will be rendered. - -Set the path to the librarys with config items ----------------------------------------------- - -There are some configuration items in Javascript library. These can -either be set in *application/config.php*, within its own -*config/javascript.php* file, or within any controller usings the -``set_item()`` function. - -An image to be used as an "ajax loader", or progress indicator. Without -one, the simple text message of "loading" will appear when Ajax calls -need to be made. - -:: - - $config['javascript_location'] = 'http://localhost/codeigniter/themes/js/jquery/'; - $config['javascript_ajax_img'] = 'images/ajax-loader.gif'; - -If you keep your files in the same directories they were downloaded -from, then you need not set this configuration items. - -The jQuery Class -================ - -To initialize the jQuery class manually in your controller constructor, -use the ``$this->load->library()`` method:: - - $this->load->library('javascript/jquery'); - -You may send an optional parameter to determine whether or not a script -tag for the main jQuery file will be automatically included when loading -the library. It will be created by default. To prevent this, load the -library as follows:: - - $this->load->library('javascript/jquery', FALSE); - -Once loaded, the jQuery library object will be available using: - - $this->jquery - -jQuery Events -============= - -Events are set using the following syntax. -:: - - $this->jquery->event('element_path', code_to_run()); - -In the above example: - -- "event" is any of blur, change, click, dblclick, error, focus, hover, - keydown, keyup, load, mousedown, mouseup, mouseover, mouseup, resize, - scroll, or unload. -- "element_path" is any valid `jQuery selector - <http://api.jquery.com/category/selectors/>`_. Due to jQuery's unique - selector syntax, this is usually an element id, or CSS selector. For - example "#notice_area" would effect ``<div id="notice_area">``, and - "#content a.notice" would effect all anchors with a class of "notice" - in the div with id "content". -- "``code_to_run()``" is script your write yourself, or an action such as - an effect from the jQuery library below. - -Effects -======= - -The query library supports a powerful -`Effects <http://api.jquery.com/category/effects/>`_ repertoire. Before an effect -can be used, it must be loaded:: - - $this->jquery->effect([optional path] plugin name); // for example $this->jquery->effect('bounce'); - - -hide() / show() ---------------- - -Each of this functions will affect the visibility of an item on your -page. hide() will set an item invisible, show() will reveal it. - -:: - - $this->jquery->hide(target, optional speed, optional extra information); - $this->jquery->show(target, optional speed, optional extra information); - - -- "target" will be any valid jQuery selector or selectors. -- "speed" is optional, and is set to either slow, normal, fast, or - alternatively a number of milliseconds. -- "extra information" is optional, and could include a callback, or - other additional information. - -toggle() --------- - -toggle() will change the visibility of an item to the opposite of its -current state, hiding visible elements, and revealing hidden ones. - -:: - - $this->jquery->toggle(target); - - -- "target" will be any valid jQuery selector or selectors. - -animate() ---------- - -:: - - $this->jquery->animate(target, parameters, optional speed, optional extra information); - - -- "target" will be any valid jQuery selector or selectors. -- "parameters" in jQuery would generally include a series of CSS - properties that you wish to change. -- "speed" is optional, and is set to either slow, normal, fast, or - alternatively a number of milliseconds. -- "extra information" is optional, and could include a callback, or - other additional information. - -For a full summary, see -`http://api.jquery.com/animate/ <http://api.jquery.com/animate/>`_ - -Here is an example of an animate() called on a div with an id of "note", -and triggered by a click using the jQuery library's click() event. - -:: - - $params = array( - 'height' => 80, - 'width' => '50%', - 'marginLeft' => 125 - ); - $this->jquery->click('#trigger', $this->jquery->animate('#note', $params, 'normal')); - -fadeIn() / fadeOut() --------------------- - -:: - - $this->jquery->fadeIn(target, optional speed, optional extra information); - $this->jquery->fadeOut(target, optional speed, optional extra information); - - -- "target" will be any valid jQuery selector or selectors. -- "speed" is optional, and is set to either slow, normal, fast, or - alternatively a number of milliseconds. -- "extra information" is optional, and could include a callback, or - other additional information. - -toggleClass() -------------- - -This function will add or remove a CSS class to its target. - -:: - - $this->jquery->toggleClass(target, class) - - -- "target" will be any valid jQuery selector or selectors. -- "class" is any CSS classname. Note that this class must be defined - and available in a CSS that is already loaded. - -fadeIn() / fadeOut() --------------------- - -These effects cause an element(s) to disappear or reappear over time. - -:: - - $this->jquery->fadeIn(target, optional speed, optional extra information); - $this->jquery->fadeOut(target, optional speed, optional extra information); - - -- "target" will be any valid jQuery selector or selectors. -- "speed" is optional, and is set to either slow, normal, fast, or - alternatively a number of milliseconds. -- "extra information" is optional, and could include a callback, or - other additional information. - -slideUp() / slideDown() / slideToggle() ---------------------------------------- - -These effects cause an element(s) to slide. - -:: - - $this->jquery->slideUp(target, optional speed, optional extra information); - $this->jquery->slideDown(target, optional speed, optional extra information); - $this->jquery->slideToggle(target, optional speed, optional extra information); - - -- "target" will be any valid jQuery selector or selectors. -- "speed" is optional, and is set to either slow, normal, fast, or - alternatively a number of milliseconds. -- "extra information" is optional, and could include a callback, or - other additional information. - -Plugins -======= - -Some select jQuery plugins are made available using this library. - -corner() --------- - -Used to add distinct corners to page elements. For full details see -`http://malsup.com/jquery/corner/ <http://malsup.com/jquery/corner/>`_ - -:: - - $this->jquery->corner(target, corner_style); - - -- "target" will be any valid jQuery selector or selectors. -- "corner_style" is optional, and can be set to any valid style such - as round, sharp, bevel, bite, dog, etc. Individual corners can be set - by following the style with a space and using "tl" (top left), "tr" - (top right), "bl" (bottom left), or "br" (bottom right). - -:: - - $this->jquery->corner("#note", "cool tl br"); - - -tablesorter() -------------- - -description to come - -modal() -------- - -description to come - -calendar() ----------- - -description to come
\ No newline at end of file diff --git a/user_guide_src/source/libraries/output.rst b/user_guide_src/source/libraries/output.rst index 84529f766..92060f66a 100644 --- a/user_guide_src/source/libraries/output.rst +++ b/user_guide_src/source/libraries/output.rst @@ -199,11 +199,11 @@ Class Reference .. php:method:: cache($time) - :param int $time: Cache expiration time in seconds + :param int $time: Cache expiration time in minutes :returns: CI_Output instance (method chaining) :rtype: CI_Output - Caches the current page for the specified amount of seconds. + Caches the current page for the specified amount of minutes. For more information, please see the :doc:`caching documentation <../general/caching>`. diff --git a/user_guide_src/source/libraries/pagination.rst b/user_guide_src/source/libraries/pagination.rst index 913717c67..99b5a80a2 100644 --- a/user_guide_src/source/libraries/pagination.rst +++ b/user_guide_src/source/libraries/pagination.rst @@ -101,7 +101,7 @@ like:: If you have ``$config['enable_query_strings']`` set to TRUE your links will automatically be re-written using Query Strings. This option can -also be explictly set. Using ``$config['page_query_string']`` set to TRUE, +also be explicitly set. Using ``$config['page_query_string']`` set to TRUE, the pagination link will become:: http://example.com/index.php?c=test&m=page&per_page=20 diff --git a/user_guide_src/source/libraries/security.rst b/user_guide_src/source/libraries/security.rst index 305a8e57c..f7604ef00 100644 --- a/user_guide_src/source/libraries/security.rst +++ b/user_guide_src/source/libraries/security.rst @@ -16,20 +16,11 @@ application, processing input data for security. XSS Filtering ************* -CodeIgniter comes with a Cross Site Scripting Hack prevention filter -which can either run automatically to filter all POST and COOKIE data -that is encountered, or you can run it on a per item basis. By default -it does **not** run globally since it requires a bit of processing -overhead, and since you may not need it in all cases. - -The XSS filter looks for commonly used techniques to trigger Javascript -or other types of code that attempt to hijack cookies or do other -malicious things. If anything disallowed is encountered it is rendered -safe by converting the data to character entities. - -Note: This function should only be used to deal with data upon -submission. It's not something that should be used for general runtime -processing since it requires a fair amount of processing overhead. +CodeIgniter comes with a Cross Site Scripting prevention filter, which +looks for commonly used techniques to trigger JavaScript or other types +of code that attempt to hijack cookies or do other malicious things. +If anything disallowed is encountered it is rendered safe by converting +the data to character entities. To filter data through the XSS filter use the ``xss_clean()`` method:: diff --git a/user_guide_src/source/libraries/sessions.rst b/user_guide_src/source/libraries/sessions.rst index 2034ed2b0..b1f658d8f 100644 --- a/user_guide_src/source/libraries/sessions.rst +++ b/user_guide_src/source/libraries/sessions.rst @@ -471,7 +471,7 @@ Preference Default Description .. note:: The 'cookie_httponly' setting doesn't have an effect on sessions. Instead the HttpOnly parameter is always enabled, for security - reasons. Additionaly, the 'cookie_prefix' setting is completely + reasons. Additionally, the 'cookie_prefix' setting is completely ignored. Session Drivers @@ -594,31 +594,36 @@ And then of course, create the database table ... For MySQL:: CREATE TABLE IF NOT EXISTS `ci_sessions` ( - `id` varchar(40) NOT NULL, + `id` varchar(128) NOT NULL, `ip_address` varchar(45) NOT NULL, `timestamp` int(10) unsigned DEFAULT 0 NOT NULL, `data` blob NOT NULL, - PRIMARY KEY (id), KEY `ci_sessions_timestamp` (`timestamp`) ); For PostgreSQL:: CREATE TABLE "ci_sessions" ( - "id" varchar(40) NOT NULL, + "id" varchar(128) NOT NULL, "ip_address" varchar(45) NOT NULL, "timestamp" bigint DEFAULT 0 NOT NULL, - "data" text DEFAULT '' NOT NULL, - PRIMARY KEY ("id") + "data" text DEFAULT '' NOT NULL ); CREATE INDEX "ci_sessions_timestamp" ON "ci_sessions" ("timestamp"); -However, if you want to turn on the *sess_match_ip* setting, you should -also do the following, after creating the table:: +You will also need to add a PRIMARY KEY **depending on your 'sess_match_ip' +setting**. The examples below work both on MySQL and PostgreSQL:: + + // When sess_match_ip = TRUE + ALTER TABLE ci_sessions ADD PRIMARY KEY (id, ip_address); + + // When sess_match_ip = FALSE + ALTER TABLE ci_sessions ADD PRIMARY KEY (id); + + // To drop a previously created primary key (use when changing the setting) + ALTER TABLE ci_sessions DROP PRIMARY KEY; - // Works both on MySQL and PostgreSQL - ALTER TABLE ci_sessions ADD CONSTRAINT ci_sessions_id_ip UNIQUE (id, ip_address); .. important:: Only MySQL and PostgreSQL databases are officially supported, due to lack of advisory locking mechanisms on other @@ -901,7 +906,7 @@ Class Reference Gets a list of all ``$_SESSION`` that have been marked as "flashdata". - .. php:method:: umark_flash($key) + .. php:method:: unmark_flash($key) :param mixed $key: Key to be un-marked as flashdata, or an array of multiple keys :rtype: void @@ -966,7 +971,7 @@ Class Reference Gets a list of all ``$_SESSION`` that have been marked as "tempdata". - .. php:method:: umark_temp($key) + .. php:method:: unmark_temp($key) :param mixed $key: Key to be un-marked as tempdata, or an array of multiple keys :rtype: void diff --git a/user_guide_src/source/libraries/table.rst b/user_guide_src/source/libraries/table.rst index 91ae1ae8d..06dfe59de 100644 --- a/user_guide_src/source/libraries/table.rst +++ b/user_guide_src/source/libraries/table.rst @@ -275,11 +275,16 @@ Class Reference :returns: CI_Table instance (method chaining) :rtype: CI_Table - Lets you clear the table heading and row data. If you need to show multiple tables with different data you should to call this method - after each table has been generated to clear the previous table information. Example:: + Lets you clear the table heading, row data and caption. If + you need to show multiple tables with different data you + should to call this method after each table has been + generated to clear the previous table information. + + Example :: $this->load->library('table'); + $this->table->set_caption('Preferences'); $this->table->set_heading('Name', 'Color', 'Size'); $this->table->add_row('Fred', 'Blue', 'Small'); $this->table->add_row('Mary', 'Red', 'Large'); @@ -289,6 +294,7 @@ Class Reference $this->table->clear(); + $this->table->set_caption('Shipping'); $this->table->set_heading('Name', 'Day', 'Delivery'); $this->table->add_row('Fred', 'Wednesday', 'Express'); $this->table->add_row('Mary', 'Monday', 'Air'); diff --git a/user_guide_src/source/libraries/trackback.rst b/user_guide_src/source/libraries/trackback.rst index 4e0cb5541..dc4477e9f 100644 --- a/user_guide_src/source/libraries/trackback.rst +++ b/user_guide_src/source/libraries/trackback.rst @@ -239,7 +239,7 @@ Class Reference This method simply validates the incoming TB data, returning TRUE on success and FALSE on failure. If the data is valid it is set to the ``$this->data`` array so that it can be inserted into a database. - .. php:method:: send_error([$message = 'Incomplete information') + .. php:method:: send_error([$message = 'Incomplete information']) :param string $message: Error message :rtype: void @@ -262,7 +262,7 @@ Class Reference :returns: Data value or empty string if not found :rtype: string - Returns a single item from the reponse data array. + Returns a single item from the response data array. .. php:method:: process($url, $data) diff --git a/user_guide_src/source/libraries/xmlrpc.rst b/user_guide_src/source/libraries/xmlrpc.rst index 4d7ed66d5..2fe07c49d 100644 --- a/user_guide_src/source/libraries/xmlrpc.rst +++ b/user_guide_src/source/libraries/xmlrpc.rst @@ -490,6 +490,10 @@ Class Reference $this->xmlrpc->timeout(6); + This timeout period will be used both for an initial connection to + the remote server, as well as for getting a response from it. + Make sure you set the timeout before calling ``send_request()``. + .. php:method:: method($function) :param string $function: Method name @@ -575,4 +579,4 @@ Class Reference 'struct' ); - return $this->xmlrpc->send_response($response);
\ No newline at end of file + return $this->xmlrpc->send_response($response); diff --git a/user_guide_src/source/libraries/zip.rst b/user_guide_src/source/libraries/zip.rst index 816f49ca1..9704d5b1d 100644 --- a/user_guide_src/source/libraries/zip.rst +++ b/user_guide_src/source/libraries/zip.rst @@ -24,7 +24,7 @@ your controller using the $this->load->library function:: $this->load->library('zip'); -Once loaded, the Zip library object will be available using: +Once loaded, the Zip library object will be available using:: $this->zip diff --git a/user_guide_src/source/license.rst b/user_guide_src/source/license.rst index c1a32772f..c943c294a 100644 --- a/user_guide_src/source/license.rst +++ b/user_guide_src/source/license.rst @@ -2,7 +2,7 @@ The MIT License (MIT) ##################### -Copyright (c) 2014 - 2015, British Columbia Institute of Technology +Copyright (c) 2014 - 2017, British Columbia Institute of Technology Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/user_guide_src/source/overview/at_a_glance.rst b/user_guide_src/source/overview/at_a_glance.rst index ce195c211..742d7bd0e 100644 --- a/user_guide_src/source/overview/at_a_glance.rst +++ b/user_guide_src/source/overview/at_a_glance.rst @@ -54,8 +54,8 @@ approach:: example.com/news/article/345 -Note: By default the index.php file is included in the URL but it can be -removed using a simple .htaccess file. +.. note:: By default the *index.php* file is included in the URL but it can + be removed using a simple *.htaccess* file. CodeIgniter Packs a Punch ========================= diff --git a/user_guide_src/source/tutorial/create_news_items.rst b/user_guide_src/source/tutorial/create_news_items.rst index 5c5270472..cde52fde8 100644 --- a/user_guide_src/source/tutorial/create_news_items.rst +++ b/user_guide_src/source/tutorial/create_news_items.rst @@ -14,7 +14,7 @@ To input data into the database you need to create a form where you can input the information to be stored. This means you'll be needing a form with two fields, one for the title and one for the text. You'll derive the slug from our title in the model. Create the new view at -application/views/news/create.php. +*application/views/news/create.php*. :: @@ -35,7 +35,7 @@ application/views/news/create.php. </form> There are only two things here that probably look unfamiliar to you: the -form_open() function and the validation_errors() function. +``form_open()`` function and the ``validation_errors()`` function. The first function is provided by the :doc:`form helper <../helpers/form_helper>` and renders the form element and @@ -58,7 +58,7 @@ validation <../libraries/form_validation>` library to do this. $data['title'] = 'Create a news item'; $this->form_validation->set_rules('title', 'Title', 'required'); - $this->form_validation->set_rules('text', 'text', 'required'); + $this->form_validation->set_rules('text', 'Text', 'required'); if ($this->form_validation->run() === FALSE) { @@ -76,7 +76,7 @@ validation <../libraries/form_validation>` library to do this. The code above adds a lot of functionality. The first few lines load the form helper and the form validation library. After that, rules for the -form validation are set. The set\_rules() method takes three arguments; +form validation are set. The ``set_rules()`` method takes three arguments; the name of the input field, the name to be used in error messages, and the rule. In this case the title and text fields are required. @@ -88,7 +88,7 @@ Continuing down, you can see a condition that checks whether the form validation ran successfully. If it did not, the form is displayed, if it was submitted **and** passed all the rules, the model is called. After this, a view is loaded to display a success message. Create a view at -application/views/news/success.php and write a success message. +*application/views/news/success.php* and write a success message. Model ----- @@ -123,19 +123,19 @@ sure everything is in lowercase characters. This leaves you with a nice slug, perfect for creating URIs. Let's continue with preparing the record that is going to be inserted -later, inside the $data array. Each element corresponds with a column in +later, inside the ``$data`` array. Each element corresponds with a column in the database table created earlier. You might notice a new method here, -namely the post() method from the :doc:`input +namely the ``post()`` method from the :doc:`input library <../libraries/input>`. This method makes sure the data is sanitized, protecting you from nasty attacks from others. The input -library is loaded by default. At last, you insert our $data array into +library is loaded by default. At last, you insert our ``$data`` array into our database. Routing ------- Before you can start adding news items into your CodeIgniter application -you have to add an extra rule to config/routes.php file. Make sure your +you have to add an extra rule to *config/routes.php* file. Make sure your file contains the following. This makes sure CodeIgniter sees 'create' as a method instead of a news item's slug. diff --git a/user_guide_src/source/tutorial/static_pages.rst b/user_guide_src/source/tutorial/static_pages.rst index 66621471e..5daaa958f 100644 --- a/user_guide_src/source/tutorial/static_pages.rst +++ b/user_guide_src/source/tutorial/static_pages.rst @@ -24,7 +24,7 @@ you'll see URL patterns that match: As URL schemes become more complex, this may change. But for now, this is all we will need to know. -Create a file at application/controllers/Pages.php with the following +Create a file at *application/controllers/Pages.php* with the following code. :: @@ -97,7 +97,7 @@ page actually exists: public function view($page = 'home') { - if ( ! file_exists(APPPATH.'/views/pages/'.$page.'.php')) + if ( ! file_exists(APPPATH.'views/pages/'.$page.'.php')) { // Whoops, we don't have a page for that! show_404(); |