diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-03-13 11:10:12 +0100 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-03-13 11:10:12 +0100 |
commit | 60138567c58dd924e2240973e34f0e3903a7ef2b (patch) | |
tree | 533c1dd40f69a534c0b03e8c327011427e458bd8 /user_guide_src | |
parent | 7203d54604a372fd8dd0b30bd8d4cdbd0af738bc (diff) | |
parent | dbf4a5ad7b279b2833484e30f1168032cea9b7d3 (diff) |
Merge upstream branch
Diffstat (limited to 'user_guide_src')
-rw-r--r-- | user_guide_src/cilexer/cilexer/cilexer.py | 2 | ||||
-rw-r--r-- | user_guide_src/source/_themes/eldocs/static/asset/css/common.css | 2 | ||||
-rw-r--r-- | user_guide_src/source/changelog.rst | 13 | ||||
-rw-r--r-- | user_guide_src/source/general/requirements.rst | 6 | ||||
-rw-r--r-- | user_guide_src/source/helpers/form_helper.rst | 265 | ||||
-rw-r--r-- | user_guide_src/source/installation/upgrade_200.rst | 2 | ||||
-rw-r--r-- | user_guide_src/source/libraries/form_validation.rst | 10 | ||||
-rw-r--r-- | user_guide_src/source/libraries/table.rst | 2 |
8 files changed, 179 insertions, 123 deletions
diff --git a/user_guide_src/cilexer/cilexer/cilexer.py b/user_guide_src/cilexer/cilexer/cilexer.py index 713268e9c..1c41f2aa0 100644 --- a/user_guide_src/cilexer/cilexer/cilexer.py +++ b/user_guide_src/cilexer/cilexer/cilexer.py @@ -1,7 +1,7 @@ # CodeIgniter # http://codeigniter.com # -# An open source application development framework for PHP 5.1.6 or newer +# An open source application development framework for PHP 5.2.4 or newer # # NOTICE OF LICENSE # diff --git a/user_guide_src/source/_themes/eldocs/static/asset/css/common.css b/user_guide_src/source/_themes/eldocs/static/asset/css/common.css index b9e28aec0..66768bac6 100644 --- a/user_guide_src/source/_themes/eldocs/static/asset/css/common.css +++ b/user_guide_src/source/_themes/eldocs/static/asset/css/common.css @@ -2,7 +2,7 @@ CodeIgniter http://codeigniter.com -An open source application development framework for PHP 5.1.6 or newer +An open source application development framework for PHP 5.2.4 or newer NOTICE OF LICENSE diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 4c6fd38bc..f9e742264 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -19,6 +19,7 @@ Release Date: Not Released - General Changes + - PHP 5.1.6 is no longer supported. CodeIgniter now requires PHP 5.2.4. - Added an optional backtrace to php-error template. - Added Android to the list of user agents. - Added Windows 7 to the list of user platforms. @@ -42,6 +43,8 @@ Release Date: Not Released - Changed humanize to include a second param for the separator. - Refactored ``plural()`` and ``singular()`` to avoid double pluralization and support more words. - Added an optional third parameter to ``force_download()`` that enables/disables sending the actual file MIME type in the Content-Type header (disabled by default). + - Added a work-around in force_download() for a bug Android <= 2.1, where the filename extension needs to be in uppercase. + - form_dropdown() will now also take an array for unity with other form helpers. - Database @@ -65,12 +68,13 @@ Release Date: Not Released - Added a constructor to the DB_result class and moved all driver-specific properties and logic out of the base DB_driver class to allow better abstraction. - Removed limit() and order_by() support for UPDATE and DELETE queries in PostgreSQL driver. Postgres does not support those features. - Removed protect_identifiers() and renamed _protect_identifiers() to it instead - it was just an alias. + - MySQL and MySQLi drivers now require at least MySQL version 5.1. + - db_set_charset() now only requires one parameter (collation was only needed due to legacy support for MySQL versions prior to 5.1). - Libraries - Added max_filename_increment config setting for Upload library. - CI_Loader::_ci_autoloader() is now a protected method. - - Modified valid_ip() to use PHP's filter_var() when possible (>= PHP 5.2) in the :doc:`Form Validation library <libraries/form_validation>`. - Added custom filename to Email::attach() as $this->email->attach($filename, $disposition, $newname) - Cart library changes include: - It now auto-increments quantity's instead of just resetting it, this is the default behaviour of large e-commerce sites. @@ -85,10 +89,13 @@ Release Date: Not Released - Minor speed optimizations and method & property visibility declarations in the Calendar Library. - Removed SHA1 function in the :doc:`Encryption Library <libraries/encryption>`. - Added $config['csrf_regeneration'] to the CSRF protection in the :doc:`Security library <libraries/security>`, which makes token regeneration optional. + - Allowed for setting table class defaults in a config file. + - Form Validation library now allows setting of error delimiters in the config file via $config['error_prefix'] and $config['error_suffix']. - Added function error_array() to return all error messages as an array in the Form_validation class. - Added function set_data() to Form_validation library, which can be used in place of the default $_POST array. - Added function reset_validation() to form validation library, which resets internal validation variables in case of multiple validation routines. - Changed the Session library to select only one row when using database sessions. + - Added a Wincache driver to the `Caching Library <libraries/caching>`. - Core @@ -98,6 +105,7 @@ Release Date: Not Released - is_loaded() function from system/core/Commons.php now returns a reference. - $config['rewrite_short_tags'] now has no effect when using PHP 5.4 as *<?=* will always be available. - Added method() to CI_Input to retrieve $_SERVER['REQUEST_METHOD']. + - Modified valid_ip() to use PHP's filter_var() in the :doc:`Input Library <libraries/input>`. Bug fixes for 3.0 ------------------ @@ -136,7 +144,7 @@ Bug fixes for 3.0 - Fixed a bug in PDO's _version() method where it used to return the client version as opposed to the server one. - Fixed a bug in PDO's insert_id() method where it could've failed if it's used with Postgre versions prior to 8.1. - Fixed a bug in CUBRID's affected_rows() method where a connection resource was passed to cubrid_affected_rows() instead of a result. -- Fixed a bug (#638) - db_set_charset() ignored its arguments and always used the configured charset and collation instead. +- Fixed a bug (#638) - db_set_charset() ignored its arguments and always used the configured charset instead. - Fixed a bug (#413) - Oracle's error handling methods used to only return connection-related errors. - Fixed a bug (#804) - Profiler library was trying to handle objects as strings in some cases, resulting in warnings being issued by htmlspecialchars(). - Fixed a bug (#1101) - MySQL/MySQLi result method field_data() was implemented as if it was handling a DESCRIBE result instead of the actual result set. @@ -148,6 +156,7 @@ Bug fixes for 3.0 - Fixed a bug (#64) - Regular expression in DB_active_rec.php failed to handle queries containing SQL bracket delimiters in the join condition. - Fixed a bug in the :doc:`Session Library <libraries/sessions>` where a PHP E_NOTICE error was triggered by _unserialize() due to results from databases such as MSSQL and Oracle being space-padded on the right. - Fixed a bug (#501) - set_rules() to check if the request method is not 'POST' before aborting, instead of depending on count($_POST) in the :doc:`Form Validation Library <libraries/form_validation>`. +- Fixed a bug (#940) - csrf_verify() used to set the CSRF cookie while processing a POST request with no actual POST data, which resulted in validating a request that should be considered invalid. Version 2.1.1 ============= diff --git a/user_guide_src/source/general/requirements.rst b/user_guide_src/source/general/requirements.rst index 38623557d..05e87961a 100644 --- a/user_guide_src/source/general/requirements.rst +++ b/user_guide_src/source/general/requirements.rst @@ -2,7 +2,7 @@ Server Requirements ################### -- `PHP <http://www.php.net/>`_ version 5.1.6 or newer. +- `PHP <http://www.php.net/>`_ version 5.2.4 or newer. - A Database is required for most web application programming. Current - supported databases are MySQL (4.1+), MySQLi, MS SQL, Postgres, Oracle, - SQLite, ODBC and CUBRID.
\ No newline at end of file + supported databases are MySQL (5.1+), MySQLi, MS SQL, SQLSRV, Oracle, + PostgreSQL, SQLite, CUBRID, Interbase, ODBC and PDO. diff --git a/user_guide_src/source/helpers/form_helper.rst b/user_guide_src/source/helpers/form_helper.rst index 3794e0835..4cb0cfd38 100644 --- a/user_guide_src/source/helpers/form_helper.rst +++ b/user_guide_src/source/helpers/form_helper.rst @@ -45,7 +45,7 @@ parameter, like this :: - $attributes = array('class' => 'email', 'id' => 'myform'); + $attributes = array('class' => 'email', 'id' => 'myform'); echo form_open('email/send', $attributes); The above example would create a form similar to this @@ -61,15 +61,15 @@ Hidden fields can be added by passing an associative array to the third paramete :: - $hidden = array('username' => 'Joe', 'member_id' => '234'); + $hidden = array('username' => 'Joe', 'member_id' => '234'); echo form_open('email/send', '', $hidden); The above example would create a form similar to this :: - <form method="post" accept-charset="utf-8" action="http://example.com/index.php/email/send"> - <input type="hidden" name="username" value="Joe" /> + <form method="post" accept-charset="utf-8" action="http://example.com/index.php/email/send"> + <input type="hidden" name="username" value="Joe" /> <input type="hidden" name="member_id" value="234" /> form_open_multipart() @@ -87,28 +87,67 @@ name/value string to create one field :: - form_hidden('username', 'johndoe'); + form_hidden('username', 'johndoe'); // Would produce: <input type="hidden" name="username" value="johndoe" /> Or you can submit an associative array to create multiple fields :: - $data = array( - 'name' => 'John Doe', - 'email' => 'john@example.com', - 'url' => 'http://example.com' - ); - - echo form_hidden($data); - + $data = array( + 'name' => 'John Doe', + 'email' => 'john@example.com', + 'url' => 'http://example.com' + ); + + echo form_hidden($data); + /* - Would produce: - <input type="hidden" name="name" value="John Doe" /> - <input type="hidden" name="email" value="john@example.com" /> + Would produce: + <input type="hidden" name="name" value="John Doe" /> + <input type="hidden" name="email" value="john@example.com" /> <input type="hidden" name="url" value="http://example.com" /> */ +Or pass an associative array to the value field. + +:: + + $data = array( + 'name' => 'John Doe', + 'email' => 'john@example.com', + 'url' => 'http://example.com' + ); + + echo form_hidden('my_array', $data); + + /* + Would produce: + <input type="hidden" name="my_array[name]" value="John Doe" /> + <input type="hidden" name="my_array[email]" value="john@example.com" /> + <input type="hidden" name="my_array[url]" value="http://example.com" /> + */ + +If you want to create hidden input fields with extra attributes + +:: + + $data = array( + 'type' => 'hidden', + 'name' => 'email', + 'id' => 'hiddenemail', + 'value' => 'john@example.com', + 'class' => 'hiddenemail' + ); + + echo form_input($data); + + /* + Would produce: + + <input type="hidden" name="email" value="john@example.com" id="hiddenemail" class="hiddenemail" /> + */ + form_input() ============ @@ -124,20 +163,20 @@ form to contain :: - $data = array( - 'name' => 'username', - 'id' => 'username', - 'value' => 'johndoe', - 'maxlength' => '100', - 'size' => '50', - 'style' => 'width:50%', - ); - + $data = array( + 'name' => 'username', + 'id' => 'username', + 'value' => 'johndoe', + 'maxlength' => '100', + 'size' => '50', + 'style' => 'width:50%' + ); + echo form_input($data); - + /* Would produce: - + <input type="text" name="username" id="username" value="johndoe" maxlength="100" size="50" style="width:50%" /> */ @@ -146,7 +185,7 @@ Javascript, you can pass it as a string in the third parameter :: - $js = 'onClick="some_function()"'; + $js = 'onClick="some_function()"'; echo form_input('username', 'johndoe', $js); form_password() @@ -176,37 +215,37 @@ multiple select for you. Example :: - $options = array( - 'small' => 'Small Shirt', - 'med' => 'Medium Shirt', - 'large' => 'Large Shirt', - 'xlarge' => 'Extra Large Shirt', - ); - - $shirts_on_sale = array('small', 'large'); - echo form_dropdown('shirts', $options, 'large'); - + $options = array( + 'small' => 'Small Shirt', + 'med' => 'Medium Shirt', + 'large' => 'Large Shirt', + 'xlarge' => 'Extra Large Shirt', + ); + + $shirts_on_sale = array('small', 'large'); + echo form_dropdown('shirts', $options, 'large'); + /* - Would produce: - - <select name="shirts"> - <option value="small">Small Shirt</option> - <option value="med">Medium Shirt</option> - <option value="large" selected="selected">Large Shirt</option> - <option value="xlarge">Extra Large Shirt</option> + Would produce: + + <select name="shirts"> + <option value="small">Small Shirt</option> + <option value="med">Medium Shirt</option> + <option value="large" selected="selected">Large Shirt</option> + <option value="xlarge">Extra Large Shirt</option> </select> */ - + echo form_dropdown('shirts', $options, $shirts_on_sale); - + /* - Would produce: - - <select name="shirts" multiple="multiple"> - <option value="small" selected="selected">Small Shirt</option> - <option value="med">Medium Shirt</option> - <option value="large" selected="selected">Large Shirt</option> - <option value="xlarge">Extra Large Shirt</option> + Would produce: + + <select name="shirts" multiple="multiple"> + <option value="small" selected="selected">Small Shirt</option> + <option value="med">Medium Shirt</option> + <option value="large" selected="selected">Large Shirt</option> + <option value="xlarge">Extra Large Shirt</option> </select> */ @@ -216,7 +255,7 @@ parameter :: - $js = 'id="shirts" onChange="some_function();"'; + $js = 'id="shirts" onChange="some_function();"'; echo form_dropdown('shirts', $options, 'large', $js); If the array passed as $options is a multidimensional array, @@ -240,38 +279,38 @@ Lets you generate fieldset/legend fields. :: - echo form_fieldset('Address Information'); - echo "<p>fieldset content here</p>\n"; + echo form_fieldset('Address Information'); + echo "<p>fieldset content here</p>\n"; echo form_fieldset_close(); - + /* Produces: - <fieldset> - <legend>Address Information</legend> - <p>form content here</p> + <fieldset> + <legend>Address Information</legend> + <p>form content here</p> </fieldset> */ - + Similar to other functions, you can submit an associative array in the second parameter if you prefer to set additional attributes. :: $attributes = array( - 'id' => 'address_info', + 'id' => 'address_info', 'class' => 'address_info' - ); - - echo form_fieldset('Address Information', $attributes); - echo "<p>fieldset content here</p>\n"; - echo form_fieldset_close(); - + ); + + echo form_fieldset('Address Information', $attributes); + echo "<p>fieldset content here</p>\n"; + echo form_fieldset_close(); + /* - Produces: - - <fieldset id="address_info" class="address_info"> - <legend>Address Information</legend> - <p>form content here</p> + Produces: + + <fieldset id="address_info" class="address_info"> + <legend>Address Information</legend> + <p>form content here</p> </fieldset> */ @@ -284,8 +323,8 @@ the tag. For example :: - $string = "</div></div>"; - echo form_fieldset_close($string); + $string = "</div></div>"; + echo form_fieldset_close($string); // Would produce: </fieldset> </div></div> form_checkbox() @@ -295,7 +334,7 @@ Lets you generate a checkbox field. Simple example :: - echo form_checkbox('newsletter', 'accept', TRUE); + echo form_checkbox('newsletter', 'accept', TRUE); // Would produce: <input type="checkbox" name="newsletter" value="accept" checked="checked" /> The third parameter contains a boolean TRUE/FALSE to determine whether @@ -306,15 +345,15 @@ array of attributes to the function :: - $data = array( - 'name' => 'newsletter', - 'id' => 'newsletter', - 'value' => 'accept', - 'checked' => TRUE, - 'style' => 'margin:10px', - ); - - echo form_checkbox($data); + $data = array( + 'name' => 'newsletter', + 'id' => 'newsletter', + 'value' => 'accept', + 'checked' => TRUE, + 'style' => 'margin:10px', + ); + + echo form_checkbox($data); // Would produce: <input type="checkbox" name="newsletter" id="newsletter" value="accept" checked="checked" style="margin:10px" /> As with other functions, if you would like the tag to contain additional @@ -323,7 +362,7 @@ parameter :: - $js = 'onClick="some_function()"'; + $js = 'onClick="some_function()"'; echo form_checkbox('newsletter', 'accept', TRUE, $js) form_radio() @@ -339,7 +378,7 @@ Lets you generate a standard submit button. Simple example :: - echo form_submit('mysubmit', 'Submit Post!'); + echo form_submit('mysubmit', 'Submit Post!'); // Would produce: <input type="submit" name="mysubmit" value="Submit Post!" /> Similar to other functions, you can submit an associative array in the @@ -353,7 +392,7 @@ Lets you generate a <label>. Simple example :: - echo form_label('What is your Name', 'username'); + echo form_label('What is your Name', 'username'); // Would produce: <label for="username">What is your Name</label> Similar to other functions, you can submit an associative array in the @@ -361,12 +400,12 @@ third parameter if you prefer to set additional attributes. :: - $attributes = array( - 'class' => 'mycustomclass', + $attributes = array( + 'class' => 'mycustomclass', 'style' => 'color: #000;' - ); - - echo form_label('What is your Name', 'username', $attributes); + ); + + echo form_label('What is your Name', 'username', $attributes); // Would produce: <label for="username" class="mycustomclass" style="color: #000;">What is your Name</label> @@ -384,7 +423,7 @@ button name and content in the first and second parameter :: - echo form_button('name','content'); + echo form_button('name','content'); // Would produce <button name="name" type="button">Content</button> Or you can pass an associative array containing any data you wish your @@ -392,15 +431,15 @@ form to contain: :: - $data = array( - 'name' => 'button', - 'id' => 'button', - 'value' => 'true', - 'type' => 'reset', - 'content' => 'Reset' - ); - - echo form_button($data); + $data = array( + 'name' => 'button', + 'id' => 'button', + 'value' => 'true', + 'type' => 'reset', + 'content' => 'Reset' + ); + + echo form_button($data); // Would produce: <button name="button" id="button" value="true" type="reset">Reset</button> If you would like your form to contain some additional data, like @@ -408,7 +447,7 @@ JavaScript, you can pass it as a string in the third parameter: :: - $js = 'onClick="some_function()"'; + $js = 'onClick="some_function()"'; echo form_button('mybutton', 'Click Me', $js); form_close() @@ -420,8 +459,8 @@ the tag. For example :: - $string = "</div></div>"; - echo form_close($string); + $string = "</div></div>"; + echo form_close($string); // Would produce: </form> </div></div> form_prep() @@ -432,7 +471,7 @@ elements without breaking out of the form. Consider this example :: - $string = 'Here is a string containing "quoted" text.'; + $string = 'Here is a string containing "quoted" text.'; <input type="text" name="myform" value="$string" /> Since the above string contains a set of quotes it will cause the form @@ -475,9 +514,9 @@ Example :: <select name="myselect"> - <option value="one" <?php echo set_select('myselect', 'one', TRUE); ?> >One</option> - <option value="two" <?php echo set_select('myselect', 'two'); ?> >Two</option> - <option value="three" <?php echo set_select('myselect', 'three'); ?> >Three</option> + <option value="one" <?php echo set_select('myselect', 'one', TRUE); ?> >One</option> + <option value="two" <?php echo set_select('myselect', 'two'); ?> >Two</option> + <option value="three" <?php echo set_select('myselect', 'three'); ?> >Three</option> </select> set_checkbox() @@ -490,7 +529,7 @@ lets you set an item as the default (use boolean TRUE/FALSE). Example :: - <input type="checkbox" name="mycheck" value="1" <?php echo set_checkbox('mycheck', '1'); ?> /> + <input type="checkbox" name="mycheck" value="1" <?php echo set_checkbox('mycheck', '1'); ?> /> <input type="checkbox" name="mycheck" value="2" <?php echo set_checkbox('mycheck', '2'); ?> /> set_radio() @@ -501,6 +540,6 @@ This function is identical to the **set_checkbox()** function above. :: - <input type="radio" name="myradio" value="1" <?php echo set_radio('myradio', '1', TRUE); ?> /> + <input type="radio" name="myradio" value="1" <?php echo set_radio('myradio', '1', TRUE); ?> /> <input type="radio" name="myradio" value="2" <?php echo set_radio('myradio', '2'); ?> /> diff --git a/user_guide_src/source/installation/upgrade_200.rst b/user_guide_src/source/installation/upgrade_200.rst index 0bcbd5c99..b39f4fd23 100644 --- a/user_guide_src/source/installation/upgrade_200.rst +++ b/user_guide_src/source/installation/upgrade_200.rst @@ -102,7 +102,7 @@ Please refer to the :ref:`2.0.0 Change Log <2.0.0-changelog>` for full details, but here are some of the larger changes that are more likely to impact your code: -- CodeIgniter now requires PHP 5.1.6. +- CodeIgniter now requires PHP 5.2.4. - Scaffolding has been removed. - The CAPTCHA plugin in now a :doc:`helper </helpers/captcha_helper>`. - The JavaScript calendar plugin was removed. diff --git a/user_guide_src/source/libraries/form_validation.rst b/user_guide_src/source/libraries/form_validation.rst index 5aa64d032..5d7368ccb 100644 --- a/user_guide_src/source/libraries/form_validation.rst +++ b/user_guide_src/source/libraries/form_validation.rst @@ -523,7 +523,7 @@ Changing the Error Delimiters By default, the Form Validation class adds a paragraph tag (<p>) around each error message shown. You can either change these delimiters -globally or individually. +globally, individually, or change the defaults in a config file. #. **Changing delimiters Globally** To globally change the error delimiters, in your controller function, @@ -543,6 +543,12 @@ globally or individually. <?php echo validation_errors('<div class="error">', '</div>'); ?> +#. **Set delimiters in a config file** + You can add your error delimiters in application/config/form_validation.php as follows:: + + $config['error_prefix'] = '<div class="error_prefix">'; + $config['error_suffix'] = '</div>'; + Showing Errors Individually =========================== @@ -869,7 +875,7 @@ Rule Parameter Description underscores or dashes. **numeric** No Returns FALSE if the form element contains anything other than numeric characters. **integer** No Returns FALSE if the form element contains anything other than an integer. -**decimal** Yes Returns FALSE if the form element is not exactly the parameter value. +**decimal** No Returns FALSE if the form element contains anything other than a decimal number. **is_natural** No Returns FALSE if the form element contains anything other than a natural number: 0, 1, 2, 3, etc. **is_natural_no_zero** No Returns FALSE if the form element contains anything other than a natural diff --git a/user_guide_src/source/libraries/table.rst b/user_guide_src/source/libraries/table.rst index 9bc3f3423..6a808abc2 100644 --- a/user_guide_src/source/libraries/table.rst +++ b/user_guide_src/source/libraries/table.rst @@ -116,6 +116,8 @@ example, only the table opening tag is being changed:: $tmpl = array ( 'table_open' => '<table border="1" cellpadding="2" cellspacing="1" class="mytable">' ); $this->table->set_template($tmpl); + +You can also set defaults for these in a config file. ****************** Function Reference |