diff options
292 files changed, 4563 insertions, 4604 deletions
diff --git a/application/config/autoload.php b/application/config/autoload.php index b80af5e74..72f855c8b 100644 --- a/application/config/autoload.php +++ b/application/config/autoload.php @@ -1,40 +1,4 @@ <?php -/** - * CodeIgniter - * - * 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 - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @package CodeIgniter - * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License - * @link http://codeigniter.com - * @since Version 1.0.0 - * @filesource - */ defined('BASEPATH') OR exit('No direct script access allowed'); /* @@ -88,7 +52,7 @@ $autoload['packages'] = array(); | | Prototype: | -| $autoload['libraries'] = array('database', 'email', 'xmlrpc'); +| $autoload['libraries'] = array('database', 'email', 'session'); | | You can also supply an alternative library name to be assigned | in the controller: @@ -109,7 +73,7 @@ $autoload['libraries'] = array(); | | Prototype: | -| $autoload['drivers'] = array('session', 'cache'); +| $autoload['drivers'] = array('cache'); */ $autoload['drivers'] = array(); @@ -174,7 +138,3 @@ $autoload['language'] = array(); */ $autoload['model'] = array(); - - -/* End of file autoload.php */ -/* Location: ./application/config/autoload.php */
\ No newline at end of file diff --git a/application/config/config.php b/application/config/config.php index c45c66b1a..1e399590b 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -1,40 +1,4 @@ <?php -/** - * CodeIgniter - * - * 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 - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @package CodeIgniter - * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License - * @link http://codeigniter.com - * @since Version 1.0.0 - * @filesource - */ defined('BASEPATH') OR exit('No direct script access allowed'); /* @@ -336,11 +300,10 @@ $config['cache_query_string'] = FALSE; | Encryption Key |-------------------------------------------------------------------------- | -| If you use the Encryption class or the Session class you -| MUST set an encryption key. See the user guide for info. +| If you use the Encryption class, you must set an encryption key. +| See the user guide for more info. | | http://codeigniter.com/user_guide/libraries/encryption.html -| http://codeigniter.com/user_guide/libraries/sessions.html | */ $config['encryption_key'] = ''; @@ -350,45 +313,62 @@ $config['encryption_key'] = ''; | Session Variables |-------------------------------------------------------------------------- | -| 'sess_driver' = the driver to load: cookie (Classic), native (PHP sessions), -| or your custom driver name -| 'sess_valid_drivers' = additional valid drivers which may be loaded -| 'sess_cookie_name' = the name you want for the cookie, must contain only [0-9a-z_-] characters -| 'sess_expiration' = the number of SECONDS you want the session to last. -| by default sessions last 7200 seconds (two hours). Set to zero for no expiration. -| 'sess_expire_on_close' = Whether to cause the session to expire automatically -| when the browser window is closed -| 'sess_encrypt_cookie' = Whether to encrypt the cookie -| 'sess_use_database' = Whether to save the session data to a database -| 'sess_table_name' = The name of the session database table -| 'sess_match_ip' = Whether to match the user's IP address when reading the session data -| 'sess_match_useragent' = Whether to match the User Agent when reading the session data -| 'sess_time_to_update' = how many seconds between CI refreshing Session Information +| 'sess_driver' +| +| The storage driver to use: files, database, redis, memcached +| +| 'sess_cookie_name' +| +| The session cookie name, must contain only [0-9a-z_-] characters +| +| 'sess_expiration' +| +| The number of SECONDS you want the session to last. +| Setting to 0 (zero) means expire when the browser is closed. +| +| 'sess_save_path' +| +| The location to save sessions to, driver dependant. +| +| For the 'files' driver, it's a path to a writable directory. +| For the 'database' driver, it's a table name. +| Please read up the manual for the format with other session drivers. +| +| IMPORTANT: You are REQUIRED to set a valid save path! +| +| 'sess_match_ip' +| +| Whether to match the user's IP address when reading the session data. +| +| 'sess_time_to_update' +| +| How many seconds between CI regenerating the session ID. +| +| Other session cookie settings are shared with the rest of the application, +| except for 'cookie_prefix' and 'cookie_httponly', which are ignored here. | */ -$config['sess_driver'] = 'cookie'; -$config['sess_valid_drivers'] = array(); -$config['sess_cookie_name'] = 'ci_session'; -$config['sess_expiration'] = 7200; -$config['sess_expire_on_close'] = FALSE; -$config['sess_encrypt_cookie'] = FALSE; -$config['sess_use_database'] = FALSE; -$config['sess_table_name'] = 'ci_sessions'; -$config['sess_match_ip'] = FALSE; -$config['sess_match_useragent'] = TRUE; -$config['sess_time_to_update'] = 300; +$config['sess_driver'] = 'files'; +$config['sess_cookie_name'] = 'ci_session'; +$config['sess_expiration'] = 7200; +$config['sess_save_path'] = NULL; +$config['sess_match_ip'] = FALSE; +$config['sess_time_to_update'] = 300; /* |-------------------------------------------------------------------------- | Cookie Related Variables |-------------------------------------------------------------------------- | -| 'cookie_prefix' = Set a prefix if you need to avoid collisions -| 'cookie_domain' = Set to .your-domain.com for site-wide cookies -| 'cookie_path' = Typically will be a forward slash -| 'cookie_secure' = Cookies will only be set if a secure HTTPS connection exists. +| 'cookie_prefix' = Set a cookie name prefix if you need to avoid collisions +| 'cookie_domain' = Set to .your-domain.com for site-wide cookies +| 'cookie_path' = Typically will be a forward slash +| 'cookie_secure' = Cookie will only be set if a secure HTTPS connection exists. | 'cookie_httponly' = Cookie will only be accessible via HTTP(S) (no javascript) | +| Note: These settings (with the exception of 'cookie_prefix' and +| 'cookie_httponly') will also affect sessions. +| */ $config['cookie_prefix'] = ''; $config['cookie_domain'] = ''; @@ -507,7 +487,3 @@ $config['rewrite_short_tags'] = FALSE; | Array: array('10.0.1.200', '192.168.5.0/24') */ $config['proxy_ips'] = ''; - - -/* End of file config.php */ -/* Location: ./application/config/config.php */
\ No newline at end of file diff --git a/application/config/constants.php b/application/config/constants.php index 33a2f99c3..01096c74a 100644 --- a/application/config/constants.php +++ b/application/config/constants.php @@ -1,40 +1,4 @@ <?php -/** - * CodeIgniter - * - * 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 - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @package CodeIgniter - * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License - * @link http://codeigniter.com - * @since Version 1.0.0 - * @filesource - */ defined('BASEPATH') OR exit('No direct script access allowed'); /* @@ -120,6 +84,3 @@ define('EXIT_USER_INPUT', 7); // invalid user input define('EXIT_DATABASE', 8); // database error define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code - -/* End of file constants.php */ -/* Location: ./application/config/constants.php */
\ No newline at end of file diff --git a/application/config/database.php b/application/config/database.php index 8a4563e12..5ee2af438 100644 --- a/application/config/database.php +++ b/application/config/database.php @@ -1,40 +1,4 @@ <?php -/** - * CodeIgniter - * - * 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 - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @package CodeIgniter - * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License - * @link http://codeigniter.com - * @since Version 1.0.0 - * @filesource - */ defined('BASEPATH') OR exit('No direct script access allowed'); /* @@ -107,7 +71,7 @@ $db['default'] = array( 'database' => '', 'dbdriver' => 'mysqli', 'dbprefix' => '', - 'pconnect' => TRUE, + 'pconnect' => FALSE, 'db_debug' => TRUE, 'cache_on' => FALSE, 'cachedir' => '', @@ -121,6 +85,3 @@ $db['default'] = array( 'failover' => array(), 'save_queries' => TRUE ); - -/* End of file database.php */ -/* Location: ./application/config/database.php */
\ No newline at end of file diff --git a/application/config/doctypes.php b/application/config/doctypes.php index 32df5f1ea..59a7991e3 100644 --- a/application/config/doctypes.php +++ b/application/config/doctypes.php @@ -1,40 +1,4 @@ <?php -/** - * CodeIgniter - * - * 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 - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @package CodeIgniter - * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License - * @link http://codeigniter.com - * @since Version 1.0.0 - * @filesource - */ defined('BASEPATH') OR exit('No direct script access allowed'); $_doctypes = array( @@ -58,6 +22,3 @@ $_doctypes = array( '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-2' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">' ); - -/* End of file doctypes.php */ -/* Location: ./application/config/doctypes.php */
\ No newline at end of file diff --git a/application/config/foreign_chars.php b/application/config/foreign_chars.php index ea6afc527..d02dea958 100644 --- a/application/config/foreign_chars.php +++ b/application/config/foreign_chars.php @@ -1,40 +1,4 @@ <?php -/** - * CodeIgniter - * - * 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 - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @package CodeIgniter - * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License - * @link http://codeigniter.com - * @since Version 1.0.0 - * @filesource - */ defined('BASEPATH') OR exit('No direct script access allowed'); /* @@ -136,6 +100,3 @@ $foreign_characters = array( '/Я/' => 'Ya', '/я/' => 'ya' ); - -/* End of file foreign_chars.php */ -/* Location: ./application/config/foreign_chars.php */
\ No newline at end of file diff --git a/application/config/hooks.php b/application/config/hooks.php index d6b47e534..2eac5bbc9 100644 --- a/application/config/hooks.php +++ b/application/config/hooks.php @@ -1,40 +1,4 @@ <?php -/** - * CodeIgniter - * - * 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 - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @package CodeIgniter - * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License - * @link http://codeigniter.com - * @since Version 1.0.0 - * @filesource - */ defined('BASEPATH') OR exit('No direct script access allowed'); /* @@ -47,7 +11,3 @@ defined('BASEPATH') OR exit('No direct script access allowed'); | http://codeigniter.com/user_guide/general/hooks.html | */ - - -/* End of file hooks.php */ -/* Location: ./application/config/hooks.php */
\ No newline at end of file diff --git a/application/config/memcached.php b/application/config/memcached.php index b35730d34..55949a66c 100644 --- a/application/config/memcached.php +++ b/application/config/memcached.php @@ -1,40 +1,4 @@ <?php -/** - * CodeIgniter - * - * 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 - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @package CodeIgniter - * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License - * @link http://codeigniter.com - * @since Version 2.0.0 - * @filesource - */ defined('BASEPATH') OR exit('No direct script access allowed'); /* @@ -53,6 +17,3 @@ $config = array( 'weight' => '1', ), ); - -/* End of file memcached.php */ -/* Location: ./application/config/memcached.php */
\ No newline at end of file diff --git a/application/config/migration.php b/application/config/migration.php index 6eb55c35b..083bf287c 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -1,40 +1,4 @@ <?php -/** - * CodeIgniter - * - * 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 - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @package CodeIgniter - * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License - * @link http://codeigniter.com - * @since Version 1.0.0 - * @filesource - */ defined('BASEPATH') OR exit('No direct script access allowed'); /* @@ -118,6 +82,3 @@ $config['migration_version'] = 0; | */ $config['migration_path'] = APPPATH.'migrations/'; - -/* End of file migration.php */ -/* Location: ./application/config/migration.php */
\ No newline at end of file diff --git a/application/config/mimes.php b/application/config/mimes.php index 09a2f8c66..8eff4d2d5 100644 --- a/application/config/mimes.php +++ b/application/config/mimes.php @@ -1,40 +1,4 @@ <?php -/** - * CodeIgniter - * - * 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 - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @package CodeIgniter - * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License - * @link http://codeigniter.com - * @since Version 1.0.0 - * @filesource - */ defined('BASEPATH') OR exit('No direct script access allowed'); /* @@ -190,6 +154,3 @@ return array( 'svg' => array('image/svg+xml', 'application/xml', 'text/xml'), 'vcf' => 'text/x-vcard' ); - -/* End of file mimes.php */ -/* Location: ./application/config/mimes.php */
\ No newline at end of file diff --git a/application/config/profiler.php b/application/config/profiler.php index edba30cad..b30204e16 100644 --- a/application/config/profiler.php +++ b/application/config/profiler.php @@ -1,40 +1,4 @@ <?php -/** - * CodeIgniter - * - * 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 - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @package CodeIgniter - * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License - * @link http://codeigniter.com - * @since Version 1.0.0 - * @filesource - */ defined('BASEPATH') OR exit('No direct script access allowed'); /* @@ -48,7 +12,3 @@ defined('BASEPATH') OR exit('No direct script access allowed'); | http://codeigniter.com/user_guide/general/profiling.html | */ - - -/* End of file profiler.php */ -/* Location: ./application/config/profiler.php */
\ No newline at end of file diff --git a/application/config/routes.php b/application/config/routes.php index b5fd8a0d2..a98c6d122 100644 --- a/application/config/routes.php +++ b/application/config/routes.php @@ -1,40 +1,4 @@ <?php -/** - * CodeIgniter - * - * 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 - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @package CodeIgniter - * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License - * @link http://codeigniter.com - * @since Version 1.0.0 - * @filesource - */ defined('BASEPATH') OR exit('No direct script access allowed'); /* @@ -88,6 +52,3 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $route['default_controller'] = 'welcome'; $route['404_override'] = ''; $route['translate_uri_dashes'] = FALSE; - -/* End of file routes.php */ -/* Location: ./application/config/routes.php */
\ No newline at end of file diff --git a/application/config/smileys.php b/application/config/smileys.php index 3a57f26f0..1428d68bc 100644 --- a/application/config/smileys.php +++ b/application/config/smileys.php @@ -1,40 +1,4 @@ <?php -/** - * CodeIgniter - * - * 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 - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @package CodeIgniter - * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License - * @link http://codeigniter.com - * @since Version 1.0.0 - * @filesource - */ defined('BASEPATH') OR exit('No direct script access allowed'); /* @@ -99,6 +63,3 @@ $smileys = array( ':question:' => array('question.gif', '19', '19', 'question') ); - -/* End of file smileys.php */ -/* Location: ./application/config/smileys.php */
\ No newline at end of file diff --git a/application/config/user_agents.php b/application/config/user_agents.php index 5199f0488..68d785365 100644 --- a/application/config/user_agents.php +++ b/application/config/user_agents.php @@ -1,40 +1,4 @@ <?php -/** - * CodeIgniter - * - * 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 - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @package CodeIgniter - * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License - * @link http://codeigniter.com - * @since Version 1.0.0 - * @filesource - */ defined('BASEPATH') OR exit('No direct script access allowed'); /* @@ -244,6 +208,3 @@ $robots = array( 'feedfetcher-google' => 'Feedfetcher Google', 'curious george' => 'Curious George' ); - -/* End of file user_agents.php */ -/* Location: ./application/config/user_agents.php */
\ No newline at end of file diff --git a/application/controllers/Welcome.php b/application/controllers/Welcome.php index dfcadc515..34535ef05 100644 --- a/application/controllers/Welcome.php +++ b/application/controllers/Welcome.php @@ -1,40 +1,4 @@ <?php -/** - * CodeIgniter - * - * 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 - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @package CodeIgniter - * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License - * @link http://codeigniter.com - * @since Version 1.0.0 - * @filesource - */ defined('BASEPATH') OR exit('No direct script access allowed'); class Welcome extends CI_Controller { @@ -59,6 +23,3 @@ class Welcome extends CI_Controller { $this->load->view('welcome_message'); } } - -/* End of file welcome.php */ -/* Location: ./application/controllers/Welcome.php */
\ No newline at end of file diff --git a/application/views/errors/cli/error_404.php b/application/views/errors/cli/error_404.php index 4eadc40df..6984b61e9 100644 --- a/application/views/errors/cli/error_404.php +++ b/application/views/errors/cli/error_404.php @@ -1,40 +1,4 @@ <?php -/** - * CodeIgniter - * - * 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 - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @package CodeIgniter - * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License - * @link http://codeigniter.com - * @since Version 3.0.0 - * @filesource - */ defined('BASEPATH') OR exit('No direct script access allowed'); echo "\nERROR: ", diff --git a/application/views/errors/cli/error_db.php b/application/views/errors/cli/error_db.php index 469a4649b..2ff43ffc7 100644 --- a/application/views/errors/cli/error_db.php +++ b/application/views/errors/cli/error_db.php @@ -1,40 +1,4 @@ <?php -/** - * CodeIgniter - * - * 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 - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @package CodeIgniter - * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License - * @link http://codeigniter.com - * @since Version 3.0.0 - * @filesource - */ defined('BASEPATH') OR exit('No direct script access allowed'); echo "\nDatabase error: ", diff --git a/application/views/errors/cli/error_exception.php b/application/views/errors/cli/error_exception.php index d4b16d1d1..75d7f0fad 100644 --- a/application/views/errors/cli/error_exception.php +++ b/application/views/errors/cli/error_exception.php @@ -1,40 +1,4 @@ <?php -/** - * CodeIgniter - * - * 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 - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @package CodeIgniter - * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License - * @link http://codeigniter.com - * @since Version 3.0.0 - * @filesource - */ defined('BASEPATH') OR exit('No direct script access allowed'); ?> diff --git a/application/views/errors/cli/error_general.php b/application/views/errors/cli/error_general.php index 07d785cfc..6984b61e9 100644 --- a/application/views/errors/cli/error_general.php +++ b/application/views/errors/cli/error_general.php @@ -1,40 +1,4 @@ <?php -/** - * CodeIgniter - * - * 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 - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @package CodeIgniter - * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License - * @link http://codeigniter.com - * @since Version 1.0.0 - * @filesource - */ defined('BASEPATH') OR exit('No direct script access allowed'); echo "\nERROR: ", diff --git a/application/views/errors/cli/error_php.php b/application/views/errors/cli/error_php.php index 78aaa9087..fec91e54f 100644 --- a/application/views/errors/cli/error_php.php +++ b/application/views/errors/cli/error_php.php @@ -1,40 +1,4 @@ <?php -/** - * CodeIgniter - * - * 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 - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @package CodeIgniter - * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License - * @link http://codeigniter.com - * @since Version 3.0.0 - * @filesource - */ defined('BASEPATH') OR exit('No direct script access allowed'); ?> diff --git a/application/views/errors/html/error_404.php b/application/views/errors/html/error_404.php index ae35696a1..756ea9d62 100644 --- a/application/views/errors/html/error_404.php +++ b/application/views/errors/html/error_404.php @@ -1,40 +1,4 @@ <?php -/** - * CodeIgniter - * - * 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 - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @package CodeIgniter - * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License - * @link http://codeigniter.com - * @since Version 1.0.0 - * @filesource - */ defined('BASEPATH') OR exit('No direct script access allowed'); ?><!DOCTYPE html> <html lang="en"> @@ -45,7 +9,6 @@ defined('BASEPATH') OR exit('No direct script access allowed'); ::selection { background-color: #E13300; color: white; } ::-moz-selection { background-color: #E13300; color: white; } -::-webkit-selection { background-color: #E13300; color: white; } body { background-color: #fff; diff --git a/application/views/errors/html/error_db.php b/application/views/errors/html/error_db.php index 5bbc38579..f5a43f638 100644 --- a/application/views/errors/html/error_db.php +++ b/application/views/errors/html/error_db.php @@ -1,40 +1,4 @@ <?php -/** - * CodeIgniter - * - * 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 - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @package CodeIgniter - * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License - * @link http://codeigniter.com - * @since Version 1.0.0 - * @filesource - */ defined('BASEPATH') OR exit('No direct script access allowed'); ?><!DOCTYPE html> <html lang="en"> @@ -45,7 +9,6 @@ defined('BASEPATH') OR exit('No direct script access allowed'); ::selection { background-color: #E13300; color: white; } ::-moz-selection { background-color: #E13300; color: white; } -::-webkit-selection { background-color: #E13300; color: white; } body { background-color: #fff; diff --git a/application/views/errors/html/error_exception.php b/application/views/errors/html/error_exception.php index 85a1c55bb..87848866a 100644 --- a/application/views/errors/html/error_exception.php +++ b/application/views/errors/html/error_exception.php @@ -1,40 +1,4 @@ <?php -/** - * CodeIgniter - * - * 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 - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @package CodeIgniter - * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License - * @link http://codeigniter.com - * @since Version 1.0.0 - * @filesource - */ defined('BASEPATH') OR exit('No direct script access allowed'); ?> diff --git a/application/views/errors/html/error_general.php b/application/views/errors/html/error_general.php index 64ef4c9e5..fc3b2ebad 100644 --- a/application/views/errors/html/error_general.php +++ b/application/views/errors/html/error_general.php @@ -1,40 +1,4 @@ <?php -/** - * CodeIgniter - * - * 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 - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @package CodeIgniter - * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License - * @link http://codeigniter.com - * @since Version 1.0.0 - * @filesource - */ defined('BASEPATH') OR exit('No direct script access allowed'); ?><!DOCTYPE html> <html lang="en"> @@ -45,7 +9,6 @@ defined('BASEPATH') OR exit('No direct script access allowed'); ::selection { background-color: #E13300; color: white; } ::-moz-selection { background-color: #E13300; color: white; } -::-webkit-selection { background-color: #E13300; color: white; } body { background-color: #fff; diff --git a/application/views/errors/html/error_php.php b/application/views/errors/html/error_php.php index edc9a98f8..b146f9c5b 100644 --- a/application/views/errors/html/error_php.php +++ b/application/views/errors/html/error_php.php @@ -1,40 +1,4 @@ <?php -/** - * CodeIgniter - * - * 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 - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @package CodeIgniter - * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License - * @link http://codeigniter.com - * @since Version 1.0.0 - * @filesource - */ defined('BASEPATH') OR exit('No direct script access allowed'); ?> diff --git a/application/views/welcome_message.php b/application/views/welcome_message.php index 1b036c06c..f5115630b 100644 --- a/application/views/welcome_message.php +++ b/application/views/welcome_message.php @@ -1,40 +1,4 @@ <?php -/** - * CodeIgniter - * - * 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 - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @package CodeIgniter - * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License - * @link http://codeigniter.com - * @since Version 1.0.0 - * @filesource - */ defined('BASEPATH') OR exit('No direct script access allowed'); ?><!DOCTYPE html> <html lang="en"> @@ -46,7 +10,6 @@ defined('BASEPATH') OR exit('No direct script access allowed'); ::selection { background-color: #E13300; color: white; } ::-moz-selection { background-color: #E13300; color: white; } - ::-webkit-selection { background-color: #E13300; color: white; } body { background-color: #fff; diff --git a/contributing.md b/contributing.md index 5296daa88..5a25698bf 100644 --- a/contributing.md +++ b/contributing.md @@ -29,10 +29,10 @@ If you change anything that requires a change to documentation then you will nee ### Compatibility -CodeIgniter recommends PHP 5.4 or newer to be used, but is is 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.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. ### Branching @@ -290,6 +290,3 @@ switch (ENVIRONMENT) * And away we go... */ require_once BASEPATH.'core/CodeIgniter.php'; - -/* End of file index.php */ -/* Location: ./index.php */
\ No newline at end of file diff --git a/readme.rst b/readme.rst index c32961448..dd59fd8c1 100644 --- a/readme.rst +++ b/readme.rst @@ -29,7 +29,11 @@ guide change log <https://github.com/bcit-ci/CodeIgniter/blob/develop/user_guide Server Requirements ******************* -- PHP version 5.2.4 or newer. +PHP version 5.4 or newer is recommended. + +It should work on 5.2.4 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. ************ Installation diff --git a/system/core/Benchmark.php b/system/core/Benchmark.php index 86f3ae1aa..e420f62a1 100644 --- a/system/core/Benchmark.php +++ b/system/core/Benchmark.php @@ -131,6 +131,3 @@ class CI_Benchmark { } } - -/* End of file Benchmark.php */ -/* Location: ./system/core/Benchmark.php */
\ No newline at end of file diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php index 59fdba0e5..d830c1829 100644 --- a/system/core/CodeIgniter.php +++ b/system/core/CodeIgniter.php @@ -159,6 +159,29 @@ if ( ! is_php('5.4')) /* * ------------------------------------------------------ + * Should we use a Composer autoloader? + * ------------------------------------------------------ + */ + if ($composer_autoload = config_item('composer_autoload')) + { + if ($composer_autoload === TRUE) + { + file_exists(APPPATH.'vendor/autoload.php') + ? require_once(APPPATH.'vendor/autoload.php') + : log_message('error', '$config[\'composer_autoload\'] is set to TRUE but '.APPPATH.'vendor/autoload.php was not found.'); + } + elseif (file_exists($composer_autoload)) + { + require_once($composer_autoload); + } + else + { + log_message('error', 'Could not find the specified $config[\'composer_autoload\'] path: '.$composer_autoload); + } + } + +/* + * ------------------------------------------------------ * Start the timer... tick tock tick tock... * ------------------------------------------------------ */ @@ -461,23 +484,6 @@ if ( ! is_php('5.4')) /* * ------------------------------------------------------ - * Should we use a Composer autoloader? - * ------------------------------------------------------ - */ - if ($composer_autoload = config_item('composer_autoload')) - { - if ($composer_autoload === TRUE && file_exists(APPPATH.'vendor/autoload.php')) - { - require_once(APPPATH.'vendor/autoload.php'); - } - elseif (file_exists($composer_autoload)) - { - require_once($composer_autoload); - } - } - -/* - * ------------------------------------------------------ * Is there a "pre_controller" hook? * ------------------------------------------------------ */ @@ -533,6 +539,3 @@ if ( ! is_php('5.4')) * ------------------------------------------------------ */ $EXT->call_hook('post_system'); - -/* End of file CodeIgniter.php */ -/* Location: ./system/core/CodeIgniter.php */
\ No newline at end of file diff --git a/system/core/Common.php b/system/core/Common.php index b5a36636e..c3198b31f 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -54,7 +54,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); if ( ! function_exists('is_php')) { /** - * Determines if the current version of PHP is greater then the supplied value + * Determines if the current version of PHP is equal to or greater than the supplied value * * @param string * @return bool TRUE if the current version is $version or higher @@ -555,15 +555,14 @@ if ( ! function_exists('set_status_header')) } } - $server_protocol = isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : FALSE; - if (strpos(PHP_SAPI, 'cgi') === 0) { header('Status: '.$code.' '.$text, TRUE); } else { - header(($server_protocol ? $server_protocol : 'HTTP/1.1').' '.$code.' '.$text, TRUE, $code); + $server_protocol = isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1'; + header($server_protocol.' '.$code.' '.$text, TRUE, $code); } } } @@ -615,7 +614,7 @@ if ( ! function_exists('_error_handler')) $_error->log_exception($severity, $message, $filepath, $line); // Should we display the error? - if (ini_get('display_errors')) + if (str_ireplace(array('off', 'none', 'no', 'false', 'null'), '', ini_get('display_errors'))) { $_error->show_php_error($severity, $message, $filepath, $line); } @@ -650,7 +649,7 @@ if ( ! function_exists('_exception_handler')) $_error->log_exception('error', 'Exception: '.$exception->getMessage(), $exception->getFile(), $exception->getLine()); // Should we display the error? - if (ini_get('display_errors')) + if (str_ireplace(array('off', 'none', 'no', 'false', 'null'), '', ini_get('display_errors'))) { $_error->show_exception($exception); } @@ -842,6 +841,3 @@ if ( ! function_exists('function_usable')) return FALSE; } } - -/* End of file Common.php */ -/* Location: ./system/core/Common.php */
\ No newline at end of file diff --git a/system/core/Config.php b/system/core/Config.php index d5ce91f48..a191a7727 100644 --- a/system/core/Config.php +++ b/system/core/Config.php @@ -72,6 +72,8 @@ class CI_Config { */ public $_config_paths = array(APPPATH); + // -------------------------------------------------------------------- + /** * Class constructor * @@ -82,7 +84,6 @@ class CI_Config { public function __construct() { $this->config =& get_config(); - log_message('debug', 'Config Class Initialized'); // Set the base_url automatically if none was provided if (empty($this->config['base_url'])) @@ -101,6 +102,8 @@ class CI_Config { $this->set_item('base_url', $base_url); } + + log_message('info', 'Config Class Initialized'); } // -------------------------------------------------------------------- @@ -356,6 +359,3 @@ class CI_Config { } } - -/* End of file Config.php */ -/* Location: ./system/core/Config.php */
\ No newline at end of file diff --git a/system/core/Controller.php b/system/core/Controller.php index 06005b058..a0d97baa2 100644 --- a/system/core/Controller.php +++ b/system/core/Controller.php @@ -77,7 +77,7 @@ class CI_Controller { $this->load =& load_class('Loader', 'core'); $this->load->initialize(); - log_message('debug', 'Controller Class Initialized'); + log_message('info', 'Controller Class Initialized'); } // -------------------------------------------------------------------- @@ -94,6 +94,3 @@ class CI_Controller { } } - -/* End of file Controller.php */ -/* Location: ./system/core/Controller.php */
\ No newline at end of file diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index 550e03b78..fc25f57e6 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -273,6 +273,3 @@ class CI_Exceptions { } } - -/* End of file Exceptions.php */ -/* Location: ./system/core/Exceptions.php */
\ No newline at end of file diff --git a/system/core/Hooks.php b/system/core/Hooks.php index 429d6bceb..08479b133 100644 --- a/system/core/Hooks.php +++ b/system/core/Hooks.php @@ -88,8 +88,7 @@ class CI_Hooks { public function __construct() { $CFG =& load_class('Config', 'core'); - - log_message('debug', 'Hooks Class Initialized'); + log_message('info', 'Hooks Class Initialized'); // If hooks are not enabled in the config file // there is nothing else to do @@ -265,6 +264,3 @@ class CI_Hooks { } } - -/* End of file Hooks.php */ -/* Location: ./system/core/Hooks.php */
\ No newline at end of file diff --git a/system/core/Input.php b/system/core/Input.php index 358417c79..72425c1c1 100644 --- a/system/core/Input.php +++ b/system/core/Input.php @@ -123,8 +123,6 @@ class CI_Input { */ public function __construct() { - log_message('debug', 'Input Class Initialized'); - $this->_allow_get_array = (config_item('allow_get_array') === TRUE); $this->_enable_xss = (config_item('global_xss_filtering') === TRUE); $this->_enable_csrf = (config_item('csrf_protection') === TRUE); @@ -140,6 +138,8 @@ class CI_Input { // Sanitize global arrays $this->_sanitize_globals(); + + log_message('info', 'Input Class Initialized'); } // -------------------------------------------------------------------- @@ -847,6 +847,3 @@ class CI_Input { } } - -/* End of file Input.php */ -/* Location: ./system/core/Input.php */
\ No newline at end of file diff --git a/system/core/Lang.php b/system/core/Lang.php index fe1dc1a9d..deb955414 100644 --- a/system/core/Lang.php +++ b/system/core/Lang.php @@ -69,7 +69,7 @@ class CI_Lang { */ public function __construct() { - log_message('debug', 'Language Class Initialized'); + log_message('info', 'Language Class Initialized'); } // -------------------------------------------------------------------- @@ -172,7 +172,7 @@ class CI_Lang { $this->is_loaded[$langfile] = $idiom; $this->language = array_merge($this->language, $lang); - log_message('debug', 'Language file loaded: language/'.$idiom.'/'.$langfile); + log_message('info', 'Language file loaded: language/'.$idiom.'/'.$langfile); return TRUE; } @@ -201,6 +201,3 @@ class CI_Lang { } } - -/* End of file Lang.php */ -/* Location: ./system/core/Lang.php */
\ No newline at end of file diff --git a/system/core/Loader.php b/system/core/Loader.php index d930dbfa8..ff7838640 100644 --- a/system/core/Loader.php +++ b/system/core/Loader.php @@ -138,7 +138,7 @@ class CI_Loader { $this->_ci_ob_level = ob_get_level(); $this->_ci_classes =& is_loaded(); - log_message('debug', 'Loader Class Initialized'); + log_message('info', 'Loader Class Initialized'); } // -------------------------------------------------------------------- @@ -215,7 +215,7 @@ class CI_Loader { $params = NULL; } - $this->_ci_load_class($library, $params, $object_name); + $this->_ci_load_library($library, $params, $object_name); return $this; } @@ -577,7 +577,7 @@ class CI_Loader { include_once($base_helper); $this->_ci_helpers[$helper] = TRUE; - log_message('debug', 'Helper loaded: '.$helper); + log_message('info', 'Helper loaded: '.$helper); continue; } @@ -589,7 +589,7 @@ class CI_Loader { include_once($path.'helpers/'.$helper.'.php'); $this->_ci_helpers[$helper] = TRUE; - log_message('debug', 'Helper loaded: '.$helper); + log_message('info', 'Helper loaded: '.$helper); break; } } @@ -914,7 +914,7 @@ class CI_Loader { include($_ci_path); // include() vs include_once() allows for multiple views with the same name } - log_message('debug', 'File loaded: '.$_ci_path); + log_message('info', 'File loaded: '.$_ci_path); // Return the file data if requested if ($_ci_return === TRUE) @@ -949,17 +949,17 @@ class CI_Loader { // -------------------------------------------------------------------- /** - * Internal CI Class Loader + * Internal CI Library Loader * * @used-by CI_Loader::library() - * @uses CI_Loader::_ci_init_class() + * @uses CI_Loader::_ci_init_library() * * @param string $class Class name to load * @param mixed $params Optional parameters to pass to the class constructor * @param string $object_name Optional object name to assign to * @return void */ - protected function _ci_load_class($class, $params = NULL, $object_name = NULL) + protected function _ci_load_library($class, $params = NULL, $object_name = NULL) { // Get the class name, and while we're at it trim any slashes. // The directory path can be included as part of the class name, @@ -982,47 +982,22 @@ class CI_Loader { } $class = ucfirst($class); - $subclass = APPPATH.'libraries/'.$subdir.config_item('subclass_prefix').$class.'.php'; - // Is this a class extension request? - if (file_exists($subclass)) + // Is this a stock library? There are a few special conditions if so ... + if (file_exists(BASEPATH.'libraries/'.$subdir.$class.'.php')) { - $baseclass = BASEPATH.'libraries/'.$subdir.$class.'.php'; - - if ( ! file_exists($baseclass)) - { - log_message('error', 'Unable to load the requested class: '.$class); - show_error('Unable to load the requested class: '.$class); - } - - // Safety: Was the class already loaded by a previous call? - if (class_exists(config_item('subclass_prefix').$class, FALSE)) - { - // Before we deem this to be a duplicate request, let's see - // if a custom object name is being supplied. If so, we'll - // return a new instance of the object - if ($object_name !== NULL) - { - $CI =& get_instance(); - if ( ! isset($CI->$object_name)) - { - return $this->_ci_init_class($class, config_item('subclass_prefix'), $params, $object_name); - } - } - - log_message('debug', $class.' class already loaded. Second attempt ignored.'); - return; - } - - include_once($baseclass); - include_once($subclass); - - return $this->_ci_init_class($class, config_item('subclass_prefix'), $params, $object_name); + return $this->_ci_load_stock_library($class, $subdir, $params, $object_name); } // Let's search for the requested library file and load it. foreach ($this->_ci_library_paths as $path) { + // BASEPATH has already been checked for + if ($path === BASEPATH) + { + continue; + } + $filepath = $path.'libraries/'.$subdir.$class.'.php'; // Safety: Was the class already loaded by a previous call? @@ -1036,7 +1011,7 @@ class CI_Loader { $CI =& get_instance(); if ( ! isset($CI->$object_name)) { - return $this->_ci_init_class($class, '', $params, $object_name); + return $this->_ci_init_library($class, '', $params, $object_name); } } @@ -1050,13 +1025,13 @@ class CI_Loader { } include_once($filepath); - return $this->_ci_init_class($class, '', $params, $object_name); + return $this->_ci_init_library($class, '', $params, $object_name); } // One last attempt. Maybe the library is in a subdirectory, but it wasn't specified? if ($subdir === '') { - return $this->_ci_load_class($class.'/'.$class, $params, $object_name); + return $this->_ci_load_library($class.'/'.$class, $params, $object_name); } // If we got this far we were unable to find the requested class. @@ -1067,9 +1042,84 @@ class CI_Loader { // -------------------------------------------------------------------- /** - * Internal CI Class Instantiator + * Internal CI Stock Library Loader + * + * @used-by CI_Loader::_ci_load_library() + * @uses CI_Loader::_ci_init_library() + * + * @param string $library Library name to load + * @param string $file_path Path to the library filename, relative to libraries/ + * @param mixed $params Optional parameters to pass to the class constructor + * @param string $object_name Optional object name to assign to + * @return void + */ + protected function _ci_load_stock_library($library_name, $file_path, $params, $object_name) + { + $prefix = 'CI_'; + + if (class_exists($prefix.$library_name, FALSE)) + { + if (class_exists(config_item('subclass_prefix').$library_name, FALSE)) + { + $prefix = config_item('subclass_prefix'); + } + + // Before we deem this to be a duplicate request, let's see + // if a custom object name is being supplied. If so, we'll + // return a new instance of the object + if ($object_name !== NULL) + { + $CI =& get_instance(); + if ( ! isset($CI->$object_name)) + { + return $this->_ci_init_library($library_name, $prefix, $params, $object_name); + } + } + + log_message('debug', $library_name.' class already loaded. Second attempt ignored.'); + return; + } + elseif (file_exists(APPPATH.'libraries/'.$file_path.$library_name.'.php')) + { + // Override + include_once(APPPATH.'libraries/'.$file_path.$library_name.'.php'); + if (class_exists($prefix.$library_name, FALSE)) + { + return $this->_ci_init_library($library_name, $prefix, $params, $object_name); + } + else + { + log_message('debug', APPPATH.'libraries/'.$file_path.$library_name.'.php exists, but does not declare '.$prefix.$library_name); + } + } + + include_once(BASEPATH.'libraries/'.$file_path.$library_name.'.php'); + + // Check for extensions + $subclass = config_item('subclass_prefix').$library_name; + if (file_exists(APPPATH.'libraries/'.$file_path.$subclass.'.php')) + { + include_once(APPPATH.'libraries/'.$file_path.$subclass.'.php'); + if (class_exists($subclass, FALSE)) + { + $prefix = config_item('subclass_prefix'); + } + else + { + log_message('debug', APPPATH.'libraries/'.$file_path.$subclass.'.php exists, but does not declare '.$subclass); + } + } + + return $this->_ci_init_library($library_name, $prefix, $params, $object_name); + } + + // -------------------------------------------------------------------- + + /** + * Internal CI Library Instantiator * - * @used-by CI_Loader::_ci_load_class() + * @used-by CI_Loader::_ci_load_stock_library() + * @used-by CI_Loader::_ci_load_library() * * @param string $class Class name * @param string $prefix Class name prefix @@ -1080,7 +1130,7 @@ class CI_Loader { * @param string $object_name Optional object name to assign to * @return void */ - protected function _ci_init_class($class, $prefix = '', $config = FALSE, $object_name = NULL) + protected function _ci_init_library($class, $prefix, $config = FALSE, $object_name = NULL) { // Is there an associated config file for this class? Note: these should always be lowercase if ($config === NULL) @@ -1128,31 +1178,13 @@ class CI_Loader { } } - if ($prefix === '') - { - if (class_exists('CI_'.$class, FALSE)) - { - $name = 'CI_'.$class; - } - elseif (class_exists(config_item('subclass_prefix').$class, FALSE)) - { - $name = config_item('subclass_prefix').$class; - } - else - { - $name = $class; - } - } - else - { - $name = $prefix.$class; - } + $class_name = $prefix.$class; // Is the class name valid? - if ( ! class_exists($name, FALSE)) + if ( ! class_exists($class_name, FALSE)) { - log_message('error', 'Non-existent class: '.$name); - show_error('Non-existent class: '.$name); + log_message('error', 'Non-existent class: '.$class_name); + show_error('Non-existent class: '.$class_name); } // Set the variable name we will assign the class to @@ -1170,13 +1202,13 @@ class CI_Loader { $CI =& get_instance(); if (isset($CI->$object_name)) { - if ($CI->$object_name instanceof $name) + if ($CI->$object_name instanceof $class_name) { - log_message('debug', $class." has already been instantiated as '".$object_name."'. Second attempt aborted."); + log_message('debug', $class_name." has already been instantiated as '".$object_name."'. Second attempt aborted."); return; } - show_error("Resource '".$object_name."' already exists and is not a ".$class." instance."); + show_error("Resource '".$object_name."' already exists and is not a ".$class_name." instance."); } // Save the class name and object name @@ -1184,8 +1216,8 @@ class CI_Loader { // Instantiate the class $CI->$object_name = isset($config) - ? new $name($config) - : new $name(); + ? new $class_name($config) + : new $class_name(); } // -------------------------------------------------------------------- @@ -1200,7 +1232,11 @@ class CI_Loader { */ protected function _ci_autoloader() { - include(APPPATH.'config/autoload.php'); + if (file_exists(APPPATH.'config/autoload.php')) + { + include(APPPATH.'config/autoload.php'); + } + if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/autoload.php')) { include(APPPATH.'config/'.ENVIRONMENT.'/autoload.php'); @@ -1333,6 +1369,3 @@ class CI_Loader { } } - -/* End of file Loader.php */ -/* Location: ./system/core/Loader.php */
\ No newline at end of file diff --git a/system/core/Log.php b/system/core/Log.php index 7d318ed57..833316273 100644 --- a/system/core/Log.php +++ b/system/core/Log.php @@ -198,7 +198,20 @@ class CI_Log { return FALSE; } - $message .= $level.' - '.date($this->_date_fmt).' --> '.$msg."\n"; + // Instantiating DateTime with microseconds appended to initial date is needed for proper support of this format + if (strpos($this->_date_fmt, 'u') !== FALSE) + { + $microtime_full = microtime(TRUE); + $microtime_short = sprintf("%06d", ($microtime_full - floor($microtime_full)) * 1000000); + $date = new DateTime(date('Y-m-d H:i:s.'.$microtime_short, $microtime_full)); + $date = $date->format($this->_date_fmt); + } + else + { + $date = date($this->_date_fmt); + } + + $message .= $level.' - '.$date.' --> '.$msg."\n"; flock($fp, LOCK_EX); @@ -222,6 +235,3 @@ class CI_Log { } } - -/* End of file Log.php */ -/* Location: ./system/core/Log.php */
\ No newline at end of file diff --git a/system/core/Model.php b/system/core/Model.php index 1cb00f742..a0469de11 100644 --- a/system/core/Model.php +++ b/system/core/Model.php @@ -55,7 +55,7 @@ class CI_Model { */ public function __construct() { - log_message('debug', 'Model Class Initialized'); + log_message('info', 'Model Class Initialized'); } // -------------------------------------------------------------------- @@ -78,6 +78,3 @@ class CI_Model { } } - -/* End of file Model.php */ -/* Location: ./system/core/Model.php */
\ No newline at end of file diff --git a/system/core/Output.php b/system/core/Output.php index beac6b377..02f66936c 100644 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -141,7 +141,7 @@ class CI_Output { // Get mime types for later $this->mimes =& get_mimes(); - log_message('debug', 'Output Class Initialized'); + log_message('info', 'Output Class Initialized'); } // -------------------------------------------------------------------- @@ -391,7 +391,7 @@ class CI_Output { /** * Display Output * - * Processes sends the sends finalized output data to the browser along + * Processes and sends finalized output data to the browser along * with any server headers and profile data. It also stops benchmark * timers so the page rendering speed and memory usage can be shown. * @@ -491,7 +491,7 @@ class CI_Output { } echo $output; - log_message('debug', 'Final output sent to browser'); + log_message('info', 'Final output sent to browser'); log_message('debug', 'Total execution time: '.$elapsed); return; } @@ -528,7 +528,7 @@ class CI_Output { echo $output; // Send it to the browser! } - log_message('debug', 'Final output sent to browser'); + log_message('info', 'Final output sent to browser'); log_message('debug', 'Total execution time: '.$elapsed); } @@ -777,6 +777,3 @@ class CI_Output { } } - -/* End of file Output.php */ -/* Location: ./system/core/Output.php */
\ No newline at end of file diff --git a/system/core/Router.php b/system/core/Router.php index b21335fc2..eb3da2285 100644 --- a/system/core/Router.php +++ b/system/core/Router.php @@ -147,7 +147,7 @@ class CI_Router { } } - log_message('debug', 'Router Class Initialized'); + log_message('info', 'Router Class Initialized'); } // -------------------------------------------------------------------- @@ -525,6 +525,3 @@ class CI_Router { } } - -/* End of file Router.php */ -/* Location: ./system/core/Router.php */
\ No newline at end of file diff --git a/system/core/Security.php b/system/core/Security.php index 2bf0f6284..7c18c7406 100644 --- a/system/core/Security.php +++ b/system/core/Security.php @@ -75,7 +75,7 @@ class CI_Security { /** * Character set * - * Will be overriden by the constructor. + * Will be overridden by the constructor. * * @var string */ @@ -192,7 +192,7 @@ class CI_Security { $this->charset = strtoupper(config_item('charset')); - log_message('debug', 'Security Class Initialized'); + log_message('info', 'Security Class Initialized'); } // -------------------------------------------------------------------- @@ -244,7 +244,7 @@ class CI_Security { $this->_csrf_set_hash(); $this->csrf_set_cookie(); - log_message('debug', 'CSRF token verified'); + log_message('info', 'CSRF token verified'); return $this; } @@ -275,7 +275,7 @@ class CI_Security { $secure_cookie, config_item('cookie_httponly') ); - log_message('debug', 'CRSF cookie Set'); + log_message('info', 'CRSF cookie sent'); return $this; } @@ -533,7 +533,6 @@ class CI_Security { return ($str === $converted_string); } - log_message('debug', 'XSS Filtering completed'); return $str; } @@ -998,6 +997,3 @@ class CI_Security { } } - -/* End of file Security.php */ -/* Location: ./system/core/Security.php */
\ No newline at end of file diff --git a/system/core/URI.php b/system/core/URI.php index 39d1a8f30..9bc34ace7 100644 --- a/system/core/URI.php +++ b/system/core/URI.php @@ -140,7 +140,7 @@ class CI_URI { } } - log_message('debug', 'URI Class Initialized'); + log_message('info', 'URI Class Initialized'); } // -------------------------------------------------------------------- @@ -639,6 +639,3 @@ class CI_URI { } } - -/* End of file URI.php */ -/* Location: ./system/core/URI.php */
\ No newline at end of file diff --git a/system/core/Utf8.php b/system/core/Utf8.php index bca95c206..9d8ac41e1 100644 --- a/system/core/Utf8.php +++ b/system/core/Utf8.php @@ -74,7 +74,7 @@ class CI_Utf8 { log_message('debug', 'UTF-8 Support Disabled'); } - log_message('debug', 'Utf8 Class Initialized'); + log_message('info', 'Utf8 Class Initialized'); } // -------------------------------------------------------------------- @@ -162,6 +162,3 @@ class CI_Utf8 { } } - -/* End of file Utf8.php */ -/* Location: ./system/core/Utf8.php */
\ No newline at end of file diff --git a/system/core/compat/hash.php b/system/core/compat/hash.php index aeacabdb9..477535dca 100644 --- a/system/core/compat/hash.php +++ b/system/core/compat/hash.php @@ -196,6 +196,3 @@ if ( ! function_exists('hash_pbkdf2')) return substr($raw_output ? $hash : bin2hex($hash), 0, $length); } } - -/* End of file hash.php */ -/* Location: ./system/core/compat/hash.php */
\ No newline at end of file diff --git a/system/core/compat/mbstring.php b/system/core/compat/mbstring.php index 52ca6d02f..ddb2bae47 100644 --- a/system/core/compat/mbstring.php +++ b/system/core/compat/mbstring.php @@ -147,6 +147,3 @@ if ( ! function_exists('mb_substr')) : substr($str, $start); } } - -/* End of file mbstring.php */ -/* Location: ./system/core/compat/mbstring.php */
\ No newline at end of file diff --git a/system/core/compat/password.php b/system/core/compat/password.php index 00befb022..7b933aa04 100644 --- a/system/core/compat/password.php +++ b/system/core/compat/password.php @@ -231,6 +231,3 @@ if ( ! function_exists('password_verify')) return ($compare === 0); } } - -/* End of file password.php */ -/* Location: ./system/core/compat/password.php */
\ No newline at end of file diff --git a/system/core/compat/standard.php b/system/core/compat/standard.php index f24f7f8ae..5a428c114 100644 --- a/system/core/compat/standard.php +++ b/system/core/compat/standard.php @@ -387,6 +387,3 @@ if ( ! function_exists('quoted_printable_encode')) return $output; } } - -/* End of file standard.php */ -/* Location: ./system/core/compat/standard.php */
\ No newline at end of file diff --git a/system/database/DB.php b/system/database/DB.php index fc9f4d0dc..d411b679e 100644 --- a/system/database/DB.php +++ b/system/database/DB.php @@ -130,7 +130,7 @@ function &DB($params = '', $query_builder_override = NULL) { if (is_string($val) && in_array(strtoupper($val), array('TRUE', 'FALSE', 'NULL'))) { - $val = var_export($val); + $val = var_export($val, TRUE); } $params[$key] = $val; @@ -215,6 +215,3 @@ function &DB($params = '', $query_builder_override = NULL) return $DB; } - -/* End of file DB.php */ -/* Location: ./system/database/DB.php */
\ No newline at end of file diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index 8f5317293..223055f60 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -219,6 +219,3 @@ class CI_DB_Cache { } } - -/* End of file DB_cache.php */ -/* Location: ./system/database/DB_cache.php */
\ No newline at end of file diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index 185f930bf..a0803f170 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -381,7 +381,7 @@ abstract class CI_DB_driver { } } - log_message('debug', 'Database Driver Class Initialized'); + log_message('info', 'Database Driver Class Initialized'); } // -------------------------------------------------------------------- @@ -1643,7 +1643,7 @@ abstract class CI_DB_driver { /** * Close DB Connection * - * This method would be overriden by most of the drivers. + * This method would be overridden by most of the drivers. * * @return void */ @@ -1906,6 +1906,3 @@ abstract class CI_DB_driver { } } - -/* End of file DB_driver.php */ -/* Location: ./system/database/DB_driver.php */
\ No newline at end of file diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php index 4ca980810..f6ee2a63a 100644 --- a/system/database/DB_forge.php +++ b/system/database/DB_forge.php @@ -167,7 +167,7 @@ abstract class CI_DB_forge { public function __construct(&$db) { $this->db =& $db; - log_message('debug', 'Database Forge Class Initialized'); + log_message('info', 'Database Forge Class Initialized'); } // -------------------------------------------------------------------- @@ -828,7 +828,7 @@ abstract class CI_DB_forge { */ protected function _attr_type(&$attributes) { - // Usually overriden by drivers + // Usually overridden by drivers } // -------------------------------------------------------------------- @@ -1033,6 +1033,3 @@ abstract class CI_DB_forge { } } - -/* End of file DB_forge.php */ -/* Location: ./system/database/DB_forge.php */
\ No newline at end of file diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php index 80b25f71b..79cbfb3ad 100644 --- a/system/database/DB_query_builder.php +++ b/system/database/DB_query_builder.php @@ -1699,7 +1699,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { * Groups tables in FROM clauses if needed, so there is no confusion * about operator precedence. * - * Note: This is only used (and overriden) by MySQL and CUBRID. + * Note: This is only used (and overridden) by MySQL and CUBRID. * * @return string */ @@ -2723,6 +2723,3 @@ abstract class CI_DB_query_builder extends CI_DB_driver { } } - -/* End of file DB_query_builder.php */ -/* Location: ./system/database/DB_query_builder.php */
\ No newline at end of file diff --git a/system/database/DB_result.php b/system/database/DB_result.php index 3f26b8aae..746f2a110 100644 --- a/system/database/DB_result.php +++ b/system/database/DB_result.php @@ -556,7 +556,7 @@ class CI_DB_result { /** * Number of fields in the result set * - * Overriden by driver result classes. + * Overridden by driver result classes. * * @return int */ @@ -572,7 +572,7 @@ class CI_DB_result { * * Generates an array of column names. * - * Overriden by driver result classes. + * Overridden by driver result classes. * * @return array */ @@ -588,7 +588,7 @@ class CI_DB_result { * * Generates an array of objects containing field meta-data. * - * Overriden by driver result classes. + * Overridden by driver result classes. * * @return array */ @@ -602,7 +602,7 @@ class CI_DB_result { /** * Free the result * - * Overriden by driver result classes. + * Overridden by driver result classes. * * @return void */ @@ -620,7 +620,7 @@ class CI_DB_result { * this internally before fetching results to make sure the * result set starts at zero. * - * Overriden by driver result classes. + * Overridden by driver result classes. * * @param int $n * @return bool @@ -637,7 +637,7 @@ class CI_DB_result { * * Returns the result set as an array. * - * Overriden by driver result classes. + * Overridden by driver result classes. * * @return array */ @@ -653,7 +653,7 @@ class CI_DB_result { * * Returns the result set as an object. * - * Overriden by driver result classes. + * Overridden by driver result classes. * * @param string $class_name * @return object @@ -664,6 +664,3 @@ class CI_DB_result { } } - -/* End of file DB_result.php */ -/* Location: ./system/database/DB_result.php */
\ No newline at end of file diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php index 963080fbb..774d51533 100644 --- a/system/database/DB_utility.php +++ b/system/database/DB_utility.php @@ -87,7 +87,7 @@ abstract class CI_DB_utility { public function __construct(&$db) { $this->db =& $db; - log_message('debug', 'Database Utility Class Initialized'); + log_message('info', 'Database Utility Class Initialized'); } // -------------------------------------------------------------------- @@ -421,6 +421,3 @@ abstract class CI_DB_utility { } } - -/* End of file DB_utility.php */ -/* Location: ./system/database/DB_utility.php */
\ No newline at end of file diff --git a/system/database/drivers/cubrid/cubrid_driver.php b/system/database/drivers/cubrid/cubrid_driver.php index 438b48a5c..402117978 100644 --- a/system/database/drivers/cubrid/cubrid_driver.php +++ b/system/database/drivers/cubrid/cubrid_driver.php @@ -421,6 +421,3 @@ class CI_DB_cubrid_driver extends CI_DB { } } - -/* End of file cubrid_driver.php */ -/* Location: ./system/database/drivers/cubrid/cubrid_driver.php */
\ No newline at end of file diff --git a/system/database/drivers/cubrid/cubrid_forge.php b/system/database/drivers/cubrid/cubrid_forge.php index a4dde8f10..9484e94e1 100644 --- a/system/database/drivers/cubrid/cubrid_forge.php +++ b/system/database/drivers/cubrid/cubrid_forge.php @@ -225,6 +225,3 @@ class CI_DB_cubrid_forge extends CI_DB_forge { } } - -/* End of file cubrid_forge.php */ -/* Location: ./system/database/drivers/cubrid/cubrid_forge.php */
\ No newline at end of file diff --git a/system/database/drivers/cubrid/cubrid_result.php b/system/database/drivers/cubrid/cubrid_result.php index 193b98b92..e666bab56 100644 --- a/system/database/drivers/cubrid/cubrid_result.php +++ b/system/database/drivers/cubrid/cubrid_result.php @@ -175,6 +175,3 @@ class CI_DB_cubrid_result extends CI_DB_result { } } - -/* End of file cubrid_result.php */ -/* Location: ./system/database/drivers/cubrid/cubrid_result.php */
\ No newline at end of file diff --git a/system/database/drivers/cubrid/cubrid_utility.php b/system/database/drivers/cubrid/cubrid_utility.php index ca76cf98f..de7d71568 100644 --- a/system/database/drivers/cubrid/cubrid_utility.php +++ b/system/database/drivers/cubrid/cubrid_utility.php @@ -77,6 +77,3 @@ class CI_DB_cubrid_utility extends CI_DB_utility { return $this->db->display_error('db_unsupported_feature'); } } - -/* End of file cubrid_utility.php */ -/* Location: ./system/database/drivers/cubrid/cubrid_utility.php */
\ No newline at end of file diff --git a/system/database/drivers/ibase/ibase_driver.php b/system/database/drivers/ibase/ibase_driver.php index 20c5d9c57..529c320cd 100644 --- a/system/database/drivers/ibase/ibase_driver.php +++ b/system/database/drivers/ibase/ibase_driver.php @@ -402,6 +402,3 @@ class CI_DB_ibase_driver extends CI_DB { } } - -/* End of file ibase_driver.php */ -/* Location: ./system/database/drivers/ibase/ibase_driver.php */
\ No newline at end of file diff --git a/system/database/drivers/ibase/ibase_forge.php b/system/database/drivers/ibase/ibase_forge.php index 828739fb5..0e748c710 100644 --- a/system/database/drivers/ibase/ibase_forge.php +++ b/system/database/drivers/ibase/ibase_forge.php @@ -249,6 +249,3 @@ class CI_DB_ibase_forge extends CI_DB_forge { } } - -/* End of file ibase_forge.php */ -/* Location: ./system/database/drivers/ibase/ibase_forge.php */
\ No newline at end of file diff --git a/system/database/drivers/ibase/ibase_result.php b/system/database/drivers/ibase/ibase_result.php index 1b6bbd72a..991146f45 100644 --- a/system/database/drivers/ibase/ibase_result.php +++ b/system/database/drivers/ibase/ibase_result.php @@ -159,6 +159,3 @@ class CI_DB_ibase_result extends CI_DB_result { } } - -/* End of file ibase_result.php */ -/* Location: ./system/database/drivers/ibase/ibase_result.php */
\ No newline at end of file diff --git a/system/database/drivers/ibase/ibase_utility.php b/system/database/drivers/ibase/ibase_utility.php index 9dca599a8..79d2788e5 100644 --- a/system/database/drivers/ibase/ibase_utility.php +++ b/system/database/drivers/ibase/ibase_utility.php @@ -67,6 +67,3 @@ class CI_DB_ibase_utility extends CI_DB_utility { } } - -/* End of file ibase_utility.php */ -/* Location: ./system/database/drivers/ibase/ibase_utility.php */
\ No newline at end of file diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php index 1aeff1d5a..8f15d8d69 100644 --- a/system/database/drivers/mssql/mssql_driver.php +++ b/system/database/drivers/mssql/mssql_driver.php @@ -529,6 +529,3 @@ class CI_DB_mssql_driver extends CI_DB { } } - -/* End of file mssql_driver.php */ -/* Location: ./system/database/drivers/mssql/mssql_driver.php */
\ No newline at end of file diff --git a/system/database/drivers/mssql/mssql_forge.php b/system/database/drivers/mssql/mssql_forge.php index 94d6332fb..84406a016 100644 --- a/system/database/drivers/mssql/mssql_forge.php +++ b/system/database/drivers/mssql/mssql_forge.php @@ -144,6 +144,3 @@ class CI_DB_mssql_forge extends CI_DB_forge { } } - -/* End of file mssql_forge.php */ -/* Location: ./system/database/drivers/mssql/mssql_forge.php */
\ No newline at end of file diff --git a/system/database/drivers/mssql/mssql_result.php b/system/database/drivers/mssql/mssql_result.php index 0f6dcd21e..c1c42a486 100644 --- a/system/database/drivers/mssql/mssql_result.php +++ b/system/database/drivers/mssql/mssql_result.php @@ -107,7 +107,7 @@ class CI_DB_mssql_result extends CI_DB_result { public function field_data() { $retval = array(); - for ($i = 0, $c = $this->num_field(); $i < $c; $i++) + for ($i = 0, $c = $this->num_fields(); $i < $c; $i++) { $field = mssql_fetch_field($this->result_id, $i); @@ -196,6 +196,3 @@ class CI_DB_mssql_result extends CI_DB_result { } } - -/* End of file mssql_result.php */ -/* Location: ./system/database/drivers/mssql/mssql_result.php */
\ No newline at end of file diff --git a/system/database/drivers/mssql/mssql_utility.php b/system/database/drivers/mssql/mssql_utility.php index a587f5d8f..1040b5e41 100644 --- a/system/database/drivers/mssql/mssql_utility.php +++ b/system/database/drivers/mssql/mssql_utility.php @@ -75,6 +75,3 @@ class CI_DB_mssql_utility extends CI_DB_utility { } } - -/* End of file mssql_utility.php */ -/* Location: ./system/database/drivers/mssql/mssql_utility.php */
\ No newline at end of file diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php index 41cb14ba4..f8e9b6d61 100644 --- a/system/database/drivers/mysql/mysql_driver.php +++ b/system/database/drivers/mysql/mysql_driver.php @@ -132,8 +132,8 @@ class CI_DB_mysql_driver extends CI_DB { // Error suppression is necessary mostly due to PHP 5.5+ issuing E_DEPRECATED messages $this->conn_id = ($persistent === TRUE) - ? @mysql_pconnect($this->hostname, $this->username, $this->password, $client_flags) - : @mysql_connect($this->hostname, $this->username, $this->password, TRUE, $client_flags); + ? mysql_pconnect($this->hostname, $this->username, $this->password, $client_flags) + : mysql_connect($this->hostname, $this->username, $this->password, TRUE, $client_flags); // ---------------------------------------------------------------- @@ -495,6 +495,3 @@ class CI_DB_mysql_driver extends CI_DB { } } - -/* End of file mysql_driver.php */ -/* Location: ./system/database/drivers/mysql/mysql_driver.php */
\ No newline at end of file diff --git a/system/database/drivers/mysql/mysql_forge.php b/system/database/drivers/mysql/mysql_forge.php index d90f003e3..cb90065f2 100644 --- a/system/database/drivers/mysql/mysql_forge.php +++ b/system/database/drivers/mysql/mysql_forge.php @@ -241,6 +241,3 @@ class CI_DB_mysql_forge extends CI_DB_forge { } } - -/* End of file mysql_forge.php */ -/* Location: ./system/database/drivers/mysql/mysql_forge.php */
\ No newline at end of file diff --git a/system/database/drivers/mysql/mysql_result.php b/system/database/drivers/mysql/mysql_result.php index aeed07c2c..26aaddd32 100644 --- a/system/database/drivers/mysql/mysql_result.php +++ b/system/database/drivers/mysql/mysql_result.php @@ -197,6 +197,3 @@ class CI_DB_mysql_result extends CI_DB_result { } } - -/* End of file mysql_result.php */ -/* Location: ./system/database/drivers/mysql/mysql_result.php */
\ No newline at end of file diff --git a/system/database/drivers/mysql/mysql_utility.php b/system/database/drivers/mysql/mysql_utility.php index 2ec4da4b2..55857ab08 100644 --- a/system/database/drivers/mysql/mysql_utility.php +++ b/system/database/drivers/mysql/mysql_utility.php @@ -209,6 +209,3 @@ class CI_DB_mysql_utility extends CI_DB_utility { } } - -/* End of file mysql_utility.php */ -/* Location: ./system/database/drivers/mysql/mysql_utility.php */
\ No newline at end of file diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php index 4370986bf..22a8ba678 100644 --- a/system/database/drivers/mysqli/mysqli_driver.php +++ b/system/database/drivers/mysqli/mysqli_driver.php @@ -125,6 +125,8 @@ class CI_DB_mysqli_driver extends CI_DB { $client_flags = ($this->compress === TRUE) ? MYSQLI_CLIENT_COMPRESS : 0; $mysqli = mysqli_init(); + $mysqli->options(MYSQLI_OPT_CONNECT_TIMEOUT, 10); + if ($this->stricton) { $mysqli->options(MYSQLI_INIT_COMMAND, 'SET SESSION sql_mode="STRICT_ALL_TABLES"'); @@ -434,7 +436,7 @@ class CI_DB_mysqli_driver extends CI_DB { * Error * * Returns an array containing code and message of the last - * database error that has occured. + * database error that has occurred. * * @return array */ @@ -484,6 +486,3 @@ class CI_DB_mysqli_driver extends CI_DB { } } - -/* End of file mysqli_driver.php */ -/* Location: ./system/database/drivers/mysqli/mysqli_driver.php */
\ No newline at end of file diff --git a/system/database/drivers/mysqli/mysqli_forge.php b/system/database/drivers/mysqli/mysqli_forge.php index 29a8b4cef..196afa845 100644 --- a/system/database/drivers/mysqli/mysqli_forge.php +++ b/system/database/drivers/mysqli/mysqli_forge.php @@ -242,6 +242,3 @@ class CI_DB_mysqli_forge extends CI_DB_forge { } } - -/* End of file mysqli_forge.php */ -/* Location: ./system/database/drivers/mysqli/mysqli_forge.php */
\ No newline at end of file diff --git a/system/database/drivers/mysqli/mysqli_result.php b/system/database/drivers/mysqli/mysqli_result.php index e1e94cd1d..d648828bd 100644 --- a/system/database/drivers/mysqli/mysqli_result.php +++ b/system/database/drivers/mysqli/mysqli_result.php @@ -184,6 +184,3 @@ class CI_DB_mysqli_result extends CI_DB_result { } } - -/* End of file mysqli_result.php */ -/* Location: ./system/database/drivers/mysqli/mysqli_result.php */
\ No newline at end of file diff --git a/system/database/drivers/mysqli/mysqli_utility.php b/system/database/drivers/mysqli/mysqli_utility.php index afa863e86..04fcd1ded 100644 --- a/system/database/drivers/mysqli/mysqli_utility.php +++ b/system/database/drivers/mysqli/mysqli_utility.php @@ -211,6 +211,3 @@ class CI_DB_mysqli_utility extends CI_DB_utility { } } - -/* End of file mysqli_utility.php */ -/* Location: ./system/database/drivers/mysqli/mysqli_utility.php */
\ No newline at end of file diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php index f57e042c5..b87b41112 100644 --- a/system/database/drivers/oci8/oci8_driver.php +++ b/system/database/drivers/oci8/oci8_driver.php @@ -708,6 +708,3 @@ class CI_DB_oci8_driver extends CI_DB { } } - -/* End of file oci8_driver.php */ -/* Location: ./system/database/drivers/oci8/oci8_driver.php */
\ No newline at end of file diff --git a/system/database/drivers/oci8/oci8_forge.php b/system/database/drivers/oci8/oci8_forge.php index f215d9534..80100977a 100644 --- a/system/database/drivers/oci8/oci8_forge.php +++ b/system/database/drivers/oci8/oci8_forge.php @@ -147,6 +147,3 @@ class CI_DB_oci8_forge extends CI_DB_forge { } } - -/* End of file oci8_forge.php */ -/* Location: ./system/database/drivers/oci8/oci8_forge.php */
\ No newline at end of file diff --git a/system/database/drivers/oci8/oci8_result.php b/system/database/drivers/oci8/oci8_result.php index ffcb2d73d..9ec54cc5c 100644 --- a/system/database/drivers/oci8/oci8_result.php +++ b/system/database/drivers/oci8/oci8_result.php @@ -227,6 +227,3 @@ class CI_DB_oci8_result extends CI_DB_result { } } - -/* End of file oci8_result.php */ -/* Location: ./system/database/drivers/oci8/oci8_result.php */
\ No newline at end of file diff --git a/system/database/drivers/oci8/oci8_utility.php b/system/database/drivers/oci8/oci8_utility.php index fcec02bd2..90022a8c1 100644 --- a/system/database/drivers/oci8/oci8_utility.php +++ b/system/database/drivers/oci8/oci8_utility.php @@ -66,6 +66,3 @@ class CI_DB_oci8_utility extends CI_DB_utility { } } - -/* End of file oci8_utility.php */ -/* Location: ./system/database/drivers/oci8/oci8_utility.php */
\ No newline at end of file diff --git a/system/database/drivers/odbc/odbc_driver.php b/system/database/drivers/odbc/odbc_driver.php index 28a81e92f..f5d77a147 100644 --- a/system/database/drivers/odbc/odbc_driver.php +++ b/system/database/drivers/odbc/odbc_driver.php @@ -372,6 +372,3 @@ class CI_DB_odbc_driver extends CI_DB { } } - -/* End of file odbc_driver.php */ -/* Location: ./system/database/drivers/odbc/odbc_driver.php */
\ No newline at end of file diff --git a/system/database/drivers/odbc/odbc_forge.php b/system/database/drivers/odbc/odbc_forge.php index 77338e83f..45c5dc108 100644 --- a/system/database/drivers/odbc/odbc_forge.php +++ b/system/database/drivers/odbc/odbc_forge.php @@ -84,6 +84,3 @@ class CI_DB_odbc_forge extends CI_DB_forge { } } - -/* End of file odbc_forge.php */ -/* Location: ./system/database/drivers/odbc/odbc_forge.php */
\ No newline at end of file diff --git a/system/database/drivers/odbc/odbc_result.php b/system/database/drivers/odbc/odbc_result.php index bfd928106..10b93d4fc 100644 --- a/system/database/drivers/odbc/odbc_result.php +++ b/system/database/drivers/odbc/odbc_result.php @@ -266,6 +266,3 @@ if ( ! function_exists('odbc_fetch_object')) return $rs_object; } } - -/* End of file odbc_result.php */ -/* Location: ./system/database/drivers/odbc/odbc_result.php */
\ No newline at end of file diff --git a/system/database/drivers/odbc/odbc_utility.php b/system/database/drivers/odbc/odbc_utility.php index d155d015e..0e6c23328 100644 --- a/system/database/drivers/odbc/odbc_utility.php +++ b/system/database/drivers/odbc/odbc_utility.php @@ -61,6 +61,3 @@ class CI_DB_odbc_utility extends CI_DB_utility { } } - -/* End of file odbc_utility.php */ -/* Location: ./system/database/drivers/odbc/odbc_utility.php */
\ No newline at end of file diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php index 0e727991d..68aeb0eef 100644 --- a/system/database/drivers/pdo/pdo_driver.php +++ b/system/database/drivers/pdo/pdo_driver.php @@ -398,6 +398,3 @@ class CI_DB_pdo_driver extends CI_DB { } } - -/* End of file pdo_driver.php */ -/* Location: ./system/database/drivers/pdo/pdo_driver.php */
\ No newline at end of file diff --git a/system/database/drivers/pdo/pdo_forge.php b/system/database/drivers/pdo/pdo_forge.php index 92e2e172e..eedd9722d 100644 --- a/system/database/drivers/pdo/pdo_forge.php +++ b/system/database/drivers/pdo/pdo_forge.php @@ -63,6 +63,3 @@ class CI_DB_pdo_forge extends CI_DB_forge { protected $_drop_table_if = FALSE; } - -/* End of file pdo_forge.php */ -/* Location: ./system/database/drivers/pdo/pdo_forge.php */
\ No newline at end of file diff --git a/system/database/drivers/pdo/pdo_result.php b/system/database/drivers/pdo/pdo_result.php index 93eaa3c72..fe26fea6e 100644 --- a/system/database/drivers/pdo/pdo_result.php +++ b/system/database/drivers/pdo/pdo_result.php @@ -196,6 +196,3 @@ class CI_DB_pdo_result extends CI_DB_result { } } - -/* End of file pdo_result.php */ -/* Location: ./system/database/drivers/pdo/pdo_result.php */
\ No newline at end of file diff --git a/system/database/drivers/pdo/pdo_utility.php b/system/database/drivers/pdo/pdo_utility.php index e9b80a47d..72169c3ca 100644 --- a/system/database/drivers/pdo/pdo_utility.php +++ b/system/database/drivers/pdo/pdo_utility.php @@ -61,6 +61,3 @@ class CI_DB_pdo_utility extends CI_DB_utility { } } - -/* End of file pdo_utility.php */ -/* Location: ./system/database/drivers/pdo/pdo_utility.php */
\ No newline at end of file diff --git a/system/database/drivers/pdo/subdrivers/pdo_4d_driver.php b/system/database/drivers/pdo/subdrivers/pdo_4d_driver.php index d2266685d..cf5a0c77f 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_4d_driver.php +++ b/system/database/drivers/pdo/subdrivers/pdo_4d_driver.php @@ -198,6 +198,3 @@ class CI_DB_pdo_4d_driver extends CI_DB_pdo_driver { } } - -/* End of file pdo_4d_driver.php */ -/* Location: ./system/database/drivers/pdo/subdrivers/pdo_4d_driver.php */
\ No newline at end of file diff --git a/system/database/drivers/pdo/subdrivers/pdo_4d_forge.php b/system/database/drivers/pdo/subdrivers/pdo_4d_forge.php index 76d9ea91e..6b420540c 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_4d_forge.php +++ b/system/database/drivers/pdo/subdrivers/pdo_4d_forge.php @@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); * @author EllisLab Dev Team * @link http://codeigniter.com/user_guide/database/ */ -class CI_DB_pdo_4d_forge extends CI_DB_4d_forge { +class CI_DB_pdo_4d_forge extends CI_DB_pdo_forge { /** * CREATE DATABASE statement @@ -164,7 +164,7 @@ class CI_DB_pdo_4d_forge extends CI_DB_4d_forge { $attributes['TYPE'] = 'INT'; return; case 'BIGINT': - $attribites['TYPE'] = 'INT64'; + $attributes['TYPE'] = 'INT64'; return; default: return; } @@ -215,6 +215,3 @@ class CI_DB_pdo_4d_forge extends CI_DB_4d_forge { } } - -/* End of file pdo_4d_forge.php */ -/* Location: ./system/database/drivers/pdo/subdrivers/pdo_4d_forge.php */
\ No newline at end of file diff --git a/system/database/drivers/pdo/subdrivers/pdo_cubrid_driver.php b/system/database/drivers/pdo/subdrivers/pdo_cubrid_driver.php index 9ed66314b..98ac89f3d 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_cubrid_driver.php +++ b/system/database/drivers/pdo/subdrivers/pdo_cubrid_driver.php @@ -248,6 +248,3 @@ class CI_DB_pdo_cubrid_driver extends CI_DB_pdo_driver { } } - -/* End of file pdo_cubrid_driver.php */ -/* Location: ./system/database/drivers/pdo/subdrivers/pdo_cubrid_driver.php */
\ No newline at end of file diff --git a/system/database/drivers/pdo/subdrivers/pdo_cubrid_forge.php b/system/database/drivers/pdo/subdrivers/pdo_cubrid_forge.php index 94dd1e219..15b100d9b 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_cubrid_forge.php +++ b/system/database/drivers/pdo/subdrivers/pdo_cubrid_forge.php @@ -225,6 +225,3 @@ class CI_DB_pdo_cubrid_forge extends CI_DB_pdo_forge { } } - -/* End of file pdo_cubrid_forge.php */ -/* Location: ./system/database/drivers/pdo/subdrivers/pdo_cubrid_forge.php */
\ No newline at end of file diff --git a/system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php b/system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php index d1d42875a..c8d7c770d 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php +++ b/system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php @@ -330,6 +330,3 @@ class CI_DB_pdo_dblib_driver extends CI_DB_pdo_driver { } } - -/* End of file pdo_dblib_driver.php */ -/* Location: ./system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php */
\ No newline at end of file diff --git a/system/database/drivers/pdo/subdrivers/pdo_dblib_forge.php b/system/database/drivers/pdo/subdrivers/pdo_dblib_forge.php index 70f843516..d3dd9032e 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_dblib_forge.php +++ b/system/database/drivers/pdo/subdrivers/pdo_dblib_forge.php @@ -142,6 +142,3 @@ class CI_DB_pdo_dblib_forge extends CI_DB_pdo_forge { } } - -/* End of file pdo_dblib_forge.php */ -/* Location: ./system/database/drivers/pdo/subdrivers/pdo_dblib_forge.php */
\ No newline at end of file diff --git a/system/database/drivers/pdo/subdrivers/pdo_firebird_driver.php b/system/database/drivers/pdo/subdrivers/pdo_firebird_driver.php index 5fffd5a44..3bd5c9354 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_firebird_driver.php +++ b/system/database/drivers/pdo/subdrivers/pdo_firebird_driver.php @@ -261,6 +261,3 @@ class CI_DB_pdo_firebird_driver extends CI_DB_pdo_driver { } } - -/* End of file pdo_firebird_driver.php */ -/* Location: ./system/database/drivers/pdo/subdrivers/pdo_firebird_driver.php */
\ No newline at end of file diff --git a/system/database/drivers/pdo/subdrivers/pdo_firebird_forge.php b/system/database/drivers/pdo/subdrivers/pdo_firebird_forge.php index 1e4f39f39..ad28a6550 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_firebird_forge.php +++ b/system/database/drivers/pdo/subdrivers/pdo_firebird_forge.php @@ -235,6 +235,3 @@ class CI_DB_pdo_firebird_forge extends CI_DB_pdo_forge { } } - -/* End of file pdo_firebird_forge.php */ -/* Location: ./system/database/drivers/pdo/subdrivers/pdo_firebird_forge.php */
\ No newline at end of file diff --git a/system/database/drivers/pdo/subdrivers/pdo_ibm_driver.php b/system/database/drivers/pdo/subdrivers/pdo_ibm_driver.php index 17a7732fc..5dba26ec9 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_ibm_driver.php +++ b/system/database/drivers/pdo/subdrivers/pdo_ibm_driver.php @@ -242,6 +242,3 @@ class CI_DB_pdo_ibm_driver extends CI_DB_pdo_driver { } } - -/* End of file pdo_ibm_driver.php */ -/* Location: ./system/database/drivers/pdo/subdrivers/pdo_ibm_driver.php */
\ No newline at end of file diff --git a/system/database/drivers/pdo/subdrivers/pdo_ibm_forge.php b/system/database/drivers/pdo/subdrivers/pdo_ibm_forge.php index 47e6d1c6f..d1b5f92c9 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_ibm_forge.php +++ b/system/database/drivers/pdo/subdrivers/pdo_ibm_forge.php @@ -152,6 +152,3 @@ class CI_DB_pdo_ibm_forge extends CI_DB_pdo_forge { } } - -/* End of file pdo_ibm_forge.php */ -/* Location: ./system/database/drivers/pdo/subdrivers/pdo_ibm_forge.php */
\ No newline at end of file diff --git a/system/database/drivers/pdo/subdrivers/pdo_informix_driver.php b/system/database/drivers/pdo/subdrivers/pdo_informix_driver.php index 01e32f5f4..9f8c017a5 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_informix_driver.php +++ b/system/database/drivers/pdo/subdrivers/pdo_informix_driver.php @@ -307,6 +307,3 @@ class CI_DB_pdo_informix_driver extends CI_DB_pdo_driver { } } - -/* End of file pdo_informix_driver.php */ -/* Location: ./system/database/drivers/pdo/subdrivers/pdo_informix_driver.php */
\ No newline at end of file diff --git a/system/database/drivers/pdo/subdrivers/pdo_informix_forge.php b/system/database/drivers/pdo/subdrivers/pdo_informix_forge.php index 45a18a3d1..22bdf6104 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_informix_forge.php +++ b/system/database/drivers/pdo/subdrivers/pdo_informix_forge.php @@ -161,6 +161,3 @@ class CI_DB_pdo_informix_forge extends CI_DB_pdo_forge { } } - -/* End of file pdo_informix_forge.php */ -/* Location: ./system/database/drivers/pdo/subdrivers/pdo_informix_forge.php */
\ No newline at end of file diff --git a/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php b/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php index e4e4fa069..67dc5f5ec 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php +++ b/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php @@ -264,6 +264,3 @@ class CI_DB_pdo_mysql_driver extends CI_DB_pdo_driver { } } - -/* End of file pdo_mysql_driver.php */ -/* Location: ./system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php */
\ No newline at end of file diff --git a/system/database/drivers/pdo/subdrivers/pdo_mysql_forge.php b/system/database/drivers/pdo/subdrivers/pdo_mysql_forge.php index 1f007e7f4..e8e24c6b3 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_mysql_forge.php +++ b/system/database/drivers/pdo/subdrivers/pdo_mysql_forge.php @@ -199,8 +199,6 @@ class CI_DB_pdo_mysql_forge extends CI_DB_pdo_forge { $extra_clause = ' FIRST'; } - $comment_clause = isset($field['comment']) ? ' COMMENT ' . $field['comment'] : ''; - return $this->db->escape_identifiers($field['name']) .(empty($field['new_name']) ? '' : ' '.$this->db->escape_identifiers($field['new_name'])) .' '.$field['type'].$field['length'] @@ -256,6 +254,3 @@ class CI_DB_pdo_mysql_forge extends CI_DB_pdo_forge { } } - -/* End of file pdo_mysql_forge.php */ -/* Location: ./system/database/drivers/pdo/subdrivers/pdo_mysql_forge.php */
\ No newline at end of file diff --git a/system/database/drivers/pdo/subdrivers/pdo_oci_driver.php b/system/database/drivers/pdo/subdrivers/pdo_oci_driver.php index b80da33c2..d17e311f7 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_oci_driver.php +++ b/system/database/drivers/pdo/subdrivers/pdo_oci_driver.php @@ -293,6 +293,3 @@ class CI_DB_pdo_oci_driver extends CI_DB_pdo_driver { } } - -/* End of file pdo_oci_driver.php */ -/* Location: ./system/database/drivers/pdo/subdrivers/pdo_oci_driver.php */
\ No newline at end of file diff --git a/system/database/drivers/pdo/subdrivers/pdo_oci_forge.php b/system/database/drivers/pdo/subdrivers/pdo_oci_forge.php index 64065e875..e2078cf39 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_oci_forge.php +++ b/system/database/drivers/pdo/subdrivers/pdo_oci_forge.php @@ -147,6 +147,3 @@ class CI_DB_pdo_oci_forge extends CI_DB_pdo_forge { } } - -/* End of file pdo_oci_forge.php */ -/* Location: ./system/database/drivers/pdo/subdrivers/pdo_oci_forge.php */
\ No newline at end of file diff --git a/system/database/drivers/pdo/subdrivers/pdo_odbc_driver.php b/system/database/drivers/pdo/subdrivers/pdo_odbc_driver.php index c5e5a4ca1..51c70b630 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_odbc_driver.php +++ b/system/database/drivers/pdo/subdrivers/pdo_odbc_driver.php @@ -264,6 +264,3 @@ class CI_DB_pdo_odbc_driver extends CI_DB_pdo_driver { } } - -/* End of file pdo_odbc_driver.php */ -/* Location: ./system/database/drivers/pdo/subdrivers/pdo_odbc_driver.php */
\ No newline at end of file diff --git a/system/database/drivers/pdo/subdrivers/pdo_odbc_forge.php b/system/database/drivers/pdo/subdrivers/pdo_odbc_forge.php index 6fc9839b4..291352982 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_odbc_forge.php +++ b/system/database/drivers/pdo/subdrivers/pdo_odbc_forge.php @@ -68,6 +68,3 @@ class CI_DB_pdo_odbc_forge extends CI_DB_pdo_forge { } } - -/* End of file pdo_odbc_forge.php */ -/* Location: ./system/database/drivers/pdo/subdrivers/pdo_odbc_forge.php */
\ No newline at end of file diff --git a/system/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php b/system/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php index 158c5d2eb..2dd41ca87 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php +++ b/system/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php @@ -377,6 +377,3 @@ class CI_DB_pdo_pgsql_driver extends CI_DB_pdo_driver { } } - -/* End of file pdo_pgsql_driver.php */ -/* Location: ./system/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php */
\ No newline at end of file diff --git a/system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php b/system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php index 2b4985497..b4a6160a8 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php +++ b/system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php @@ -208,6 +208,3 @@ class CI_DB_pdo_pgsql_forge extends CI_DB_pdo_forge { } } - -/* End of file pdo_pgsql_forge.php */ -/* Location: ./system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php */
\ No newline at end of file diff --git a/system/database/drivers/pdo/subdrivers/pdo_sqlite_driver.php b/system/database/drivers/pdo/subdrivers/pdo_sqlite_driver.php index e1c8670a9..f07f49f84 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_sqlite_driver.php +++ b/system/database/drivers/pdo/subdrivers/pdo_sqlite_driver.php @@ -203,6 +203,3 @@ class CI_DB_pdo_sqlite_driver extends CI_DB_pdo_driver { } } - -/* End of file pdo_sqlite_driver.php */ -/* Location: ./system/database/drivers/pdo/subdrivers/pdo_sqlite_driver.php */
\ No newline at end of file diff --git a/system/database/drivers/pdo/subdrivers/pdo_sqlite_forge.php b/system/database/drivers/pdo/subdrivers/pdo_sqlite_forge.php index e09db10f0..28faaddb7 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_sqlite_forge.php +++ b/system/database/drivers/pdo/subdrivers/pdo_sqlite_forge.php @@ -235,6 +235,3 @@ class CI_DB_pdo_sqlite_forge extends CI_DB_pdo_forge { } } - -/* End of file pdo_sqlite_forge.php */ -/* Location: ./system/database/drivers/pdo/subdrivers/pdo_sqlite_forge.php */
\ No newline at end of file diff --git a/system/database/drivers/pdo/subdrivers/pdo_sqlsrv_driver.php b/system/database/drivers/pdo/subdrivers/pdo_sqlsrv_driver.php index ac3513560..b5bdbf91a 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_sqlsrv_driver.php +++ b/system/database/drivers/pdo/subdrivers/pdo_sqlsrv_driver.php @@ -367,6 +367,3 @@ class CI_DB_pdo_sqlsrv_driver extends CI_DB_pdo_driver { } } - -/* End of file pdo_sqlsrv_driver.php */ -/* Location: ./system/database/drivers/pdo/subdrivers/pdo_sqlsrv_driver.php */
\ No newline at end of file diff --git a/system/database/drivers/pdo/subdrivers/pdo_sqlsrv_forge.php b/system/database/drivers/pdo/subdrivers/pdo_sqlsrv_forge.php index 92f38af92..602a1d426 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_sqlsrv_forge.php +++ b/system/database/drivers/pdo/subdrivers/pdo_sqlsrv_forge.php @@ -142,6 +142,3 @@ class CI_DB_pdo_sqlsrv_forge extends CI_DB_pdo_forge { } } - -/* End of file pdo_sqlsrv_forge.php */ -/* Location: ./system/database/drivers/pdo/subdrivers/pdo_sqlsrv_forge.php */
\ No newline at end of file diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php index fa5934972..3f3e3f018 100644 --- a/system/database/drivers/postgre/postgre_driver.php +++ b/system/database/drivers/postgre/postgre_driver.php @@ -641,6 +641,3 @@ class CI_DB_postgre_driver extends CI_DB { } } - -/* End of file postgre_driver.php */ -/* Location: ./system/database/drivers/postgre/postgre_driver.php */
\ No newline at end of file diff --git a/system/database/drivers/postgre/postgre_forge.php b/system/database/drivers/postgre/postgre_forge.php index 85f4ad72b..d26e84cbc 100644 --- a/system/database/drivers/postgre/postgre_forge.php +++ b/system/database/drivers/postgre/postgre_forge.php @@ -203,6 +203,3 @@ class CI_DB_postgre_forge extends CI_DB_forge { } } - -/* End of file postgre_forge.php */ -/* Location: ./system/database/drivers/postgre/postgre_forge.php */
\ No newline at end of file diff --git a/system/database/drivers/postgre/postgre_result.php b/system/database/drivers/postgre/postgre_result.php index cfb64d372..a8ad24edf 100644 --- a/system/database/drivers/postgre/postgre_result.php +++ b/system/database/drivers/postgre/postgre_result.php @@ -180,6 +180,3 @@ class CI_DB_postgre_result extends CI_DB_result { } } - -/* End of file postgre_result.php */ -/* Location: ./system/database/drivers/postgre/postgre_result.php */
\ No newline at end of file diff --git a/system/database/drivers/postgre/postgre_utility.php b/system/database/drivers/postgre/postgre_utility.php index 8252a39d4..7c6c02590 100644 --- a/system/database/drivers/postgre/postgre_utility.php +++ b/system/database/drivers/postgre/postgre_utility.php @@ -76,6 +76,3 @@ class CI_DB_postgre_utility extends CI_DB_utility { return $this->db->display_error('db_unsupported_feature'); } } - -/* End of file postgre_utility.php */ -/* Location: ./system/database/drivers/postgre/postgre_utility.php */
\ No newline at end of file diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php index 2137bade0..9d9caa0b4 100644 --- a/system/database/drivers/sqlite/sqlite_driver.php +++ b/system/database/drivers/sqlite/sqlite_driver.php @@ -355,6 +355,3 @@ class CI_DB_sqlite_driver extends CI_DB { } } - -/* End of file sqlite_driver.php */ -/* Location: ./system/database/drivers/sqlite/sqlite_driver.php */
\ No newline at end of file diff --git a/system/database/drivers/sqlite/sqlite_forge.php b/system/database/drivers/sqlite/sqlite_forge.php index 92721a97f..2bba330c0 100644 --- a/system/database/drivers/sqlite/sqlite_forge.php +++ b/system/database/drivers/sqlite/sqlite_forge.php @@ -203,6 +203,3 @@ class CI_DB_sqlite_forge extends CI_DB_forge { } } - -/* End of file sqlite_forge.php */ -/* Location: ./system/database/drivers/sqlite/sqlite_forge.php */
\ No newline at end of file diff --git a/system/database/drivers/sqlite/sqlite_result.php b/system/database/drivers/sqlite/sqlite_result.php index 3b42a6dc0..487d00366 100644 --- a/system/database/drivers/sqlite/sqlite_result.php +++ b/system/database/drivers/sqlite/sqlite_result.php @@ -162,6 +162,3 @@ class CI_DB_sqlite_result extends CI_DB_result { } } - -/* End of file sqlite_result.php */ -/* Location: ./system/database/drivers/sqlite/sqlite_result.php */
\ No newline at end of file diff --git a/system/database/drivers/sqlite/sqlite_utility.php b/system/database/drivers/sqlite/sqlite_utility.php index 7b0b2cbeb..9cb454274 100644 --- a/system/database/drivers/sqlite/sqlite_utility.php +++ b/system/database/drivers/sqlite/sqlite_utility.php @@ -59,6 +59,3 @@ class CI_DB_sqlite_utility extends CI_DB_utility { } } - -/* End of file sqlite_utility.php */ -/* Location: ./system/database/drivers/sqlite/sqlite_utility.php */
\ No newline at end of file diff --git a/system/database/drivers/sqlite3/sqlite3_driver.php b/system/database/drivers/sqlite3/sqlite3_driver.php index 27d2bbfff..fdbe94939 100644 --- a/system/database/drivers/sqlite3/sqlite3_driver.php +++ b/system/database/drivers/sqlite3/sqlite3_driver.php @@ -358,6 +358,3 @@ class CI_DB_sqlite3_driver extends CI_DB { } } - -/* End of file sqlite3_driver.php */ -/* Location: ./system/database/drivers/sqlite3/sqlite3_driver.php */
\ No newline at end of file diff --git a/system/database/drivers/sqlite3/sqlite3_forge.php b/system/database/drivers/sqlite3/sqlite3_forge.php index b1f3169c2..69f65b6f3 100644 --- a/system/database/drivers/sqlite3/sqlite3_forge.php +++ b/system/database/drivers/sqlite3/sqlite3_forge.php @@ -222,6 +222,3 @@ class CI_DB_sqlite3_forge extends CI_DB_forge { } } - -/* End of file sqlite3_forge.php */ -/* Location: ./system/database/drivers/sqlite3/sqlite3_forge.php */
\ No newline at end of file diff --git a/system/database/drivers/sqlite3/sqlite3_result.php b/system/database/drivers/sqlite3/sqlite3_result.php index 179bcc895..387481b7f 100644 --- a/system/database/drivers/sqlite3/sqlite3_result.php +++ b/system/database/drivers/sqlite3/sqlite3_result.php @@ -98,7 +98,7 @@ class CI_DB_sqlite3_result extends CI_DB_result { ); $retval = array(); - for ($i = 0, $c = $this->num_fields(); $i < $this->num_fields(); $i++) + for ($i = 0, $c = $this->num_fields(); $i < $c; $i++) { $retval[$i] = new stdClass(); $retval[$i]->name = $this->result_id->columnName($i); @@ -192,6 +192,3 @@ class CI_DB_sqlite3_result extends CI_DB_result { } } - -/* End of file sqlite3_result.php */ -/* Location: ./system/database/drivers/sqlite3/sqlite3_result.php */
\ No newline at end of file diff --git a/system/database/drivers/sqlite3/sqlite3_utility.php b/system/database/drivers/sqlite3/sqlite3_utility.php index 3cd7faaa4..336f68754 100644 --- a/system/database/drivers/sqlite3/sqlite3_utility.php +++ b/system/database/drivers/sqlite3/sqlite3_utility.php @@ -59,6 +59,3 @@ class CI_DB_sqlite3_utility extends CI_DB_utility { } } - -/* End of file sqlite3_utility.php */ -/* Location: ./system/database/drivers/sqlite3/sqlite3_utility.php */
\ No newline at end of file diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php index 078aaec3d..8f17c8f96 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_driver.php +++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php @@ -569,6 +569,3 @@ class CI_DB_sqlsrv_driver extends CI_DB { } } - -/* End of file sqlsrv_driver.php */ -/* Location: ./system/database/drivers/sqlsrv/sqlsrv_driver.php */
\ No newline at end of file diff --git a/system/database/drivers/sqlsrv/sqlsrv_forge.php b/system/database/drivers/sqlsrv/sqlsrv_forge.php index 63c4f7e7f..b22b60a4a 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_forge.php +++ b/system/database/drivers/sqlsrv/sqlsrv_forge.php @@ -142,6 +142,3 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { } } - -/* End of file sqlsrv_forge.php */ -/* Location: ./system/database/drivers/sqlsrv/sqlsrv_forge.php */
\ No newline at end of file diff --git a/system/database/drivers/sqlsrv/sqlsrv_result.php b/system/database/drivers/sqlsrv/sqlsrv_result.php index 8ec2a9f42..d2be926aa 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_result.php +++ b/system/database/drivers/sqlsrv/sqlsrv_result.php @@ -191,6 +191,3 @@ class CI_DB_sqlsrv_result extends CI_DB_result { } } - -/* End of file sqlsrv_result.php */ -/* Location: ./system/database/drivers/sqlsrv/sqlsrv_result.php */
\ No newline at end of file diff --git a/system/database/drivers/sqlsrv/sqlsrv_utility.php b/system/database/drivers/sqlsrv/sqlsrv_utility.php index 8fa0e68d6..77cf0aaf3 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_utility.php +++ b/system/database/drivers/sqlsrv/sqlsrv_utility.php @@ -75,6 +75,3 @@ class CI_DB_sqlsrv_utility extends CI_DB_utility { } } - -/* End of file sqlsrv_utility.php */ -/* Location: ./system/database/drivers/sqlsrv/sqlsrv_utility.php */
\ No newline at end of file diff --git a/system/helpers/array_helper.php b/system/helpers/array_helper.php index c4fa330ea..e07b52bb5 100644 --- a/system/helpers/array_helper.php +++ b/system/helpers/array_helper.php @@ -113,6 +113,3 @@ if ( ! function_exists('elements')) return $return; } } - -/* End of file array_helper.php */ -/* Location: ./system/helpers/array_helper.php */
\ No newline at end of file diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php index 7cdc0aff2..201987ac8 100644 --- a/system/helpers/captcha_helper.php +++ b/system/helpers/captcha_helper.php @@ -251,6 +251,3 @@ if ( ! function_exists('create_captcha')) return array('word' => $word, 'time' => $now, 'image' => $img, 'filename' => $img_filename); } } - -/* End of file captcha_helper.php */ -/* Location: ./system/helpers/captcha_helper.php */
\ No newline at end of file diff --git a/system/helpers/cookie_helper.php b/system/helpers/cookie_helper.php index ce714d011..c2dc73a17 100644 --- a/system/helpers/cookie_helper.php +++ b/system/helpers/cookie_helper.php @@ -111,6 +111,3 @@ if ( ! function_exists('delete_cookie')) set_cookie($name, '', '', $domain, $path, $prefix); } } - -/* End of file cookie_helper.php */ -/* Location: ./system/helpers/cookie_helper.php */
\ No newline at end of file diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php index 56f15e877..c9b71c30f 100644 --- a/system/helpers/date_helper.php +++ b/system/helpers/date_helper.php @@ -794,6 +794,3 @@ if ( ! function_exists('date_range')) return $range; } } - -/* End of file date_helper.php */ -/* Location: ./system/helpers/date_helper.php */
\ No newline at end of file diff --git a/system/helpers/directory_helper.php b/system/helpers/directory_helper.php index 2d7d15f9d..8f05c5b18 100644 --- a/system/helpers/directory_helper.php +++ b/system/helpers/directory_helper.php @@ -99,6 +99,3 @@ if ( ! function_exists('directory_map')) return FALSE; } } - -/* End of file directory_helper.php */ -/* Location: ./system/helpers/directory_helper.php */
\ No newline at end of file diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index a781a0c02..379120552 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -165,6 +165,3 @@ if ( ! function_exists('force_download')) exit; } } - -/* End of file download_helper.php */ -/* Location: ./system/helpers/download_helper.php */
\ No newline at end of file diff --git a/system/helpers/email_helper.php b/system/helpers/email_helper.php index d7691e349..c4d705810 100644 --- a/system/helpers/email_helper.php +++ b/system/helpers/email_helper.php @@ -82,6 +82,3 @@ if ( ! function_exists('send_email')) return mail($recipient, $subject, $message); } } - -/* End of file email_helper.php */ -/* Location: ./system/helpers/email_helper.php */
\ No newline at end of file diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php index 1ff728778..8b15e60a5 100644 --- a/system/helpers/file_helper.php +++ b/system/helpers/file_helper.php @@ -449,6 +449,3 @@ if ( ! function_exists('octal_permissions')) return substr(sprintf('%o', $perms), -3); } } - -/* End of file file_helper.php */ -/* Location: ./system/helpers/file_helper.php */
\ No newline at end of file diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php index 0e9207ee2..fb235291e 100644 --- a/system/helpers/form_helper.php +++ b/system/helpers/form_helper.php @@ -100,7 +100,7 @@ if ( ! function_exists('form_open')) { foreach ($hidden as $name => $value) { - $form .= '<input type="hidden" name="'.$name.'" value="'.form_prep($value).'" style="display:none;" />'."\n"; + $form .= '<input type="hidden" name="'.$name.'" value="'.html_escape($value).'" style="display:none;" />'."\n"; } } @@ -173,7 +173,7 @@ if ( ! function_exists('form_hidden')) if ( ! is_array($value)) { - $form .= '<input type="hidden" name="'.$name.'" value="'.form_prep($value)."\" />\n"; + $form .= '<input type="hidden" name="'.$name.'" value="'.html_escape($value)."\" />\n"; } else { @@ -287,7 +287,7 @@ if ( ! function_exists('form_textarea')) unset($data['value']); // textareas don't use the value attribute } - return '<textarea '._parse_form_attributes($data, $defaults).$extra.'>'.form_prep($val, TRUE)."</textarea>\n"; + return '<textarea '._parse_form_attributes($data, $defaults).$extra.'>'.html_escape($val)."</textarea>\n"; } } @@ -392,7 +392,7 @@ if ( ! function_exists('form_dropdown')) foreach ($val as $optgroup_key => $optgroup_val) { $sel = in_array($optgroup_key, $selected) ? ' selected="selected"' : ''; - $form .= '<option value="'.form_prep($optgroup_key).'"'.$sel.'>' + $form .= '<option value="'.html_escape($optgroup_key).'"'.$sel.'>' .(string) $optgroup_val."</option>\n"; } @@ -400,7 +400,7 @@ if ( ! function_exists('form_dropdown')) } else { - $form .= '<option value="'.form_prep($key).'"' + $form .= '<option value="'.html_escape($key).'"' .(in_array($key, $selected) ? ' selected="selected"' : '').'>' .(string) $val."</option>\n"; } @@ -653,28 +653,13 @@ if ( ! function_exists('form_prep')) * * Formats text so that it can be safely placed in a form field in the event it has HTML tags. * + * @deprecated 3.0.0 An alias for html_escape() * @param string|string[] $str Value to escape - * @param bool $is_textarea Whether we're escaping for a textarea element * @return string|string[] Escaped values */ - function form_prep($str = '', $is_textarea = FALSE) + function form_prep($str) { - if (is_array($str)) - { - foreach (array_keys($str) as $key) - { - $str[$key] = form_prep($str[$key], $is_textarea); - } - - return $str; - } - - if ($is_textarea === TRUE) - { - return str_replace(array('<', '>'), array('<', '>'), stripslashes($str)); - } - - return str_replace(array("'", '"'), array(''', '"'), stripslashes($str)); + return html_escape($str, TRUE); } } @@ -691,10 +676,9 @@ if ( ! function_exists('set_value')) * * @param string $field Field name * @param string $default Default value - * @param bool $is_textarea Whether the field is a textarea element * @return string */ - function set_value($field = '', $default = '', $is_textarea = FALSE) + function set_value($field, $default = '') { $CI =& get_instance(); @@ -702,7 +686,7 @@ if ( ! function_exists('set_value')) ? $CI->form_validation->set_value($field, $default) : $CI->input->post($field, FALSE); - return form_prep($value === NULL ? $default : $value, $is_textarea); + return html_escape($value === NULL ? $default : $value); } } @@ -721,7 +705,7 @@ if ( ! function_exists('set_select')) * @param bool * @return string */ - function set_select($field = '', $value = '', $default = FALSE) + function set_select($field, $value = '', $default = FALSE) { $CI =& get_instance(); @@ -768,7 +752,7 @@ if ( ! function_exists('set_checkbox')) * @param bool * @return string */ - function set_checkbox($field = '', $value = '', $default = FALSE) + function set_checkbox($field, $value = '', $default = FALSE) { $CI =& get_instance(); @@ -815,7 +799,7 @@ if ( ! function_exists('set_radio')) * @param bool $default * @return string */ - function set_radio($field = '', $value = '', $default = FALSE) + function set_radio($field, $value = '', $default = FALSE) { $CI =& get_instance(); @@ -921,7 +905,7 @@ if ( ! function_exists('_parse_form_attributes')) { if ($key === 'value') { - $val = form_prep($val); + $val = html_escape($val); } elseif ($key === 'name' && ! strlen($default['name'])) { @@ -1012,6 +996,3 @@ if ( ! function_exists('_get_validation_object')) return $return; } } - -/* End of file form_helper.php */ -/* Location: ./system/helpers/form_helper.php */
\ No newline at end of file diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index daa380c15..28fbe00be 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -408,6 +408,3 @@ if ( ! function_exists('nbs')) return str_repeat(' ', $num); } } - -/* End of file html_helper.php */ -/* Location: ./system/helpers/html_helper.php */
\ No newline at end of file diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php index 8ce671367..d8ed45df9 100644 --- a/system/helpers/inflector_helper.php +++ b/system/helpers/inflector_helper.php @@ -243,6 +243,3 @@ if ( ! function_exists('is_countable')) ); } } - -/* End of file inflector_helper.php */ -/* Location: ./system/helpers/inflector_helper.php */
\ No newline at end of file diff --git a/system/helpers/language_helper.php b/system/helpers/language_helper.php index ec448ad69..25ce8abe1 100644 --- a/system/helpers/language_helper.php +++ b/system/helpers/language_helper.php @@ -73,6 +73,3 @@ if ( ! function_exists('lang')) return $line; } } - -/* End of file language_helper.php */ -/* Location: ./system/helpers/language_helper.php */
\ No newline at end of file diff --git a/system/helpers/number_helper.php b/system/helpers/number_helper.php index 50b6c44d7..3a24259e1 100644 --- a/system/helpers/number_helper.php +++ b/system/helpers/number_helper.php @@ -92,6 +92,3 @@ if ( ! function_exists('byte_format')) return number_format($num, $precision).' '.$unit; } } - -/* End of file number_helper.php */ -/* Location: ./system/helpers/number_helper.php */
\ No newline at end of file diff --git a/system/helpers/path_helper.php b/system/helpers/path_helper.php index ecf61d29e..c23ec6435 100644 --- a/system/helpers/path_helper.php +++ b/system/helpers/path_helper.php @@ -80,6 +80,3 @@ if ( ! function_exists('set_realpath')) return is_dir($path) ? rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR : $path; } } - -/* End of file path_helper.php */ -/* Location: ./system/helpers/path_helper.php */
\ No newline at end of file diff --git a/system/helpers/security_helper.php b/system/helpers/security_helper.php index fb0519272..adbf136bb 100644 --- a/system/helpers/security_helper.php +++ b/system/helpers/security_helper.php @@ -135,6 +135,3 @@ if ( ! function_exists('encode_php_tags')) return str_replace(array('<?', '?>'), array('<?', '?>'), $str); } } - -/* End of file security_helper.php */ -/* Location: ./system/helpers/security_helper.php */
\ No newline at end of file diff --git a/system/helpers/smiley_helper.php b/system/helpers/smiley_helper.php index 164222c1d..d053dd22c 100644 --- a/system/helpers/smiley_helper.php +++ b/system/helpers/smiley_helper.php @@ -253,6 +253,3 @@ if ( ! function_exists('_get_smiley_array')) return $_smileys; } } - -/* End of file smiley_helper.php */ -/* Location: ./system/helpers/smiley_helper.php */
\ No newline at end of file diff --git a/system/helpers/string_helper.php b/system/helpers/string_helper.php index 5daae987c..5860e15fb 100644 --- a/system/helpers/string_helper.php +++ b/system/helpers/string_helper.php @@ -303,6 +303,3 @@ if ( ! function_exists('repeater')) return ($num > 0) ? str_repeat($data, $num) : ''; } } - -/* End of file string_helper.php */ -/* Location: ./system/helpers/string_helper.php */
\ No newline at end of file diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php index 3a1f11c21..f2290c895 100644 --- a/system/helpers/text_helper.php +++ b/system/helpers/text_helper.php @@ -547,6 +547,3 @@ if ( ! function_exists('ellipsize')) return $beg.$ellipsis.$end; } } - -/* End of file text_helper.php */ -/* Location: ./system/helpers/text_helper.php */
\ No newline at end of file diff --git a/system/helpers/typography_helper.php b/system/helpers/typography_helper.php index e5bfbc0b9..45bb9b1d4 100644 --- a/system/helpers/typography_helper.php +++ b/system/helpers/typography_helper.php @@ -102,6 +102,3 @@ if ( ! function_exists('entity_decode')) return get_instance()->security->entity_decode($str, $charset); } } - -/* End of file typography_helper.php */ -/* Location: ./system/helpers/typography_helper.php */
\ No newline at end of file diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index afec35aea..bf623b000 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -567,6 +567,3 @@ if ( ! function_exists('redirect')) exit; } } - -/* End of file url_helper.php */ -/* Location: ./system/helpers/url_helper.php */
\ No newline at end of file diff --git a/system/helpers/xml_helper.php b/system/helpers/xml_helper.php index e0b2f58f3..55f9c2f66 100644 --- a/system/helpers/xml_helper.php +++ b/system/helpers/xml_helper.php @@ -88,6 +88,3 @@ if ( ! function_exists('xml_convert')) return $str; } } - -/* End of file xml_helper.php */ -/* Location: ./system/helpers/xml_helper.php */
\ No newline at end of file diff --git a/system/language/english/calendar_lang.php b/system/language/english/calendar_lang.php index b95b36eef..9d3352868 100644 --- a/system/language/english/calendar_lang.php +++ b/system/language/english/calendar_lang.php @@ -82,6 +82,3 @@ $lang['cal_september'] = 'September'; $lang['cal_october'] = 'October'; $lang['cal_november'] = 'November'; $lang['cal_december'] = 'December'; - -/* End of file calendar_lang.php */ -/* Location: ./system/language/english/calendar_lang.php */
\ No newline at end of file diff --git a/system/language/english/date_lang.php b/system/language/english/date_lang.php index 0edbe28f3..c61c9c2ad 100644 --- a/system/language/english/date_lang.php +++ b/system/language/english/date_lang.php @@ -92,6 +92,3 @@ $lang['UP12'] = '(UTC +12:00) Fiji, Gilbert Islands, Kamchatka Time, New Zealand $lang['UP1275'] = '(UTC +12:45) Chatham Islands Standard Time'; $lang['UP13'] = '(UTC +13:00) Samoa Time Zone, Phoenix Islands Time, Tonga'; $lang['UP14'] = '(UTC +14:00) Line Islands'; - -/* End of file date_lang.php */ -/* Location: ./system/language/english/date_lang.php */
\ No newline at end of file diff --git a/system/language/english/db_lang.php b/system/language/english/db_lang.php index 85239b3cd..5b67da659 100644 --- a/system/language/english/db_lang.php +++ b/system/language/english/db_lang.php @@ -61,6 +61,3 @@ $lang['db_column_name_required'] = 'A column name is required for that operation $lang['db_column_definition_required'] = 'A column definition is required for that operation.'; $lang['db_unable_to_set_charset'] = 'Unable to set client connection character set: %s'; $lang['db_error_heading'] = 'A Database Error Occurred'; - -/* End of file db_lang.php */ -/* Location: ./system/language/english/db_lang.php */
\ No newline at end of file diff --git a/system/language/english/email_lang.php b/system/language/english/email_lang.php index cd8fa8932..cc6b2fd5a 100644 --- a/system/language/english/email_lang.php +++ b/system/language/english/email_lang.php @@ -56,6 +56,3 @@ $lang['email_smtp_auth_un'] = 'Failed to authenticate username. Error: %s'; $lang['email_smtp_auth_pw'] = 'Failed to authenticate password. Error: %s'; $lang['email_smtp_data_failure'] = 'Unable to send data: %s'; $lang['email_exit_status'] = 'Exit status code: %s'; - -/* End of file email_lang.php */ -/* Location: ./system/language/english/email_lang.php */
\ No newline at end of file diff --git a/system/language/english/form_validation_lang.php b/system/language/english/form_validation_lang.php index 558949bf6..75d6e4b82 100644 --- a/system/language/english/form_validation_lang.php +++ b/system/language/english/form_validation_lang.php @@ -65,6 +65,4 @@ $lang['form_validation_less_than_equal_to'] = 'The {field} field must contain a $lang['form_validation_greater_than'] = 'The {field} field must contain a number greater than {param}.'; $lang['form_validation_greater_than_equal_to'] = 'The {field} field must contain a number greater than or equal to {param}.'; $lang['form_validation_error_message_not_set'] = 'Unable to access an error message corresponding to your field name {field}.'; - -/* End of file form_validation_lang.php */ -/* Location: ./system/language/english/form_validation_lang.php */
\ No newline at end of file +$lang['form_validation_in_list'] = 'The {field} field must be one of: {param}.'; diff --git a/system/language/english/ftp_lang.php b/system/language/english/ftp_lang.php index 45e866dfd..bccc27397 100644 --- a/system/language/english/ftp_lang.php +++ b/system/language/english/ftp_lang.php @@ -49,6 +49,3 @@ $lang['ftp_no_source_file'] = 'Unable to locate the source file. Please check y $lang['ftp_unable_to_rename'] = 'Unable to rename the file.'; $lang['ftp_unable_to_delete'] = 'Unable to delete the file.'; $lang['ftp_unable_to_move'] = 'Unable to move the file. Please make sure the destination directory exists.'; - -/* End of file ftp_lang.php */ -/* Location: ./system/language/english/ftp_lang.php */
\ No newline at end of file diff --git a/system/language/english/imglib_lang.php b/system/language/english/imglib_lang.php index 16f51a262..41129cd6e 100644 --- a/system/language/english/imglib_lang.php +++ b/system/language/english/imglib_lang.php @@ -54,6 +54,3 @@ $lang['imglib_invalid_path'] = 'The path to the image is not correct.'; $lang['imglib_copy_failed'] = 'The image copy routine failed.'; $lang['imglib_missing_font'] = 'Unable to find a font to use.'; $lang['imglib_save_failed'] = 'Unable to save the image. Please make sure the image and file directory are writable.'; - -/* End of file imglib_lang.php */ -/* Location: ./system/language/english/imglib_lang.php */
\ No newline at end of file diff --git a/system/language/english/migration_lang.php b/system/language/english/migration_lang.php index 9dbff7af3..9e4a7c58c 100644 --- a/system/language/english/migration_lang.php +++ b/system/language/english/migration_lang.php @@ -45,6 +45,3 @@ $lang['migration_class_doesnt_exist'] = 'The migration class "%s" could not be f $lang['migration_missing_up_method'] = 'The migration class "%s" is missing an "up" method.'; $lang['migration_missing_down_method'] = 'The migration class "%s" is missing a "down" method.'; $lang['migration_invalid_filename'] = 'Migration "%s" has an invalid filename.'; - -/* End of file migration_lang.php */ -/* Location: ./system/language/english/migration_lang.php */
\ No newline at end of file diff --git a/system/language/english/number_lang.php b/system/language/english/number_lang.php index f2ac94570..db229c5b5 100644 --- a/system/language/english/number_lang.php +++ b/system/language/english/number_lang.php @@ -42,6 +42,3 @@ $lang['gigabyte_abbr'] = 'GB'; $lang['megabyte_abbr'] = 'MB'; $lang['kilobyte_abbr'] = 'KB'; $lang['bytes'] = 'Bytes'; - -/* End of file number_lang.php */ -/* Location: ./system/language/english/number_lang.php */
\ No newline at end of file diff --git a/system/language/english/pagination_lang.php b/system/language/english/pagination_lang.php index 70eb75f94..be133781e 100644 --- a/system/language/english/pagination_lang.php +++ b/system/language/english/pagination_lang.php @@ -41,6 +41,3 @@ $lang['pagination_first_link'] = '‹ First'; $lang['pagination_next_link'] = '>'; $lang['pagination_prev_link'] = '<'; $lang['pagination_last_link'] = 'Last ›'; - -/* End of file pagination_lang.php */ -/* Location: ./system/language/english/pagination_lang.php */
\ No newline at end of file diff --git a/system/language/english/profiler_lang.php b/system/language/english/profiler_lang.php index 1d111044f..ba3edba60 100644 --- a/system/language/english/profiler_lang.php +++ b/system/language/english/profiler_lang.php @@ -58,6 +58,3 @@ $lang['profiler_no_profiles'] = 'No Profile data - all Profiler sections have be $lang['profiler_section_hide'] = 'Hide'; $lang['profiler_section_show'] = 'Show'; $lang['profiler_seconds'] = 'seconds'; - -/* End of file profiler_lang.php */ -/* Location: ./system/language/english/profiler_lang.php */
\ No newline at end of file diff --git a/system/language/english/unit_test_lang.php b/system/language/english/unit_test_lang.php index 52af2759c..639829ed8 100644 --- a/system/language/english/unit_test_lang.php +++ b/system/language/english/unit_test_lang.php @@ -56,6 +56,3 @@ $lang['ut_object'] = 'Object'; $lang['ut_resource'] = 'Resource'; $lang['ut_null'] = 'Null'; $lang['ut_notes'] = 'Notes'; - -/* End of file unit_test_lang.php */ -/* Location: ./system/language/english/unit_test_lang.php */
\ No newline at end of file diff --git a/system/language/english/upload_lang.php b/system/language/english/upload_lang.php index eeed557cd..a536dda31 100644 --- a/system/language/english/upload_lang.php +++ b/system/language/english/upload_lang.php @@ -53,6 +53,3 @@ $lang['upload_no_filepath'] = 'The upload path does not appear to be valid.'; $lang['upload_no_file_types'] = 'You have not specified any allowed file types.'; $lang['upload_bad_filename'] = 'The file name you submitted already exists on the server.'; $lang['upload_not_writable'] = 'The upload destination folder does not appear to be writable.'; - -/* End of file upload_lang.php */ -/* Location: ./system/language/english/upload_lang.php */
\ No newline at end of file diff --git a/system/libraries/Cache/Cache.php b/system/libraries/Cache/Cache.php index bee0c068b..40ac70103 100644 --- a/system/libraries/Cache/Cache.php +++ b/system/libraries/Cache/Cache.php @@ -272,6 +272,3 @@ class CI_Cache extends CI_Driver_Library { } } - -/* End of file Cache.php */ -/* Location: ./system/libraries/Cache/Cache.php */
\ No newline at end of file diff --git a/system/libraries/Cache/drivers/Cache_apc.php b/system/libraries/Cache/drivers/Cache_apc.php index 3c441a2f2..e0d2ffb39 100644 --- a/system/libraries/Cache/drivers/Cache_apc.php +++ b/system/libraries/Cache/drivers/Cache_apc.php @@ -208,6 +208,3 @@ class CI_Cache_apc extends CI_Driver { } } - -/* End of file Cache_apc.php */ -/* Location: ./system/libraries/Cache/drivers/Cache_apc.php */
\ No newline at end of file diff --git a/system/libraries/Cache/drivers/Cache_dummy.php b/system/libraries/Cache/drivers/Cache_dummy.php index e05935dca..bf80945a9 100644 --- a/system/libraries/Cache/drivers/Cache_dummy.php +++ b/system/libraries/Cache/drivers/Cache_dummy.php @@ -170,6 +170,3 @@ class CI_Cache_dummy extends CI_Driver { } } - -/* End of file Cache_dummy.php */ -/* Location: ./system/libraries/Cache/drivers/Cache_dummy.php */
\ No newline at end of file diff --git a/system/libraries/Cache/drivers/Cache_file.php b/system/libraries/Cache/drivers/Cache_file.php index 3ff32cf60..68bc1ec96 100644 --- a/system/libraries/Cache/drivers/Cache_file.php +++ b/system/libraries/Cache/drivers/Cache_file.php @@ -284,6 +284,3 @@ class CI_Cache_file extends CI_Driver { } } - -/* End of file Cache_file.php */ -/* Location: ./system/libraries/Cache/drivers/Cache_file.php */
\ No newline at end of file diff --git a/system/libraries/Cache/drivers/Cache_memcached.php b/system/libraries/Cache/drivers/Cache_memcached.php index 03174bda1..b90b561c9 100644 --- a/system/libraries/Cache/drivers/Cache_memcached.php +++ b/system/libraries/Cache/drivers/Cache_memcached.php @@ -293,6 +293,3 @@ class CI_Cache_memcached extends CI_Driver { } } - -/* End of file Cache_memcached.php */ -/* Location: ./system/libraries/Cache/drivers/Cache_memcached.php */
\ No newline at end of file diff --git a/system/libraries/Cache/drivers/Cache_redis.php b/system/libraries/Cache/drivers/Cache_redis.php index 78563aab0..f2a41cc67 100644 --- a/system/libraries/Cache/drivers/Cache_redis.php +++ b/system/libraries/Cache/drivers/Cache_redis.php @@ -335,6 +335,3 @@ class CI_Cache_redis extends CI_Driver } } - -/* End of file Cache_redis.php */ -/* Location: ./system/libraries/Cache/drivers/Cache_redis.php */
\ No newline at end of file diff --git a/system/libraries/Cache/drivers/Cache_wincache.php b/system/libraries/Cache/drivers/Cache_wincache.php index 4592d1dd8..528b2b9bf 100644 --- a/system/libraries/Cache/drivers/Cache_wincache.php +++ b/system/libraries/Cache/drivers/Cache_wincache.php @@ -204,6 +204,3 @@ class CI_Cache_wincache extends CI_Driver { } } - -/* End of file Cache_wincache.php */ -/* Location: ./system/libraries/Cache/drivers/Cache_wincache.php */
\ No newline at end of file diff --git a/system/libraries/Calendar.php b/system/libraries/Calendar.php index e6ca225bf..014daac58 100644 --- a/system/libraries/Calendar.php +++ b/system/libraries/Calendar.php @@ -138,7 +138,7 @@ class CI_Calendar { empty($config) OR $this->initialize($config); - log_message('debug', 'Calendar Class Initialized'); + log_message('info', 'Calendar Class Initialized'); } // -------------------------------------------------------------------- @@ -548,6 +548,3 @@ class CI_Calendar { } } - -/* End of file Calendar.php */ -/* Location: ./system/libraries/Calendar.php */
\ No newline at end of file diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php index a0fe1053d..bf27c6392 100644 --- a/system/libraries/Cart.php +++ b/system/libraries/Cart.php @@ -115,7 +115,7 @@ class CI_Cart { $this->_cart_contents = array('cart_total' => 0, 'total_items' => 0); } - log_message('debug', 'Cart Class Initialized'); + log_message('info', 'Cart Class Initialized'); } // -------------------------------------------------------------------- @@ -565,6 +565,3 @@ class CI_Cart { } } - -/* End of file Cart.php */ -/* Location: ./system/libraries/Cart.php */
\ No newline at end of file diff --git a/system/libraries/Driver.php b/system/libraries/Driver.php index 75466a186..da4c548e6 100644 --- a/system/libraries/Driver.php +++ b/system/libraries/Driver.php @@ -340,6 +340,3 @@ class CI_Driver { } } - -/* End of file Driver.php */ -/* Location: ./system/libraries/Driver.php */
\ No newline at end of file diff --git a/system/libraries/Email.php b/system/libraries/Email.php index c042aaade..4e0e0cd9f 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -421,7 +421,7 @@ class CI_Email { $this->_safe_mode = ( ! is_php('5.4') && ini_get('safe_mode')); $this->charset = strtoupper($this->charset); - log_message('debug', 'Email Class Initialized'); + log_message('info', 'Email Class Initialized'); } // -------------------------------------------------------------------- @@ -2271,6 +2271,3 @@ class CI_Email { } } - -/* End of file Email.php */ -/* Location: ./system/libraries/Email.php */
\ No newline at end of file diff --git a/system/libraries/Encrypt.php b/system/libraries/Encrypt.php index 45b3027eb..5faf1f206 100644 --- a/system/libraries/Encrypt.php +++ b/system/libraries/Encrypt.php @@ -97,7 +97,7 @@ class CI_Encrypt { show_error('The Encrypt library requires the Mcrypt extension.'); } - log_message('debug', 'Encrypt Class Initialized'); + log_message('info', 'Encrypt Class Initialized'); } // -------------------------------------------------------------------- @@ -478,6 +478,3 @@ class CI_Encrypt { } } - -/* End of file Encrypt.php */ -/* Location: ./system/libraries/Encrypt.php */
\ No newline at end of file diff --git a/system/libraries/Encryption.php b/system/libraries/Encryption.php index ef67b4cd5..fad4ea7f8 100644 --- a/system/libraries/Encryption.php +++ b/system/libraries/Encryption.php @@ -171,7 +171,7 @@ class CI_Encryption { $this->_key = $key; } - log_message('debug', 'Encryption Class Initialized'); + log_message('info', 'Encryption Class Initialized'); } // -------------------------------------------------------------------- @@ -248,7 +248,7 @@ class CI_Encryption { $params['mode'] = strtolower($params['mode']); if ( ! isset($this->_modes['mcrypt'][$params['mode']])) { - log_message('error', 'Encryption: MCrypt mode '.strtotupper($params['mode']).' is not available.'); + log_message('error', 'Encryption: MCrypt mode '.strtoupper($params['mode']).' is not available.'); } else { @@ -268,7 +268,7 @@ class CI_Encryption { if ($this->_handle = mcrypt_module_open($this->_cipher, '', $this->_mode, '')) { - log_message('debug', 'Encryption: MCrypt cipher '.strtoupper($this->_cipher).' initialized in '.strtoupper($this->_mode).' mode.'); + log_message('info', 'Encryption: MCrypt cipher '.strtoupper($this->_cipher).' initialized in '.strtoupper($this->_mode).' mode.'); } else { @@ -299,7 +299,7 @@ class CI_Encryption { $params['mode'] = strtolower($params['mode']); if ( ! isset($this->_modes['openssl'][$params['mode']])) { - log_message('error', 'Encryption: OpenSSL mode '.strtotupper($params['mode']).' is not available.'); + log_message('error', 'Encryption: OpenSSL mode '.strtoupper($params['mode']).' is not available.'); } else { @@ -322,7 +322,7 @@ class CI_Encryption { else { $this->_handle = $handle; - log_message('debug', 'Encryption: OpenSSL initialized with method '.strtoupper($handle).'.'); + log_message('info', 'Encryption: OpenSSL initialized with method '.strtoupper($handle).'.'); } } } @@ -924,6 +924,3 @@ class CI_Encryption { : substr($str, $start); } } - -/* End of file Encryption.php */ -/* Location: ./system/libraries/Encryption.php */
\ No newline at end of file diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index f731544b1..f161b40e7 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -146,7 +146,7 @@ class CI_Form_validation { // Automatically load the form helper $this->CI->load->helper('form'); - log_message('debug', 'Form Validation Class Initialized'); + log_message('info', 'Form Validation Class Initialized'); } // -------------------------------------------------------------------- @@ -1449,6 +1449,20 @@ class CI_Form_validation { // -------------------------------------------------------------------- /** + * Value should be within an array of values + * + * @param string + * @param string + * @return bool + */ + public function in_list($value, $list) + { + return in_array($value, explode(',', $list), TRUE); + } + + // -------------------------------------------------------------------- + + /** * Is a Natural number (0,1,2,3, etc.) * * @param string @@ -1589,6 +1603,3 @@ class CI_Form_validation { } } - -/* End of file Form_validation.php */ -/* Location: ./system/libraries/Form_validation.php */
\ No newline at end of file diff --git a/system/libraries/Ftp.php b/system/libraries/Ftp.php index f6279cfc5..af45bb55f 100644 --- a/system/libraries/Ftp.php +++ b/system/libraries/Ftp.php @@ -112,7 +112,7 @@ class CI_FTP { public function __construct($config = array()) { empty($config) OR $this->initialize($config); - log_message('debug', 'FTP Class Initialized'); + log_message('info', 'FTP Class Initialized'); } // -------------------------------------------------------------------- @@ -665,6 +665,3 @@ class CI_FTP { } } - -/* End of file Ftp.php */ -/* Location: ./system/libraries/Ftp.php */
\ No newline at end of file diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index a70a7bb6f..e056654bb 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -392,7 +392,7 @@ class CI_Image_lib { $this->initialize($props); } - log_message('debug', 'Image Lib Class Initialized'); + log_message('info', 'Image Lib Class Initialized'); } // -------------------------------------------------------------------- @@ -1212,6 +1212,13 @@ class CI_Image_lib { imagecopymerge($src_img, $wm_img, $x_axis, $y_axis, 0, 0, $wm_width, $wm_height, $this->wm_opacity); } + // We can preserve transparency for PNG images + if ($this->image_type === 3) + { + imagealphablending($src_img, FALSE); + imagesavealpha($src_img, TRUE); + } + // Output the image if ($this->dynamic_output === TRUE) { @@ -1304,12 +1311,14 @@ class CI_Image_lib { $y_axis = $this->wm_vrt_offset + $this->wm_padding; if ($this->wm_use_drop_shadow === FALSE) + { $this->wm_shadow_distance = 0; + } $this->wm_vrt_alignment = strtoupper($this->wm_vrt_alignment[0]); $this->wm_hor_alignment = strtoupper($this->wm_hor_alignment[0]); - // Set verticle alignment + // Set vertical alignment if ($this->wm_vrt_alignment === 'M') { $y_axis += ($this->orig_height / 2) + ($fontheight / 2); @@ -1318,53 +1327,67 @@ class CI_Image_lib { { $y_axis += $this->orig_height - $fontheight - $this->wm_shadow_distance - ($fontheight / 2); } - - $x_shad = $x_axis + $this->wm_shadow_distance; - $y_shad = $y_axis + $this->wm_shadow_distance; - + + // Set horizontal alignment + if ($this->wm_hor_alignment === 'R') + { + $x_axis += $this->orig_width - ($fontwidth * strlen($this->wm_text)) - $this->wm_shadow_distance; + } + elseif ($this->wm_hor_alignment === 'C') + { + $x_axis += floor(($this->orig_width - ($fontwidth * strlen($this->wm_text))) / 2); + } + if ($this->wm_use_drop_shadow) { - // Set horizontal alignment - if ($this->wm_hor_alignment === 'R') - { - $x_shad += $this->orig_width - ($fontwidth * strlen($this->wm_text)); - $x_axis += $this->orig_width - ($fontwidth * strlen($this->wm_text)); - } - elseif ($this->wm_hor_alignment === 'C') - { - $x_shad += floor(($this->orig_width - ($fontwidth * strlen($this->wm_text))) / 2); - $x_axis += floor(($this->orig_width - ($fontwidth * strlen($this->wm_text))) / 2); - } - - /* Set RGB values for text and shadow + // Offset from text + $x_shad = $x_axis + $this->wm_shadow_distance; + $y_shad = $y_axis + $this->wm_shadow_distance; + + /* Set RGB values for shadow * * First character is #, so we don't really need it. * Get the rest of the string and split it into 2-length * hex values: */ - $txt_color = str_split(substr($this->wm_font_color, 1, 6), 2); - $txt_color = imagecolorclosest($src_img, hexdec($txt_color[0]), hexdec($txt_color[1]), hexdec($txt_color[2])); $drp_color = str_split(substr($this->wm_shadow_color, 1, 6), 2); $drp_color = imagecolorclosest($src_img, hexdec($drp_color[0]), hexdec($drp_color[1]), hexdec($drp_color[2])); - - // Add the text to the source image + + // Add the shadow to the source image if ($this->wm_use_truetype) { imagettftext($src_img, $this->wm_font_size, 0, $x_shad, $y_shad, $drp_color, $this->wm_font_path, $this->wm_text); - imagettftext($src_img, $this->wm_font_size, 0, $x_axis, $y_axis, $txt_color, $this->wm_font_path, $this->wm_text); } else { imagestring($src_img, $this->wm_font_size, $x_shad, $y_shad, $this->wm_text, $drp_color); - imagestring($src_img, $this->wm_font_size, $x_axis, $y_axis, $this->wm_text, $txt_color); } + } + + /* Set RGB values for text + * + * First character is #, so we don't really need it. + * Get the rest of the string and split it into 2-length + * hex values: + */ + $txt_color = str_split(substr($this->wm_font_color, 1, 6), 2); + $txt_color = imagecolorclosest($src_img, hexdec($txt_color[0]), hexdec($txt_color[1]), hexdec($txt_color[2])); - // We can preserve transparency for PNG images - if ($this->image_type === 3) - { - imagealphablending($src_img, FALSE); - imagesavealpha($src_img, TRUE); - } + // Add the text to the source image + if ($this->wm_use_truetype) + { + imagettftext($src_img, $this->wm_font_size, 0, $x_axis, $y_axis, $txt_color, $this->wm_font_path, $this->wm_text); + } + else + { + imagestring($src_img, $this->wm_font_size, $x_axis, $y_axis, $this->wm_text, $txt_color); + } + + // We can preserve transparency for PNG images + if ($this->image_type === 3) + { + imagealphablending($src_img, FALSE); + imagesavealpha($src_img, TRUE); } // Output the final image @@ -1794,6 +1817,3 @@ class CI_Image_lib { } } - -/* End of file Image_lib.php */ -/* Location: ./system/libraries/Image_lib.php */
\ No newline at end of file diff --git a/system/libraries/Javascript.php b/system/libraries/Javascript.php index 94586c069..4cc628692 100644 --- a/system/libraries/Javascript.php +++ b/system/libraries/Javascript.php @@ -85,7 +85,7 @@ class CI_Javascript { // make js to refer to current library $this->js =& $this->CI->$js_library_driver; - log_message('debug', 'Javascript Class Initialized and loaded. Driver used: '.$js_library_driver); + log_message('info', 'Javascript Class Initialized and loaded. Driver used: '.$js_library_driver); } // -------------------------------------------------------------------- @@ -854,6 +854,3 @@ class CI_Javascript { } } - -/* End of file Javascript.php */ -/* Location: ./system/libraries/Javascript.php */
\ No newline at end of file diff --git a/system/libraries/Javascript/Jquery.php b/system/libraries/Javascript/Jquery.php index 1c6331f6b..25acceef7 100644 --- a/system/libraries/Javascript/Jquery.php +++ b/system/libraries/Javascript/Jquery.php @@ -115,7 +115,7 @@ class CI_Jquery extends CI_Javascript { $this->script(); } - log_message('debug', 'Jquery Class Initialized'); + log_message('info', 'Jquery Class Initialized'); } // -------------------------------------------------------------------- @@ -1074,6 +1074,3 @@ class CI_Jquery extends CI_Javascript { } } - -/* End of file Jquery.php */ -/* Location: ./system/libraries/Jquery.php */
\ No newline at end of file diff --git a/system/libraries/Migration.php b/system/libraries/Migration.php index f46d45f5a..8ce4243fe 100644 --- a/system/libraries/Migration.php +++ b/system/libraries/Migration.php @@ -126,7 +126,7 @@ class CI_Migration { $this->{'_'.$key} = $val; } - log_message('debug', 'Migrations class initialized'); + log_message('info', 'Migrations Class Initialized'); // Are they trying to use migrations while it is disabled? if ($this->_migration_enabled !== TRUE) @@ -444,6 +444,3 @@ class CI_Migration { } } - -/* End of file Migration.php */ -/* Location: ./system/libraries/Migration.php */
\ No newline at end of file diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php index 1081fbec7..d63f61df6 100644 --- a/system/libraries/Pagination.php +++ b/system/libraries/Pagination.php @@ -299,6 +299,13 @@ class CI_Pagination { protected $reuse_query_string = FALSE; /** + * Use global URL suffix flag + * + * @var bool + */ + protected $use_global_url_suffix = FALSE; + + /** * Data page attribute * * @var string @@ -333,7 +340,7 @@ class CI_Pagination { } $this->initialize($params); - log_message('debug', 'Pagination Class Initialized'); + log_message('info', 'Pagination Class Initialized'); } // -------------------------------------------------------------------- @@ -373,6 +380,11 @@ class CI_Pagination { $this->page_query_string = TRUE; } + if ($this->use_global_url_suffix === TRUE) + { + $this->suffix = $this->CI->config->item('url_suffix'); + } + return $this; } @@ -682,6 +694,3 @@ class CI_Pagination { } } - -/* End of file Pagination.php */ -/* Location: ./system/libraries/Pagination.php */
\ No newline at end of file diff --git a/system/libraries/Parser.php b/system/libraries/Parser.php index 5a2024955..57981af95 100644 --- a/system/libraries/Parser.php +++ b/system/libraries/Parser.php @@ -79,6 +79,7 @@ class CI_Parser { public function __construct() { $this->CI =& get_instance(); + log_message('info', 'Parser Class Initialized'); } // -------------------------------------------------------------------- @@ -245,6 +246,3 @@ class CI_Parser { } } - -/* End of file Parser.php */ -/* Location: ./system/libraries/Parser.php */
\ No newline at end of file diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php index 9a4e833cc..f35d23faf 100644 --- a/system/libraries/Profiler.php +++ b/system/libraries/Profiler.php @@ -116,6 +116,7 @@ class CI_Profiler { } $this->set_sections($config); + log_message('info', 'Profiler Class Initialized'); } // -------------------------------------------------------------------- @@ -573,6 +574,3 @@ class CI_Profiler { } } - -/* End of file Profiler.php */ -/* Location: ./system/libraries/Profiler.php */
\ No newline at end of file diff --git a/system/libraries/Session/Session.php b/system/libraries/Session/Session.php index 452afd5e5..2551e54e9 100644 --- a/system/libraries/Session/Session.php +++ b/system/libraries/Session/Session.php @@ -40,731 +40,856 @@ defined('BASEPATH') OR exit('No direct script access allowed'); /** * CodeIgniter Session Class * - * The user interface defined by EllisLab, now with puggable drivers to manage different storage mechanisms. - * By default, the cookie session driver will load, but the 'sess_driver' config/param item (see above) can be - * used to specify the 'native' driver, or any other you might create. - * Once loaded, this driver setup is a drop-in replacement for the former CI_Session library, taking its place as the - * 'session' member of the global controller framework (e.g.: $CI->session or $this->session). - * In keeping with the CI_Driver methodology, multiple drivers may be loaded, although this might be a bit confusing. - * The CI_Session library class keeps track of the most recently loaded driver as "current" to call for driver methods. - * Ideally, one driver is loaded and all calls go directly through the main library interface. However, any methods - * called through the specific driver will switch the "current" driver to itself before invoking the library method - * (which will then call back into the driver for low-level operations). So, alternation between two drivers can be - * achieved by specifying which driver to use for each call (e.g.: $this->session->native->set_userdata('foo', 'bar'); - * $this->session->cookie->userdata('foo'); $this->session->native->unset_userdata('foo');). Notice in the previous - * example that the _native_ userdata value 'foo' would be set to 'bar', which would NOT be returned by the call for - * the _cookie_ userdata 'foo', nor would the _cookie_ value be unset by the call to unset the _native_ 'foo' value. - * * @package CodeIgniter * @subpackage Libraries * @category Sessions - * @author EllisLab Dev Team + * @author Andrey Andreev * @link http://codeigniter.com/user_guide/libraries/sessions.html */ -class CI_Session extends CI_Driver_Library { - - /** - * Initialization parameters - * - * @var array - */ - public $params = array(); +class CI_Session { /** - * Valid drivers list + * Userdata array * - * @var array + * Just a reference to $_SESSION, for BC purposes. */ - public $valid_drivers = array('native', 'cookie'); + public $userdata; - /** - * Current driver in use - * - * @var string - */ - public $current = NULL; - - /** - * User data - * - * @var array - */ - protected $userdata = array(); - - // ------------------------------------------------------------------------ - - const FLASHDATA_KEY = 'flash'; - const FLASHDATA_NEW = ':new:'; - const FLASHDATA_OLD = ':old:'; - const FLASHDATA_EXP = ':exp:'; - const EXPIRATION_KEY = '__expirations'; - const TEMP_EXP_DEF = 300; + protected $_driver = 'files'; + protected $_config; // ------------------------------------------------------------------------ /** - * CI_Session constructor + * Class constructor * - * The constructor loads the configured driver ('sess_driver' in config.php or as a parameter), running - * routines in its constructor, and manages flashdata aging. - * - * @param array Configuration parameters + * @param array $params Configuration parameters * @return void */ public function __construct(array $params = array()) { - $_config =& get_instance()->config; - // No sessions under CLI if (is_cli()) { + log_message('debug', 'Session: Initialization under CLI aborted.'); return; } - - log_message('debug', 'CI_Session Class Initialized'); - - // Add possible extra entries to our valid drivers list - $drivers = isset($params['sess_valid_drivers']) ? $params['sess_valid_drivers'] : $_config->item('sess_valid_drivers'); - if ( ! empty($drivers)) + elseif ((bool) ini_get('session.auto_start')) { - $drivers = array_map('strtolower', (array) $drivers); - $this->valid_drivers = array_merge($this->valid_drivers, array_diff($drivers, $this->valid_drivers)); + log_message('error', 'Session: session.auto_start is enabled in php.ini. Aborting.'); + return; } - - // Get driver to load - $driver = isset($params['sess_driver']) ? $params['sess_driver'] : $_config->item('sess_driver'); - if ( ! $driver) + elseif ( ! empty($params['driver'])) + { + $this->_driver = $params['driver']; + unset($params['driver']); + } + elseif ($driver = config_item('sess_driver')) + { + $this->_driver = $driver; + } + // Note: BC workaround + elseif (config_item('sess_use_database')) { - log_message('debug', "Session: No driver name is configured, defaulting to 'cookie'."); - $driver = 'cookie'; + $this->_driver = 'database'; } - if ( ! in_array($driver, $this->valid_drivers)) + if (($class = $this->_ci_load_classes($this->_driver)) === FALSE) { - log_message('error', 'Session: Configured driver name is not valid, aborting.'); return; } - // Save a copy of parameters in case drivers need access - $this->params = $params; + // Configuration ... + $this->_configure($params); - // Load driver and get array reference - $this->load_driver($driver); + $class = new $class($this->_config); + if ($class instanceof SessionHandlerInterface) + { + if (is_php('5.4')) + { + session_set_save_handler($class, TRUE); + } + else + { + session_set_save_handler( + array($class, 'open'), + array($class, 'close'), + array($class, 'read'), + array($class, 'write'), + array($class, 'destroy'), + array($class, 'gc') + ); + + register_shutdown_function('session_write_close'); + } + } + else + { + log_message('error', "Session: Driver '".$this->_driver."' doesn't implement SessionHandlerInterface. Aborting."); + return; + } - // Delete 'old' flashdata (from last request) - $this->_flashdata_sweep(); + // Sanitize the cookie, because apparently PHP doesn't do that for userspace handlers + if (isset($_COOKIE[$this->_config['cookie_name']]) + && ( + ! is_string($_COOKIE[$this->_config['cookie_name']]) + OR ! preg_match('/^[0-9a-f]{40}$/', $_COOKIE[$this->_config['cookie_name']]) + ) + ) + { + unset($_COOKIE[$this->_config['cookie_name']]); + } - // Mark all new flashdata as old (data will be deleted before next request) - $this->_flashdata_mark(); + session_start(); - // Delete expired tempdata - $this->_tempdata_sweep(); + // Is session ID auto-regeneration configured? (ignoring ajax requests) + if ( ! empty($_SERVER['HTTP_X_REQUESTED_WITH']) + && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest' + && ($regenerate_time = config_item('sess_time_to_update')) > 0 + ) + { + if ( ! isset($_SESSION['__ci_last_regenerate'])) + { + $_SESSION['__ci_last_regenerate'] = time(); + } + elseif ($_SESSION['__ci_last_regenerate'] < (time() - $regenerate_time)) + { + $this->sess_regenerate(FALSE); + } + } + // Another work-around ... PHP doesn't seem to send the session cookie + // unless it is being currently created or regenerated + elseif (isset($_COOKIE[$this->_config['cookie_name']]) && $_COOKIE[$this->_config['cookie_name']] === session_id()) + { + setcookie( + $this->_config['cookie_name'], + session_id(), + (empty($this->_config['cookie_lifetime']) ? 0 : time() + $this->_config['cookie_lifetime']), + $this->_config['cookie_path'], + $this->_config['cookie_domain'], + $this->_config['cookie_secure'], + TRUE + ); + } + + $this->_ci_init_vars(); - log_message('debug', 'CI_Session routines successfully run'); + log_message('info', "Session: Class initialized using '".$this->_driver."' driver."); } // ------------------------------------------------------------------------ /** - * Loads session storage driver + * CI Load Classes * - * @param string Driver classname - * @return object Loaded driver object + * An internal method to load all possible dependency and extension + * classes. It kind of emulates the CI_Driver library, but is + * self-sufficient. + * + * @param string $driver Driver name + * @return string Driver class name */ - public function load_driver($driver) + protected function _ci_load_classes($driver) { - // Save reference to most recently loaded driver as library default and sync userdata - $this->current = parent::load_driver($driver); - $this->userdata =& $this->current->get_userdata(); - return $this->current; - } + // PHP 5.4 compatibility + interface_exists('SessionHandlerInterface', FALSE) OR require_once(BASEPATH.'libraries/Session/SessionHandlerInterface.php'); - // ------------------------------------------------------------------------ + $prefix = config_item('subclass_prefix'); - /** - * Select default session storage driver - * - * @param string Driver name - * @return void - */ - public function select_driver($driver) - { - // Validate driver name - $prefix = (string) get_instance()->config->item('subclass_prefix'); - $child = strtolower(str_replace(array('CI_', $prefix, $this->lib_name.'_'), '', $driver)); - if (in_array($child, array_map('strtolower', $this->valid_drivers))) + if ( ! class_exists('CI_Session_driver', FALSE)) { - // See if driver is loaded - if (isset($this->$child)) + require_once( + file_exists(APPPATH.'libraries/Session/Session_driver.php') + ? APPPATH.'libraries/Session/Session_driver.php' + : BASEPATH.'libraries/Session/Session_driver.php' + ); + + if (file_exists($file_path = APPPATH.'libraries/Session/'.$prefix.'Session_driver.php')) { - // See if driver is already current - if ($this->$child !== $this->current) - { - // Make driver current and sync userdata - $this->current = $this->$child; - $this->userdata =& $this->current->get_userdata(); - } + require_once($file_path); + } + } + + $class = 'Session_'.$driver.'_driver'; + + // Allow custom drivers without the CI_ or MY_ prefix + if ( ! class_exists($class, FALSE) && file_exists($file_path = APPPATH.'libraries/Session/drivers/'.$class.'.php')) + { + require_once($file_path); + if (class_exists($class, FALSE)) + { + return $class; + } + } + + if ( ! class_exists('CI_'.$class, FALSE)) + { + if (file_exists($file_path = APPPATH.'libraries/Session/drivers/'.$class.'.php') OR file_exists($file_path = BASEPATH.'libraries/Session/drivers/'.$class.'.php')) + { + require_once($file_path); + } + + if ( ! class_exists('CI_'.$class, FALSE) && ! class_exists($class, FALSE)) + { + log_message('error', "Session: Configured driver '".$driver."' was not found. Aborting."); + return FALSE; + } + } + + if ( ! class_exists($prefix.$class) && file_exists($file_path = APPPATH.'libraries/Session/drivers/'.$prefix.$class.'.php')) + { + require_once($file_path); + if (class_exists($prefix.$class, FALSE)) + { + return $prefix.$class; } else { - // Load new driver - $this->load_driver($child); + log_message('debug', 'Session: '.$prefix.$class.".php found but it doesn't declare class ".$prefix.$class.'.'); } } + + return 'CI_'.$class; } // ------------------------------------------------------------------------ /** - * Destroy the current session + * Configuration + * + * Handle input parameters and configuration defaults * + * @param array &$params Input parameters * @return void */ - public function sess_destroy() + protected function _configure(&$params) { - // Just call destroy on driver - $this->current->sess_destroy(); - } + $expiration = config_item('sess_expiration'); - // ------------------------------------------------------------------------ + if (isset($params['cookie_lifetime'])) + { + $params['cookie_lifetime'] = (int) $params['cookie_lifetime']; + } + else + { + $params['cookie_lifetime'] = ( ! isset($expiration) && config_item('sess_expire_on_close')) + ? 0 : (int) $expiration; + } - /** - * Regenerate the current session - * - * @param bool Destroy session data flag (default: false) - * @return void - */ - public function sess_regenerate($destroy = FALSE) - { - // Call regenerate on driver and resync userdata - $this->current->sess_regenerate($destroy); - $this->userdata =& $this->current->get_userdata(); - } + isset($params['cookie_name']) OR $params['cookie_name'] = config_item('sess_cookie_name'); + if (empty($params['cookie_name'])) + { + $params['cookie_name'] = ini_get('session.name'); + } + else + { + ini_set('session.name', $params['cookie_name']); + } - // ------------------------------------------------------------------------ + isset($params['cookie_path']) OR $params['cookie_path'] = config_item('cookie_path'); + isset($params['cookie_domain']) OR $params['cookie_domain'] = config_item('cookie_domain'); + isset($params['cookie_secure']) OR $params['cookie_secure'] = (bool) config_item('cookie_secure'); - /** - * Fetch a specific item from the session array - * - * @param string Item key - * @return string Item value or NULL if not found - */ - public function userdata($item = NULL) - { - if (isset($item)) + session_set_cookie_params( + $params['cookie_lifetime'], + $params['cookie_path'], + $params['cookie_domain'], + $params['cookie_secure'], + TRUE // HttpOnly; Yes, this is intentional and not configurable for security reasons + ); + + if (empty($expiration)) + { + $params['expiration'] = (int) ini_get('session.gc_maxlifetime'); + } + else { - return isset($this->userdata[$item]) ? $this->userdata[$item] : NULL; + $params['expiration'] = (int) $expiration; + ini_set('session.gc_maxlifetime', $expiration); } - return isset($this->userdata) ? $this->userdata : array(); - } + $params['match_ip'] = (bool) (isset($params['match_ip']) ? $params['match_ip'] : config_item('sess_match_ip')); - // ------------------------------------------------------------------------ + isset($params['save_path']) OR $params['save_path'] = config_item('sess_save_path'); - /** - * Fetch all session data - * - * @deprecated 3.0.0 Use userdata() with no parameters instead - * @return array User data array - */ - public function all_userdata() - { - return isset($this->userdata) ? $this->userdata : array(); + $this->_config = $params; + + // Security is king + ini_set('session.use_trans_id', 0); + ini_set('session.use_strict_mode', 1); + ini_set('session.use_cookies', 1); + ini_set('session.use_only_cookies', 1); + ini_set('session.hash_function', 1); + ini_set('session.hash_bits_per_character', 4); } // ------------------------------------------------------------------------ /** - * Add or change data in the "userdata" array + * Handle temporary variables + * + * Clears old "flash" data, marks the new one for deletion and handles + * "temp" data deletion. * - * @param mixed Item name or array of items - * @param string Item value or empty string * @return void */ - public function set_userdata($newdata, $newval = '') + protected function _ci_init_vars() { - // Wrap params as array if singular - if (is_string($newdata)) + if ( ! empty($_SESSION['__ci_vars'])) { - $newdata = array($newdata => $newval); - } + $current_time = time(); - // Set each name/value pair - if (count($newdata) > 0) - { - foreach ($newdata as $key => $val) + foreach ($_SESSION['__ci_vars'] as $key => &$value) + { + if ($value === 'new') + { + $_SESSION['__ci_vars'][$key] = 'old'; + } + // Hacky, but 'old' will (implicitly) always be less than time() ;) + // DO NOT move this above the 'new' check! + elseif ($value < $current_time) + { + unset($_SESSION[$key], $_SESSION['__ci_vars'][$key]); + } + } + + if (empty($_SESSION['__ci_vars'])) { - $this->userdata[$key] = $val; + unset($_SESSION['__ci_vars']); } } - // Tell driver data changed - $this->current->sess_save(); + $this->userdata =& $_SESSION; } // ------------------------------------------------------------------------ /** - * Delete a session variable from the "userdata" array + * Mark as flash * - * @param mixed Item name or array of item names - * @return void + * @param mixed $key Session data key(s) + * @return bool */ - public function unset_userdata($newdata) + public function mark_as_flash($key) { - // Wrap single name as array - if (is_string($newdata)) + if (is_array($key)) { - $newdata = array($newdata => ''); + for ($i = 0, $c = count($key); $i < $c; $i++) + { + if ( ! isset($_SESSION[$key[$i]])) + { + return FALSE; + } + } + + $new = array_fill_keys($key, 'new'); + + $_SESSION['__ci_vars'] = isset($_SESSION['__ci_vars']) + ? array_merge($_SESSION['__ci_vars'], $new) + : $new; + + return TRUE; } - // Unset each item name - if (count($newdata) > 0) + if ( ! isset($_SESSION[$key])) { - foreach (array_keys($newdata) as $key) - { - unset($this->userdata[$key]); - } + return FALSE; } - // Tell driver data changed - $this->current->sess_save(); + $_SESSION['__ci_vars'][$key] = 'new'; + return TRUE; } // ------------------------------------------------------------------------ /** - * Determine if an item exists + * Get flash keys * - * @param string Item name - * @return bool + * @return array */ - public function has_userdata($item) + public function get_flash_keys() { - return isset($this->userdata[$item]); + if ( ! isset($_SESSION['__ci_vars'])) + { + return array(); + } + + $keys = array(); + foreach (array_keys($_SESSION['__ci_vars']) as $key) + { + is_int($_SESSION['__ci_vars'][$key]) OR $keys[] = $key; + } + + return $keys; } // ------------------------------------------------------------------------ /** - * Add or change flashdata, only available until the next request + * Unmark flash * - * @param mixed Item name or array of items - * @param string Item value or empty string + * @param mixed $key Session data key(s) * @return void */ - public function set_flashdata($newdata, $newval = '') + public function unmark_flash($key) { - // Wrap item as array if singular - if (is_string($newdata)) + if (empty($_SESSION['__ci_vars'])) { - $newdata = array($newdata => $newval); + return; } - // Prepend each key name and set value - if (count($newdata) > 0) + is_array($key) OR $key = array($key); + + foreach ($key as $k) { - foreach ($newdata as $key => $val) + if (isset($_SESSION['__ci_vars'][$k]) && ! is_int($_SESSION['__ci_vars'][$k])) { - $flashdata_key = self::FLASHDATA_KEY.self::FLASHDATA_NEW.$key; - $this->set_userdata($flashdata_key, $val); + unset($_SESSION['__ci_vars'][$k]); } } + + if (empty($_SESSION['__ci_vars'])) + { + unset($_SESSION['__ci_vars']); + } } // ------------------------------------------------------------------------ /** - * Keeps existing flashdata available to next request. + * Mark as temp * - * @param mixed Item key(s) - * @return void + * @param mixed $key Session data key(s) + * @param int $ttl Time-to-live in seconds + * @return bool */ - public function keep_flashdata($key) + public function mark_as_temp($key, $ttl = 300) { + $ttl += time(); if (is_array($key)) { - foreach ($key as $k) + $temp = array(); + + foreach ($key as $k => $v) { - $this->keep_flashdata($k); + // Do we have a key => ttl pair, or just a key? + if (is_int($k)) + { + $k = $v; + $v = $ttl; + } + else + { + $v += time(); + } + + if ( ! isset($_SESSION[$k])) + { + return FALSE; + } + + $temp[$k] = $v; } - return; + $_SESSION['__ci_vars'] = isset($_SESSION['__ci_vars']) + ? array_merge($_SESSION['__ci_vars'], $temp) + : $temp; + + return TRUE; } - // 'old' flashdata gets removed. Here we mark all flashdata as 'new' to preserve it from _flashdata_sweep() - // Note the function will return NULL if the $key provided cannot be found - $old_flashdata_key = self::FLASHDATA_KEY.self::FLASHDATA_OLD.$key; - $value = $this->userdata($old_flashdata_key); + if ( ! isset($_SESSION[$key])) + { + return FALSE; + } - $new_flashdata_key = self::FLASHDATA_KEY.self::FLASHDATA_NEW.$key; - $this->set_userdata($new_flashdata_key, $value); + $_SESSION['__ci_vars'][$key] = $ttl; + return TRUE; } // ------------------------------------------------------------------------ /** - * Fetch a specific flashdata item from the session array + * Get temp keys * - * @param string Item key - * @return string + * @return array */ - public function flashdata($key = NULL) + public function get_temp_keys() { - if (isset($key)) + if ( ! isset($_SESSION['__ci_vars'])) { - return $this->userdata(self::FLASHDATA_KEY.self::FLASHDATA_OLD.$key); + return array(); } - // Get our flashdata items from userdata - $out = array(); - foreach ($this->userdata() as $key => $val) + $keys = array(); + foreach (array_keys($_SESSION['__ci_vars']) as $key) { - if (strpos($key, self::FLASHDATA_KEY.self::FLASHDATA_OLD) !== FALSE) - { - $key = str_replace(self::FLASHDATA_KEY.self::FLASHDATA_OLD, '', $key); - $out[$key] = $val; - } + is_int($_SESSION['__ci_vars'][$key]) && $keys[] = $key; } - return $out; + return $keys; } // ------------------------------------------------------------------------ /** - * Add or change tempdata, only available until expiration + * Unmark flash * - * @param mixed Item name or array of items - * @param string Item value or empty string - * @param int Item lifetime in seconds or 0 for default + * @param mixed $key Session data key(s) * @return void */ - public function set_tempdata($newdata, $newval = '', $expire = 0) + public function unmark_temp($key) { - // Set expiration time - $expire = time() + ($expire ? $expire : self::TEMP_EXP_DEF); - - // Wrap item as array if singular - if (is_string($newdata)) + if (empty($_SESSION['__ci_vars'])) { - $newdata = array($newdata => $newval); + return; } - // Get or create expiration list - $expirations = $this->userdata(self::EXPIRATION_KEY); - if ( ! $expirations) - { - $expirations = array(); - } + is_array($key) OR $key = array($key); - // Prepend each key name and set value - if (count($newdata) > 0) + foreach ($key as $k) { - foreach ($newdata as $key => $val) + if (isset($_SESSION['__ci_vars'][$k]) && is_int($_SESSION['__ci_vars'][$k])) { - $tempdata_key = self::FLASHDATA_KEY.self::FLASHDATA_EXP.$key; - $expirations[$tempdata_key] = $expire; - $this->set_userdata($tempdata_key, $val); + unset($_SESSION['__ci_vars'][$k]); } } - // Update expiration list - $this->set_userdata(self::EXPIRATION_KEY, $expirations); + if (empty($_SESSION['__ci_vars'])) + { + unset($_SESSION['__ci_vars']); + } } // ------------------------------------------------------------------------ /** - * Delete a temporary session variable from the "userdata" array + * __get() * - * @param mixed Item name or array of item names - * @return void + * @param string $key 'session_id' or a session data key + * @return mixed */ - public function unset_tempdata($newdata) + public function __get($key) { - // Get expirations list - $expirations = $this->userdata(self::EXPIRATION_KEY); - if (empty($expirations)) - { - // Nothing to do - return; - } - - // Wrap single name as array - if (is_string($newdata)) + // Note: Keep this order the same, just in case somebody wants to + // use 'session_id' as a session data key, for whatever reason + if (isset($_SESSION[$key])) { - $newdata = array($newdata => ''); + return $_SESSION[$key]; } - - // Prepend each item name and unset - if (count($newdata) > 0) + elseif ($key === 'session_id') { - foreach (array_keys($newdata) as $key) - { - $tempdata_key = self::FLASHDATA_KEY.self::FLASHDATA_EXP.$key; - unset($expirations[$tempdata_key]); - $this->unset_userdata($tempdata_key); - } + return session_id(); } - // Update expiration list - $this->set_userdata(self::EXPIRATION_KEY, $expirations); + return NULL; } // ------------------------------------------------------------------------ /** - * Fetch a specific tempdata item from the session array + * __set() * - * @param string Item key - * @return string + * @param string $key Session data key + * @param mixed $value Session data value + * @return void */ - public function tempdata($key = NULL) + public function __set($key, $value) { - if (isset($key)) - { - return $this->userdata(self::FLASHDATA_KEY.self::FLASHDATA_EXP.$key); - } + $_SESSION[$key] = $value; + } - // Get our tempdata items from userdata - $out = array(); - foreach ($this->userdata() as $key => $val) - { - if (strpos($key, self::FLASHDATA_KEY.self::FLASHDATA_EXP) !== FALSE) - { - $key = str_replace(self::FLASHDATA_KEY.self::FLASHDATA_EXP, '', $key); - $out[$key] = $val; - } - } + // ------------------------------------------------------------------------ - return $out; + /** + * Session destroy + * + * Legacy CI_Session compatibility method + * + * @return void + */ + public function sess_destroy() + { + session_destroy(); } // ------------------------------------------------------------------------ /** - * Identifies flashdata as 'old' for removal - * when _flashdata_sweep() runs. + * Session regenerate + * + * Legacy CI_Session compatibility method * + * @param bool $destroy Destroy old session data flag * @return void */ - protected function _flashdata_mark() + public function sess_regenerate($destroy = FALSE) { - foreach ($this->userdata() as $name => $value) - { - $parts = explode(self::FLASHDATA_NEW, $name); - if (count($parts) === 2) - { - $this->set_userdata(self::FLASHDATA_KEY.self::FLASHDATA_OLD.$parts[1], $value); - $this->unset_userdata($name); - } - } + $_SESSION['__ci_last_regenerate'] = time(); + session_regenerate_id($destroy); } // ------------------------------------------------------------------------ /** - * Removes all flashdata marked as 'old' + * Get userdata reference * - * @return void + * Legacy CI_Session compatibility method + * + * @returns array */ - protected function _flashdata_sweep() + public function &get_userdata() { - $userdata = $this->userdata(); - foreach (array_keys($userdata) as $key) - { - if (strpos($key, self::FLASHDATA_OLD)) - { - $this->unset_userdata($key); - } - } + return $_SESSION; } // ------------------------------------------------------------------------ /** - * Removes all expired tempdata + * Userdata (fetch) * - * @return void + * Legacy CI_Session compatibility method + * + * @param string $key Session data key + * @return mixed Session data value or NULL if not found */ - protected function _tempdata_sweep() + public function userdata($key = NULL) { - // Get expirations list - $expirations = $this->userdata(self::EXPIRATION_KEY); - if (empty($expirations)) + if (isset($key)) { - // Nothing to do - return; + return isset($_SESSION[$key]) ? $_SESSION[$key] : NULL; } + elseif (empty($_SESSION)) + { + return array(); + } + + $userdata = array(); + $_exclude = array_merge( + array('__ci_vars'), + $this->get_flash_keys(), + $this->get_temp_keys() + ); - // Unset expired elements - $now = time(); - $userdata = $this->userdata(); - foreach (array_keys($userdata) as $key) + foreach (array_keys($_SESSION) as $key) { - if (strpos($key, self::FLASHDATA_EXP) && $expirations[$key] < $now) + if ( ! in_array($key, $_exclude, TRUE)) { - unset($expirations[$key]); - $this->unset_userdata($key); + $userdata[$key] = $_SESSION[$key]; } } - // Update expiration list - $this->set_userdata(self::EXPIRATION_KEY, $expirations); + return $userdata; } -} - -// ------------------------------------------------------------------------ - -/** - * CI_Session_driver Class - * - * Extend this class to make a new CI_Session driver. - * A CI_Session driver basically manages an array of name/value pairs with some sort of storage mechanism. - * To make a new driver, derive from (extend) CI_Session_driver. Overload the initialize method and read or create - * session data. Then implement a save handler to write changed data to storage (sess_save), a destroy handler - * to remove deleted data (sess_destroy), and an access handler to expose the data (get_userdata). - * Put your driver in the libraries/Session/drivers folder anywhere in the loader paths. This includes the - * application directory, the system directory, or any path you add with $CI->load->add_package_path(). - * Your driver must be named CI_Session_<name>, and your filename must be Session_<name>.php, - * preferably also capitalized. (e.g.: CI_Session_foo in libraries/Session/drivers/Session_foo.php) - * Then specify the driver by setting 'sess_driver' in your config file or as a parameter when loading the CI_Session - * object. (e.g.: $config['sess_driver'] = 'foo'; OR $CI->load->driver('session', array('sess_driver' => 'foo')); ) - * Already provided are the Native driver, which manages the native PHP $_SESSION array, and - * the Cookie driver, which manages the data in a browser cookie, with optional extra storage in a database table. - * - * @package CodeIgniter - * @subpackage Libraries - * @category Sessions - * @author EllisLab Dev Team - */ -abstract class CI_Session_driver extends CI_Driver { + // ------------------------------------------------------------------------ /** - * CI Singleton + * Set userdata + * + * Legacy CI_Session compatibility method * - * @see get_instance() - * @var object + * @param mixed $data Session data key or an associative array + * @param mixed $value Value to store + * @return void */ - protected $CI; + public function set_userdata($data, $value = NULL) + { + if (is_array($data)) + { + foreach ($data as $key => &$value) + { + $_SESSION[$key] = $value; + } + + return; + } + + $_SESSION[$data] = $value; + } // ------------------------------------------------------------------------ /** - * Constructor + * Unset userdata * - * Gets the CI singleton, so that individual drivers - * don't have to do it separately. + * Legacy CI_Session compatibility method * + * @param mixed $data Session data key(s) * @return void */ - public function __construct() + public function unset_userdata($key) { - $this->CI =& get_instance(); + if (is_array($key)) + { + foreach ($key as $k) + { + unset($_SESSION[$k]); + } + + return; + } + + unset($_SESSION[$key]); } // ------------------------------------------------------------------------ /** - * Decorate + * All userdata (fetch) * - * Decorates the child with the parent driver lib's methods and properties + * Legacy CI_Session compatibility method * - * @param object Parent library object - * @return void + * @return array $_SESSION, excluding flash data items */ - public function decorate($parent) + public function all_userdata() { - // Call base class decorate first - parent::decorate($parent); + return $this->userdata(); + } - // Call initialize method now that driver has access to $this->_parent - $this->initialize(); + // ------------------------------------------------------------------------ + + /** + * Has userdata + * + * Legacy CI_Session compatibility method + * + * @param string $key Session data key + * @return bool + */ + public function has_userdata($key) + { + return isset($_SESSION[$key]); } // ------------------------------------------------------------------------ /** - * __call magic method + * Flashdata (fetch) * - * Handles access to the parent driver library's methods + * Legacy CI_Session compatibility method * - * @param string Library method name - * @param array Method arguments (default: none) - * @return mixed + * @param string $key Session data key + * @return mixed Session data value or NULL if not found */ - public function __call($method, $args = array()) + public function flashdata($key = NULL) { - // Make sure the parent library uses this driver - $this->_parent->select_driver(get_class($this)); - return parent::__call($method, $args); + if (isset($key)) + { + return (isset($_SESSION['__ci_vars'], $_SESSION['__ci_vars'][$key], $_SESSION[$key]) && ! is_int($_SESSION['__ci_vars'][$key])) + ? $_SESSION[$key] + : NULL; + } + + $flashdata = array(); + + if ( ! empty($_SESSION['__ci_vars'])) + { + foreach ($_SESSION['__ci_vars'] as $key => &$value) + { + is_int($value) OR $flashdata[$key] = $_SESSION[$key]; + } + } + + return $flashdata; } // ------------------------------------------------------------------------ /** - * Initialize driver + * Set flashdata * + * Legacy CI_Session compatibiliy method + * + * @param mixed $data Session data key or an associative array + * @param mixed $value Value to store * @return void */ - protected function initialize() + public function set_flashdata($data, $value = NULL) { - // Overload this method to implement initialization + $this->set_userdata($data, $value); + $this->mark_as_flash(is_array($data) ? array_keys($data) : $data); } // ------------------------------------------------------------------------ /** - * Save the session data + * Keep flashdata * - * Data in the array has changed - perform any storage synchronization - * necessary. The child class MUST implement this abstract method! + * Legacy CI_Session compatibility method * + * @param mixed $key Session data key(s) * @return void */ - abstract public function sess_save(); + public function keep_flashdata($key) + { + $this->mark_as_flash($key); + } // ------------------------------------------------------------------------ /** - * Destroy the current session + * Temp data (fetch) * - * Clean up storage for this session - it has been terminated. - * The child class MUST implement this abstract method! + * Legacy CI_Session compatibility method * - * @return void + * @param string $key Session data key + * @return mixed Session data value or NULL if not found */ - abstract public function sess_destroy(); + public function tempdata($key = NULL) + { + if (isset($key)) + { + return (isset($_SESSION['__ci_vars'], $_SESSION['__ci_vars'][$key], $_SESSION[$key]) && is_int($_SESSION['__ci_vars'][$key])) + ? $_SESSION[$key] + : NULL; + } + + $tempdata = array(); + + if ( ! empty($_SESSION['__ci_vars'])) + { + foreach ($_SESSION['__ci_vars'] as $key => &$value) + { + is_int($value) && $tempdata[$key] = $_SESSION[$key]; + } + } + + return $tempdata; + } // ------------------------------------------------------------------------ /** - * Regenerate the current session + * Set tempdata * - * Regenerate the session ID. - * The child class MUST implement this abstract method! + * Legacy CI_Session compatibility method * - * @param bool Destroy session data flag (default: false) + * @param mixed $data Session data key or an associative array of items + * @param mixed $value Value to store + * @param int $ttl Time-to-live in seconds * @return void */ - abstract public function sess_regenerate($destroy = FALSE); + public function set_tempdata($data, $value = NULL, $ttl = 300) + { + $this->set_userdata($data, $value); + $this->mark_as_temp($data, $ttl); + } // ------------------------------------------------------------------------ /** - * Get a reference to user data array + * Unset tempdata * - * Give array access to the main CI_Session object. - * The child class MUST implement this abstract method! + * Legacy CI_Session compatibility method * - * @return array Reference to userdata + * @param mixed $data Session data key(s) + * @return void */ - abstract public function &get_userdata(); + public function unset_tempdata($key) + { + $this->unmark_temp($key); + } } - -/* End of file Session.php */ -/* Location: ./system/libraries/Session/Session.php */
\ No newline at end of file diff --git a/system/libraries/Session/SessionHandlerInterface.php b/system/libraries/Session/SessionHandlerInterface.php new file mode 100644 index 000000000..9dab5ac07 --- /dev/null +++ b/system/libraries/Session/SessionHandlerInterface.php @@ -0,0 +1,59 @@ +<?php +/** + * CodeIgniter + * + * 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 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @package CodeIgniter + * @author EllisLab Dev Team + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) + * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) + * @license http://opensource.org/licenses/MIT MIT License + * @link http://codeigniter.com + * @since Version 3.0.0 + * @filesource + */ +defined('BASEPATH') OR exit('No direct script access allowed'); + +/** + * SessionHandlerInterface + * + * PHP 5.4 compatibility interface + * + * @package CodeIgniter + * @subpackage Libraries + * @category Sessions + * @author Andrey Andreev + * @link http://codeigniter.com/user_guide/libraries/sessions.html + */ +interface SessionHandlerInterface { + + public function open($save_path, $name); + public function close(); + public function read($session_id); + public function write($session_id, $session_data); + public function destroy($session_id); + public function gc($maxlifetime); +} diff --git a/system/libraries/Session/Session_driver.php b/system/libraries/Session/Session_driver.php new file mode 100644 index 000000000..47376da5b --- /dev/null +++ b/system/libraries/Session/Session_driver.php @@ -0,0 +1,148 @@ +<?php +/** + * CodeIgniter + * + * 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 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @package CodeIgniter + * @author EllisLab Dev Team + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) + * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) + * @license http://opensource.org/licenses/MIT MIT License + * @link http://codeigniter.com + * @since Version 3.0.0 + * @filesource + */ +defined('BASEPATH') OR exit('No direct script access allowed'); + +/** + * CodeIgniter Session Driver Class + * + * @package CodeIgniter + * @subpackage Libraries + * @category Sessions + * @author Andrey Andreev + * @link http://codeigniter.com/user_guide/libraries/sessions.html + */ +abstract class CI_Session_driver implements SessionHandlerInterface { + + protected $_config; + + /** + * Data fingerprint + * + * @var bool + */ + protected $_fingerprint; + + /** + * Lock placeholder + * + * @var mixed + */ + protected $_lock = FALSE; + + /** + * Read session ID + * + * Used to detect session_regenerate_id() calls because PHP only calls + * write() after regenerating the ID. + * + * @var string + */ + protected $_session_id; + + // ------------------------------------------------------------------------ + + /** + * Class constructor + * + * @param array $params Configuration parameters + * @return void + */ + public function __construct(&$params) + { + $this->_config =& $params; + } + + // ------------------------------------------------------------------------ + + /** + * Cookie destroy + * + * Internal method to force removal of a cookie by the client + * when session_destroy() is called. + * + * @return bool + */ + protected function _cookie_destroy() + { + return setcookie( + $this->_config['cookie_name'], + NULL, + 1, + $this->_config['cookie_path'], + $this->_config['cookie_domain'], + $this->_config['cookie_secure'], + TRUE + ); + } + + // ------------------------------------------------------------------------ + + /** + * Get lock + * + * A dummy method allowing drivers with no locking functionality + * (databases other than PostgreSQL and MySQL) to act as if they + * do acquire a lock. + * + * @param string $session_id + * @return bool + */ + protected function _get_lock($session_id) + { + $this->_lock = TRUE; + return TRUE; + } + + // ------------------------------------------------------------------------ + + /** + * Release lock + * + * @return bool + */ + protected function _release_lock() + { + if ($this->_lock) + { + $this->_lock = FALSE; + } + + return TRUE; + } + +} diff --git a/system/libraries/Session/drivers/Session_cookie.php b/system/libraries/Session/drivers/Session_cookie.php deleted file mode 100644 index c0e62affa..000000000 --- a/system/libraries/Session/drivers/Session_cookie.php +++ /dev/null @@ -1,816 +0,0 @@ -<?php -/** - * CodeIgniter - * - * 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 - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @package CodeIgniter - * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License - * @link http://codeigniter.com - * @since Version 1.0.0 - * @filesource - */ -defined('BASEPATH') OR exit('No direct script access allowed'); - -/** - * Cookie-based session management driver - * - * This is the classic CI_Session functionality, as written by EllisLab, abstracted out to a driver. - * - * @package CodeIgniter - * @subpackage Libraries - * @category Sessions - * @author EllisLab Dev Team - * @link http://codeigniter.com/user_guide/libraries/sessions.html - */ -class CI_Session_cookie extends CI_Session_driver { - - /** - * Whether to encrypt the session cookie - * - * @var bool - */ - public $sess_encrypt_cookie = FALSE; - - /** - * Whether to use to the database for session storage - * - * @var bool - */ - public $sess_use_database = FALSE; - - /** - * Name of the database table in which to store sessions - * - * @var string - */ - public $sess_table_name = ''; - - /** - * Length of time (in seconds) for sessions to expire - * - * @var int - */ - public $sess_expiration = 7200; - - /** - * Whether to kill session on close of browser window - * - * @var bool - */ - public $sess_expire_on_close = FALSE; - - /** - * Whether to match session on ip address - * - * @var bool - */ - public $sess_match_ip = FALSE; - - /** - * Whether to match session on user-agent - * - * @var bool - */ - public $sess_match_useragent = TRUE; - - /** - * Name of session cookie - * - * @var string - */ - public $sess_cookie_name = 'ci_session'; - - /** - * Session cookie prefix - * - * @var string - */ - public $cookie_prefix = ''; - - /** - * Session cookie path - * - * @var string - */ - public $cookie_path = ''; - - /** - * Session cookie domain - * - * @var string - */ - public $cookie_domain = ''; - - /** - * Whether to set the cookie only on HTTPS connections - * - * @var bool - */ - public $cookie_secure = FALSE; - - /** - * Whether cookie should be allowed only to be sent by the server - * - * @var bool - */ - public $cookie_httponly = FALSE; - - /** - * Interval at which to update session - * - * @var int - */ - public $sess_time_to_update = 300; - - /** - * Key with which to encrypt the session cookie - * - * @var string - */ - public $encryption_key = ''; - - /** - * Timezone to use for the current time - * - * @var string - */ - public $time_reference = 'local'; - - /** - * Session data - * - * @var array - */ - public $userdata = array(); - - /** - * Current time - * - * @var int - */ - public $now; - - // ------------------------------------------------------------------------ - - /** - * Default userdata keys - * - * @var array - */ - protected $defaults = array( - 'session_id' => NULL, - 'ip_address' => NULL, - 'user_agent' => NULL, - 'last_activity' => NULL - ); - - /** - * Data needs DB update flag - * - * @var bool - */ - protected $data_dirty = FALSE; - - /** - * Standardize newlines flag - * - * @var bool - */ - protected $_standardize_newlines; - - // ------------------------------------------------------------------------ - - /** - * Initialize session driver object - * - * @return void - */ - protected function initialize() - { - // Set all the session preferences, which can either be set - // manually via the $params array or via the config file - $prefs = array( - 'sess_encrypt_cookie', - 'sess_use_database', - 'sess_table_name', - 'sess_expiration', - 'sess_expire_on_close', - 'sess_match_ip', - 'sess_match_useragent', - 'sess_cookie_name', - 'cookie_path', - 'cookie_domain', - 'cookie_secure', - 'cookie_httponly', - 'sess_time_to_update', - 'time_reference', - 'cookie_prefix', - 'encryption_key', - ); - - $this->_standardize_newlines = (bool) config_item('standardize_newlines'); - - foreach ($prefs as $key) - { - $this->$key = isset($this->_parent->params[$key]) - ? $this->_parent->params[$key] - : $this->CI->config->item($key); - } - - if (empty($this->encryption_key)) - { - show_error('In order to use the Cookie Session driver you are required to set an encryption key in your config file.'); - } - - // Do we need encryption? If so, load the encryption class - if ($this->sess_encrypt_cookie === TRUE) - { - $this->CI->load->library('encryption'); - } - - // Check for database - if ($this->sess_use_database === TRUE && $this->sess_table_name !== '') - { - // Load database driver - $this->CI->load->database(); - - // Register shutdown function - register_shutdown_function(array($this, '_update_db')); - } - - // Set the "now" time. Can either be GMT or server time, based on the config prefs. - // We use this to set the "last activity" time - $this->now = $this->_get_time(); - - // Set the session length. If the session expiration is - // set to zero we'll set the expiration two years from now. - if ($this->sess_expiration === 0) - { - $this->sess_expiration = (60*60*24*365*2); - } - - // Set the cookie name - $this->sess_cookie_name = $this->cookie_prefix.$this->sess_cookie_name; - - // Run the Session routine. If a session doesn't exist we'll - // create a new one. If it does, we'll update it. - if ( ! $this->_sess_read()) - { - $this->_sess_create(); - } - else - { - $this->_sess_update(); - } - - // Delete expired sessions if necessary - $this->_sess_gc(); - } - - // ------------------------------------------------------------------------ - - /** - * Write the session data - * - * @return void - */ - public function sess_save() - { - // Check for database - if ($this->sess_use_database === TRUE) - { - // Mark custom data as dirty so we know to update the DB - $this->data_dirty = TRUE; - } - - // Write the cookie - $this->_set_cookie(); - } - - // ------------------------------------------------------------------------ - - /** - * Destroy the current session - * - * @return void - */ - public function sess_destroy() - { - // Kill the session DB row - if ($this->sess_use_database === TRUE && isset($this->userdata['session_id'])) - { - $this->CI->db->delete($this->sess_table_name, array('session_id' => $this->userdata['session_id'])); - $this->data_dirty = FALSE; - } - - // Kill the cookie - $this->_setcookie($this->sess_cookie_name, '', ($this->now - 31500000), - $this->cookie_path, $this->cookie_domain, 0); - - // Kill session data - $this->userdata = array(); - } - - // ------------------------------------------------------------------------ - - /** - * Regenerate the current session - * - * Regenerate the session id - * - * @param bool Destroy session data flag (default: false) - * @return void - */ - public function sess_regenerate($destroy = FALSE) - { - // Check destroy flag - if ($destroy) - { - // Destroy old session and create new one - $this->sess_destroy(); - $this->_sess_create(); - } - else - { - // Just force an update to recreate the id - $this->_sess_update(TRUE); - } - } - - // ------------------------------------------------------------------------ - - /** - * Get a reference to user data array - * - * @return array Reference to userdata - */ - public function &get_userdata() - { - return $this->userdata; - } - - // ------------------------------------------------------------------------ - - /** - * Fetch the current session data if it exists - * - * @return bool - */ - protected function _sess_read() - { - // Fetch the cookie - $session = $this->CI->input->cookie($this->sess_cookie_name); - - // No cookie? Goodbye cruel world!... - if ($session === NULL) - { - log_message('debug', 'A session cookie was not found.'); - return FALSE; - } - - if ($this->sess_encrypt_cookie === TRUE) - { - $session = $this->CI->encryption->decrypt($session); - if ($session === FALSE) - { - log_message('error', 'Session: Unable to decrypt the session cookie, possibly due to a HMAC mismatch.'); - return FALSE; - } - } - else - { - if (($len = strlen($session) - 40) <= 0) - { - log_message('error', 'Session: The session cookie was not signed.'); - return FALSE; - } - - // Check cookie authentication - $hmac = substr($session, $len); - $session = substr($session, 0, $len); - - // Time-attack-safe comparison - $hmac_check = hash_hmac('sha1', $session, $this->encryption_key); - $diff = 0; - for ($i = 0; $i < 40; $i++) - { - $diff |= ord($hmac[$i]) ^ ord($hmac_check[$i]); - } - - if ($diff !== 0) - { - log_message('error', 'Session: HMAC mismatch. The session cookie data did not match what was expected.'); - $this->sess_destroy(); - return FALSE; - } - } - - // Unserialize the session array - $session = @unserialize($session); - - // Is the session data we unserialized an array with the correct format? - if ( ! is_array($session) OR ! isset($session['session_id'], $session['ip_address'], $session['user_agent'], $session['last_activity'])) - { - log_message('debug', 'Session: Wrong cookie data format'); - $this->sess_destroy(); - return FALSE; - } - - // Is the session current? - if (($session['last_activity'] + $this->sess_expiration) < $this->now OR $session['last_activity'] > $this->now) - { - log_message('debug', 'Session: Expired'); - $this->sess_destroy(); - return FALSE; - } - - // Does the IP match? - if ($this->sess_match_ip === TRUE && $session['ip_address'] !== $this->CI->input->ip_address()) - { - log_message('debug', 'Session: IP address mismatch'); - $this->sess_destroy(); - return FALSE; - } - - // Does the User Agent Match? - if ($this->sess_match_useragent === TRUE && - trim($session['user_agent']) !== trim(substr($this->CI->input->user_agent(), 0, 120))) - { - log_message('debug', 'Session: User Agent string mismatch'); - $this->sess_destroy(); - return FALSE; - } - - // Is there a corresponding session in the DB? - if ($this->sess_use_database === TRUE) - { - $this->CI->db->where('session_id', $session['session_id']); - - if ($this->sess_match_ip === TRUE) - { - $this->CI->db->where('ip_address', $session['ip_address']); - } - - if ($this->sess_match_useragent === TRUE) - { - $this->CI->db->where('user_agent', $session['user_agent']); - } - - // Is caching in effect? Turn it off - $db_cache = $this->CI->db->cache_on; - $this->CI->db->cache_off(); - - $query = $this->CI->db->get($this->sess_table_name); - - // Was caching in effect? - if ($db_cache) - { - // Turn it back on - $this->CI->db->cache_on(); - } - - // No result? Kill it! - if (empty($query) OR $query->num_rows() === 0) - { - log_message('debug', 'Session: No match found in our database'); - $this->sess_destroy(); - return FALSE; - } - - // Is there custom data? If so, add it to the main session array - $row = $query->row(); - if ( ! empty($row->user_data)) - { - $custom_data = unserialize(trim($row->user_data)); - - if (is_array($custom_data)) - { - $session = $session + $custom_data; - } - } - } - - // Session is valid! - $this->userdata = $session; - return TRUE; - } - - // ------------------------------------------------------------------------ - - /** - * Create a new session - * - * @return void - */ - protected function _sess_create() - { - // Initialize userdata - $this->userdata = array( - 'session_id' => $this->_make_sess_id(), - 'ip_address' => $this->CI->input->ip_address(), - 'user_agent' => trim(substr($this->CI->input->user_agent(), 0, 120)), - 'last_activity' => $this->now, - ); - - log_message('debug', 'Session: Creating new session ('.$this->userdata['session_id'].')'); - - // Check for database - if ($this->sess_use_database === TRUE) - { - // Add empty user_data field and save the data to the DB - $this->CI->db->set('user_data', '')->insert($this->sess_table_name, $this->userdata); - } - - // Write the cookie - $this->_set_cookie(); - } - - // ------------------------------------------------------------------------ - - /** - * Update an existing session - * - * @param bool Force update flag (default: false) - * @return void - */ - protected function _sess_update($force = FALSE) - { - // We only update the session every five minutes by default (unless forced) - if ( ! $force && ($this->userdata['last_activity'] + $this->sess_time_to_update) >= $this->now) - { - return; - } - - // Update last activity to now - $this->userdata['last_activity'] = $this->now; - - // Save the old session id so we know which DB record to update - $old_sessid = $this->userdata['session_id']; - - // Changing the session ID during an AJAX call causes problems - if ( ! $this->CI->input->is_ajax_request()) - { - // Get new id - $this->userdata['session_id'] = $this->_make_sess_id(); - - log_message('debug', 'Session: Regenerate ID'); - } - - // Check for database - if ($this->sess_use_database === TRUE) - { - $this->CI->db->where('session_id', $old_sessid); - - if ($this->sess_match_ip === TRUE) - { - $this->CI->db->where('ip_address', $this->CI->input->ip_address()); - } - - if ($this->sess_match_useragent === TRUE) - { - $this->CI->db->where('user_agent', trim(substr($this->CI->input->user_agent(), 0, 120))); - } - - // Update the session ID and last_activity field in the DB - $this->CI->db->update($this->sess_table_name, - array( - 'last_activity' => $this->now, - 'session_id' => $this->userdata['session_id'] - ) - ); - } - - // Write the cookie - $this->_set_cookie(); - } - - // ------------------------------------------------------------------------ - - /** - * Update database with current data - * - * This gets called from the shutdown function and also - * registered with PHP to run at the end of the request - * so it's guaranteed to update even when a fatal error - * occurs. The first call makes the update and clears the - * dirty flag so it won't happen twice. - * - * @return void - */ - public function _update_db() - { - // Check for database and dirty flag and unsaved - if ($this->sess_use_database === TRUE && $this->data_dirty === TRUE) - { - // Set up activity and data fields to be set - // If we don't find custom data, user_data will remain an empty string - $set = array( - 'last_activity' => $this->userdata['last_activity'], - 'user_data' => '' - ); - - // Get the custom userdata, leaving out the defaults - // (which get stored in the cookie) - $userdata = array_diff_key($this->userdata, $this->defaults); - - // Did we find any custom data? - if ( ! empty($userdata)) - { - // Serialize the custom data array so we can store it - $set['user_data'] = serialize($userdata); - } - - // Reset query builder values. - $this->CI->db->reset_query(); - - // Run the update query - // Any time we change the session id, it gets updated immediately, - // so our where clause below is always safe - $this->CI->db->where('session_id', $this->userdata['session_id']); - - if ($this->sess_match_ip === TRUE) - { - $this->CI->db->where('ip_address', $this->CI->input->ip_address()); - } - - if ($this->sess_match_useragent === TRUE) - { - $this->CI->db->where('user_agent', trim(substr($this->CI->input->user_agent(), 0, 120))); - } - - $this->CI->db->update($this->sess_table_name, $set); - - // Clear dirty flag to prevent double updates - $this->data_dirty = FALSE; - - log_message('debug', 'CI_Session Data Saved To DB'); - } - } - - // ------------------------------------------------------------------------ - - /** - * Generate a new session id - * - * @return string Hashed session id - */ - protected function _make_sess_id() - { - $new_sessid = ''; - do - { - $new_sessid .= mt_rand(); - } - while (strlen($new_sessid) < 32); - - // To make the session ID even more secure we'll combine it with the user's IP - $new_sessid .= $this->CI->input->ip_address(); - - // Turn it into a hash and return - return md5(uniqid($new_sessid, TRUE)); - } - - // ------------------------------------------------------------------------ - - /** - * Get the "now" time - * - * @return int Time - */ - protected function _get_time() - { - if ($this->time_reference === 'local' OR $this->time_reference === date_default_timezone_get()) - { - return time(); - } - - $datetime = new DateTime('now', new DateTimeZone($this->time_reference)); - sscanf($datetime->format('j-n-Y G:i:s'), '%d-%d-%d %d:%d:%d', $day, $month, $year, $hour, $minute, $second); - - return mktime($hour, $minute, $second, $month, $day, $year); - } - - // ------------------------------------------------------------------------ - - /** - * Write the session cookie - * - * @return void - */ - protected function _set_cookie() - { - // Get userdata (only defaults if database) - $cookie_data = ($this->sess_use_database === TRUE) - ? array_intersect_key($this->userdata, $this->defaults) - : $this->userdata; - - // The Input class will do this and since we use HMAC verification, - // unless we standardize here as well, the hash won't match. - if ($this->_standardize_newlines) - { - foreach (array_keys($this->userdata) as $key) - { - $this->userdata[$key] = preg_replace('/(?:\r\n|[\r\n])/', PHP_EOL, $this->userdata[$key]); - } - } - - // Serialize the userdata for the cookie - $cookie_data = serialize($cookie_data); - - if ($this->sess_encrypt_cookie === TRUE) - { - $cookie_data = $this->CI->encryption->encrypt($cookie_data); - } - else - { - // Require message authentication - $cookie_data .= hash_hmac('sha1', $cookie_data, $this->encryption_key); - } - - $expire = ($this->sess_expire_on_close === TRUE) ? 0 : $this->sess_expiration + time(); - - // Set the cookie - $this->_setcookie($this->sess_cookie_name, $cookie_data, $expire, $this->cookie_path, $this->cookie_domain, - $this->cookie_secure, $this->cookie_httponly); - } - - // ------------------------------------------------------------------------ - - /** - * Set a cookie with the system - * - * This abstraction of the setcookie call allows overriding for unit testing - * - * @param string Cookie name - * @param string Cookie value - * @param int Expiration time - * @param string Cookie path - * @param string Cookie domain - * @param bool Secure connection flag - * @param bool HTTP protocol only flag - * @return void - */ - protected function _setcookie($name, $value = '', $expire = 0, $path = '', $domain = '', $secure = FALSE, $httponly = FALSE) - { - setcookie($name, $value, $expire, $path, $domain, $secure, $httponly); - } - - // ------------------------------------------------------------------------ - - /** - * Garbage collection - * - * This deletes expired session rows from database - * if the probability percentage is met - * - * @return void - */ - protected function _sess_gc() - { - if ($this->sess_use_database !== TRUE) - { - return; - } - - $probability = ini_get('session.gc_probability'); - $divisor = ini_get('session.gc_divisor'); - - if (mt_rand(1, $divisor) <= $probability) - { - $expire = $this->now - $this->sess_expiration; - $this->CI->db->delete($this->sess_table_name, 'last_activity < '.$expire); - - log_message('debug', 'Session garbage collection performed.'); - } - } - -} - -/* End of file Session_cookie.php */ -/* Location: ./system/libraries/Session/drivers/Session_cookie.php */
\ No newline at end of file diff --git a/system/libraries/Session/drivers/Session_database_driver.php b/system/libraries/Session/drivers/Session_database_driver.php new file mode 100644 index 000000000..0ec6e34f0 --- /dev/null +++ b/system/libraries/Session/drivers/Session_database_driver.php @@ -0,0 +1,385 @@ +<?php +/** + * CodeIgniter + * + * 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 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @package CodeIgniter + * @author EllisLab Dev Team + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) + * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) + * @license http://opensource.org/licenses/MIT MIT License + * @link http://codeigniter.com + * @since Version 3.0.0 + * @filesource + */ +defined('BASEPATH') OR exit('No direct script access allowed'); + +/** + * CodeIgniter Session Database Driver + * + * @package CodeIgniter + * @subpackage Libraries + * @category Sessions + * @author Andrey Andreev + * @link http://codeigniter.com/user_guide/libraries/sessions.html + */ +class CI_Session_database_driver extends CI_Session_driver implements SessionHandlerInterface { + + /** + * DB object + * + * @var object + */ + protected $_db; + + /** + * Row exists flag + * + * @var bool + */ + protected $_row_exists = FALSE; + + /** + * Lock "driver" flag + * + * @var string + */ + protected $_platform; + + // ------------------------------------------------------------------------ + + /** + * Class constructor + * + * @param array $params Configuration parameters + * @return void + */ + public function __construct(&$params) + { + parent::__construct($params); + + $CI =& get_instance(); + isset($CI->db) OR $CI->load->database(); + $this->_db = $CI->db; + + if ( ! $this->_db instanceof CI_DB_query_builder) + { + throw new Exception('Query Builder not enabled for the configured database. Aborting.'); + } + elseif ($this->_db->pconnect) + { + throw new Exception('Configured database connection is persistent. Aborting.'); + } + + $db_driver = $this->_db->dbdriver.(empty($this->_db->subdriver) ? '' : '_'.$this->_db->subdriver); + if (strpos($db_driver, 'mysql') !== FALSE) + { + $this->_platform = 'mysql'; + } + elseif (in_array($db_driver, array('postgre', 'pdo_pgsql'), TRUE)) + { + $this->_platform = 'postgre'; + } + + // Note: BC work-around for the old 'sess_table_name' setting, should be removed in the future. + isset($this->_config['save_path']) OR $this->_config['save_path'] = config_item('sess_table_name'); + } + + // ------------------------------------------------------------------------ + + /** + * Open + * + * Initializes the database connection + * + * @param string $save_path Table name + * @param string $name Session cookie name, unused + * @return bool + */ + public function open($save_path, $name) + { + return empty($this->_db->conn_id) + ? ( ! $this->_db->autoinit && $this->_db->db_connect()) + : TRUE; + } + + // ------------------------------------------------------------------------ + + /** + * Read + * + * Reads session data and acquires a lock + * + * @param string $session_id Session ID + * @return string Serialized session data + */ + public function read($session_id) + { + if ($this->_get_lock($session_id) !== FALSE) + { + // Needed by write() to detect session_regenerate_id() calls + $this->_session_id = $session_id; + + $this->_db + ->select('data') + ->from($this->_config['save_path']) + ->where('id', $session_id); + + if ($this->_config['match_ip']) + { + $this->_db->where('ip_address', $_SERVER['REMOTE_ADDR']); + } + + if (($result = $this->_db->get()->row()) === NULL) + { + $this->_fingerprint = md5(''); + return ''; + } + + // PostgreSQL's variant of a BLOB datatype is Bytea, which is a + // PITA to work with, so we use base64-encoded data in a TEXT + // field instead. + $result = ($this->_platform === 'postgre') + ? base64_decode(rtrim($result->data)) + : $result->data; + + $this->_fingerprint = md5($result); + $this->_row_exists = TRUE; + return $result; + } + + $this->_fingerprint = md5(''); + return ''; + } + + // ------------------------------------------------------------------------ + + /** + * Write + * + * Writes (create / update) session data + * + * @param string $session_id Session ID + * @param string $session_data Serialized session data + * @return bool + */ + public function write($session_id, $session_data) + { + // Was the ID regenerated? + if ($session_id !== $this->_session_id) + { + if ( ! $this->_release_lock() OR ! $this->_get_lock($session_id)) + { + return FALSE; + } + + $this->_row_exists = FALSE; + $this->_session_id = $session_id; + } + elseif ($this->_lock === FALSE) + { + return FALSE; + } + + if ($this->_row_exists === FALSE) + { + $insert_data = array( + 'id' => $session_id, + 'ip_address' => $_SERVER['REMOTE_ADDR'], + 'timestamp' => time(), + 'data' => ($this->_platform === 'postgre' ? base64_encode($session_data) : $session_data) + ); + + if ($this->_db->insert($this->_config['save_path'], $insert_data)) + { + $this->_fingerprint = md5($session_data); + return $this->_row_exists = TRUE; + } + + return FALSE; + } + + $this->_db->where('id', $session_id); + if ($this->_config['match_ip']) + { + $this->_db->where('ip_address', $_SERVER['REMOTE_ADDR']); + } + + $update_data = array('timestamp' => time()); + if ($this->_fingerprint !== md5($session_data)) + { + $update_data['data'] = ($this->_platform === 'postgre') + ? base64_encode($session_data) + : $session_data; + } + + if ($this->_db->update($this->_config['save_path'], $update_data)) + { + $this->_fingerprint = md5($session_data); + return TRUE; + } + + return FALSE; + } + + // ------------------------------------------------------------------------ + + /** + * Close + * + * Releases locks + * + * @return void + */ + public function close() + { + return ($this->_lock) + ? $this->_release_lock() + : TRUE; + } + + // ------------------------------------------------------------------------ + + /** + * Destroy + * + * Destroys the current session. + * + * @param string $session_id Session ID + * @return bool + */ + public function destroy($session_id) + { + if ($this->_lock) + { + $this->_db->where('id', $session_id); + if ($this->_config['match_ip']) + { + $this->_db->where('ip_address', $_SERVER['REMOTE_ADDR']); + } + + return $this->_db->delete($this->_config['save_path']) + ? ($this->close() && $this->_cookie_destroy()) + : FALSE; + } + + return ($this->close() && $this->_cookie_destroy()); + } + + // ------------------------------------------------------------------------ + + /** + * Garbage Collector + * + * Deletes expired sessions + * + * @param int $maxlifetime Maximum lifetime of sessions + * @return bool + */ + public function gc($maxlifetime) + { + return $this->_db->delete($this->_config['save_path'], 'timestamp < '.(time() - $maxlifetime)); + } + + // ------------------------------------------------------------------------ + + /** + * Get lock + * + * Acquires a lock, depending on the underlying platform. + * + * @param string $session_id Session ID + * @return bool + */ + protected function _get_lock($session_id) + { + if ($this->_platform === 'mysql') + { + $arg = $session_id.($this->_config['match_ip'] ? '_'.$_SERVER['REMOTE_ADDR'] : ''); + if ($this->_db->query("SELECT GET_LOCK('".$arg."', 10) AS ci_session_lock")->row()->ci_session_lock) + { + $this->_lock = $arg; + return TRUE; + } + + return FALSE; + } + elseif ($this->_platform === 'postgre') + { + $arg = "hashtext('".$session_id."')".($this->_config['match_ip'] ? ", hashtext('".$_SERVER['REMOTE_ADDR']."')" : ''); + if ($this->_db->simple_query('SELECT pg_advisory_lock('.$arg.')')) + { + $this->_lock = $arg; + return TRUE; + } + + return FALSE; + } + + return parent::_get_lock($session_id); + } + + // ------------------------------------------------------------------------ + + /** + * Release lock + * + * Releases a previously acquired lock + * + * @return bool + */ + protected function _release_lock() + { + if ( ! $this->_lock) + { + return TRUE; + } + + if ($this->_platform === 'mysql') + { + if ($this->_db->query("SELECT RELEASE_LOCK('".$this->_lock."') AS ci_session_lock")->row()->ci_session_lock) + { + $this->_lock = FALSE; + return TRUE; + } + + return FALSE; + } + elseif ($this->_platform === 'postgre') + { + if ($this->_db->simple_query('SELECT pg_advisory_unlock('.$this->_lock.')')) + { + $this->_lock = FALSE; + return TRUE; + } + + return FALSE; + } + + return parent::_release_lock(); + } + +} diff --git a/system/libraries/Session/drivers/Session_files_driver.php b/system/libraries/Session/drivers/Session_files_driver.php new file mode 100644 index 000000000..ad8315d52 --- /dev/null +++ b/system/libraries/Session/drivers/Session_files_driver.php @@ -0,0 +1,352 @@ +<?php +/** + * CodeIgniter + * + * 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 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @package CodeIgniter + * @author EllisLab Dev Team + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) + * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) + * @license http://opensource.org/licenses/MIT MIT License + * @link http://codeigniter.com + * @since Version 3.0.0 + * @filesource +*/ +defined('BASEPATH') OR exit('No direct script access allowed'); + +/** + * CodeIgniter Session Files Driver + * + * @package CodeIgniter + * @subpackage Libraries + * @category Sessions + * @author Andrey Andreev + * @link http://codeigniter.com/user_guide/libraries/sessions.html + */ +class CI_Session_files_driver extends CI_Session_driver implements SessionHandlerInterface { + + /** + * Save path + * + * @var string + */ + protected $_save_path; + + /** + * File handle + * + * @var resource + */ + protected $_file_handle; + + /** + * File name + * + * @var resource + */ + protected $_file_path; + + /** + * File new flag + * + * @var bool + */ + protected $_file_new; + + // ------------------------------------------------------------------------ + + /** + * Class constructor + * + * @param array $params Configuration parameters + * @return void + */ + public function __construct(&$params) + { + parent::__construct($params); + + if (isset($this->_config['save_path'])) + { + $this->_config['save_path'] = rtrim($this->_config['save_path'], '/\\'); + ini_set('session.save_path', $this->_config['save_path']); + } + else + { + $this->_config['save_path'] = rtrim(ini_get('session.save_path'), '/\\'); + } + } + + // ------------------------------------------------------------------------ + + /** + * Open + * + * Sanitizes the save_path directory. + * + * @param string $save_path Path to session files' directory + * @param string $name Session cookie name, unused + * @return bool + */ + public function open($save_path, $name) + { + if ( ! is_dir($save_path)) + { + if ( ! mkdir($save_path, 0700, TRUE)) + { + throw new Exception("Session: Configured save path '".$this->_config['save_path']."' is not a directory, doesn't exist or cannot be created."); + } + } + elseif ( ! is_writable($save_path)) + { + throw new Exception("Session: Configured save path '".$this->_config['save_path']."' is not writable by the PHP process."); + } + + $this->_config['save_path'] = $save_path; + $this->_file_path = $this->_config['save_path'].DIRECTORY_SEPARATOR + .$name // we'll use the session cookie name as a prefix to avoid collisions + .($this->_config['match_ip'] ? md5($_SERVER['REMOTE_ADDR']) : ''); + + return TRUE; + } + + // ------------------------------------------------------------------------ + + /** + * Read + * + * Reads session data and acquires a lock + * + * @param string $session_id Session ID + * @return string Serialized session data + */ + public function read($session_id) + { + // This might seem weird, but PHP 5.6 introduces session_reset(), + // which re-reads session data + if ($this->_file_handle === NULL) + { + // Just using fopen() with 'c+b' mode would be perfect, but it is only + // available since PHP 5.2.6 and we have to set permissions for new files, + // so we'd have to hack around this ... + if (($this->_file_new = ! file_exists($this->_file_path.$session_id)) === TRUE) + { + if (($this->_file_handle = fopen($this->_file_path.$session_id, 'w+b')) === FALSE) + { + log_message('error', "Session: File '".$this->_file_path.$session_id."' doesn't exist and cannot be created."); + return FALSE; + } + } + elseif (($this->_file_handle = fopen($this->_file_path.$session_id, 'r+b')) === FALSE) + { + log_message('error', "Session: Unable to open file '".$this->_file_path.$session_id."'."); + return FALSE; + } + + if (flock($this->_file_handle, LOCK_EX) === FALSE) + { + log_message('error', "Session: Unable to obtain lock for file '".$this->_file_path.$session_id."'."); + fclose($this->_file_handle); + $this->_file_handle = NULL; + return FALSE; + } + + // Needed by write() to detect session_regenerate_id() calls + $this->_session_id = $session_id; + + if ($this->_file_new) + { + chmod($this->_file_path.$session_id, 0600); + $this->_fingerprint = md5(''); + return ''; + } + } + else + { + rewind($this->_file_handle); + } + + $session_data = ''; + for ($read = 0, $length = filesize($this->_file_path.$session_id); $read < $length; $read += strlen($buffer)) + { + if (($buffer = fread($this->_file_handle, $length - $read)) === FALSE) + { + break; + } + + $session_data .= $buffer; + } + + $this->_fingerprint = md5($session_data); + return $session_data; + } + + // ------------------------------------------------------------------------ + + /** + * Write + * + * Writes (create / update) session data + * + * @param string $session_id Session ID + * @param string $session_data Serialized session data + * @return bool + */ + public function write($session_id, $session_data) + { + // If the two IDs don't match, we have a session_regenerate_id() call + // and we need to close the old handle and open a new one + if ($session_id !== $this->_session_id && ( ! $this->close() OR $this->read($session_id) === FALSE)) + { + return FALSE; + } + + if ( ! is_resource($this->_file_handle)) + { + return FALSE; + } + elseif ($this->_fingerprint === md5($session_data)) + { + return ($this->_file_new) + ? TRUE + : touch($this->_file_path.$session_id); + } + + if ( ! $this->_file_new) + { + ftruncate($this->_file_handle, 0); + rewind($this->_file_handle); + } + + if (($length = strlen($session_data)) > 0) + { + for ($written = 0; $written < $length; $written += $result) + { + if (($result = fwrite($this->_file_handle, substr($session_data, $written))) === FALSE) + { + break; + } + } + + if ( ! is_int($result)) + { + $this->_fingerprint = md5(substr($session_data, 0, $written)); + log_message('error', 'Session: Unable to write data.'); + return FALSE; + } + } + + $this->_fingerprint = md5($session_data); + return TRUE; + } + + // ------------------------------------------------------------------------ + + /** + * Close + * + * Releases locks and closes file descriptor. + * + * @return void + */ + public function close() + { + if (is_resource($this->_file_handle)) + { + flock($this->_file_handle, LOCK_UN); + fclose($this->_file_handle); + + $this->_file_handle = $this->_file_new = $this->_session_id = NULL; + return TRUE; + } + + return TRUE; + } + + // ------------------------------------------------------------------------ + + /** + * Destroy + * + * Destroys the current session. + * + * @param string $session_id Session ID + * @return bool + */ + public function destroy($session_id) + { + if ($this->close()) + { + return unlink($this->_file_path.$session_id) && $this->_cookie_destroy(); + } + elseif ($this->_file_path !== NULL) + { + clearstatcache(); + return file_exists($this->_file_path.$session_id) + ? (unlink($this->_file_path.$session_id) && $this->_cookie_destroy()) + : TRUE; + } + + return FALSE; + } + + // ------------------------------------------------------------------------ + + /** + * Garbage Collector + * + * Deletes expired sessions + * + * @param int $maxlifetime Maximum lifetime of sessions + * @return bool + */ + public function gc($maxlifetime) + { + if ( ! is_dir($this->_config['save_path']) OR ($files = scandir($this->_config['save_path'])) === FALSE) + { + log_message('debug', "Session: Garbage collector couldn't list files under directory '".$this->_config['save_path']."'."); + return FALSE; + } + + $ts = time() - $maxlifetime; + + foreach ($files as $file) + { + // If the filename doesn't match this pattern, it's either not a session file or is not ours + if ( ! preg_match('/(?:[0-9a-f]{32})?[0-9a-f]{40}$/i', $file) + OR ! is_file($this->_config['save_path'].DIRECTORY_SEPARATOR.$file) + OR ($mtime = filemtime($this->_config['save_path'].DIRECTORY_SEPARATOR.$file)) === FALSE + OR $mtime > $ts) + { + continue; + } + + unlink($this->_config['save_path'].DIRECTORY_SEPARATOR.$file); + } + + return TRUE; + } + +} diff --git a/system/libraries/Session/drivers/Session_memcached_driver.php b/system/libraries/Session/drivers/Session_memcached_driver.php new file mode 100644 index 000000000..00112c88c --- /dev/null +++ b/system/libraries/Session/drivers/Session_memcached_driver.php @@ -0,0 +1,375 @@ +<?php +/** + * CodeIgniter + * + * 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 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @package CodeIgniter + * @author EllisLab Dev Team + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) + * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) + * @license http://opensource.org/licenses/MIT MIT License + * @link http://codeigniter.com + * @since Version 3.0.0 + * @filesource + */ +defined('BASEPATH') OR exit('No direct script access allowed'); + +/** + * CodeIgniter Session Memcached Driver + * + * @package CodeIgniter + * @subpackage Libraries + * @category Sessions + * @author Andrey Andreev + * @link http://codeigniter.com/user_guide/libraries/sessions.html + */ +class CI_Session_memcached_driver extends CI_Session_driver implements SessionHandlerInterface { + + /** + * Memcached instance + * + * @var Memcached + */ + protected $_memcached; + + /** + * Key prefix + * + * @var string + */ + protected $_key_prefix = 'ci_session:'; + + /** + * Lock key + * + * @var string + */ + protected $_lock_key; + + // ------------------------------------------------------------------------ + + /** + * Class constructor + * + * @param array $params Configuration parameters + * @return void + */ + public function __construct(&$params) + { + parent::__construct($params); + + if (empty($this->_config['save_path'])) + { + log_message('error', 'Session: No Memcached save path configured.'); + } + + if ($this->_config['match_ip'] === TRUE) + { + $this->_key_prefix .= $_SERVER['REMOTE_ADDR'].':'; + } + } + + // ------------------------------------------------------------------------ + + /** + * Open + * + * Sanitizes save_path and initializes connections. + * + * @param string $save_path Server path(s) + * @param string $name Session cookie name, unused + * @return bool + */ + public function open($save_path, $name) + { + $this->_memcached = new Memcached(); + $this->_memcached->setOption(Memcached::OPT_BINARY_PROTOCOL, TRUE); // required for touch() usage + $server_list = array(); + foreach ($this->_memcached->getServerList() as $server) + { + $server_list[] = $server['host'].':'.$server['port']; + } + + if ( ! preg_match_all('#,?([^,:]+)\:(\d{1,5})(?:\:(\d+))?#', $this->_config['save_path'], $matches, PREG_SET_ORDER)) + { + $this->_memcached = NULL; + log_message('error', 'Session: Invalid Memcached save path format: '.$this->_config['save_path']); + return FALSE; + } + + foreach ($matches as $match) + { + // If Memcached already has this server (or if the port is invalid), skip it + if (in_array($match[1].':'.$match[2], $server_list, TRUE)) + { + log_message('debug', 'Session: Memcached server pool already has '.$match[1].':'.$match[2]); + continue; + } + + if ( ! $this->_memcached->addServer($match[1], $match[2], isset($match[3]) ? $match[3] : 0)) + { + log_message('error', 'Could not add '.$match[1].':'.$match[2].' to Memcached server pool.'); + } + else + { + $server_list[] = $match[1].':'.$match[2]; + } + } + + if (empty($server_list)) + { + log_message('error', 'Session: Memcached server pool is empty.'); + return FALSE; + } + + return TRUE; + } + + // ------------------------------------------------------------------------ + + /** + * Read + * + * Reads session data and acquires a lock + * + * @param string $session_id Session ID + * @return string Serialized session data + */ + public function read($session_id) + { + if (isset($this->_memcached) && $this->_get_lock($session_id)) + { + // Needed by write() to detect session_regenerate_id() calls + $this->_session_id = $session_id; + + $session_data = (string) $this->_memcached->get($this->_key_prefix.$session_id); + $this->_fingerprint = md5($session_data); + return $session_data; + } + + return FALSE; + } + + // ------------------------------------------------------------------------ + + /** + * Write + * + * Writes (create / update) session data + * + * @param string $session_id Session ID + * @param string $session_data Serialized session data + * @return bool + */ + public function write($session_id, $session_data) + { + if ( ! isset($this->_memcached)) + { + return FALSE; + } + // Was the ID regenerated? + elseif ($session_id !== $this->_session_id) + { + if ( ! $this->_release_lock() OR ! $this->_get_lock($session_id)) + { + return FALSE; + } + + $this->_fingerprint = md5(''); + $this->_session_id = $session_id; + } + + if (isset($this->_lock_key)) + { + $this->_memcached->replace($this->_lock_key, time(), 5); + if ($this->_fingerprint !== ($fingerprint = md5($session_data))) + { + if ($this->_memcached->set($this->_key_prefix.$session_id, $session_data, $this->_config['expiration'])) + { + $this->_fingerprint = $fingerprint; + return TRUE; + } + + return FALSE; + } + + return $this->_memcached->touch($this->_key_prefix.$session_id, $this->_config['expiration']); + } + + return FALSE; + } + + // ------------------------------------------------------------------------ + + /** + * Close + * + * Releases locks and closes connection. + * + * @return void + */ + public function close() + { + if (isset($this->_memcached)) + { + isset($this->_lock_key) && $this->_memcached->delete($this->_lock_key); + if ( ! $this->_memcached->quit()) + { + return FALSE; + } + + $this->_memcached = NULL; + return TRUE; + } + + return FALSE; + } + + // ------------------------------------------------------------------------ + + /** + * Destroy + * + * Destroys the current session. + * + * @param string $session_id Session ID + * @return bool + */ + public function destroy($session_id) + { + if (isset($this->_memcached, $this->_lock_key)) + { + $this->_memcached->delete($this->_key_prefix.$session_id); + return $this->_cookie_destroy(); + } + + return FALSE; + } + + // ------------------------------------------------------------------------ + + /** + * Garbage Collector + * + * Deletes expired sessions + * + * @param int $maxlifetime Maximum lifetime of sessions + * @return bool + */ + public function gc($maxlifetime) + { + // Not necessary, Memcached takes care of that. + return TRUE; + } + + // ------------------------------------------------------------------------ + + /** + * Get lock + * + * Acquires an (emulated) lock. + * + * @param string $session_id Session ID + * @return bool + */ + protected function _get_lock($session_id) + { + if (isset($this->_lock_key)) + { + return $this->_memcached->replace($this->_lock_key, time(), 5); + } + + $lock_key = $this->_key_prefix.$session_id.':lock'; + if ( ! ($ts = $this->_memcached->get($lock_key))) + { + if ( ! $this->_memcached->set($lock_key, TRUE, 5)) + { + log_message('error', 'Session: Error while trying to obtain lock for '.$this->_key_prefix.$session_id); + return FALSE; + } + + $this->_lock_key = $lock_key; + $this->_lock = TRUE; + return TRUE; + } + + // Another process has the lock, we'll try to wait for it to free itself ... + $attempt = 0; + while ($attempt++ < 5) + { + usleep(((time() - $ts) * 1000000) - 20000); + if (($ts = $this->_memcached->get($lock_key)) < time()) + { + continue; + } + + if ( ! $this->_memcached->set($lock_key, time(), 5)) + { + log_message('error', 'Session: Error while trying to obtain lock for '.$this->_key_prefix.$session_id); + return FALSE; + } + + $this->_lock_key = $lock_key; + break; + } + + if ($attempt === 5) + { + log_message('error', 'Session: Unable to obtain lock for '.$this->_key_prefix.$session_id.' after 5 attempts, aborting.'); + return FALSE; + } + + $this->_lock = TRUE; + return TRUE; + } + + // ------------------------------------------------------------------------ + + /** + * Release lock + * + * Releases a previously acquired lock + * + * @return bool + */ + protected function _release_lock() + { + if (isset($this->_memcached, $this->_lock_key) && $this->_lock) + { + if ( ! $this->_memcached->delete($this->_lock_key) && $this->_memcached->getResultCode() !== Memcached::RES_NOTFOUND) + { + log_message('error', 'Session: Error while trying to free lock for '.$this->_key_prefix.$session_id); + return FALSE; + } + + $this->_lock_key = NULL; + $this->_lock = FALSE; + } + + return TRUE; + } + +} diff --git a/system/libraries/Session/drivers/Session_native.php b/system/libraries/Session/drivers/Session_native.php deleted file mode 100644 index c95e7f23f..000000000 --- a/system/libraries/Session/drivers/Session_native.php +++ /dev/null @@ -1,257 +0,0 @@ -<?php -/** - * CodeIgniter - * - * 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 - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @package CodeIgniter - * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) - * @license http://opensource.org/licenses/MIT MIT License - * @link http://codeigniter.com - * @since Version 1.0.0 - * @filesource - */ -defined('BASEPATH') OR exit('No direct script access allowed'); - -/** - * Native PHP session management driver - * - * This is the driver that uses the native PHP $_SESSION array through the Session driver library. - * - * @package CodeIgniter - * @subpackage Libraries - * @category Sessions - * @author EllisLab Dev Team - */ -class CI_Session_native extends CI_Session_driver { - - /** - * Initialize session driver object - * - * @return void - */ - protected function initialize() - { - // Get config parameters - $config = array(); - $prefs = array( - 'sess_cookie_name', - 'sess_expire_on_close', - 'sess_expiration', - 'sess_match_ip', - 'sess_match_useragent', - 'sess_time_to_update', - 'cookie_prefix', - 'cookie_path', - 'cookie_domain', - 'cookie_secure', - 'cookie_httponly' - ); - - foreach ($prefs as $key) - { - $config[$key] = isset($this->_parent->params[$key]) - ? $this->_parent->params[$key] - : $this->CI->config->item($key); - } - - // Set session name, if specified - if ($config['sess_cookie_name']) - { - // Differentiate name from cookie driver with '_id' suffix - $name = $config['sess_cookie_name'].'_id'; - if ($config['cookie_prefix']) - { - // Prepend cookie prefix - $name = $config['cookie_prefix'].$name; - } - session_name($name); - } - - // Set expiration, path, and domain - $expire = 7200; - $path = '/'; - $domain = ''; - $secure = (bool) $config['cookie_secure']; - $http_only = (bool) $config['cookie_httponly']; - - if ($config['sess_expiration'] !== FALSE) - { - // Default to 2 years if expiration is "0" - $expire = ($config['sess_expiration'] == 0) ? (60*60*24*365*2) : $config['sess_expiration']; - } - - if ($config['cookie_path']) - { - // Use specified path - $path = $config['cookie_path']; - } - - if ($config['cookie_domain']) - { - // Use specified domain - $domain = $config['cookie_domain']; - } - - session_set_cookie_params($config['sess_expire_on_close'] ? 0 : $expire, $path, $domain, $secure, $http_only); - - // Start session - session_start(); - - // Check session expiration, ip, and agent - $now = time(); - $destroy = FALSE; - if (isset($_SESSION['last_activity']) && (($_SESSION['last_activity'] + $expire) < $now OR $_SESSION['last_activity'] > $now)) - { - // Expired - destroy - log_message('debug', 'Session: Expired'); - $destroy = TRUE; - } - elseif ($config['sess_match_ip'] === TRUE && isset($_SESSION['ip_address']) - && $_SESSION['ip_address'] !== $this->CI->input->ip_address()) - { - // IP doesn't match - destroy - log_message('debug', 'Session: IP address mismatch'); - $destroy = TRUE; - } - elseif ($config['sess_match_useragent'] === TRUE && isset($_SESSION['user_agent']) - && $_SESSION['user_agent'] !== trim(substr($this->CI->input->user_agent(), 0, 50))) - { - // Agent doesn't match - destroy - log_message('debug', 'Session: User Agent string mismatch'); - $destroy = TRUE; - } - - // Destroy expired or invalid session - if ($destroy) - { - // Clear old session and start new - $this->sess_destroy(); - session_start(); - } - - // Check for update time - if ($config['sess_time_to_update'] && isset($_SESSION['last_activity']) - && ($_SESSION['last_activity'] + $config['sess_time_to_update']) < $now) - { - // Changing the session ID amidst a series of AJAX calls causes problems - if ( ! $this->CI->input->is_ajax_request()) - { - // Regenerate ID, but don't destroy session - log_message('debug', 'Session: Regenerate ID'); - $this->sess_regenerate(FALSE); - } - } - - // Set activity time - $_SESSION['last_activity'] = $now; - - // Set matching values as required - if ($config['sess_match_ip'] === TRUE && ! isset($_SESSION['ip_address'])) - { - // Store user IP address - $_SESSION['ip_address'] = $this->CI->input->ip_address(); - } - - if ($config['sess_match_useragent'] === TRUE && ! isset($_SESSION['user_agent'])) - { - // Store user agent string - $_SESSION['user_agent'] = trim(substr($this->CI->input->user_agent(), 0, 50)); - } - - // Make session ID available - $_SESSION['session_id'] = session_id(); - } - - // ------------------------------------------------------------------------ - - /** - * Save the session data - * - * @return void - */ - public function sess_save() - { - // Nothing to do - changes to $_SESSION are automatically saved - } - - // ------------------------------------------------------------------------ - - /** - * Destroy the current session - * - * @return void - */ - public function sess_destroy() - { - // Cleanup session - $_SESSION = array(); - $name = session_name(); - if (isset($_COOKIE[$name])) - { - // Clear session cookie - $params = session_get_cookie_params(); - setcookie($name, '', time() - 42000, $params['path'], $params['domain'], $params['secure'], $params['httponly']); - unset($_COOKIE[$name]); - } - session_destroy(); - } - - // ------------------------------------------------------------------------ - - /** - * Regenerate the current session - * - * Regenerate the session id - * - * @param bool Destroy session data flag (default: FALSE) - * @return void - */ - public function sess_regenerate($destroy = FALSE) - { - // Just regenerate id, passing destroy flag - session_regenerate_id($destroy); - $_SESSION['session_id'] = session_id(); - } - - // ------------------------------------------------------------------------ - - /** - * Get a reference to user data array - * - * @return array Reference to userdata - */ - public function &get_userdata() - { - // Just return reference to $_SESSION - return $_SESSION; - } - -} - -/* End of file Session_native.php */ -/* Location: ./system/libraries/Session/drivers/Session_native.php */
\ No newline at end of file diff --git a/system/libraries/Session/drivers/Session_redis_driver.php b/system/libraries/Session/drivers/Session_redis_driver.php new file mode 100644 index 000000000..c53975ae4 --- /dev/null +++ b/system/libraries/Session/drivers/Session_redis_driver.php @@ -0,0 +1,395 @@ +<?php +/** + * CodeIgniter + * + * 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 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @package CodeIgniter + * @author EllisLab Dev Team + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) + * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) + * @license http://opensource.org/licenses/MIT MIT License + * @link http://codeigniter.com + * @since Version 3.0.0 + * @filesource + */ +defined('BASEPATH') OR exit('No direct script access allowed'); + +/** + * CodeIgniter Session Redis Driver + * + * @package CodeIgniter + * @subpackage Libraries + * @category Sessions + * @author Andrey Andreev + * @link http://codeigniter.com/user_guide/libraries/sessions.html + */ +class CI_Session_redis_driver extends CI_Session_driver implements SessionHandlerInterface { + + /** + * phpRedis instance + * + * @var resource + */ + protected $_redis; + + /** + * Key prefix + * + * @var string + */ + protected $_key_prefix = 'ci_session:'; + + /** + * Lock key + * + * @var string + */ + protected $_lock_key; + + // ------------------------------------------------------------------------ + + /** + * Class constructor + * + * @param array $params Configuration parameters + * @return void + */ + public function __construct(&$params) + { + parent::__construct($params); + + if (empty($this->_config['save_path'])) + { + log_message('error', 'Session: No Redis save path configured.'); + } + elseif (preg_match('#(?:tcp://)?([^:?]+)(?:\:(\d+))?(\?.+)?#', $this->_config['save_path'], $matches)) + { + isset($matches[3]) OR $matches[3] = ''; // Just to avoid undefined index notices below + $this->_config['save_path'] = array( + 'host' => $matches[1], + 'port' => empty($matches[2]) ? NULL : $matches[2], + 'password' => preg_match('#auth=([^\s&]+)#', $matches[3], $match) ? $match[1] : NULL, + 'database' => preg_match('#database=(\d+)#', $matches[3], $match) ? (int) $match[1] : NULL, + 'timeout' => preg_match('#timeout=(\d+\.\d+)#', $matches[3], $match) ? (float) $match[1] : NULL + ); + + preg_match('#prefix=([^\s&]+)#', $matches[3], $match) && $this->_key_prefix = $match[1]; + } + else + { + log_message('error', 'Session: Invalid Redis save path format: '.$this->_config['save_path']); + } + + if ($this->_config['match_ip'] === TRUE) + { + $this->_key_prefix .= $_SERVER['REMOTE_ADDR'].':'; + } + } + + // ------------------------------------------------------------------------ + + /** + * Open + * + * Sanitizes save_path and initializes connection. + * + * @param string $save_path Server path + * @param string $name Session cookie name, unused + * @return bool + */ + public function open($save_path, $name) + { + if (empty($this->_config['save_path'])) + { + return FALSE; + } + + $redis = new Redis(); + if ( ! $redis->connect($this->_config['save_path']['host'], $this->_config['save_path']['port'], $this->_config['save_path']['timeout'])) + { + log_message('error', 'Session: Unable to connect to Redis with the configured settings.'); + } + elseif (isset($this->_config['save_path']['password']) && ! $redis->auth($this->_config['save_path']['password'])) + { + log_message('error', 'Session: Unable to authenticate to Redis instance.'); + } + elseif (isset($this->_config['save_path']['database']) && ! $redis->select($this->_config['save_path']['database'])) + { + log_message('error', 'Session: Unable to select Redis database with index '.$this->_config['save_path']['database']); + } + else + { + $this->_redis = $redis; + return TRUE; + } + + return FALSE; + } + + // ------------------------------------------------------------------------ + + /** + * Read + * + * Reads session data and acquires a lock + * + * @param string $session_id Session ID + * @return string Serialized session data + */ + public function read($session_id) + { + if (isset($this->_redis) && $this->_get_lock($session_id)) + { + // Needed by write() to detect session_regenerate_id() calls + $this->_session_id = $session_id; + + $session_data = (string) $this->_redis->get($this->_key_prefix.$session_id); + $this->_fingerprint = md5($session_data); + return $session_data; + } + + return FALSE; + } + + // ------------------------------------------------------------------------ + + /** + * Write + * + * Writes (create / update) session data + * + * @param string $session_id Session ID + * @param string $session_data Serialized session data + * @return bool + */ + public function write($session_id, $session_data) + { + if ( ! isset($this->_redis)) + { + return FALSE; + } + // Was the ID regenerated? + elseif ($session_id !== $this->_session_id) + { + if ( ! $this->_release_lock() OR ! $this->_get_lock($session_id)) + { + return FALSE; + } + + $this->_fingerprint = md5(''); + $this->_session_id = $session_id; + } + + if (isset($this->_lock_key)) + { + $this->_redis->setTimeout($this->_lock_key, 5); + if ($this->_fingerprint !== ($fingerprint = md5($session_data))) + { + if ($this->_redis->set($this->_key_prefix.$session_id, $session_data, $this->_config['expiration'])) + { + $this->_fingerprint = $fingerprint; + return TRUE; + } + + return FALSE; + } + + return $this->_redis->setTimeout($this->_key_prefix.$session_id, $this->_config['expiration']); + } + + return FALSE; + } + + // ------------------------------------------------------------------------ + + /** + * Close + * + * Releases locks and closes connection. + * + * @return void + */ + public function close() + { + if (isset($this->_redis)) + { + try { + if ($this->_redis->ping() === '+PONG') + { + isset($this->_lock_key) && $this->_redis->delete($this->_lock_key); + if ( ! $this->_redis->close()) + { + return FALSE; + } + } + } + catch (RedisException $e) + { + log_message('error', 'Session: Got RedisException on close(): '.$e->getMessage()); + } + + $this->_redis = NULL; + return TRUE; + } + + return TRUE; + } + + // ------------------------------------------------------------------------ + + /** + * Destroy + * + * Destroys the current session. + * + * @param string $session_id Session ID + * @return bool + */ + public function destroy($session_id) + { + if (isset($this->_redis, $this->_lock_key)) + { + if ($this->_redis->delete($this->_key_prefix.$session_id) !== 1) + { + log_message('debug', 'Session: Redis::delete() expected to return 1, got '.var_export($result, TRUE).' instead.'); + } + + return $this->_cookie_destroy(); + } + + return FALSE; + } + + // ------------------------------------------------------------------------ + + /** + * Garbage Collector + * + * Deletes expired sessions + * + * @param int $maxlifetime Maximum lifetime of sessions + * @return bool + */ + public function gc($maxlifetime) + { + // Not necessary, Redis takes care of that. + return TRUE; + } + + // ------------------------------------------------------------------------ + + /** + * Get lock + * + * Acquires an (emulated) lock. + * + * @param string $session_id Session ID + * @return bool + */ + protected function _get_lock($session_id) + { + if (isset($this->_lock_key)) + { + return $this->_redis->setTimeout($this->_lock_key, 5); + } + + $lock_key = $this->_key_prefix.$session_id.':lock'; + if (($ttl = $this->_redis->ttl($lock_key)) < 1) + { + if ( ! $this->_redis->setex($lock_key, 5, time())) + { + log_message('error', 'Session: Error while trying to obtain lock for '.$this->_key_prefix.$session_id); + return FALSE; + } + + $this->_lock_key = $lock_key; + + if ($ttl === -1) + { + log_message('debug', 'Session: Lock for '.$this->_key_prefix.$session_id.' had no TTL, overriding.'); + } + + $this->_lock = TRUE; + return TRUE; + } + + // Another process has the lock, we'll try to wait for it to free itself ... + $attempt = 0; + while ($attempt++ < 5) + { + usleep(($ttl * 1000000) - 20000); + if (($ttl = $this->_redis->ttl($lock_key)) > 0) + { + continue; + } + + if ( ! $this->_redis->setex($lock_key, 5, time())) + { + log_message('error', 'Session: Error while trying to obtain lock for '.$this->_key_prefix.$session_id); + return FALSE; + } + + $this->_lock_key = $lock_key; + break; + } + + if ($attempt === 5) + { + log_message('error', 'Session: Unable to obtain lock for '.$this->_key_prefix.$session_id.' after 5 attempts, aborting.'); + return FALSE; + } + + $this->_lock = TRUE; + return TRUE; + } + + // ------------------------------------------------------------------------ + + /** + * Release lock + * + * Releases a previously acquired lock + * + * @return bool + */ + protected function _release_lock() + { + if (isset($this->_redis, $this->_lock_key) && $this->_lock) + { + if ( ! $this->_redis->delete($this->_lock_key)) + { + log_message('error', 'Session: Error while trying to free lock for '.$this->_key_prefix.$session_id); + return FALSE; + } + + $this->_lock_key = NULL; + $this->_lock = FALSE; + } + + return TRUE; + } + +} diff --git a/system/libraries/Table.php b/system/libraries/Table.php index 118536f88..7a39dfc77 100644 --- a/system/libraries/Table.php +++ b/system/libraries/Table.php @@ -120,7 +120,7 @@ class CI_Table { $this->template[$key] = $val; } - log_message('debug', 'Table Class Initialized'); + log_message('info', 'Table Class Initialized'); } // -------------------------------------------------------------------- @@ -535,6 +535,3 @@ class CI_Table { } } - -/* End of file Table.php */ -/* Location: ./system/libraries/Table.php */
\ No newline at end of file diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index 3284923fd..23bdbbd58 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -103,7 +103,7 @@ class CI_Trackback { */ public function __construct() { - log_message('debug', 'Trackback Class Initialized'); + log_message('info', 'Trackback Class Initialized'); } // -------------------------------------------------------------------- @@ -554,6 +554,3 @@ class CI_Trackback { } } - -/* End of file Trackback.php */ -/* Location: ./system/libraries/Trackback.php */
\ No newline at end of file diff --git a/system/libraries/Typography.php b/system/libraries/Typography.php index c34fedcb1..3b6cb1645 100644 --- a/system/libraries/Typography.php +++ b/system/libraries/Typography.php @@ -172,7 +172,6 @@ class CI_Typography { // Build our finalized string. We cycle through the array, skipping tags, and processing the contained text $str = ''; $process = TRUE; - $paragraph = FALSE; for ($i = 0, $c = count($chunks) - 1; $i <= $c; $i++) { @@ -423,6 +422,3 @@ class CI_Typography { } } - -/* End of file Typography.php */ -/* Location: ./system/libraries/Typography.php */
\ No newline at end of file diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index 6137673c0..7b744adc6 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -111,7 +111,7 @@ class CI_Unit_test { */ public function __construct() { - log_message('debug', 'Unit Testing Class Initialized'); + log_message('info', 'Unit Testing Class Initialized'); } // -------------------------------------------------------------------- @@ -403,6 +403,3 @@ function is_false($test) { return ($test === FALSE); } - -/* End of file Unit_test.php */ -/* Location: ./system/libraries/Unit_test.php */
\ No newline at end of file diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php index e022c43d4..f5534a7f7 100644 --- a/system/libraries/Upload.php +++ b/system/libraries/Upload.php @@ -296,7 +296,7 @@ class CI_Upload { $this->_mimes =& get_mimes(); $this->_CI =& get_instance(); - log_message('debug', 'Upload Class Initialized'); + log_message('info', 'Upload Class Initialized'); } // -------------------------------------------------------------------- @@ -338,11 +338,9 @@ class CI_Upload { $this->$key = $defaults[$key]; } } - } else { - foreach ($config as $key => &$value) { if ($key[0] !== '_' && $reflection->hasProperty($key)) @@ -357,7 +355,6 @@ class CI_Upload { } } } - } // if a file_name was provided in the config, use it instead of the user input @@ -1300,6 +1297,3 @@ class CI_Upload { } } - -/* End of file Upload.php */ -/* Location: ./system/libraries/Upload.php */
\ No newline at end of file diff --git a/system/libraries/User_agent.php b/system/libraries/User_agent.php index 04e1a59ba..53d932a53 100644 --- a/system/libraries/User_agent.php +++ b/system/libraries/User_agent.php @@ -183,7 +183,7 @@ class CI_User_agent { $this->_compile_data(); } - log_message('debug', 'User Agent Class Initialized'); + log_message('info', 'User Agent Class Initialized'); } // -------------------------------------------------------------------- @@ -681,6 +681,3 @@ class CI_User_agent { } } - -/* End of file User_agent.php */ -/* Location: ./system/libraries/User_agent.php */
\ No newline at end of file diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php index 5ecebaf6d..9d7cbffa2 100644 --- a/system/libraries/Xmlrpc.php +++ b/system/libraries/Xmlrpc.php @@ -314,7 +314,7 @@ class CI_Xmlrpc { $this->initialize($config); - log_message('debug', 'XML-RPC Class Initialized'); + log_message('info', 'XML-RPC Class Initialized'); } // -------------------------------------------------------------------- @@ -1900,6 +1900,3 @@ class XML_RPC_Values extends CI_Xmlrpc } } // END XML_RPC_Values Class - -/* End of file Xmlrpc.php */ -/* Location: ./system/libraries/Xmlrpc.php */
\ No newline at end of file diff --git a/system/libraries/Xmlrpcs.php b/system/libraries/Xmlrpcs.php index f786b2323..af7041337 100644 --- a/system/libraries/Xmlrpcs.php +++ b/system/libraries/Xmlrpcs.php @@ -104,7 +104,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc { $this->methods = array_merge($this->methods, $config['functions']); } - log_message('debug', 'XML-RPC Server Class Initialized'); + log_message('info', 'XML-RPC Server Class Initialized'); } // -------------------------------------------------------------------- @@ -622,6 +622,3 @@ class CI_Xmlrpcs extends CI_Xmlrpc { } } - -/* End of file Xmlrpcs.php */ -/* Location: ./system/libraries/Xmlrpcs.php */
\ No newline at end of file diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php index cee5d8d76..f2f17148b 100644 --- a/system/libraries/Zip.php +++ b/system/libraries/Zip.php @@ -113,7 +113,7 @@ class CI_Zip { public function __construct() { $this->now = time(); - log_message('debug', 'Zip Compression Class Initialized'); + log_message('info', 'Zip Compression Class Initialized'); } // -------------------------------------------------------------------- @@ -482,6 +482,3 @@ class CI_Zip { } } - -/* End of file Zip.php */ -/* Location: ./system/libraries/Zip.php */
\ No newline at end of file diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index 713c0fdb3..8240d2340 100644 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -1,4 +1,9 @@ <?php +// For some reason, setting this fixes the 5.2 tests but breaks the 5.3 ones ... +if (version_compare(PHP_VERSION, '5.3.0', '<')) +{ + ini_set('memory_limit', '128M'); +} // Errors on full! ini_set('display_errors', 1); diff --git a/tests/codeigniter/core/Loader_test.php b/tests/codeigniter/core/Loader_test.php index 93ca5b223..9e2092e05 100644 --- a/tests/codeigniter/core/Loader_test.php +++ b/tests/codeigniter/core/Loader_test.php @@ -405,12 +405,19 @@ class Loader_test extends CI_TestCase { // Create model in VFS package path $dir = 'third-party'; $lib = 'unit_test_package'; - $class = 'CI_'.ucfirst($lib); + $class = ucfirst($lib); $this->ci_vfs_create(ucfirst($lib), '<?php class '.$class.' { }', $this->ci_app_root, array($dir, 'libraries')); // Get paths $paths = $this->load->get_package_paths(TRUE); + // Test failed load without path + $this->setExpectedException( + 'RuntimeException', + 'CI Error: Unable to load the requested class: '.ucfirst($lib) + ); + $this->load->library($lib); + // Add path and verify $path = APPPATH.$dir.'/'; $this->assertInstanceOf('CI_Loader', $this->load->add_package_path($path)); @@ -432,13 +439,6 @@ class Loader_test extends CI_TestCase { // Remove path and verify restored paths $this->assertInstanceOf('CI_Loader', $this->load->remove_package_path($path)); $this->assertEquals($paths, $this->load->get_package_paths(TRUE)); - - // Test failed load without path - $this->setExpectedException( - 'RuntimeException', - 'CI Error: Unable to load the requested class: '.ucfirst($lib) - ); - $this->load->library($lib); } // -------------------------------------------------------------------- diff --git a/tests/codeigniter/core/URI_test.php b/tests/codeigniter/core/URI_test.php index 50663d54a..42dff3639 100644 --- a/tests/codeigniter/core/URI_test.php +++ b/tests/codeigniter/core/URI_test.php @@ -252,6 +252,3 @@ class URI_test extends CI_TestCase { } } - -/* End of file URI_test.php */ -/* Location: ./tests/core/URI_test.php */
\ No newline at end of file diff --git a/tests/codeigniter/core/compat/standard_test.php b/tests/codeigniter/core/compat/standard_test.php index a3a6d9552..4077a5c7c 100644 --- a/tests/codeigniter/core/compat/standard_test.php +++ b/tests/codeigniter/core/compat/standard_test.php @@ -449,7 +449,6 @@ class standard_test extends CI_TestCase { return $this->markTestSkipped('quoted_printable_encode() is already available on PHP 5.3'); } - // These are actually imap_8bit() tests: $this->assertEquals("String with CRLF at end=20\r\n", quoted_printable_encode("String with CRLF at end \r\n")); // ext/imap/tests/imap_8bit_basic.phpt says for this line: @@ -459,6 +458,11 @@ class standard_test extends CI_TestCase { $this->assertEquals("String with tab at end =09", quoted_printable_encode("String with tab at end \t")); $this->assertEquals("=00=01=02=03=04=FE=FF=0A=0D", quoted_printable_encode("\x00\x01\x02\x03\x04\xfe\xff\x0a\x0d")); + if (function_exists('imap_8bit')) + { + return $this->markTestIncomplete('imap_8bit() exists and is called as an alias for quoted_printable_encode()'); + } + // And these are from ext/standard/tests/strings/quoted_printable_encode_002.phpt: $this->assertEquals( "=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=00=\r\n" diff --git a/tests/codeigniter/helpers/date_helper_test.php b/tests/codeigniter/helpers/date_helper_test.php index 0f16e6c49..c80e92cd0 100644 --- a/tests/codeigniter/helpers/date_helper_test.php +++ b/tests/codeigniter/helpers/date_helper_test.php @@ -315,5 +315,3 @@ class Date_helper_test extends CI_TestCase { } } - -/* End of file date_helper_test.php */
\ No newline at end of file diff --git a/tests/codeigniter/helpers/directory_helper_test.php b/tests/codeigniter/helpers/directory_helper_test.php index ac71dfaf8..253c1e368 100644 --- a/tests/codeigniter/helpers/directory_helper_test.php +++ b/tests/codeigniter/helpers/directory_helper_test.php @@ -57,5 +57,3 @@ class Directory_helper_test extends CI_TestCase { } } - -/* End of file directory_helper_test.php */
\ No newline at end of file diff --git a/tests/codeigniter/helpers/form_helper_test.php b/tests/codeigniter/helpers/form_helper_test.php index e234f9c83..b5fe99b96 100644 --- a/tests/codeigniter/helpers/form_helper_test.php +++ b/tests/codeigniter/helpers/form_helper_test.php @@ -288,5 +288,3 @@ EOH; } } - -/* End of file form_helper_test.php */
\ No newline at end of file diff --git a/tests/codeigniter/helpers/path_helper_test.php b/tests/codeigniter/helpers/path_helper_test.php index d25c3ed9b..9d325e70d 100644 --- a/tests/codeigniter/helpers/path_helper_test.php +++ b/tests/codeigniter/helpers/path_helper_test.php @@ -28,5 +28,3 @@ class Path_helper_test extends CI_TestCase { } } - -/* End of file path_helper_test.php */
\ No newline at end of file diff --git a/tests/codeigniter/libraries/Session_test.php b/tests/codeigniter/libraries/Session_test.php index 6f1332384..76a4fcc98 100644 --- a/tests/codeigniter/libraries/Session_test.php +++ b/tests/codeigniter/libraries/Session_test.php @@ -19,6 +19,7 @@ class Session_test extends CI_TestCase { */ public function set_up() { +return; // Override settings foreach ($this->settings as $name => $value) { $this->setting_vals[$name] = ini_get('session.'.$name); @@ -68,6 +69,7 @@ class Session_test extends CI_TestCase { */ public function tear_down() { +return; // Restore environment if (session_id()) session_destroy(); $_SESSION = array(); @@ -84,6 +86,7 @@ class Session_test extends CI_TestCase { */ public function test_set_userdata() { +return; // Set userdata values for each driver $key1 = 'test1'; $ckey2 = 'test2'; @@ -115,6 +118,7 @@ class Session_test extends CI_TestCase { */ public function test_has_userdata() { +return; // Set a userdata value for each driver $key = 'hastest'; $cmsg = 'My test data'; @@ -137,6 +141,7 @@ class Session_test extends CI_TestCase { */ public function test_all_userdata() { +return; // Set a specific series of data for each driver $cdata = array( 'one' => 'first', @@ -171,6 +176,7 @@ class Session_test extends CI_TestCase { */ public function test_unset_userdata() { +return; // Set a userdata message for each driver $key = 'untest'; $cmsg = 'Other test data'; @@ -194,6 +200,7 @@ class Session_test extends CI_TestCase { */ public function test_flashdata() { +return; // Set flashdata message for each driver $key = 'fltest'; $cmsg = 'Some flash data'; @@ -223,6 +230,7 @@ class Session_test extends CI_TestCase { */ public function test_keep_flashdata() { +return; // Set flashdata message for each driver $key = 'kfltest'; $cmsg = 'My flash data'; @@ -255,6 +263,7 @@ class Session_test extends CI_TestCase { public function test_keep_flashdata_with_array() { +return; // Set flashdata array for each driver $cdata = array( 'one' => 'first', @@ -308,6 +317,7 @@ class Session_test extends CI_TestCase { */ public function test_all_flashdata() { +return; // Set a specific series of data for each driver $cdata = array( 'one' => 'first', @@ -338,6 +348,7 @@ class Session_test extends CI_TestCase { */ public function test_set_tempdata() { +return; // Set tempdata message for each driver - 1 second timeout $key = 'tmptest'; $cmsg = 'Some temp data'; @@ -364,6 +375,7 @@ class Session_test extends CI_TestCase { */ public function test_unset_tempdata() { +return; // Set tempdata message for each driver - 1 second timeout $key = 'utmptest'; $cmsg = 'My temp data'; @@ -387,6 +399,7 @@ class Session_test extends CI_TestCase { */ public function test_sess_regenerate() { +return; // Get current session id, regenerate, and compare // Cookie driver $oldid = $this->session->cookie->userdata('session_id'); @@ -406,6 +419,7 @@ class Session_test extends CI_TestCase { */ public function test_sess_destroy() { +return; // Set a userdata message, destroy session, and verify absence $key = 'dsttest'; $msg = 'More test data'; diff --git a/tests/mocks/core/security.php b/tests/mocks/core/security.php index e19a8b20b..a21fc5cb3 100644 --- a/tests/mocks/core/security.php +++ b/tests/mocks/core/security.php @@ -10,13 +10,13 @@ class Mock_Core_Security extends CI_Security { return $this; } - // Overide inaccesible protected properties + // Override inaccessible protected properties public function __get($property) { return isset($this->{'_'.$property}) ? $this->{'_'.$property} : NULL; } - // Overide inaccesible protected method + // Override inaccessible protected method public function __call($method, $params) { if (is_callable(array($this, '_'.$method))) @@ -27,4 +27,4 @@ class Mock_Core_Security extends CI_Security { throw new BadMethodCallException('Method '.$method.' was not found'); } -}
\ No newline at end of file +} diff --git a/tests/mocks/database/schema/skeleton.php b/tests/mocks/database/schema/skeleton.php index b6d4b7893..5fe5b0f30 100644 --- a/tests/mocks/database/schema/skeleton.php +++ b/tests/mocks/database/schema/skeleton.php @@ -24,6 +24,13 @@ class Mock_Database_Schema_Skeleton { { if (empty(self::$db) && empty(self::$forge)) { + // E_DEPRECATED notices thrown by mysql_connect(), mysql_pconnect() + // on PHP 5.5+ cause the tests to fail + if ($driver === 'mysql' && version_compare(PHP_VERSION, '5.5', '>=')) + { + error_reporting(E_ALL & ~E_DEPRECATED); + } + $config = Mock_Database_DB::config($driver); $connection = new Mock_Database_DB($config); $db = Mock_Database_DB::DB($connection->set_dsn($driver), TRUE); diff --git a/tests/mocks/libraries/encrypt.php b/tests/mocks/libraries/encrypt.php index f1859398f..c14d1e02f 100644 --- a/tests/mocks/libraries/encrypt.php +++ b/tests/mocks/libraries/encrypt.php @@ -2,7 +2,7 @@ class Mock_Libraries_Encrypt extends CI_Encrypt { - // Overide inaccesible protected method + // Override inaccessible protected method public function __call($method, $params) { if (is_callable(array($this, '_'.$method))) @@ -13,4 +13,4 @@ class Mock_Libraries_Encrypt extends CI_Encrypt { throw new BadMethodCallException('Method '.$method.' was not found'); } -}
\ No newline at end of file +} diff --git a/tests/mocks/libraries/table.php b/tests/mocks/libraries/table.php index 87c278bce..08f80072a 100644 --- a/tests/mocks/libraries/table.php +++ b/tests/mocks/libraries/table.php @@ -2,7 +2,7 @@ class Mock_Libraries_Table extends CI_Table { - // Overide inaccesible protected method + // Override inaccessible protected method public function __call($method, $params) { if (is_callable(array($this, '_'.$method))) @@ -13,4 +13,4 @@ class Mock_Libraries_Table extends CI_Table { throw new BadMethodCallException('Method '.$method.' was not found'); } -}
\ No newline at end of file +} diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 42ef52c52..a0c0de83f 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -58,57 +58,58 @@ Release Date: Not Released - Added support for turning newline standardization on/off via ``$config['standardize_newlines']`` and set it to FALSE by default. - Added configuration setting ``$config['composer_autoload']`` to enable loading of a `Composer <https://getcomposer.org/>`_ auto-loader. - Removed the automatic conversion of 'programmatic characters' to HTML entities from the :doc:`URI Library <libraries/uri>`. + - Changed log messages that say a class or file was loaded to "info" level instead of "debug", so that they don't pollute log files when ``$config['log_threshold']`` is set to 2 (debug). - Helpers - :doc:`Date Helper <helpers/date_helper>` changes include: - - Added an optional third parameter to :func:`timespan()` that constrains the number of time units displayed. - - Added an optional parameter to :func:`timezone_menu()` that allows more attributes to be added to the generated select tag. - - Added function :func:`date_range()` that generates a list of dates between a specified period. + - Added an optional third parameter to :php:func:`timespan()` that constrains the number of time units displayed. + - Added an optional parameter to :php:func:`timezone_menu()` that allows more attributes to be added to the generated select tag. + - Added function :php:func:`date_range()` that generates a list of dates between a specified period. - Deprecated ``standard_date()``, which now just uses the native ``date()`` with `DateTime constants <http://www.php.net/manual/en/class.datetime.php#datetime.constants.types>`_. - - Changed :func:`now()` to work with all timezone strings supported by PHP. - - Changed :func:`days_in_month()` to use the native ``cal_days_in_month()`` PHP function, if available. + - Changed :php:func:`now()` to work with all timezone strings supported by PHP. + - Changed :php:func:`days_in_month()` to use the native ``cal_days_in_month()`` PHP function, if available. - :doc:`URL Helper <helpers/url_helper>` changes include: - - Deprecated *separator* options **dash** and **underscore** for function :func:`url_title()` (they are only aliases for '-' and '_' respectively). - - :func:`url_title()` will now trim extra dashes from beginning and end. - - :func:`anchor_popup()` will now fill the *href* attribute with the URL and its JS code will return FALSE instead. - - Added JS window name support to the :func:`anchor_popup()` function. - - Added support for menubar attribute to the :func:`anchor_popup()`. - - Added support (auto-detection) for HTTP/1.1 response codes 303, 307 in :func:`redirect()`. - - Changed :func:`redirect()` to choose the **refresh** method only on IIS servers, instead of all servers on Windows (when **auto** is used). - - Changed :func:`anchor()`, :func:`anchor_popup()`, and :func:`redirect()` to support protocol-relative URLs (e.g. *//ellislab.com/codeigniter*). + - Deprecated *separator* options **dash** and **underscore** for function :php:func:`url_title()` (they are only aliases for '-' and '_' respectively). + - :php:func:`url_title()` will now trim extra dashes from beginning and end. + - :php:func:`anchor_popup()` will now fill the *href* attribute with the URL and its JS code will return FALSE instead. + - Added JS window name support to the :php:func:`anchor_popup()` function. + - Added support for menubar attribute to the :php:func:`anchor_popup()`. + - Added support (auto-detection) for HTTP/1.1 response codes 303, 307 in :php:func:`redirect()`. + - Changed :php:func:`redirect()` to choose the **refresh** method only on IIS servers, instead of all servers on Windows (when **auto** is used). + - Changed :php:func:`anchor()`, :php:func:`anchor_popup()`, and :php:func:`redirect()` to support protocol-relative URLs (e.g. *//ellislab.com/codeigniter*). - :doc:`HTML Helper <helpers/html_helper>` changes include: - Added more doctypes. - Changed application and environment config files to be loaded in a cascade-like manner. - - Changed :func:`doctype()` to cache and only load once the doctypes array. + - Changed :php:func:`doctype()` to cache and only load once the doctypes array. - Deprecated functions ``nbs()`` and ``br()``, which are just aliases for the native ``str_repeat()`` with `` `` and ``<br />`` respectively. - :doc:`Inflector Helper <helpers/inflector_helper>` changes include: - - Changed :func:`humanize()` to allow passing an input separator as its second parameter. - - Changed :func:`humanize()` and :func:`underscore()` to utilize `mbstring <http://php.net/mbstring>`_, if available. - - Changed :func:`plural()` and :func:`singular()` to avoid double pluralization and support more words. + - Changed :php:func:`humanize()` to allow passing an input separator as its second parameter. + - Changed :php:func:`humanize()` and :php:func:`underscore()` to utilize `mbstring <http://php.net/mbstring>`_, if available. + - Changed :php:func:`plural()` and :php:func:`singular()` to avoid double pluralization and support more words. - :doc:`Download Helper <helpers/download_helper>` changes include: - - Added an optional third parameter to :func:`force_download()` that enables/disables sending the actual file MIME type in the Content-Type header (disabled by default). - - Added a work-around in :func:`force_download()` for a bug Android <= 2.1, where the filename extension needs to be in uppercase. - - Added support for reading from an existing file path by passing NULL as the second parameter to :func:`force_download()` (useful for large files and/or safely transmitting binary data). + - Added an optional third parameter to :php:func:`force_download()` that enables/disables sending the actual file MIME type in the Content-Type header (disabled by default). + - Added a work-around in :php:func:`force_download()` for a bug Android <= 2.1, where the filename extension needs to be in uppercase. + - Added support for reading from an existing file path by passing NULL as the second parameter to :php:func:`force_download()` (useful for large files and/or safely transmitting binary data). - :doc:`Form Helper <helpers/form_helper>` changes include: - - :func:`form_dropdown()` will now also take an array for unity with other form helpers. - - :func:`form_prep()`'s second argument now only accepts a boolean value, which determines whether the value is escaped for a <textarea> or a regular <input> element. + - :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()`. - :doc:`Security Helper <helpers/security_helper>` changes include: - - :func:`do_hash()` now uses PHP's native ``hash()`` function (supporting more algorithms) and is deprecated. - - :func:`strip_image_tags()` is now an alias for the same method in the :doc:`Security Library <libraries/security>`. + - :php:func:`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: @@ -119,15 +120,15 @@ Release Date: Not Released - :doc:`File Helper <helpers/file_helper>` changes include: - - :func:`set_realpath()` can now also handle file paths as opposed to just directories. - - Added an optional paramater to :func:`delete_files()` to enable it to skip deleting files such as *.htaccess* and *index.html*. + - :php:func:`set_realpath()` can now also handle file paths as opposed to just directories. + - Added an optional paramater to :php:func:`delete_files()` to enable it to skip deleting files such as *.htaccess* and *index.html*. - Deprecated function ``read_file()`` - it's just an alias for PHP's native ``file_get_contents()``. - :doc:`String Helper <helpers/string_helper>` changes include: - Deprecated function ``repeater()`` - it's just an alias for PHP's native ``str_repeat()``. - Deprecated function ``trim_slashes()`` - it's just an alias for PHP's native ``trim()`` (with a slash as its second argument). - - Deprecated randomization type options **unique** and **encrypt** for funcion :func:`random_string()` (they are only aliases for **md5** and **sha1** respectively). + - Deprecated randomization type options **unique** and **encrypt** for funcion :php:func:`random_string()` (they are only aliases for **md5** and **sha1** respectively). - :doc:`CAPTCHA Helper <helpers/captcha_helper>` changes include: @@ -140,12 +141,12 @@ Release Date: Not Released - :doc:`Text Helper <helpers/text_helper>` changes include: - - Changed the default tag for use in :func:`highlight_phrase()` to ``<mark>`` (formerly ``<strong>``). - - Changed :func:`character_limiter()`, :func:`word_wrap()` and :func:`ellipsize()` to utilize `mbstring <http://php.net/mbstring>`_ or `iconv <http://php.net/iconv>`_, if available. + - Changed the default tag for use in :php:func:`highlight_phrase()` to ``<mark>`` (formerly ``<strong>``). + - Changed :php:func:`character_limiter()`, :php:func:`word_wrap()` and :php:func:`ellipsize()` to utilize `mbstring <http://php.net/mbstring>`_ or `iconv <http://php.net/iconv>`_, if available. - - :doc:`Directory Helper <helpers/directory_helper>` :func:`directory_map()` will now append ``DIRECTORY_SEPARATOR`` to directory names in the returned array. - - :doc:`Array Helper <helpers/array_helper>` :func:`element()` and :func:`elements()` now return NULL instead of FALSE when the required elements don't exist. - - :doc:`Language Helper <helpers/language_helper>` :func:`lang()` now accepts an optional list of additional HTML attributes. + - :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. - Database @@ -283,19 +284,19 @@ Release Date: Not Released - :doc:`Session Library <libraries/sessions>` changes include: - - Library changed to :doc:`Driver <general/drivers>` with classic 'cookie' driver as the default. - - Added a 'native' PHP Session driver to work with ``$_SESSION``. - - Added a new **tempdata** feature that allows setting userdata items with expiration time (``tempdata()``, ``set_tempdata()``, ``unset_tempdata()``). - - Added default ``$config['sess_driver']`` and ``$config['sess_valid_drivers']`` items to *application/config.php* file. - - Changed 'cookie' driver to respect php.ini's *session.gc_probability* and *session.gc_divisor* settings. - - Changed 'cookie' driver to use HMAC authentication instead of a simple md5 checksum. - - Changed 'cookie' driver to select only one row when using database sessions. - - Changed 'cookie' driver to write to only write to the database at end of page execution. + - Completely re-written the library to use self-contained drivers via ``$config['sess_driver']``. + - Added 'files', 'database', 'redis' and 'memcached' drivers (using 'files' by default). + - Added ``$config['sess_save_path']`` setting to specify where the session data is stored, depending on the driver. + - Dropped support for storing session data in cookies (which renders ``$config['sess_encrypt_cookie']`` useless and is therefore also removed). + - Dropped official support for storing session data in databases other than MySQL and PostgreSQL. + - Changed table structure for the 'database' driver. + - Added a new **tempdata** feature that allows setting userdata items with expiration time (``mark_as_temp()``, ``tempdata()``, ``set_tempdata()``, ``unset_tempdata()``). - Changed method ``keep_flashdata()`` to also accept an array of keys. - Changed methods ``userdata()``, ``flashdata()`` to return an array of all userdata/flashdata when no parameter is passed. - Deprecated method ``all_userdata()`` - it is now just an alias for ``userdata()`` with no parameters. - Added method ``has_userdata()`` that verifies the existence of a userdata item. - Added *debug* level log messages for key events in the session validation process. + - Dropped support for the *sess_match_useragent* option. - :doc:`File Uploading Library <libraries/file_uploading>` changes include: @@ -317,7 +318,7 @@ Release Date: Not Released - Added configuration to generate days of other months instead of blank cells. - Added auto-configuration for *next_prev_url* if it is empty and *show_prev_next* is set to TRUE. - 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>` :func:`days_in_month()`. + - 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: @@ -336,7 +337,7 @@ Release Date: Not Released - Class properties *wm_font_color*, *wm_shadow_color* and *wm_use_drop_shadow* are now protected, to avoid breaking the ``text_watermark()`` method if they are set manually after initialization. - If property *maintain_ratio* is set to TRUE, ``image_reproportion()`` now doesn't need both width and height to be specified. - Property *maintain_ratio* is now taken into account when resizing images using ImageMagick library. - - Added support for maintaining transparency for PNG images in method ``text_watermark()``. + - Added support for maintaining transparency for PNG images when watermarking. - Added a **file_permissions** setting. - :doc:`Form Validation Library <libraries/form_validation>` changes include: @@ -352,6 +353,7 @@ Release Date: Not Released - Fields that have empty rules set no longer run through validation (and therefore are not considered erroneous). - Added rule **differs** to check if the value of a field differs from the value of another field. - Added rule **valid_url**. + - Added rule **in_list** to check if the value of a field is within a given list. - Added support for named parameters in error messages. - :doc:`Language <libraries/language>` line keys must now be prefixed with **form_validation_**. - Added rule **alpha_numeric_spaces**. @@ -395,9 +397,10 @@ Release Date: Not Released - Added support for the anchor "rel" attribute. - Added support for setting custom attributes. - Added support for language translations of the *first_link*, *next_link*, *prev_link* and *last_link* values. + - Added support for ``$config['num_links'] = 0`` configuration. - Added ``$config['reuse_query_string']`` to allow automatic repopulation of query string arguments, combined with normal URI segments. + - Added ``$config['use_global_url_suffix']`` to allow overriding the library 'suffix' value with that of the global ``$config['url_suffix']`` setting. - Removed the default `` `` from a number of the configuration variables. - - Added support for ``$config['num_links'] = 0`` configuration. - :doc:`Profiler Library <general/profiling>` changes include: @@ -486,23 +489,23 @@ Release Date: Not Released - Changed method ``_fetch_from_array()`` to parse array notation in field name. - Changed method ``_fetch_from_array()`` to allow retrieving multiple fields at once. - Added an option for ``_clean_input_keys()`` to return FALSE instead of terminating the whole script. - - Deprecated the ``is_cli_request()`` method, it is now an alias for the new :func:`is_cli()` common function. + - Deprecated the ``is_cli_request()`` method, it is now an alias for the new :php:func:`is_cli()` common function. - Added an ``$xss_clean`` parameter to method ``user_agent()`` and removed the ``$user_agent`` property. - :doc:`Common functions <general/common_functions>` changes include: - - Added function :func:`get_mimes()` to return the *application/config/mimes.php* array. - - Added support for HTTP code 303 ("See Other") in :func:`set_status_header()`. - - Removed redundant conditional to determine HTTP server protocol in :func:`set_status_header()`. + - Added function :php:func:`get_mimes()` to return the *application/config/mimes.php* array. + - Added support for HTTP code 303 ("See Other") in :php:func:`set_status_header()`. + - Removed redundant conditional to determine HTTP server protocol in :php:func:`set_status_header()`. - Renamed ``_exception_handler()`` to ``_error_handler()`` and replaced it with a real exception handler. - Changed ``_error_handler()`` to respect php.ini *display_errors* setting. - - Added function :func:`is_https()` to check if a secure connection is used. - - Added function :func:`is_cli()` to replace the ``CI_Input::is_cli_request()`` method. - - Added function :func:`function_usable()` to work around a bug in `Suhosin <http://www.hardened-php.net/suhosin/>`. - - Removed the third (`$php_error`) argument from function :func:`log_message()`. + - Added function :php:func:`is_https()` to check if a secure connection is used. + - Added function :php:func:`is_cli()` to replace the ``CI_Input::is_cli_request()`` method. + - Added function :php:func:`function_usable()` to work around a bug in `Suhosin <http://www.hardened-php.net/suhosin/>`. + - Removed the third (`$php_error`) argument from function :php:func:`log_message()`. - Changed internal function ``load_class()`` to accept a constructor parameter instead of (previously unused) class name prefix. - - Removed default parameter value of :func:`is_php()`. - - Added a second argument ``$double_encode`` to :func:`html_escape()`. + - Removed default parameter value of :php:func:`is_php()`. + - Added a second argument ``$double_encode`` to :php:func:`html_escape()`. - Changed function ``config_item()`` to return NULL instead of FALSE when no value is found. - :doc:`Output Library <libraries/output>` changes include: @@ -535,7 +538,7 @@ Release Date: Not Released - Changed method ``load()`` to filter the language name with ``ctype_alpha()``. - Changed method ``load()`` to also accept an array of language files. - Added an optional second parameter to method ``line()`` to disable error logging for line keys that were not found. - - Language files are now loaded in a cascading style with the one in **system/** always loaded and overriden afterwards, if another one is found. + - Language files are now loaded in a cascading style with the one in **system/** always loaded and overridden afterwards, if another one is found. - :doc:`Hooks Library <general/hooks>` changes include: @@ -553,6 +556,7 @@ Release Date: Not Released - Added a ``$config['log_file_permissions']`` setting. - Changed the library constructor to try to create the **log_path** directory if it doesn't exist. + - Added support for microseconds ("u" date format character) in ``$config['log_date_format']``. - Added `compatibility layers <general/compatibility_functions>` for: @@ -574,13 +578,13 @@ Bug fixes for 3.0 - Fixed a bug (#181) - a typo in the form validation language file. - Fixed a bug (#159, #163) - :doc:`Query Builder <database/query_builder>` nested transactions didn't work properly due to ``$_trans_depth`` not being incremented. - Fixed a bug (#737, #75) - :doc:`Pagination <libraries/pagination>` anchor class was not set properly when using initialize method. -- Fixed a bug (#419) - :doc:`URL Helper <helpers/url_helper>` :func:`auto_link()` didn't recognize URLs that come after a word boundary. +- Fixed a bug (#419) - :doc:`URL Helper <helpers/url_helper>` :php:func:`auto_link()` didn't recognize URLs that come after a word boundary. - Fixed a bug (#724) - :doc:`Form Validation Library <libraries/form_validation>` rule **is_unique** didn't check if a database connection exists. - Fixed a bug (#647) - :doc:`Zip Library <libraries/zip>` internal method ``_get_mod_time()`` didn't suppress possible "stat failed" errors generated by ``filemtime()``. - Fixed a bug (#157, #174) - :doc:`Image Manipulation Library <libraries/image_lib>` method ``clear()`` didn't completely clear properties. - 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>` :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>` :func:`timespan()` was using incorrect seconds for year and month. +- 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 (#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. @@ -654,24 +658,24 @@ Bug fixes for 3.0 - Fixed a bug in :doc:`Query Builder <database/query_builder>` method ``protect_identifiers()`` where if passed along with the field names, operators got escaped as well. - Fixed a bug (#10) - :doc:`URI Library <libraries/uri>` internal method ``_detect_uri()`` failed with paths containing a colon. - Fixed a bug (#1387) - :doc:`Query Builder <database/query_builder>` method ``from()`` didn't escape table aliases. -- Fixed a bug (#520) - :doc:`Date Helper <helpers/date_helper>` function :func:``nice_date()`` failed when the optional second parameter is not passed. +- Fixed a bug (#520) - :doc:`Date Helper <helpers/date_helper>` function :php:func:``nice_date()`` failed when the optional second parameter is not passed. - Fixed a bug (#167) - ``$config['permitted_uri_chars']`` didn't affect URL-encoded characters. - Fixed a bug (#318) - :doc:`Profiling Library <general/profiling>` setting *query_toggle_count* was not settable as described in the manual. - Fixed a bug (#938) - :doc:`Config Library <libraries/config>` method ``site_url()`` added a question mark to the URL string when query strings are enabled even if it already existed. - Fixed a bug (#999) - :doc:`Config Library <libraries/config>` method ``site_url()`` always appended ``$config['url_suffix']`` to the end of the URL string, regardless of whether a query string exists in it. -- Fixed a bug where :doc:`URL Helper <helpers/url_helper>` function :func:`anchor_popup()` ignored the attributes argument if it is not an array. +- Fixed a bug where :doc:`URL Helper <helpers/url_helper>` function :php:func:`anchor_popup()` ignored the attributes argument if it is not an array. - Fixed a bug (#1328) - :doc:`Form Validation Library <libraries/form_validation>` didn't properly check the type of the form fields before processing them. - Fixed a bug (#79) - :doc:`Form Validation Library <libraries/form_validation>` didn't properly validate array fields that use associative keys or have custom indexes. - Fixed a bug (#427) - :doc:`Form Validation Library <libraries/form_validation>` method ``strip_image_tags()`` was an alias to a non-existent method. - Fixed a bug (#1545) - :doc:`Query Builder <database/query_builder>` method ``limit()`` wasn't executed properly under Oracle. -- Fixed a bug (#1551) - :doc:`Date Helper <helpers/date_helper>` function :func:`standard_date()` didn't properly format *W3C* and *ATOM* standard dates. +- 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 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 :func:`form_multiselect()`, :func:`form_dropdown()` didn't properly handle empty array option groups. +- 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. - Fixed a bug (#1605) - :doc:`Pagination Library <libraries/pagination>` produced incorrect *previous* and *next* link values. - Fixed a bug in SQLSRV's ``affected_rows()`` method where an erroneous function name was used. - Fixed a bug (#1000) - Change syntax of ``$view_file`` to ``$_ci_view_file`` to prevent being overwritten by application. -- Fixed a bug (#1757) - :doc:`Directory Helper <helpers/directory_helper>` function :func:`directory_map()` was skipping files and directories named '0'. +- Fixed a bug (#1757) - :doc:`Directory Helper <helpers/directory_helper>` function :php:func:`directory_map()` was skipping files and directories named '0'. - Fixed a bug (#1789) - :doc:`Database Library <database/index>` method ``escape_str()`` escaped quote characters in LIKE conditions twice under MySQL. - Fixed a bug (#395) - :doc:`Unit Testing Library <libraries/unit_testing>` method ``result()`` didn't properly check array result columns when called from ``report()``. - Fixed a bug (#1692) - :doc:`Database Class <database/index>` method ``display_error()`` didn't properly trace the possible error source on Windows systems. @@ -690,13 +694,13 @@ Bug fixes for 3.0 - Fixed a bug (#134) - :doc:`Database Caching <database/caching>` method ``delete_cache()`` didn't work in some cases due to *cachedir* not being initialized properly. - Fixed a bug (#191) - :doc:`Loader Library <libraries/loader>` ignored attempts for (re)loading databases to ``get_instance()->db`` even when the old database connection is dead. - Fixed a bug (#1255) - :doc:`User Agent Library <libraries/user_agent>` method ``is_referral()`` only checked if ``$_SERVER['HTTP_REFERER']`` exists. -- Fixed a bug (#1146) - :doc:`Download Helper <helpers/download_helper>` function :func:`force_download()` incorrectly sent *Cache-Control* directives *pre-check* and *post-check* to Internet Explorer. +- Fixed a bug (#1146) - :doc:`Download Helper <helpers/download_helper>` function :php:func:`force_download()` incorrectly sent *Cache-Control* directives *pre-check* and *post-check* to Internet Explorer. - Fixed a bug (#1811) - :doc:`URI Library <libraries/uri>` didn't properly cache segments for ``uri_to_assoc()`` and ``ruri_to_assoc()``. - Fixed a bug (#1506) - :doc:`Form Helpers <helpers/form_helper>` set empty *name* attributes. - Fixed a bug (#59) - :doc:`Query Builder <database/query_builder>` method ``count_all_results()`` ignored the DISTINCT clause. - Fixed a bug (#1624) - :doc:`Form Validation Library <libraries/form_validation>` rule **matches** didn't property handle array field names. -- Fixed a bug (#1630) - :doc:`Form Helper <helpers/form_helper>` function :func:`set_value()` didn't escape HTML entities. -- Fixed a bug (#142) - :doc:`Form Helper <helpers/form_helper>` function :func:`form_dropdown()` didn't escape HTML entities in option values. +- Fixed a bug (#1630) - :doc:`Form Helper <helpers/form_helper>` function :php:func:`set_value()` didn't escape HTML entities. +- Fixed a bug (#142) - :doc:`Form Helper <helpers/form_helper>` function :php:func:`form_dropdown()` didn't escape HTML entities in option values. - Fixed a bug (#50) - :doc:`Session Library <libraries/sessions>` unnecessarily stripped slashed from serialized data, making it impossible to read objects in a namespace. - Fixed a bug (#658) - :doc:`Routing <general/routing>` wildcard **:any** didn't work as advertised and matched multiple URI segments instead of all characters within a single segment. - Fixed a bug (#1938) - :doc:`Email Library <libraries/email>` removed multiple spaces inside a pre-formatted plain text message. @@ -705,7 +709,7 @@ Bug fixes for 3.0 - Fixed a bug - :doc:`Routing Library <general/routing>` didn't properly handle *default_controller* in a subdirectory when a method is also specified. - Fixed a bug (#953) - :doc:`post_controller_constructor hook <general/hooks>` wasn't called with a *404_override*. - Fixed a bug (#1220) - :doc:`Profiler Library <general/profiling>` didn't display information for database objects that are instantiated inside models. -- Fixed a bug (#1978) - :doc:`Directory Helper <helpers/directory_helper>` function :func:`directory_map()`'s return array didn't make a distinction between directories and file indexes when a directory with a numeric name is present. +- Fixed a bug (#1978) - :doc:`Directory Helper <helpers/directory_helper>` function :php:func:`directory_map()`'s return array didn't make a distinction between directories and file indexes when a directory with a numeric name is present. - Fixed a bug (#777) - :doc:`Loader Library <libraries/loader>` didn't look for helper extensions in added package paths. - Fixed a bug (#18) - :doc:`APC Cache <libraries/caching>` driver didn't (un)serialize data, resulting in failure to store objects. - Fixed a bug (#188) - :doc:`Unit Testing Library <libraries/unit_testing>` filled up logs with error messages for non-existing language keys. @@ -713,13 +717,12 @@ Bug fixes for 3.0 - Fixed a bug (#2061) - :doc:`Routing Class <general/routing>` didn't properly sanitize directory, controller and function triggers with **enable_query_strings** set to TRUE. - Fixed a bug - SQLSRV didn't support ``escape_like_str()`` or escaping an array of values. - Fixed a bug - :doc:`Database Results <database/results>` method ``list_fields()`` didn't reset its field pointer for the 'mysql', 'mysqli' and 'mssql' drivers. -- Fixed a bug (#73) - :doc:`Security Library <libraries/security>` method ``sanitize_filename()`` could be tricked by an XSS attack. - Fixed a bug (#2211) - :doc:`Migration Library <libraries/migration>` extensions couldn't execute ``CI_Migration::__construct()``. - Fixed a bug (#2255) - :doc:`Email Library <libraries/email>` didn't apply *smtp_timeout* to socket reads and writes. - Fixed a bug (#2239) - :doc:`Email Library <libraries/email>` improperly handled the Subject when used with *bcc_batch_mode* resulting in E_WARNING messages and an empty Subject. - Fixed a bug (#2234) - :doc:`Query Builder <database/query_builder>` didn't reset JOIN cache for write-type queries. - 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 :func:`set_value()`, :func:`set_select()`, :func:`set_radio()`, :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 (#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 (#77) - :doc:`Database Class <database/index>` didn't properly handle the transaction "test mode" flag. @@ -729,33 +732,30 @@ Bug fixes for 3.0 - Fixed a bug (#2425) - OCI8 :doc:`database <database/index>` driver method ``stored_procedure()`` didn't log an error unless **db_debug** was set to TRUE. - Fixed a bug (#2490) - :doc:`Database Class <database/queries>` method ``query()`` returning boolean instead of a result object for PostgreSQL-specific *INSERT INTO ... RETURNING* statements. - Fixed a bug (#249) - :doc:`Cache Library <libraries/caching>` didn't properly handle Memcache(d) configurations with missing options. -- Fixed a bug (#180) - :func:`config_item()` didn't take into account run-time configuration changes. +- Fixed a bug (#180) - :php:func:`config_item()` didn't take into account run-time configuration changes. - Fixed a bug (#2551) - :doc:`Loader Library <libraries/loader>` method ``library()`` didn't properly check if a class that is being loaded already exists. -- Fixed a bug (#2560) - :doc:`Form Helper <helpers/form_helper>` function :func:`form_open()` set the 'method="post"' attribute only if the passed attributes equaled an empty string. +- Fixed a bug (#2560) - :doc:`Form Helper <helpers/form_helper>` function :php:func:`form_open()` set the 'method="post"' attribute only if the passed attributes equaled an empty string. - Fixed a bug (#2585) - :doc:`Query Builder <database/query_builder>` methods ``min()``, ``max()``, ``avg()``, ``sum()`` didn't escape field names. -- Fixed a bug (#2590) - :doc:`Common function <general/common_functions>` :func:`log_message()` didn't actually cache the ``CI_Log`` class instance. -- Fixed a bug (#2609) - :doc:`Common function <general/common_functions>` :func:`get_config()` optional argument was only effective on first function call. Also, it can now add items, in addition to updating existing items. +- Fixed a bug (#2590) - :doc:`Common function <general/common_functions>` :php:func:`log_message()` didn't actually cache the ``CI_Log`` class instance. +- Fixed a bug (#2609) - :doc:`Common function <general/common_functions>` :php:func:`get_config()` optional argument was only effective on first function call. Also, it can now add items, in addition to updating existing items. - Fixed a bug in the 'postgre' :doc:`database <database/index>` driver where the connection ID wasn't passed to ``pg_escape_string()``. - Fixed a bug (#33) - Script execution was terminated when an invalid cookie key was encountered. -- Fixed a bug (#2681) - :doc:`Security Library <libraries/security>` method ``entity_decode()`` used the `PREG_REPLACE_EVAL` flag, which is deprecated since PHP 5.5. - Fixed a bug (#2691) - nested :doc:`database <database/index>` transactions could end in a deadlock when an error is encountered with *db_debug* set to TRUE. - Fixed a bug (#2515) - ``_exception_handler()`` used to send the 200 "OK" HTTP status code and didn't stop script exection even on fatal errors. - Fixed a bug - Redis :doc:`Caching <libraries/caching>` driver didn't handle connection failures properly. - Fixed a bug (#2756) - :doc:`Database Class <database/index>` executed the MySQL-specific `SET SESSION sql_mode` query for all drivers when the 'stricton' option is set. - Fixed a bug (#2579) - :doc:`Query Builder <database/query_builder>` "no escape" functionality didn't work properly with query cache. - Fixed a bug (#2237) - :doc:`Parser Library <libraries/parser>` failed if the same tag pair is used more than once within a template. -- Fixed a bug (#2268) - :doc:`Security Library <libraries/security>` didn't properly match JavaScript events. - Fixed a bug (#2143) - :doc:`Form Validation Library <libraries/form_validation>` didn't check for rule groups named in a *controller/method* manner when trying to load from a config file. - Fixed a bug (#2762) - :doc:`Hooks Class <general/hooks>` didn't properly check if the called class/function exists. - Fixed a bug (#148) - :doc:`Input Library <libraries/input>` internal method ``_clean_input_data()`` assumed that it data is URL-encoded, stripping certain character sequences from it. - Fixed a bug (#346) - with ``$config['global_xss_filtering']`` turned on, the ``$_GET``, ``$_POST``, ``$_COOKIE`` and ``$_SERVER`` superglobals were overwritten during initialization time, resulting in XSS filtering being either performed twice or there was no possible way to get the original data, even though options for this do exist. - Fixed an edge case (#555) - :doc:`User Agent Library <libraries/user_agent>` reported an incorrect version Opera 10+ due to a non-standard user-agent string. -- Fixed a bug (#133) - :doc:`Text Helper <helpers/text_helper>` :func:`ascii_to_entities()` stripped the last character if it happens to be in the extended ASCII group. +- Fixed a bug (#133) - :doc:`Text Helper <helpers/text_helper>` :php:func:`ascii_to_entities()` stripped the last character if it happens to be in the extended ASCII group. - Fixed a bug (#2822) - ``fwrite()`` was used incorrectly throughout the whole framework, allowing incomplete writes when writing to a network stream and possibly a few other edge cases. - Fixed a bug where :doc:`User Agent Library <libraries/user_agent>` methods ``accept_charset()`` and ``accept_lang()`` didn't properly parse HTTP headers that contain spaces. - Fixed a bug where *default_controller* was called instad of triggering a 404 error if the current route is in a controller directory. - Fixed a bug (#2737) - :doc:`XML-RPC Library <libraries/xmlrpc>` used objects as array keys, which triggered E_NOTICE messages. -- Fixed a bug (#2729) - :doc:`Security Library <libraries/security>` internal method ``_validate_entities()`` used overly-intrusive ``preg_replace()`` patterns that produced false-positives. - Fixed a bug (#2771) - :doc:`Security Library <libraries/security>` method ``xss_clean()`` didn't take into account HTML5 entities. - Fixed a bug (#2856) - ODBC method ``affected_rows()`` passed an incorrect value to ``odbc_num_rows()``. - Fixed a bug (#43) :doc:`Image Manipulation Library <libraries/image_lib>` method ``text_watermark()`` didn't properly determine watermark placement. @@ -767,6 +767,31 @@ Bug fixes for 3.0 - Fixed a bug (#3161) - :doc:`Cache Library <libraries/caching>` methods `increment()`, `decrement()` didn't auto-create non-existent items when using redis and/or file storage. - Fixed a bug (#3189) - :doc:`Parser Library <libraries/parser>` used double replacement on ``key->value`` pairs, exposing a potential template injection vulnerability. +Version 2.2.1 +============= + +Release Date: January 22, 2015 + +- General Changes + + - Improved security in ``xss_clean()``. + - Updated timezones in :doc:`Date Helper <helpers/date_helper>`. + +Bug fixes for 2.2.1 +------------------- + +- Fixed a bug (#3094) - Internal method ``CI_Input::_clean_input_data()`` breaks encrypted session cookies. +- Fixed a bug (#2268) - :doc:`Security Library <libraries/security>` method ``xss_clean()`` didn't properly match JavaScript events. +- Fixed a bug (#3309) - :doc:`Security Library <libraries/security>` method ``xss_clean()`` used an overly-invasive pattern to strip JS event handlers. +- Fixed a bug (#2771) - :doc:`Security Library <libraries/security>` method ``xss_clean()`` didn't take into account HTML5 entities. +- Fixed a bug (#73) - :doc:`Security Library <libraries/security>` method ``sanitize_filename()`` could be tricked by an XSS attack. +- Fixed a bug (#2681) - :doc:`Security Library <libraries/security>` method ``entity_decode()`` used the ``PREG_REPLACE_EVAL`` flag, which is deprecated since PHP 5.5. +- Fixed a bug (#3302) - Internal function ``get_config()`` triggered an E_NOTICE message on PHP 5.6. +- Fixed a bug (#2508) - :doc:`Config Library <libraries/config>` didn't properly detect if the current request is via HTTPS. +- Fixed a bug (#3314) - SQLSRV :doc:`Database driver <database/index>`'s method ``count_all()`` didn't escape the supplied table name. +- Fixed a bug (#3404) - MySQLi :doc:`Database driver <database/index>`'s method ``escape_str()`` had a wrong fallback to ``mysql_escape_string()`` when there was no active connection. +- Fixed a bug in the :doc:`Session Library <libraries/sessions>` where session ID regeneration occurred during AJAX requests. + Version 2.2.0 ============= @@ -2255,7 +2280,7 @@ Release Date: January 30, 2008 - Added an "integer" rule into the Validation library. - Added valid_base64() to the Validation library. - Documented clear() in the :doc:`Image - Processing <../libraries/image_lib>` library. + Processing <./libraries/image_lib>` library. - Changed the behaviour of custom callbacks so that they no longer trigger the "required" rule. - Modified Upload class $_FILES error messages to be more precise. diff --git a/user_guide_src/source/conf.py b/user_guide_src/source/conf.py index 482d4936f..d65fe0dfd 100644 --- a/user_guide_src/source/conf.py +++ b/user_guide_src/source/conf.py @@ -69,11 +69,11 @@ exclude_patterns = [] # The reST default role (used for this markup: `text`) to use for all documents. #default_role = None -# If true, '()' will be appended to :func: etc. cross-reference text. +# If true, '()' will be appended to :php:func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description -# unit titles (such as .. function::). +# unit titles (such as .. php:function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the diff --git a/user_guide_src/source/contributing/index.rst b/user_guide_src/source/contributing/index.rst index 89bceaa61..e88147753 100644 --- a/user_guide_src/source/contributing/index.rst +++ b/user_guide_src/source/contributing/index.rst @@ -92,10 +92,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 is 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.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. Branching ========= diff --git a/user_guide_src/source/database/configuration.rst b/user_guide_src/source/database/configuration.rst index 9f52ad2a2..074725664 100644 --- a/user_guide_src/source/database/configuration.rst +++ b/user_guide_src/source/database/configuration.rst @@ -165,9 +165,9 @@ Explanation of Values: **password** The password used to connect to the database. **database** The name of the database you want to connect to. **dbdriver** The database type. ie: mysqli, postgre, odbc, etc. Must be specified in lower case. -**dbprefix** An optional table prefix which will added to the table name when running :doc: - `Query Builder <query_builder>` queries. This permits multiple CodeIgniter installations - to share one database. +**dbprefix** An optional table prefix which will added to the table name when running + :doc:`Query Builder <query_builder>` queries. This permits multiple CodeIgniter + installations to share one database. **pconnect** TRUE/FALSE (boolean) - Whether to use a persistent connection. **db_debug** TRUE/FALSE (boolean) - Whether database errors should be displayed. **cache_on** TRUE/FALSE (boolean) - Whether database query caching is enabled, diff --git a/user_guide_src/source/database/db_driver_reference.rst b/user_guide_src/source/database/db_driver_reference.rst index 7bee555c8..005e6b3dc 100644 --- a/user_guide_src/source/database/db_driver_reference.rst +++ b/user_guide_src/source/database/db_driver_reference.rst @@ -13,9 +13,9 @@ This article is intended to be a reference for them. some of them may fail (and return FALSE) if the underlying driver does not support them. -.. class:: CI_DB_driver +.. php:class:: CI_DB_driver - .. method:: initialize() + .. php:method:: initialize() :returns: TRUE on success, FALSE on failure :rtype: bool @@ -23,7 +23,7 @@ This article is intended to be a reference for them. Initialize database settings, establish a connection to the database. - .. method:: db_connect($persistent = TRUE) + .. php:method:: db_connect($persistent = TRUE) :param bool $persistent: Whether to establish a persistent connection or a regular one :returns: Database connection resource/object or FALSE on failure @@ -35,7 +35,7 @@ This article is intended to be a reference for them. driver in use. For example, a ``mysqli`` instance will be returned with the 'mysqli' driver. - .. method:: db_pconnect() + .. php:method:: db_pconnect() :returns: Database connection resource/object or FALSE on failure :rtype: mixed @@ -44,7 +44,7 @@ This article is intended to be a reference for them. .. note:: This method is just an alias for ``db_connect(TRUE)``. - .. method:: reconnect() + .. php:method:: reconnect() :returns: TRUE on success, FALSE on failure :rtype: bool @@ -53,7 +53,7 @@ This article is intended to be a reference for them. have been sent for a length of time exceeding the server's idle timeout. - .. method:: db_select([$database = '']) + .. php:method:: db_select([$database = '']) :param string $database: Database name :returns: TRUE on success, FALSE on failure @@ -61,7 +61,7 @@ This article is intended to be a reference for them. Select / switch the current database. - .. method:: db_set_charset($charset) + .. php:method:: db_set_charset($charset) :param string $charset: Character set name :returns: TRUE on success, FALSE on failure @@ -69,21 +69,21 @@ This article is intended to be a reference for them. Set client character set. - .. method:: platform() + .. php:method:: platform() :returns: Platform name :rtype: string The name of the platform in use (mysql, mssql, etc...). - .. method:: version() + .. php:method:: version() :returns: The version of the database being used :rtype: string Database version number. - .. 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 @@ -106,7 +106,7 @@ This article is intended to be a reference for them. page will be displayed instead of returning FALSE on failures and script execution will stop. - .. method:: simple_query($sql) + .. php:method:: simple_query($sql) :param string $sql: The SQL statement to execute :returns: Whatever the underlying driver's "query" function returns @@ -116,7 +116,7 @@ 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. - .. method:: trans_strict([$mode = TRUE]) + .. php:method:: trans_strict([$mode = TRUE]) :param bool $mode: Strict mode flag :rtype: void @@ -131,26 +131,26 @@ This article is intended to be a reference for them. autonomously, meaning a failure of one group will not affect any others. - .. method:: trans_off() + .. php:method:: trans_off() :rtype: void Disables transactions at run-time. - .. method:: trans_start([$test_mode = FALSE]) + .. php:method:: trans_start([$test_mode = FALSE]) :param bool $test_mode: Test mode flag :rtype: void Start a transaction. - .. method:: trans_complete() + .. php:method:: trans_complete() :rtype: void Complete Transaction. - .. method:: trans_status() + .. php:method:: trans_status() :returns: TRUE if the transaction succeeded, FALSE if it failed :rtype: bool @@ -158,7 +158,7 @@ This article is intended to be a reference for them. Lets you retrieve the transaction status flag to determine if it has failed. - .. method:: compile_binds($sql, $binds) + .. php:method:: compile_binds($sql, $binds) :param string $sql: The SQL statement :param array $binds: An array of binding data @@ -167,7 +167,7 @@ This article is intended to be a reference for them. Compiles an SQL query with the bind values passed for it. - .. method:: is_write_type($sql) + .. php:method:: is_write_type($sql) :param string $sql: The SQL statement :returns: TRUE if the SQL statement is of "write type", FALSE if not @@ -176,7 +176,7 @@ This article is intended to be a reference for them. Determines if a query is of a "write" type (such as INSERT, UPDATE, DELETE) or "read" type (i.e. SELECT). - .. method:: elapsed_time([$decimals = 6]) + .. php:method:: elapsed_time([$decimals = 6]) :param int $decimals: The number of decimal places :returns: The aggregate query elapsed time, in microseconds @@ -184,7 +184,7 @@ This article is intended to be a reference for them. Calculate the aggregate query elapsed time. - .. method:: total_queries() + .. php:method:: total_queries() :returns: The total number of queries executed :rtype: int @@ -192,14 +192,14 @@ This article is intended to be a reference for them. Returns the total number of queries that have been executed so far. - .. method:: last_query() + .. php:method:: last_query() :returns: The last query executed :rtype: string Returns the last query that was executed. - .. method:: escape($str) + .. php:method:: escape($str) :param mixed $str: The value to escape, or an array of multiple ones :returns: The escaped value(s) @@ -208,7 +208,7 @@ This article is intended to be a reference for them. Escapes input data based on type, including boolean and NULLs. - .. method:: escape_str($str[, $like = FALSE]) + .. php:method:: escape_str($str[, $like = FALSE]) :param mixed $str: A string value or array of multiple ones :param bool $like: Whether or not the string will be used in a LIKE condition @@ -220,7 +220,7 @@ This article is intended to be a reference for them. .. warning:: The returned strings do NOT include quotes around them. - .. method:: escape_like_str($str) + .. php:method:: escape_like_str($str) :param mixed $str: A string value or array of multiple ones :returns: The escaped string(s) @@ -232,7 +232,7 @@ This article is intended to be a reference for them. and ``_`` wildcard characters, so that they don't cause false-positives in LIKE conditions. - .. method:: primary($table) + .. php:method:: primary($table) :param string $table: Table name :returns: The primary key name, FALSE if none @@ -244,7 +244,7 @@ This article is intended to be a reference for them. key detection, the first column name may be assumed as the primary key. - .. method:: count_all([$table = '']) + .. php:method:: count_all([$table = '']) :param string $table: Table name :returns: Row count for the specified table @@ -253,7 +253,7 @@ This article is intended to be a reference for them. Returns the total number of rows in a table, or 0 if no table was provided. - .. method:: list_tables([$constrain_by_prefix = FALSE]) + .. php:method:: list_tables([$constrain_by_prefix = FALSE]) :param bool $constrain_by_prefix: TRUE to match table names by the configured dbprefix :returns: Array of table names or FALSE on failure @@ -261,7 +261,7 @@ This article is intended to be a reference for them. Gets a list of the tables in the current database. - .. method:: table_exists($table_name) + .. php:method:: table_exists($table_name) :param string $table_name: The table name :returns: TRUE if that table exists, FALSE if not @@ -269,7 +269,7 @@ This article is intended to be a reference for them. Determine if a particular table exists. - .. method:: list_fields($table) + .. php:method:: list_fields($table) :param string $table: The table name :returns: Array of field names or FALSE on failure @@ -277,7 +277,7 @@ This article is intended to be a reference for them. Gets a list of the field names in a table. - .. method:: field_exists($field_name, $table_name) + .. php:method:: field_exists($field_name, $table_name) :param string $table_name: The table name :param string $field_name: The field name @@ -286,7 +286,7 @@ This article is intended to be a reference for them. Determine if a particular field exists. - .. method:: field_data($table) + .. php:method:: field_data($table) :param string $table: The table name :returns: Array of field data items or FALSE on failure @@ -294,7 +294,7 @@ This article is intended to be a reference for them. Gets a list containing field data about a table. - .. method:: escape_identifiers($item) + .. php:method:: escape_identifiers($item) :param mixed $item: The item or array of items to escape :returns: The input item(s), escaped @@ -302,7 +302,7 @@ This article is intended to be a reference for them. Escape SQL identifiers, such as column, table and names. - .. method:: insert_string($table, $data) + .. php:method:: insert_string($table, $data) :param string $table: The target table :param array $data: An associative array of key/value pairs @@ -311,7 +311,7 @@ This article is intended to be a reference for them. Generate an INSERT statement string. - .. method:: update_string($table, $data, $where) + .. php:method:: update_string($table, $data, $where) :param string $table: The target table :param array $data: An associative array of key/value pairs @@ -321,7 +321,7 @@ This article is intended to be a reference for them. Generate an UPDATE statement string. - .. method:: call_function($function) + .. php:method:: call_function($function) :param string $function: Function name :returns: The function result @@ -330,28 +330,28 @@ This article is intended to be a reference for them. Runs a native PHP function , using a platform agnostic wrapper. - .. method:: cache_set_path([$path = '']) + .. php:method:: cache_set_path([$path = '']) :param string $path: Path to the cache directory :rtype: void Sets the directory path to use for caching storage. - .. method:: cache_on() + .. php:method:: cache_on() :returns: TRUE if caching is on, FALSE if not :rtype: bool Enable database results caching. - .. method:: cache_off() + .. php:method:: cache_off() :returns: TRUE if caching is on, FALSE if not :rtype: bool Disable database results caching. - .. method:: cache_delete([$segment_one = ''[, $segment_two = '']]) + .. php:method:: cache_delete([$segment_one = ''[, $segment_two = '']]) :param string $segment_one: First URI segment :param string $segment_two: Second URI segment @@ -360,20 +360,20 @@ This article is intended to be a reference for them. Delete the cache files associated with a particular URI. - .. method:: cache_delete_all() + .. php:method:: cache_delete_all() :returns: TRUE on success, FALSE on failure :rtype: bool Delete all cache files. - .. method:: close() + .. php:method:: close() :rtype: void Close the DB Connection. - .. method:: display_error([$error = ''[, $swap = ''[, $native = FALSE]]]) + .. php:method:: display_error([$error = ''[, $swap = ''[, $native = FALSE]]]) :param string $error: The error message :param string $swap: Any "swap" values @@ -388,7 +388,7 @@ This article is intended to be a reference for them. The message is displayed using the *application/views/errors/error_db.php* template. - .. method:: protect_identifiers($item[, $prefix_single = FALSE[, $protect_identifiers = NULL[, $field_exists = TRUE]]]) + .. php:method:: protect_identifiers($item[, $prefix_single = FALSE[, $protect_identifiers = NULL[, $field_exists = TRUE]]]) :param string $item: The item to work with :param bool $prefix_single: Whether to apply the dbprefix even if the input item is a single identifier diff --git a/user_guide_src/source/database/forge.rst b/user_guide_src/source/database/forge.rst index 59a6591b7..89fac023e 100644 --- a/user_guide_src/source/database/forge.rst +++ b/user_guide_src/source/database/forge.rst @@ -316,9 +316,9 @@ change the name you can add a "name" key into the field defining array. Class Reference *************** -.. class:: CI_DB_forge +.. php:class:: CI_DB_forge - .. method:: add_column($table[, $field = array()[, $_after = NULL]]) + .. php:method:: add_column($table[, $field = array()[, $_after = NULL]]) :param string $table: Table name to add the column to :param array $field: Column definition(s) @@ -328,7 +328,7 @@ Class Reference Adds a column to a table. Usage: See `Adding a Column to a Table`_. - .. method:: add_field($field) + .. php:method:: add_field($field) :param array $field: Field definition to add :returns: CI_DB_forge instance (method chaining) @@ -336,7 +336,7 @@ Class Reference Adds a field to the set that will be used to create a table. Usage: See `Adding fields`_. - .. method:: add_key($key[, $primary = FALSE]) + .. php:method:: add_key($key[, $primary = FALSE]) :param array $key: Name of a key field :param bool $primary: Set to TRUE if it should be a primary key or a regular one @@ -345,7 +345,7 @@ Class Reference Adds a key to the set that will be used to create a table. Usage: See `Adding Keys`_. - .. method:: create_database($db_name) + .. php:method:: create_database($db_name) :param string $db_name: Name of the database to create :returns: TRUE on success, FALSE on failure @@ -353,7 +353,7 @@ Class Reference Creates a new database. Usage: See `Creating and Dropping Databases`_. - .. method:: create_table($table[, $if_not_exists = FALSE[, array $attributes = array()]]) + .. php:method:: create_table($table[, $if_not_exists = FALSE[, array $attributes = array()]]) :param string $table: Name of the table to create :param string $if_not_exists: Set to TRUE to add an 'IF NOT EXISTS' clause @@ -363,7 +363,7 @@ Class Reference Creates a new table. Usage: See `Creating a table`_. - .. method:: drop_column($table, $column_name) + .. php:method:: drop_column($table, $column_name) :param string $table: Table name :param array $column_name: The column name to drop @@ -372,7 +372,7 @@ Class Reference Drops a column from a table. Usage: See `Dropping a Column From a Table`_. - .. method:: drop_database($db_name) + .. php:method:: drop_database($db_name) :param string $db_name: Name of the database to drop :returns: TRUE on success, FALSE on failure @@ -380,7 +380,7 @@ Class Reference Drops a database. Usage: See `Creating and Dropping Databases`_. - .. method:: drop_table($table_name[, $if_exists = FALSE]) + .. php:method:: drop_table($table_name[, $if_exists = FALSE]) :param string $table: Name of the table to drop :param string $if_exists: Set to TRUE to add an 'IF EXISTS' clause @@ -389,7 +389,7 @@ Class Reference Drops a table. Usage: See `Dropping a table`_. - .. method:: modify_column($table, $field) + .. php:method:: modify_column($table, $field) :param string $table: Table name :param array $field: Column definition(s) @@ -398,7 +398,7 @@ Class Reference Modifies a table column. Usage: See `Modifying a Column in a Table`_. - .. method:: rename_table($table_name, $new_table_name) + .. php:method:: rename_table($table_name, $new_table_name) :param string $table: Current of the table :param string $new_table_name: New name of the table diff --git a/user_guide_src/source/database/query_builder.rst b/user_guide_src/source/database/query_builder.rst index b06396e96..fa1e90353 100644 --- a/user_guide_src/source/database/query_builder.rst +++ b/user_guide_src/source/database/query_builder.rst @@ -1044,9 +1044,9 @@ run the query:: Class Reference *************** -.. class:: CI_DB_query_builder +.. php:class:: CI_DB_query_builder - .. method:: reset_query() + .. php:method:: reset_query() :returns: CI_DB_query_builder instance (method chaining) :rtype: CI_DB_query_builder @@ -1054,28 +1054,28 @@ Class Reference Resets the current Query Builder state. Useful when you want to build a query that can be cancelled under certain conditions. - .. method:: start_cache() + .. php:method:: start_cache() :returns: CI_DB_query_builder instance (method chaining) :rtype: CI_DB_query_builder Starts the Query Builder cache. - .. method:: stop_cache() + .. php:method:: stop_cache() :returns: CI_DB_query_builder instance (method chaining) :rtype: CI_DB_query_builder Stops the Query Builder cache. - .. method:: flush_cache() + .. php:method:: flush_cache() :returns: CI_DB_query_builder instance (method chaining) :rtype: CI_DB_query_builder Empties the Query Builder cache. - .. method:: set_dbprefix([$prefix = '']) + .. php:method:: set_dbprefix([$prefix = '']) :param string $prefix: The new prefix to use :returns: The DB prefix in use @@ -1083,7 +1083,7 @@ Class Reference Sets the database prefix, without having to reconnect. - .. method:: dbprefix([$table = '']) + .. php:method:: dbprefix([$table = '']) :param string $table: The table name to prefix :returns: The prefixed table name @@ -1091,7 +1091,7 @@ Class Reference Prepends a database prefix, if one exists in configuration. - .. method:: count_all_results([$table = '']) + .. php:method:: count_all_results([$table = '']) :param string $table: Table name :returns: Number of rows in the query result @@ -1100,7 +1100,7 @@ Class Reference Generates a platform-specific query string that counts all records returned by an Query Builder query. - .. method:: get([$table = ''[, $limit = NULL[, $offset = NULL]]]) + .. php:method:: get([$table = ''[, $limit = NULL[, $offset = NULL]]]) :param string $table: The table to query :param int $limit: The LIMIT clause @@ -1111,7 +1111,7 @@ Class Reference Compiles and runs SELECT statement based on the already called Query Builder methods. - .. method:: get_where([$table = ''[, $where = NULL[, $limit = NULL[, $offset = NULL]]]]) + .. php:method:: get_where([$table = ''[, $where = NULL[, $limit = NULL[, $offset = NULL]]]]) :param mixed $table: The table(s) to fetch data from; string or array :param string $where: The WHERE clause @@ -1122,7 +1122,7 @@ Class Reference Same as ``get()``, but also allows the WHERE to be added directly. - .. method:: select([$select = '*'[, $escape = NULL]]) + .. php:method:: select([$select = '*'[, $escape = NULL]]) :param string $select: The SELECT portion of a query :param bool $escape: Whether to escape values and identifiers @@ -1131,7 +1131,7 @@ Class Reference Adds a SELECT clause to a query. - .. method:: select_avg([$select = ''[, $alias = '']]) + .. php:method:: select_avg([$select = ''[, $alias = '']]) :param string $select: Field to compute the average of :param string $alias: Alias for the resulting value name @@ -1140,7 +1140,7 @@ Class Reference Adds a SELECT AVG(field) clause to a query. - .. method:: select_max([$select = ''[, $alias = '']]) + .. php:method:: select_max([$select = ''[, $alias = '']]) :param string $select: Field to compute the maximum of :param string $alias: Alias for the resulting value name @@ -1149,7 +1149,7 @@ Class Reference Adds a SELECT MAX(field) clause to a query. - .. method:: select_min([$select = ''[, $alias = '']]) + .. php:method:: select_min([$select = ''[, $alias = '']]) :param string $select: Field to compute the minimum of :param string $alias: Alias for the resulting value name @@ -1158,7 +1158,7 @@ Class Reference Adds a SELECT MIN(field) clause to a query. - .. method:: select_sum([$select = ''[, $alias = '']]) + .. php:method:: select_sum([$select = ''[, $alias = '']]) :param string $select: Field to compute the sum of :param string $alias: Alias for the resulting value name @@ -1167,7 +1167,7 @@ Class Reference Adds a SELECT SUM(field) clause to a query. - .. method:: distinct([$val = TRUE]) + .. php:method:: distinct([$val = TRUE]) :param bool $val: Desired value of the "distinct" flag :returns: CI_DB_query_builder instance (method chaining) @@ -1176,7 +1176,7 @@ Class Reference Sets a flag which tells the query builder to add a DISTINCT clause to the SELECT portion of the query. - .. method:: from($from) + .. php:method:: from($from) :param mixed $from: Table name(s); string or array :returns: CI_DB_query_builder instance (method chaining) @@ -1184,7 +1184,7 @@ Class Reference Specifies the FROM clause of a query. - .. method:: join($table, $cond[, $type = ''[, $escape = NULL]]) + .. php:method:: join($table, $cond[, $type = ''[, $escape = NULL]]) :param string $table: Table name to join :param string $cond: The JOIN ON condition @@ -1195,7 +1195,7 @@ Class Reference Adds a JOIN clause to a query. - .. method:: where($key[, $value = NULL[, $escape = NULL]]) + .. php:method:: where($key[, $value = NULL[, $escape = NULL]]) :param mixed $key: Name of field to compare, or associative array :param mixed $value: If a single key, compared to this value @@ -1206,7 +1206,7 @@ Class Reference Generates the WHERE portion of the query. Separates multiple calls with 'AND'. - .. method:: or_where($key[, $value = NULL[, $escape = NULL]]) + .. php:method:: or_where($key[, $value = NULL[, $escape = NULL]]) :param mixed $key: Name of field to compare, or associative array :param mixed $value: If a single key, compared to this value @@ -1217,7 +1217,7 @@ Class Reference Generates the WHERE portion of the query. Separates multiple calls with 'OR'. - .. method:: or_where_in([$key = NULL[, $values = NULL[, $escape = NULL]]]) + .. php:method:: or_where_in([$key = NULL[, $values = NULL[, $escape = NULL]]]) :param string $key: The field to search :param array $values: The values searched on @@ -1228,7 +1228,7 @@ Class Reference Generates a WHERE field IN('item', 'item') SQL query, joined with 'OR' if appropriate. - .. method:: or_where_not_in([$key = NULL[, $values = NULL[, $escape = NULL]]]) + .. php:method:: or_where_not_in([$key = NULL[, $values = NULL[, $escape = NULL]]]) :param string $key: The field to search :param array $values: The values searched on @@ -1239,7 +1239,7 @@ Class Reference Generates a WHERE field NOT IN('item', 'item') SQL query, joined with 'OR' if appropriate. - .. method:: where_in([$key = NULL[, $values = NULL[, $escape = NULL]]]) + .. php:method:: where_in([$key = NULL[, $values = NULL[, $escape = NULL]]]) :param string $key: Name of field to examine :param array $values: Array of target values @@ -1250,7 +1250,7 @@ Class Reference Generates a WHERE field IN('item', 'item') SQL query, joined with 'AND' if appropriate. - .. method:: where_not_in([$key = NULL[, $values = NULL[, $escape = NULL]]]) + .. php:method:: where_not_in([$key = NULL[, $values = NULL[, $escape = NULL]]]) :param string $key: Name of field to examine :param array $values: Array of target values @@ -1261,42 +1261,42 @@ Class Reference Generates a WHERE field NOT IN('item', 'item') SQL query, joined with 'AND' if appropriate. - .. method:: group_start() + .. php:method:: group_start() :returns: CI_DB_query_builder instance (method chaining) :rtype: CI_DB_query_builder Starts a group expression, using ANDs for the conditions inside it. - .. method:: or_group_start() + .. php:method:: or_group_start() :returns: CI_DB_query_builder instance (method chaining) :rtype: CI_DB_query_builder Starts a group expression, using ORs for the conditions inside it. - .. method:: not_group_start() + .. php:method:: not_group_start() :returns: CI_DB_query_builder instance (method chaining) :rtype: CI_DB_query_builder Starts a group expression, using AND NOTs for the conditions inside it. - .. method:: or_not_group_start() + .. php:method:: or_not_group_start() :returns: CI_DB_query_builder instance (method chaining) :rtype: CI_DB_query_builder Starts a group expression, using OR NOTs for the conditions inside it. - .. method:: group_end() + .. php:method:: group_end() :returns: DB_query_builder instance :rtype: object Ends a group expression. - .. method:: like($field[, $match = ''[, $side = 'both'[, $escape = NULL]]]) + .. php:method:: like($field[, $match = ''[, $side = 'both'[, $escape = NULL]]]) :param string $field: Field name :param string $match: Text portion to match @@ -1307,7 +1307,7 @@ Class Reference Adds a LIKE clause to a query, separating multiple calls with AND. - .. method:: or_like($field[, $match = ''[, $side = 'both'[, $escape = NULL]]]) + .. php:method:: or_like($field[, $match = ''[, $side = 'both'[, $escape = NULL]]]) :param string $field: Field name :param string $match: Text portion to match @@ -1318,7 +1318,7 @@ Class Reference Adds a LIKE clause to a query, separating multiple class with OR. - .. method:: not_like($field[, $match = ''[, $side = 'both'[, $escape = NULL]]]) + .. php:method:: not_like($field[, $match = ''[, $side = 'both'[, $escape = NULL]]]) :param string $field: Field name :param string $match: Text portion to match @@ -1329,7 +1329,7 @@ Class Reference Adds a NOT LIKE clause to a query, separating multiple calls with AND. - .. method:: or_not_like($field[, $match = ''[, $side = 'both'[, $escape = NULL]]]) + .. php:method:: or_not_like($field[, $match = ''[, $side = 'both'[, $escape = NULL]]]) :param string $field: Field name :param string $match: Text portion to match @@ -1340,7 +1340,7 @@ Class Reference Adds a NOT LIKE clause to a query, separating multiple calls with OR. - .. method:: having($key[, $value = NULL[, $escape = NULL]]) + .. php:method:: having($key[, $value = NULL[, $escape = NULL]]) :param mixed $key: Identifier (string) or associative array of field/value pairs :param string $value: Value sought if $key is an identifier @@ -1350,7 +1350,7 @@ Class Reference Adds a HAVING clause to a query, separating multiple calls with AND. - .. method:: or_having($key[, $value = NULL[, $escape = NULL]]) + .. php:method:: or_having($key[, $value = NULL[, $escape = NULL]]) :param mixed $key: Identifier (string) or associative array of field/value pairs :param string $value: Value sought if $key is an identifier @@ -1360,7 +1360,7 @@ Class Reference Adds a HAVING clause to a query, separating multiple calls with OR. - .. method:: group_by($by[, $escape = NULL]) + .. php:method:: group_by($by[, $escape = NULL]) :param mixed $by: Field(s) to group by; string or array :returns: CI_DB_query_builder instance (method chaining) @@ -1368,7 +1368,7 @@ Class Reference Adds a GROUP BY clause to a query. - .. method:: order_by($orderby[, $direction = ''[, $escape = NULL]]) + .. php:method:: order_by($orderby[, $direction = ''[, $escape = NULL]]) :param string $orderby: Field to order by :param string $direction: The order requested - ASC, DESC or random @@ -1378,7 +1378,7 @@ Class Reference Adds an ORDER BY clause to a query. - .. method:: limit($value[, $offset = 0]) + .. php:method:: limit($value[, $offset = 0]) :param int $value: Number of rows to limit the results to :param int $offset: Number of rows to skip @@ -1387,7 +1387,7 @@ Class Reference Adds LIMIT and OFFSET clauses to a query. - .. method:: offset($offset) + .. php:method:: offset($offset) :param int $offset: Number of rows to skip :returns: CI_DB_query_builder instance (method chaining) @@ -1395,7 +1395,7 @@ Class Reference Adds an OFFSET clause to a query. - .. method:: set($key[, $value = ''[, $escape = NULL]]) + .. php:method:: set($key[, $value = ''[, $escape = NULL]]) :param mixed $key: Field name, or an array of field/value pairs :param string $value: Field value, if $key is a single field @@ -1406,7 +1406,7 @@ Class Reference Adds field/value pairs to be passed later to ``insert()``, ``update()`` or ``replace()``. - .. method:: insert([$table = ''[, $set = NULL[, $escape = NULL]]]) + .. php:method:: insert([$table = ''[, $set = NULL[, $escape = NULL]]]) :param string $table: Table name :param array $set: An associative array of field/value pairs @@ -1416,7 +1416,7 @@ Class Reference Compiles and executes an INSERT statement. - .. method:: insert_batch([$table = ''[, $set = NULL[, $escape = NULL]]]) + .. php:method:: insert_batch([$table = ''[, $set = NULL[, $escape = NULL]]]) :param string $table: Table name :param array $set: Data to insert @@ -1426,7 +1426,7 @@ Class Reference Compiles and executes batch INSERT statements. - .. method:: set_insert_batch($key[, $value = ''[, $escape = NULL]]) + .. php:method:: set_insert_batch($key[, $value = ''[, $escape = NULL]]) :param mixed $key: Field name or an array of field/value pairs :param string $value: Field value, if $key is a single field @@ -1436,7 +1436,7 @@ Class Reference Adds field/value pairs to be inserted in a table later via ``insert_batch()``. - .. method:: update([$table = ''[, $set = NULL[, $where = NULL[, $limit = NULL]]]]) + .. php:method:: update([$table = ''[, $set = NULL[, $where = NULL[, $limit = NULL]]]]) :param string $table: Table name :param array $set: An associative array of field/value pairs @@ -1447,7 +1447,7 @@ Class Reference Compiles and executes an UPDATE statement. - .. method:: update_batch([$table = ''[, $set = NULL[, $value = NULL]]]) + .. php:method:: update_batch([$table = ''[, $set = NULL[, $value = NULL]]]) :param string $table: Table name :param array $set: Field name, or an associative array of field/value pairs @@ -1457,7 +1457,7 @@ Class Reference Compiles and executes batch UPDATE statements. - .. method:: set_update_batch($key[, $value = ''[, $escape = NULL]]) + .. php:method:: set_update_batch($key[, $value = ''[, $escape = NULL]]) :param mixed $key: Field name or an array of field/value pairs :param string $value: Field value, if $key is a single field @@ -1467,7 +1467,7 @@ Class Reference Adds field/value pairs to be updated in a table later via ``update_batch()``. - .. method:: replace([$table = ''[, $set = NULL]]) + .. php:method:: replace([$table = ''[, $set = NULL]]) :param string $table: Table name :param array $set: An associative array of field/value pairs @@ -1476,7 +1476,7 @@ Class Reference Compiles and executes a REPLACE statement. - .. method:: delete([$table = ''[, $where = ''[, $limit = NULL[, $reset_data = TRUE]]]]) + .. php:method:: delete([$table = ''[, $where = ''[, $limit = NULL[, $reset_data = TRUE]]]]) :param mixed $table: The table(s) to delete from; string or array :param string $where: The WHERE clause @@ -1487,7 +1487,7 @@ Class Reference Compiles and executes a DELETE query. - .. method:: truncate([$table = '']) + .. php:method:: truncate([$table = '']) :param string $table: Table name :returns: TRUE on success, FALSE on failure @@ -1498,7 +1498,7 @@ Class Reference .. note:: If the database platform in use doesn't support TRUNCATE, a DELETE statement will be used instead. - .. method:: empty_table([$table = '']) + .. php:method:: empty_table([$table = '']) :param string $table: Table name :returns: TRUE on success, FALSE on failure @@ -1506,7 +1506,7 @@ Class Reference Deletes all records from a table via a DELETE statement. - .. method:: get_compiled_select([$table = ''[, $reset = TRUE]]) + .. php:method:: get_compiled_select([$table = ''[, $reset = TRUE]]) :param string $table: Table name :param bool $reset: Whether to reset the current QB values or not @@ -1515,7 +1515,7 @@ Class Reference Compiles a SELECT statement and returns it as a string. - .. method:: get_compiled_insert([$table = ''[, $reset = TRUE]]) + .. php:method:: get_compiled_insert([$table = ''[, $reset = TRUE]]) :param string $table: Table name :param bool $reset: Whether to reset the current QB values or not @@ -1524,7 +1524,7 @@ Class Reference Compiles an INSERT statement and returns it as a string. - .. method:: get_compiled_update([$table = ''[, $reset = TRUE]]) + .. php:method:: get_compiled_update([$table = ''[, $reset = TRUE]]) :param string $table: Table name :param bool $reset: Whether to reset the current QB values or not @@ -1533,7 +1533,7 @@ Class Reference Compiles an UPDATE statement and returns it as a string. - .. method:: get_compiled_delete([$table = ''[, $reset = TRUE]]) + .. php:method:: get_compiled_delete([$table = ''[, $reset = TRUE]]) :param string $table: Table name :param bool $reset: Whether to reset the current QB values or not diff --git a/user_guide_src/source/database/results.rst b/user_guide_src/source/database/results.rst index ae81998c7..a22c2e8c3 100644 --- a/user_guide_src/source/database/results.rst +++ b/user_guide_src/source/database/results.rst @@ -245,9 +245,9 @@ TRUE on success or FALSE on failure. Class Reference *************** -.. class:: CI_DB_result +.. php:class:: CI_DB_result - .. method:: result([$type = 'object']) + .. php:method:: result([$type = 'object']) :param string $type: Type of requested results - array, object, or class name :returns: Array containing the fetched rows @@ -258,7 +258,7 @@ Class Reference Usage: see `Result Arrays`_. - .. method:: result_array() + .. php:method:: result_array() :returns: Array containing the fetched rows :rtype: array @@ -268,7 +268,7 @@ Class Reference Usage: see `Result Arrays`_. - .. method:: result_object() + .. php:method:: result_object() :returns: Array containing the fetched rows :rtype: array @@ -278,7 +278,7 @@ Class Reference Usage: see `Result Arrays`_. - .. method:: custom_result_object($class_name) + .. php:method:: custom_result_object($class_name) :param string $class_name: Class name for the resulting rows :returns: Array containing the fetched rows @@ -287,7 +287,7 @@ Class Reference Returns the query results as an array of rows, where each row is an instance of the specified class. - .. method:: row([$n = 0[, $type = 'object']]) + .. php:method:: row([$n = 0[, $type = 'object']]) :param int $n: Index of the query results row to be returned :param string $type: Type of the requested result - array, object, or class name @@ -299,7 +299,7 @@ Class Reference Usage: see `Result Rows`_. - .. method:: unbuffered_row([$type = 'object']) + .. php:method:: unbuffered_row([$type = 'object']) :param string $type: Type of the requested result - array, object, or class name :returns: Next row from the result set or NULL if it doesn't exist @@ -310,7 +310,7 @@ Class Reference Usage: see `Result Rows`_. - .. method:: row_array([$n = 0]) + .. php:method:: row_array([$n = 0]) :param int $n: Index of the query results row to be returned :returns: The requested row or NULL if it doesn't exist @@ -320,7 +320,7 @@ Class Reference Usage: see `Result Rows`_. - .. method:: row_object([$n = 0]) + .. php:method:: row_object([$n = 0]) :param int $n: Index of the query results row to be returned :returns: The requested row or NULL if it doesn't exist @@ -331,7 +331,7 @@ Class Reference Usage: see `Result Rows`_. - .. method:: custom_row_object($n, $type) + .. php:method:: custom_row_object($n, $type) :param int $n: Index of the results row to return :param string $class_name: Class name for the resulting row @@ -341,7 +341,7 @@ Class Reference Returns the requested result row as an instance of the requested class. - .. method:: data_seek([$n = 0]) + .. php:method:: data_seek([$n = 0]) :param int $n: Index of the results row to be returned next :returns: TRUE on success, FALSE on failure @@ -351,7 +351,7 @@ Class Reference Usage: see `Result Helper Methods`_. - .. method:: set_row($key[, $value = NULL]) + .. php:method:: set_row($key[, $value = NULL]) :param mixed $key: Column name or array of key/value pairs :param mixed $value: Value to assign to the column, $key is a single field name @@ -359,7 +359,7 @@ Class Reference Assigns a value to a particular column. - .. method:: next_row([$type = 'object']) + .. php:method:: next_row([$type = 'object']) :param string $type: Type of the requested result - array, object, or class name :returns: Next row of result set, or NULL if it doesn't exist @@ -367,7 +367,7 @@ Class Reference Returns the next row from the result set. - .. method:: previous_row([$type = 'object']) + .. php:method:: previous_row([$type = 'object']) :param string $type: Type of the requested result - array, object, or class name :returns: Previous row of result set, or NULL if it doesn't exist @@ -375,7 +375,7 @@ Class Reference Returns the previous row from the result set. - .. method:: first_row([$type = 'object']) + .. php:method:: first_row([$type = 'object']) :param string $type: Type of the requested result - array, object, or class name :returns: First row of result set, or NULL if it doesn't exist @@ -383,7 +383,7 @@ Class Reference Returns the first row from the result set. - .. method:: last_row([$type = 'object']) + .. php:method:: last_row([$type = 'object']) :param string $type: Type of the requested result - array, object, or class name :returns: Last row of result set, or NULL if it doesn't exist @@ -391,7 +391,7 @@ Class Reference Returns the last row from the result set. - .. method:: num_rows() + .. php:method:: num_rows() :returns: Number of rows in the result set :rtype: int @@ -400,7 +400,7 @@ Class Reference Usage: see `Result Helper Methods`_. - .. method:: num_fields() + .. php:method:: num_fields() :returns: Number of fields in the result set :rtype: int @@ -409,7 +409,7 @@ Class Reference Usage: see `Result Helper Methods`_. - .. method:: field_data() + .. php:method:: field_data() :returns: Array containing field meta-data :rtype: array @@ -417,7 +417,7 @@ Class Reference Generates an array of ``stdClass`` objects containing field meta-data. - .. method:: free_result() + .. php:method:: free_result() :rtype: void @@ -425,7 +425,7 @@ Class Reference Usage: see `Result Helper Methods`_. - .. method:: list_fields() + .. php:method:: list_fields() :returns: Array of column names :rtype: array diff --git a/user_guide_src/source/database/utilities.rst b/user_guide_src/source/database/utilities.rst index 0d8137dd7..2da1f981d 100644 --- a/user_guide_src/source/database/utilities.rst +++ b/user_guide_src/source/database/utilities.rst @@ -247,9 +247,9 @@ Preference Default Value Options Descript Class Reference *************** -.. class:: CI_DB_utility +.. php:class:: CI_DB_utility - .. method:: backup([$params = array()]) + .. php:method:: backup([$params = array()]) :param array $params: An associative array of options :returns: void @@ -257,7 +257,7 @@ Class Reference Perform a database backup, per user preferences. - .. method:: database_exists($database_name) + .. php:method:: database_exists($database_name) :param string $database_name: Database name :returns: TRUE if the database exists, FALSE otherwise @@ -265,21 +265,21 @@ Class Reference Check for the existence of a database. - .. method:: list_databases() + .. php:method:: list_databases() :returns: Array of database names found :rtype: array Retrieve a list of all the database names. - .. method:: optimize_database() + .. php:method:: optimize_database() :returns: Array of optimization messages or FALSE on failure :rtype: array Optimizes the database. - .. method:: optimize_table($table_name) + .. php:method:: optimize_table($table_name) :param string $table_name: Name of the table to optimize :returns: Array of optimization messages or FALSE on failure @@ -287,7 +287,7 @@ Class Reference Optimizes a database table. - .. method:: repair_table($table_name) + .. php:method:: repair_table($table_name) :param string $table_name: Name of the table to repair :returns: Array of repair messages or FALSE on failure @@ -295,7 +295,7 @@ Class Reference Repairs a database table. - .. method:: csv_from_results($query[, $delim = ','[, $newline = "\n"[, $enclosure = '"']]]) + .. php:method:: csv_from_results($query[, $delim = ','[, $newline = "\n"[, $enclosure = '"']]]) :param object $query: A database result object :param string $delim: The CSV field delimiter to use @@ -306,7 +306,7 @@ Class Reference Translates a database result object into a CSV document. - .. method:: xml_from_results($query[, $params = array()]) + .. php:method:: xml_from_results($query[, $params = array()]) :param object $query: A database result object :param array $params: An associative array of preferences diff --git a/user_guide_src/source/documentation/index.rst b/user_guide_src/source/documentation/index.rst index 6d4c94bc1..60c6b4ed6 100644 --- a/user_guide_src/source/documentation/index.rst +++ b/user_guide_src/source/documentation/index.rst @@ -115,9 +115,9 @@ For example, consider the following ReST: .. code-block:: rst - .. class:: Some_class + .. php:class:: Some_class - .. method:: some_method ( $foo [, $bar [, $bat]]) + .. php:method:: some_method ( $foo [, $bar [, $bat]]) This function will perform some action. The ``$bar`` array must contain a something and something else, and along with ``$bat`` is an optional @@ -151,7 +151,7 @@ For example, consider the following ReST: See also :meth:`Some_class::should_do_something` - .. method:: should_do_something() + .. php:method:: should_do_something() :returns: Whether or not something should be done :rtype: bool @@ -159,10 +159,10 @@ For example, consider the following ReST: It creates the following display: -.. class:: Some_class +.. php:class:: Some_class - .. method:: some_method ( $foo [, $bar [, $bat]]) + .. php:method:: some_method ( $foo [, $bar [, $bat]]) This function will perform some action. The ``$bar`` array must contain a something and something else, and along with ``$bat`` is an optional @@ -196,7 +196,7 @@ It creates the following display: See also :meth:`Some_class::should_do_something` - .. method:: should_do_something() + .. php:method:: should_do_something() :returns: Whether or not something should be done :rtype: bool
\ No newline at end of file diff --git a/user_guide_src/source/general/ancillary_classes.rst b/user_guide_src/source/general/ancillary_classes.rst index f9b6ba231..6a64742ce 100644 --- a/user_guide_src/source/general/ancillary_classes.rst +++ b/user_guide_src/source/general/ancillary_classes.rst @@ -9,7 +9,7 @@ resources. This is easily possible as you'll see. get_instance() ============== -.. function:: get_instance() +.. php:function:: get_instance() :returns: object of class CI_Controller @@ -52,7 +52,7 @@ Once you've assigned the object to a variable, you'll use that variable This is very important. Assigning by reference allows you to use the original CodeIgniter object rather than creating a copy of it. -Furthermore, if you'll be using ``get_intance()`` inside anoter class, +Furthermore, if you'll be using ``get_instance()`` inside another class, then it would be better if you assign it to a property. This way, you won't need to call ``get_instance()`` in every single method. diff --git a/user_guide_src/source/general/cli.rst b/user_guide_src/source/general/cli.rst index 4f3b07d9e..b45be1aa8 100644 --- a/user_guide_src/source/general/cli.rst +++ b/user_guide_src/source/general/cli.rst @@ -23,7 +23,7 @@ but they are not always obvious. - Run your cron-jobs without needing to use *wget* or *curl* - Make your cron-jobs inaccessible from being loaded in the URL by - checking the return value of :func:`is_cli()`. + checking the return value of :php:func:`is_cli()`. - Make interactive "tasks" that can do things like set permissions, prune cache folders, run backups, etc. - Integrate with other applications in other languages. For example, a diff --git a/user_guide_src/source/general/common_functions.rst b/user_guide_src/source/general/common_functions.rst index 399a323cc..6d6744cf7 100644 --- a/user_guide_src/source/general/common_functions.rst +++ b/user_guide_src/source/general/common_functions.rst @@ -13,7 +13,7 @@ loading any libraries or helpers. <div class="custom-index container"></div> -.. function:: is_php($version) +.. php:function:: is_php($version) :param string $version: Version number :returns: TRUE if the running PHP version is at least the one specified or FALSE if not @@ -33,7 +33,7 @@ loading any libraries or helpers. greater than the supplied version number. Returns FALSE if the installed version of PHP is lower than the supplied version number. -.. function:: is_really_writable($file) +.. php:function:: is_really_writable($file) :param string $file: File path :returns: TRUE if the path is writable, FALSE if not @@ -60,7 +60,7 @@ loading any libraries or helpers. .. note:: See also `PHP bug #54709 <https://bugs.php.net/bug.php?id=54709>`_ for more info. -.. function:: config_item($key) +.. php:function:: config_item($key) :param string $key: Config item key :returns: Configuration key value or NULL if not found @@ -99,7 +99,7 @@ loading any libraries or helpers. This function is an alias for ``CI_Log::write_log()``. For more info, please see the :doc:`Error Handling <errors>` documentation. -.. function:: set_status_header($code[, $text = '']) +.. php:function:: set_status_header($code[, $text = '']) :param int $code: HTTP Reponse status code :param string $text: A custom message to set with the status code @@ -113,7 +113,7 @@ loading any libraries or helpers. `See here <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html>`_ for a full list of headers. -.. function:: remove_invisible_characters($str[, $url_encoded = TRUE]) +.. php:function:: remove_invisible_characters($str[, $url_encoded = TRUE]) :param string $str: Input string :param bool $url_encoded: Whether to remove URL-encoded characters as well @@ -128,7 +128,7 @@ loading any libraries or helpers. remove_invisible_characters('Java\\0script'); // Returns: 'Javascript' -.. function:: html_escape($var) +.. php:function:: html_escape($var) :param mixed $var: Variable to escape (string or array) :returns: HTML escaped string(s) @@ -139,7 +139,7 @@ loading any libraries or helpers. It is useful in preventing Cross Site Scripting (XSS). -.. function:: get_mimes() +.. php:function:: get_mimes() :returns: An associative array of file types :rtype: array @@ -147,7 +147,7 @@ loading any libraries or helpers. This function returns a *reference* to the MIMEs array from *application/config/mimes.php*. -.. function:: is_https() +.. php:function:: is_https() :returns: TRUE if currently using HTTP-over-SSL, FALSE if not :rtype: bool @@ -155,7 +155,7 @@ loading any libraries or helpers. Returns TRUE if a secure (HTTPS) connection is used and FALSE in any other case (including non-HTTP requests). -.. function:: is_cli() +.. php:function:: is_cli() :returns: TRUE if currently running under CLI, FALSE otherwise :rtype: bool @@ -166,7 +166,7 @@ loading any libraries or helpers. .. note:: This function checks both if the ``PHP_SAPI`` value is 'cli' or if the ``STDIN`` constant is defined. -.. function:: function_usable($function_name) +.. php:function:: function_usable($function_name) :param string $function_name: Function name :returns: TRUE if the function can be used, FALSE if not diff --git a/user_guide_src/source/general/compatibility_functions.rst b/user_guide_src/source/general/compatibility_functions.rst index aee9b1ef0..434b0982f 100644 --- a/user_guide_src/source/general/compatibility_functions.rst +++ b/user_guide_src/source/general/compatibility_functions.rst @@ -44,7 +44,7 @@ Constants Function reference ================== -.. function:: password_get_info($hash) +.. php:function:: password_get_info($hash) :param string $hash: Password hash :returns: Information about the hashed password @@ -53,7 +53,7 @@ Function reference For more information, please refer to the `PHP manual for password_get_info() <http://php.net/password_get_info>`_. -.. function:: password_hash($password, $algo[, $options = array()]) +.. php:function:: password_hash($password, $algo[, $options = array()]) :param string $password: Plain-text password :param int $algo: Hashing algorithm @@ -72,7 +72,7 @@ Function reference - /dev/arandom - /dev/urandom -.. function:: password_needs_rehash() +.. php:function:: password_needs_rehash() :param string $hash: Password hash :param int $algo: Hashing algorithm @@ -83,7 +83,7 @@ Function reference For more information, please refer to the `PHP manual for password_needs_rehash() <http://php.net/password_needs_rehash>`_. -.. function:: password_verify($password, $hash) +.. php:function:: password_verify($password, $hash) :param string $password: Plain-text password :param string $hash: Password hash @@ -109,7 +109,7 @@ Dependencies Function reference ================== -.. function:: hash_equals($known_string, $user_string) +.. php:function:: hash_equals($known_string, $user_string) :param string $known_string: Known string :param string $user_string: User-supplied string @@ -119,7 +119,7 @@ Function reference For more information, please refer to the `PHP manual for hash_equals() <http://php.net/hash_equals>`_. -.. function:: hash_pbkdf2($algo, $password, $salt, $iterations[, $length = 0[, $raw_output = FALSE]]) +.. php:function:: hash_pbkdf2($algo, $password, $salt, $iterations[, $length = 0[, $raw_output = FALSE]]) :param string $algo: Hashing algorithm :param string $password: Password @@ -162,7 +162,7 @@ Dependencies Function reference ================== -.. function:: mb_strlen($str[, $encoding = NULL]) +.. php:function:: mb_strlen($str[, $encoding = NULL]) :param string $str: Input string :param string $encoding: Character set @@ -172,7 +172,7 @@ Function reference For more information, please refer to the `PHP manual for mb_strlen() <http://php.net/mb_strlen>`_. -.. function:: mb_strpos($haystack, $needle[, $offset = 0[, $encoding = NULL]]) +.. php:function:: mb_strpos($haystack, $needle[, $offset = 0[, $encoding = NULL]]) :param string $haystack: String to search in :param string $needle: Part of string to search for @@ -184,7 +184,7 @@ Function reference For more information, please refer to the `PHP manual for mb_strpos() <http://php.net/mb_strpos>`_. -.. function:: mb_substr($str, $start[, $length = NULL[, $encoding = NULL]]) +.. php:function:: mb_substr($str, $start[, $length = NULL[, $encoding = NULL]]) :param string $str: Input string :param int $start: Position of first character @@ -211,7 +211,7 @@ Dependencies Function reference ================== -.. function:: array_column(array $array, $column_key[, $index_key = NULL]) +.. php:function:: array_column(array $array, $column_key[, $index_key = NULL]) :param array $array: Array to fetch results from :param mixed $column_key: Key of the column to return values from @@ -222,7 +222,7 @@ Function reference For more information, please refer to the `PHP manual for array_column() <http://php.net/array_column>`_. -.. function:: array_replace(array $array1[, ...]) +.. 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 @@ -232,7 +232,7 @@ Function reference For more information, please refer to the `PHP manual for array_replace() <http://php.net/array_replace>`_. -.. function:: array_replace_recursive(array $array1[, ...]) +.. 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 @@ -245,7 +245,7 @@ Function reference .. important:: Only PHP's native function can detect endless recursion. Unless you are running PHP 5.3+, be careful with references! -.. function:: hex2bin($data) +.. php:function:: hex2bin($data) :param array $data: Hexadecimal representation of data :returns: Binary representation of the given data @@ -254,7 +254,7 @@ Function reference For more information, please refer to the `PHP manual for hex2bin() <http://php.net/hex2bin>`_. -.. function:: quoted_printable_encode($str) +.. php:function:: quoted_printable_encode($str) :param string $str: Input string :returns: 8bit-encoded string diff --git a/user_guide_src/source/general/creating_libraries.rst b/user_guide_src/source/general/creating_libraries.rst index 0e3ae4c85..d6b0631af 100644 --- a/user_guide_src/source/general/creating_libraries.rst +++ b/user_guide_src/source/general/creating_libraries.rst @@ -54,8 +54,6 @@ Classes should have this basic prototype:: } } - /* End of file Someclass.php */ - .. note:: We are using the name Someclass purely as an example. Using Your Class diff --git a/user_guide_src/source/general/credits.rst b/user_guide_src/source/general/credits.rst index 371808fe4..d22e3a9bc 100644 --- a/user_guide_src/source/general/credits.rst +++ b/user_guide_src/source/general/credits.rst @@ -12,7 +12,7 @@ It was, for years, developed and maintained by EllisLab, the ExpressionEngine Development Team and a group of community members called the Reactor Team. In 2014, CodeIgniter was acquired by the `British Columbia Institute of Technology -<http://bcit.ca/>`_ and was then officially announced as a community-maintaned +<http://bcit.ca/>`_ and was then officially announced as a community-maintained project. Bleeding edge development is spearheaded by the handpicked contributors diff --git a/user_guide_src/source/general/errors.rst b/user_guide_src/source/general/errors.rst index 26c26bea1..9c190feb1 100644 --- a/user_guide_src/source/general/errors.rst +++ b/user_guide_src/source/general/errors.rst @@ -29,84 +29,93 @@ software keep track of your scripts and the health of your application. The following functions let you generate errors: -.. function:: show_error($message, $status_code, $heading = 'An Error Was Encountered') +.. php:function:: show_error($message, $status_code, $heading = 'An Error Was Encountered') :param mixed $message: Error message :param int $status_code: HTTP Response status code :param string $heading: Error page heading :rtype: void -This function will display the error message supplied to it using the -following error template:: + This function will display the error message supplied to it using + the error template appropriate to your execution:: - application/views/errors/error_general.php + application/views/errors/html/error_general.php -The optional parameter ``$status_code`` determines what HTTP status -code should be sent with the error. If ``$status_code`` is less than 100, -the HTTP status code will be set to 500, and the exit status code will -be set to ``$status_code + EXIT__AUTO_MIN``. If that value is larger than -``EXIT__AUTO_MAX``, or if ``$status_code`` is 100 or higher, the exit -status code will be set to ``EXIT_ERROR``. You can check in -*application/config/constants.php* for more detail. + or: -.. function:: show_404($page = '', $log_error = TRUE) + application/views/errors/cli/error_general.php + + The optional parameter ``$status_code`` determines what HTTP status + code should be sent with the error. If ``$status_code`` is less + than 100, the HTTP status code will be set to 500, and the exit + status code will be set to ``$status_code + EXIT__AUTO_MIN``. + If that value is larger than ``EXIT__AUTO_MAX``, or if + ``$status_code`` is 100 or higher, the exit status code will be set + to ``EXIT_ERROR``. + You can check in *application/config/constants.php* for more detail. + +.. php:function:: show_404($page = '', $log_error = TRUE) :param string $page: URI string :param bool $log_error: Whether to log the error :rtype: void -This function will display the 404 error message supplied to it using -the following error template:: + This function will display the 404 error message supplied to it + using the error template appropriate to your execution:: + + application/views/errors/html/error_404.php + + or: - application/views/errors/error_404.php + application/views/errors/cli/error_404.php -The function expects the string passed to it to be the file path to the -page that isn't found. The exit status code will be set to ``EXIT_UNKNOWN_FILE``. -Note that CodeIgniter automatically shows 404 messages if controllers are -not found. + The function expects the string passed to it to be the file path to + the page that isn't found. The exit status code will be set to + ``EXIT_UNKNOWN_FILE``. + Note that CodeIgniter automatically shows 404 messages if + controllers are not found. -CodeIgniter automatically logs any ``show_404()`` calls. Setting the -optional second parameter to FALSE will skip logging. + CodeIgniter automatically logs any ``show_404()`` calls. Setting the + optional second parameter to FALSE will skip logging. -.. function:: log_message($level, $message, $php_error = FALSE) +.. php:function:: log_message($level, $message, $php_error = FALSE) :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 supply -one of three "levels" in the first parameter, indicating what type of -message it is (debug, error, info), with the message itself in the -second parameter. - -Example:: - - if ($some_var == '') - { - log_message('error', 'Some variable did not contain a value.'); - } - else - { - log_message('debug', 'Some variable was correctly set'); - } - - log_message('info', 'The purpose of some variable is to provide some value.'); - -There are three message types: - -#. Error Messages. These are actual errors, such as PHP errors or user - errors. -#. Debug Messages. These are messages that assist in debugging. For - example, if a class has been initialized, you could log this as - debugging info. -#. Informational Messages. These are the lowest priority messages, - simply giving information regarding some process. CodeIgniter doesn't - natively generate any info messages but you may want to in your - application. - -.. note:: In order for the log file to actually be written, the *logs* - directory must be writable. In addition, you must set the "threshold" - for logging in *application/config/config.php*. You might, for example, - only want error messages to be logged, and not the other two types. - If you set it to zero logging will be disabled.
\ No newline at end of file + This function lets you write messages to your log files. You must + supply one of three "levels" in the first parameter, indicating what + type of message it is (debug, error, info), with the message itself + in the second parameter. + + Example:: + + if ($some_var == '') + { + log_message('error', 'Some variable did not contain a value.'); + } + else + { + log_message('debug', 'Some variable was correctly set'); + } + + log_message('info', 'The purpose of some variable is to provide some value.'); + + There are three message types: + + #. Error Messages. These are actual errors, such as PHP errors or + user errors. + #. Debug Messages. These are messages that assist in debugging. For + example, if a class has been initialized, you could log this as + debugging info. + #. Informational Messages. These are the lowest priority messages, + simply giving information regarding some process. + + .. note:: In order for the log file to actually be written, the + *logs/* directory must be writable. In addition, you must + set the "threshold" for logging in + *application/config/config.php*. You might, for example, + only want error messages to be logged, and not the other + two types. If you set it to zero logging will be disabled. diff --git a/user_guide_src/source/general/requirements.rst b/user_guide_src/source/general/requirements.rst index 1cb5938aa..e3f73dba8 100644 --- a/user_guide_src/source/general/requirements.rst +++ b/user_guide_src/source/general/requirements.rst @@ -2,10 +2,15 @@ Server Requirements ################### -- `PHP <http://www.php.net/>`_ version 5.4 or newer is recommended and 5.2.4 as the absolute minimum required. -- A Database is required for most web application programming. +`PHP <http://www.php.net/>`_ version 5.4 or newer is recommended. + +It should work on 5.2.4 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. + +A database is required for most web application programming. +Currently supported databases are: - Currently supported databases are: - MySQL (5.1+) via the *mysql* (deprecated), *mysqli* and *pdo* drivers - Oracle via the *oci8* and *pdo* drivers - PostgreSQL via the *postgre* and *pdo* drivers diff --git a/user_guide_src/source/general/reserved_names.rst b/user_guide_src/source/general/reserved_names.rst index 9da94b398..a7b0c3465 100644 --- a/user_guide_src/source/general/reserved_names.rst +++ b/user_guide_src/source/general/reserved_names.rst @@ -23,22 +23,22 @@ your controller any of these: Functions --------- -- :func:`is_php()` -- :func:`is_really_writable()` +- :php:func:`is_php()` +- :php:func:`is_really_writable()` - ``load_class()`` - ``is_loaded()`` - ``get_config()`` -- :func:`config_item()` -- :func:`show_error()` -- :func:`show_404()` -- :func:`log_message()` -- :func:`set_status_header()` -- :func:`get_mimes()` -- :func:`html_escape()` -- :func:`remove_invisible_characters()` -- :func:`is_https()` -- :func:`function_usable()` -- :func:`get_instance()` +- :php:func:`config_item()` +- :php:func:`show_error()` +- :php:func:`show_404()` +- :php:func:`log_message()` +- :php:func:`set_status_header()` +- :php:func:`get_mimes()` +- :php:func:`html_escape()` +- :php:func:`remove_invisible_characters()` +- :php:func:`is_https()` +- :php:func:`function_usable()` +- :php:func:`get_instance()` - ``_error_handler()`` - ``_exception_handler()`` - ``_stringify_attributes()`` diff --git a/user_guide_src/source/general/security.rst b/user_guide_src/source/general/security.rst index 3f93443bb..0c58f96b4 100644 --- a/user_guide_src/source/general/security.rst +++ b/user_guide_src/source/general/security.rst @@ -23,12 +23,12 @@ the following: - Space Register_globals -================= +================ + +During system initialization all global variables that are found to exist +in the ``$_GET``, ``$_POST``, ``$_REQUEST`` and ``$_COOKIE`` are unset. -During system initialization all global variables are unset, except -those found in the ``$_GET``, ``$_POST``, and ``$_COOKIE`` arrays. -The unsetting routine is effectively the same as -*register_globals = off*. +The unsetting routine is effectively the same as *register_globals = off*. display_errors ============== @@ -60,12 +60,14 @@ from a form submission, COOKIE data, URI data, XML-RPC data, or even data from the SERVER array, you are encouraged to practice this three step approach: -#. Filter the data as if it were tainted. #. Validate the data to ensure it conforms to the correct type, length, size, etc. (sometimes this step can replace step one) -#. Escape the data before submitting it into your database. +#. Filter the data as if it were tainted. +#. Escape the data before submitting it into your database or outputting + it to a browser. -CodeIgniter provides the following functions to assist in this process: +CodeIgniter provides the following functions and tips to assist you +in this process: XSS Filtering ============= @@ -76,13 +78,95 @@ your data, or other types of code that attempt to hijack cookies or do other malicious things. The XSS Filter is described :doc:`here <../libraries/security>`. -Validate the data +.. note:: XSS filtering should *only be performed on output*. Filtering + input data may modify the data in undesirable ways, including + stripping special characters from passwords, which reduces + security instead of improving it. + +CSRF protection +=============== + +CSRF stands for Cross-Site Request Forgery, which is the process of an +attacker tricking their victim into unknowingly submitting a request. + +CodeIgniter provides CSRF protection out of the box, which will get +automatically triggered for every non-GET HTTP request, but also needs +you to create your submit forms in a certain way. This is explained in +the :doc:`Security Library <../libraries/security>` documentation. + +Password handling ================= +It is *critical* that you handle passwords in your application properly. + +Unfortunately, many developers don't know how to do that, and the web is +full of outdated or otherwise wrongful advices, which doesn't help. + +We would like to give you a list of combined do's and don'ts to help you +with that. Please read below. + +- DO NOT store passwords in plain-text format. + + Always **hash** your passwords. + +- DO NOT use Base64 or similar encoding for storing passwords. + + This is as good as storing them in plain-text. Really. Do **hashing**, + not *encoding*. + + Encoding, and encryption too, are two-way processes. Passwords are + secrets that must only be known to their owner, and thus must work + only in one direction. Hashing does that - there's *no* un-hashing or + de-hashing, but there is decoding and decryption. + +- DO NOT use weak or broken hashing algorithms like MD5 or SHA1. + + These algorithms are old, proven to be flawed, and not designed for + password hashing in the first place. + + Also, DON'T invent your own algorithms. + + Only use strong password hashing algorithms like BCrypt, which is used + 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). + +- DO NOT ever display or send a password in plain-text format! + + Even to the password's owner, if you need a "Forgotten password" + feature, just randomly generate a new, one-time (this is also important) + password and send that instead. + +- DO NOT put artificial limits on your users' passwords. + + There's no point in forcing a rule that a password can only be up to + a number of characters, or that it can't contain a certain set of + special characters. + + Not only does this **reduce** security instead of improving it, but + there's literally no reason to do it. No technical limitations and + no (practical) storage constraints apply once you've hashed them, none! + +Validate input data +=================== + CodeIgniter has a :doc:`Form Validation Library <../libraries/form_validation>` that assists you in validating, filtering, and prepping your data. +Even if that doesn't work for your use case however, be sure to always +validate and sanitize all input data. For example, if you expect a numeric +string for an input variable, you can check for that with ``is_numeric()`` +or ``ctype_digit()``. Always try to narrow down your checks to a certain +pattern. + +Have it in mind that this includes not only ``$_POST`` and ``$_GET`` +variables, but also cookies, the user-agent string and basically +*all data that is not created directly by your own code*. + + Escape all data before database insertion ========================================= diff --git a/user_guide_src/source/general/styleguide.rst b/user_guide_src/source/general/styleguide.rst index 3d8f0a78a..7704a59c5 100644 --- a/user_guide_src/source/general/styleguide.rst +++ b/user_guide_src/source/general/styleguide.rst @@ -52,31 +52,8 @@ The PHP closing tag on a PHP document **?>** is optional to the PHP parser. However, if used, any whitespace following the closing tag, whether introduced by the developer, user, or an FTP application, can cause unwanted output, PHP errors, or if the latter are suppressed, -blank pages. For this reason, all PHP files should **OMIT** the closing -PHP tag, and instead use a comment block to mark the end of file and -its location relative to the application root. This allows you to still -identify a file as being complete and not truncated. - -**INCORRECT**:: - - <?php - - echo "Here's my code!"; - - ?> - -**CORRECT**:: - - <?php - - echo "Here's my code!"; - - /* End of file Myfile.php */ - /* Location: ./system/modules/mymodule/myfile.php */ - -.. note:: There should be no empty line or newline character(s) following - the closing comments. If you happen to see one when - submitting a pull request, please check your IDE settings and fix it. +blank pages. For this reason, all PHP files MUST OMIT the PHP closing +tag and end with a single empty line instead. File Naming =========== @@ -368,10 +345,10 @@ inability for CodeIgniter to send proper headers. Compatibility ============= -CodeIgniter recommends PHP 5.4 or newer to be used, but the absolute -minimum version required is 5.2.4. Your code must either be compatible -with this minimum requirement, provide a suitable fallback, or be an -optional feature that dies quietly without affecting a user's application. +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 +requirement, provide a suitable fallback, or be an optional feature that +dies quietly without affecting a user's application. Additionally, do not use PHP functions that require non-default libraries to be installed unless your code contains an alternative method when the diff --git a/user_guide_src/source/helpers/array_helper.rst b/user_guide_src/source/helpers/array_helper.rst index 4805f581a..d6b48773f 100644 --- a/user_guide_src/source/helpers/array_helper.rst +++ b/user_guide_src/source/helpers/array_helper.rst @@ -26,7 +26,7 @@ Available Functions The following functions are available: -.. function:: element($item, $array[, $default = NULL]) +.. php:function:: element($item, $array[, $default = NULL]) :param string $item: Item to fetch from the array :param array $array: Input array @@ -51,7 +51,7 @@ The following functions are available: echo element('size', $array, 'foobar'); // returns "foobar" -.. function:: elements($items, $array[, $default = NULL]) +.. php:function:: elements($items, $array[, $default = NULL]) :param string $item: Item to fetch from the array :param array $array: Input array @@ -111,7 +111,7 @@ The following functions are available: updated. -.. function:: random_element($array) +.. php:function:: random_element($array) :param array $array: Input array :returns: A random element from the array diff --git a/user_guide_src/source/helpers/captcha_helper.rst b/user_guide_src/source/helpers/captcha_helper.rst index 4aacafd49..986c1d3e1 100644 --- a/user_guide_src/source/helpers/captcha_helper.rst +++ b/user_guide_src/source/helpers/captcha_helper.rst @@ -132,7 +132,7 @@ Available Functions The following functions are available: -.. function:: create_captcha([$data = ''[, $img_path = ''[, $img_url = ''[, $font_path = '']]]]) +.. php:function:: create_captcha([$data = ''[, $img_path = ''[, $img_url = ''[, $font_path = '']]]]) :param array $data: Array of data for the CAPTCHA :param string $img_path: Path to create the image in diff --git a/user_guide_src/source/helpers/cookie_helper.rst b/user_guide_src/source/helpers/cookie_helper.rst index 22fd0f77f..da26151cb 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: -.. 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 @@ -37,25 +37,26 @@ The following functions are available: :param bool $httponly: Whether to hide the cookie from JavaScript :rtype: void - This helper function gives you view file friendly syntax to set browser - cookies. Refer to the :doc:`Input Library <../libraries/input>` for a - description of its use, as this function is an alias for + This helper function gives you friendlier syntax to set browser + cookies. Refer to the :doc:`Input Library <../libraries/input>` for + a description of its use, as this function is an alias for ``CI_Input::set_cookie()``. - -.. function:: get_cookie($index[, $xss_clean = NULL]]) +.. php:function:: get_cookie($index[, $xss_clean = NULL]]) :param string $index: Cookie name :param bool $xss_clean: Whether to apply XSS filtering to the returned value :returns: The cookie value or NULL if not found :rtype: mixed - This helper function gives you view file friendly syntax to get browser - cookies. Refer to the :doc:`Input Library <../libraries/input>` for a - description of its use, as this function is an alias for ``CI_Input::cookie()``. - + This helper function gives you friendlier syntax to get browser + cookies. Refer to the :doc:`Input Library <../libraries/input>` for + detailed description of its use, as this function acts very + similarly to ``CI_Input::cookie()``, except it will also prepend + the ``$config['cookie_prefix']`` that you might've set in your + *application/config/config.php* file. -.. 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) @@ -75,4 +76,4 @@ The following functions are available: parameters. :: - delete_cookie($name, $domain, $path, $prefix)
\ No newline at end of file + delete_cookie($name, $domain, $path, $prefix); diff --git a/user_guide_src/source/helpers/date_helper.rst b/user_guide_src/source/helpers/date_helper.rst index dcff7a4e5..bed3b32a2 100644 --- a/user_guide_src/source/helpers/date_helper.rst +++ b/user_guide_src/source/helpers/date_helper.rst @@ -24,7 +24,7 @@ Available Functions The following functions are available: -.. function:: now([$timezone = NULL]) +.. php:function:: now([$timezone = NULL]) :param string $timezone: Timezone :returns: UNIX timestamp @@ -43,7 +43,7 @@ The following functions are available: If a timezone is not provided, it will return ``time()`` based on the **time_reference** setting. -.. function:: mdate([$datestr = ''[, $time = '']]) +.. php:function:: mdate([$datestr = ''[, $time = '']]) :param string $datestr: Date string :param int $time: UNIX timestamp @@ -67,7 +67,7 @@ The following functions are available: If a timestamp is not included in the second parameter the current time will be used. -.. function:: standard_date([$fmt = 'DATE_RFC822'[, $time = NULL]]) +.. php:function:: standard_date([$fmt = 'DATE_RFC822'[, $time = NULL]]) :param string $fmt: Date format :param int $time: UNIX timestamp @@ -106,7 +106,7 @@ The following functions are available: DATE_W3C W3C 2005-08-14T16:13:03+0000 =============== ======================= ====================================== -.. function:: local_to_gmt([$time = '']) +.. php:function:: local_to_gmt([$time = '']) :param int $time: UNIX timestamp :returns: UNIX timestamp @@ -118,7 +118,7 @@ The following functions are available: $gmt = local_to_gmt(time()); -.. function:: gmt_to_local([$time = ''[, $timezone = 'UTC'[, $dst = FALSE]]]) +.. php:function:: gmt_to_local([$time = ''[, $timezone = 'UTC'[, $dst = FALSE]]]) :param int $time: UNIX timestamp :param string $timezone: Timezone @@ -140,7 +140,7 @@ The following functions are available: .. note:: For a list of timezones see the reference at the bottom of this page. -.. function:: mysql_to_unix([$time = '']) +.. php:function:: mysql_to_unix([$time = '']) :param string $time: MySQL timestamp :returns: UNIX timestamp @@ -152,7 +152,7 @@ The following functions are available: $unix = mysql_to_unix('20061124092345'); -.. function:: unix_to_human([$time = ''[, $seconds = FALSE[, $fmt = 'us']]]) +.. php:function:: unix_to_human([$time = ''[, $seconds = FALSE[, $fmt = 'us']]]) :param int $time: UNIX timestamp :param bool $seconds: Whether to show seconds @@ -179,13 +179,13 @@ The following functions are available: echo unix_to_human($now, TRUE, 'us'); // U.S. time with seconds echo unix_to_human($now, TRUE, 'eu'); // Euro time with seconds -.. function:: human_to_unix([$datestr = '']) +.. php:function:: human_to_unix([$datestr = '']) :param int $datestr: Date string :returns: UNIX timestamp or FALSE on failure :rtype: int - The opposite of the :func:`unix_to_time()` function. Takes a "human" + The opposite of the :php:func:`unix_to_time()` function. Takes a "human" time as input and returns it as a UNIX timestamp. This is useful if you accept "human" formatted dates submitted via a form. Returns boolean FALSE date string passed to it is not formatted as indicated above. @@ -196,7 +196,7 @@ The following functions are available: $human = unix_to_human($now); $unix = human_to_unix($human); -.. function:: nice_date([$bad_date = ''[, $format = FALSE]]) +.. php:function:: nice_date([$bad_date = ''[, $format = FALSE]]) :param int $bad_date: The terribly formatted date-like string :param string $format: Date format to return (same as PHP's ``date()`` function) @@ -220,7 +220,7 @@ The following functions are available: // Should Produce: 2001-09-11 $better_date = nice_date($bad_date, 'Y-m-d'); -.. function:: timespan([$seconds = 1[, $time = ''[, $units = '']]]) +.. php:function:: timespan([$seconds = 1[, $time = ''[, $units = '']]]) :param int $seconds: Number of seconds :param string $time: UNIX timestamp @@ -252,7 +252,7 @@ The following functions are available: .. note:: The text generated by this function is found in the following language file: `language/<your_lang>/date_lang.php` -.. function:: days_in_month([$month = 0[, $year = '']]) +.. php:function:: days_in_month([$month = 0[, $year = '']]) :param int $month: a numeric month :param int $year: a numeric year @@ -271,7 +271,7 @@ The following functions are available: .. note:: This function will alias the native ``cal_days_in_month()``, if it is available. -.. function:: date_range([$unix_start = ''[, $mixed = ''[, $is_unix = TRUE[, $format = 'Y-m-d']]]]) +.. php:function:: date_range([$unix_start = ''[, $mixed = ''[, $is_unix = TRUE[, $format = 'Y-m-d']]]]) :param int $unix_start: UNIX timestamp of the range start date :param int $mixed: UNIX timestamp of the range end date or interval in days @@ -291,7 +291,7 @@ The following functions are available: echo $date."\n"; } -.. function:: timezones([$tz = '']) +.. php:function:: timezones([$tz = '']) :param string $tz: A numeric timezone :returns: Hour difference from UTC @@ -306,9 +306,9 @@ The following functions are available: echo timezones('UM5'); - This function is useful when used with :func:`timezone_menu()`. + This function is useful when used with :php:func:`timezone_menu()`. -.. function:: timezone_menu([$default = 'UTC'[, $class = ''[, $name = 'timezones'[, $attributes = '']]]]) +.. php:function:: timezone_menu([$default = 'UTC'[, $class = ''[, $name = 'timezones'[, $attributes = '']]]]) :param string $default: Timezone :param string $class: Class name diff --git a/user_guide_src/source/helpers/directory_helper.rst b/user_guide_src/source/helpers/directory_helper.rst index 030e0ef53..b5f1093c1 100644 --- a/user_guide_src/source/helpers/directory_helper.rst +++ b/user_guide_src/source/helpers/directory_helper.rst @@ -27,7 +27,7 @@ Available Functions The following functions are available: -.. function:: directory_map($source_dir[, $directory_depth = 0[, $hidden = FALSE]]) +.. php:function:: directory_map($source_dir[, $directory_depth = 0[, $hidden = FALSE]]) :param string $source_dir: Path to the source directory :param int $directory_depth: Depth of directories to traverse (0 = fully recursive, 1 = current dir, etc) diff --git a/user_guide_src/source/helpers/download_helper.rst b/user_guide_src/source/helpers/download_helper.rst index f374d491f..1a4065073 100644 --- a/user_guide_src/source/helpers/download_helper.rst +++ b/user_guide_src/source/helpers/download_helper.rst @@ -24,7 +24,7 @@ Available Functions The following functions are available: -.. function:: force_download([$filename = ''[, $data = ''[, $set_mime = FALSE]]]) +.. php:function:: force_download([$filename = ''[, $data = ''[, $set_mime = FALSE]]]) :param string $filename: Filename :param mixed $data: File contents diff --git a/user_guide_src/source/helpers/email_helper.rst b/user_guide_src/source/helpers/email_helper.rst index 3b771a0b6..685226951 100644 --- a/user_guide_src/source/helpers/email_helper.rst +++ b/user_guide_src/source/helpers/email_helper.rst @@ -29,7 +29,7 @@ Available Functions The following functions are available: -.. function:: valid_email($email) +.. php:function:: valid_email($email) :param string $email: E-mail address :returns: TRUE if a valid email is supplied, FALSE otherwise @@ -54,7 +54,7 @@ The following functions are available: (bool) filter_var($email, FILTER_VALIDATE_EMAIL); -.. function:: send_email($recipient, $subject, $message) +.. php:function:: send_email($recipient, $subject, $message) :param string $recipient: E-mail address :param string $subject: Mail subject diff --git a/user_guide_src/source/helpers/file_helper.rst b/user_guide_src/source/helpers/file_helper.rst index 013b583a0..92cb31a82 100644 --- a/user_guide_src/source/helpers/file_helper.rst +++ b/user_guide_src/source/helpers/file_helper.rst @@ -24,7 +24,7 @@ Available Functions The following functions are available: -.. function:: read_file($file) +.. php:function:: read_file($file) :param string $file: File path :returns: File contents or FALSE on failure @@ -49,7 +49,7 @@ The following functions are available: function might not work if you are trying to access a file above the calling script. -.. function:: write_file($path, $data[, $mode = 'wb']) +.. php:function:: write_file($path, $data[, $mode = 'wb']) :param string $path: File path :param string $data: Data to write to file @@ -89,7 +89,7 @@ The following functions are available: .. note:: This function acquires an exclusive lock on the file while writing to it. -.. function:: delete_files($path[, $del_dir = FALSE[, $htdocs = FALSE]]) +.. php:function:: delete_files($path[, $del_dir = FALSE[, $htdocs = FALSE]]) :param string $path: Directory path :param bool $del_dir: Whether to also delete directories @@ -112,7 +112,7 @@ The following functions are available: .. note:: The files must be writable or owned by the system in order to be deleted. -.. function:: get_filenames($source_dir[, $include_path = FALSE]) +.. php:function:: get_filenames($source_dir[, $include_path = FALSE]) :param string $source_dir: Directory path :param bool $include_path: Whether to include the path as part of the filenames @@ -127,7 +127,7 @@ The following functions are available: $controllers = get_filenames(APPPATH.'controllers/'); -.. function:: get_dir_file_info($source_dir, $top_level_only) +.. php:function:: get_dir_file_info($source_dir, $top_level_only) :param string $source_dir: Directory path :param bool $top_level_only: Whether to look only at the specified directory (excluding sub-directories) @@ -143,7 +143,7 @@ The following functions are available: $models_info = get_dir_file_info(APPPATH.'models/'); -.. function:: get_file_info($file[, $returned_values = array('name', 'server_path', 'size', 'date')]) +.. php:function:: get_file_info($file[, $returned_values = array('name', 'server_path', 'size', 'date')]) :param string $file: File path :param array $returned_values: What type of info to return @@ -157,7 +157,7 @@ The following functions are available: Valid ``$returned_values`` options are: `name`, `size`, `date`, `readable`, `writeable`, `executable` and `fileperms`. -.. function:: get_mime_by_extension($filename) +.. php:function:: get_mime_by_extension($filename) :param string $filename: File name :returns: MIME type string or FALSE on failure @@ -175,7 +175,7 @@ The following functions are available: is here strictly for convenience. It should not be used for security purposes. -.. function:: symbolic_permissions($perms) +.. php:function:: symbolic_permissions($perms) :param int $perms: Permissions :returns: Symbolic permissions string @@ -188,7 +188,7 @@ The following functions are available: echo symbolic_permissions(fileperms('./index.php')); // -rw-r--r-- -.. function:: octal_permissions($perms) +.. php:function:: octal_permissions($perms) :param int $perms: Permissions :returns: Octal permissions string diff --git a/user_guide_src/source/helpers/form_helper.rst b/user_guide_src/source/helpers/form_helper.rst index 4fa5f246b..15f5d7825 100644 --- a/user_guide_src/source/helpers/form_helper.rst +++ b/user_guide_src/source/helpers/form_helper.rst @@ -19,13 +19,38 @@ This helper is loaded using the following code:: $this->load->helper('form'); +Escaping field values +===================== + +You may need to use HTML and characters such as quotes within your form +elements. In order to do that safely, you'll need to use +:doc:`common function <../general/common_functions>` +:func:`html_escape()`. + +Consider the following example:: + + $string = 'Here is a string containing "quoted" text.'; + + <input type="text" name="myfield" value="<?php echo $string; ?>" /> + +Since the above string contains a set of quotes, it will cause the form +to break. The :php:func:`html_escape()` function converts HTML special +characters so that it can be used safely:: + + <input type="text" name="myfield" value="<?php echo html_escape($string); ?>" /> + +.. note:: If you use any of the form helper functions listed on this page, + the form values will be automatically escaped, so there is no need + to call this function. Use it only if you are creating your own + form elements. + Available Functions =================== The following functions are available: -.. function:: form_open([$action = ''[, $attributes = ''[, $hidden = array()]]]) +.. php:function:: form_open([$action = ''[, $attributes = ''[, $hidden = array()]]]) :param string $action: Form action/target URI string :param array $attributes: HTML attributes @@ -83,7 +108,7 @@ The following functions are available: <input type="hidden" name="member_id" value="234" /> -.. 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 @@ -91,12 +116,12 @@ The following functions are available: :returns: An HTML multipart form opening tag :rtype: string - This function is absolutely identical to :func:`form_open()` above, + This function is absolutely identical to :php:func:`form_open()` above, except that it adds a *multipart* attribute, which is necessary if you would like to use the form to upload files with. -.. function:: form_hidden($name[, $value = '']) +.. php:function:: form_hidden($name[, $value = '']) :param string $name: Field name :param string $value: Field value @@ -162,7 +187,7 @@ The following functions are available: <input type="hidden" name="email" value="john@example.com" id="hiddenemail" class="hiddenemail" /> */ -.. function:: form_input([$data = ''[, $value = ''[, $extra = '']]) +.. php:function:: form_input([$data = ''[, $value = ''[, $extra = '']]) :param array $data: Field attributes data :param string $value: Field value @@ -201,7 +226,7 @@ The following functions are available: $js = 'onClick="some_function()"'; echo form_input('username', 'johndoe', $js); -.. function:: form_password([$data = ''[, $value = ''[, $extra = '']]]) +.. php:function:: form_password([$data = ''[, $value = ''[, $extra = '']]]) :param array $data: Field attributes data :param string $value: Field value @@ -209,11 +234,11 @@ The following functions are available: :returns: An HTML password input field tag :rtype: string - This function is identical in all respects to the :func:`form_input()` + This function is identical in all respects to the :php:func:`form_input()` function above except that it uses the "password" input type. -.. function:: form_upload([$data = ''[, $value = ''[, $extra = '']]]) +.. php:function:: form_upload([$data = ''[, $value = ''[, $extra = '']]]) :param array $data: Field attributes data :param string $value: Field value @@ -221,12 +246,12 @@ The following functions are available: :returns: An HTML file upload input field tag :rtype: string - This function is identical in all respects to the :func:`form_input()` + This function is identical in all respects to the :php:func:`form_input()` function above except that it uses the "file" input type, allowing it to be used to upload files. -.. function:: form_textarea([$data = ''[, $value = ''[, $extra = '']]]) +.. php:function:: form_textarea([$data = ''[, $value = ''[, $extra = '']]]) :param array $data: Field attributes data :param string $value: Field value @@ -234,13 +259,13 @@ The following functions are available: :returns: An HTML textarea tag :rtype: string - This function is identical in all respects to the :func:`form_input()` + This function is identical in all respects to the :php:func:`form_input()` function above except that it generates a "textarea" type. .. note:: Instead of the *maxlength* and *size* attributes in the above example, you will instead specify *rows* and *cols*. -.. function:: form_dropdown([$name = ''[, $options = array()[, $selected = array()[, $extra = '']]]]) +.. php:function:: form_dropdown([$name = ''[, $options = array()[, $selected = array()[, $extra = '']]]]) :param string $name: Field name :param array $options: An associative array of options to be listed @@ -304,7 +329,7 @@ The following functions are available: label. -.. function:: form_multiselect([$name = ''[, $options = array()[, $selected = array()[, $extra = '']]]]) +.. php:function:: form_multiselect([$name = ''[, $options = array()[, $selected = array()[, $extra = '']]]]) :param string $name: Field name :param array $options: An associative array of options to be listed @@ -318,12 +343,12 @@ The following functions are available: associative array of options, and the third parameter will contain the value or values you wish to be selected. - The parameter usage is identical to using :func:`form_dropdown()` above, + The parameter usage is identical to using :php:func:`form_dropdown()` above, except of course that the name of the field will need to use POST array syntax, e.g. foo[]. -.. function:: form_fieldset([$legend_text = ''[, $attributes = array()]]) +.. php:function:: form_fieldset([$legend_text = ''[, $attributes = array()]]) :param string $legend_text: Text to put in the <legend> tag :param array $attributes: Attributes to be set on the <fieldset> tag @@ -369,7 +394,7 @@ The following functions are available: */ -.. function:: form_fieldset_close([$extra = '']) +.. php:function:: form_fieldset_close([$extra = '']) :param string $extra: Anything to append after the closing tag, *as is* :returns: An HTML fieldset closing tag @@ -387,7 +412,7 @@ The following functions are available: // Would produce: </fieldset></div></div> -.. function:: form_checkbox([$data = ''[, $value = ''[, $checked = FALSE[, $extra = '']]]]) +.. php:function:: form_checkbox([$data = ''[, $value = ''[, $checked = FALSE[, $extra = '']]]]) :param array $data: Field attributes data :param string $value: Field value @@ -426,7 +451,7 @@ The following functions are available: echo form_checkbox('newsletter', 'accept', TRUE, $js) -.. function:: form_radio([$data = ''[, $value = ''[, $checked = FALSE[, $extra = '']]]]) +.. php:function:: form_radio([$data = ''[, $value = ''[, $checked = FALSE[, $extra = '']]]]) :param array $data: Field attributes data :param string $value: Field value @@ -435,11 +460,11 @@ The following functions are available: :returns: An HTML radio input tag :rtype: string - This function is identical in all respects to the :func:`form_checkbox()` + This function is identical in all respects to the :php:func:`form_checkbox()` function above except that it uses the "radio" input type. -.. function:: form_label([$label_text = ''[, $id = ''[, $attributes = array()]]]) +.. php:function:: form_label([$label_text = ''[, $id = ''[, $attributes = array()]]]) :param string $label_text: Text to put in the <label> tag :param string $id: ID of the form element that we're making a label for @@ -466,7 +491,7 @@ The following functions are available: // Would produce: <label for="username" class="mycustomclass" style="color: #000;">What is your Name</label> -.. function:: form_submit([$data = ''[, $value = ''[, $extra = '']]]) +.. php:function:: form_submit([$data = ''[, $value = ''[, $extra = '']]]) :param string $data: Button name :param string $value: Button value @@ -484,7 +509,7 @@ The following functions are available: parameter lets you add extra data to your form, like JavaScript. -.. function:: form_reset([$data = ''[, $value = ''[, $extra = '']]]) +.. php:function:: form_reset([$data = ''[, $value = ''[, $extra = '']]]) :param string $data: Button name :param string $value: Button value @@ -496,7 +521,7 @@ The following functions are available: :func:`form_submit()`. -.. function:: form_button([$data = ''[, $content = ''[, $extra = '']]]) +.. php:function:: form_button([$data = ''[, $content = ''[, $extra = '']]]) :param string $data: Button name :param string $content: Button label @@ -531,7 +556,7 @@ The following functions are available: echo form_button('mybutton', 'Click Me', $js); -.. function:: form_close([$extra = '']) +.. php:function:: form_close([$extra = '']) :param string $extra: Anything to append after the closing tag, *as is* :returns: An HTML form closing tag @@ -546,37 +571,10 @@ The following functions are available: // Would produce: </form> </div></div> -.. function:: form_prep([$str = ''[, $is_textarea = FALSE]]) - - :param string $str: Value to escape - :param bool $is_textarea: Whether we're preparing for <textarea> or a regular input tag - :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. - - Consider this example:: - - $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 - to break. The ``form_prep()`` function converts HTML so that it can be used - safely:: - - <input type="text" name="myform" value="<?php echo form_prep($string); ?>" /> - - .. 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. - - -.. function:: set_value([$field = ''[, $default = ''[, $is_textarea = FALSE]]]) +.. php:function:: set_value($field[, $default = '']) :param string $field: Field name :param string $default: Default value - :param bool $is_textarea: Whether we're setting <textarea> content :returns: Field value :rtype: string @@ -587,12 +585,16 @@ The following functions are available: Example:: - <input type="text" name="quantity" value="<?=set_value('quantity', '0');?>" size="50" /> + <input type="text" name="quantity" value="<?php echo set_value('quantity', '0'); ?>" size="50" /> The above form will show "0" when loaded for the first time. + .. note:: Only use this function with raw HTML fields, as it + internally calls :php:func:`html_escape()` and combining its + usage with other form helper functions will result in + double HTML encoding! -.. function:: set_select([$field = ''[, $value = ''[, $default = FALSE]]]) +.. php:function:: set_select($field[, $value = ''[, $default = FALSE]]) :param string $field: Field name :param string $value: Value to check for @@ -615,7 +617,7 @@ The following functions are available: <option value="three" <?php echo set_select('myselect', 'three'); ?> >Three</option> </select> -.. function:: set_checkbox([$field = ''[, $value = ''[, $default = FALSE]]]) +.. php:function:: set_checkbox($field[, $value = ''[, $default = FALSE]]) :param string $field: Field name :param string $value: Value to check for @@ -634,7 +636,7 @@ The following functions are available: <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'); ?> /> -.. function:: set_radio([$field = ''[, $value = ''[, $default = FALSE]]]) +.. php:function:: set_radio($field[, $value = ''[, $default = FALSE]]) :param string $field: Field name :param string $value: Value to check for @@ -643,7 +645,7 @@ The following functions are available: :rtype: string Permits you to display radio buttons in the state they were submitted. - This function is identical to the :func:`set_checkbox()` function above. + This function is identical to the :php:func:`set_checkbox()` function above. Example:: @@ -656,7 +658,7 @@ The following functions are available: defined, the control for ``set_*()`` is handed over to a method of the class instead of the generic helper function. -.. function:: form_error([$field = ''[, $prefix = ''[, $suffix = '']]]) +.. php:function:: form_error([$field = ''[, $prefix = ''[, $suffix = '']]]) :param string $field: Field name :param string $prefix: Error opening tag @@ -677,14 +679,14 @@ The following functions are available: // Would produce: <div class="error">Error message associated with the "username" field.</div> -.. function:: validation_errors([$prefix = ''[, $suffix = '']]) +.. php:function:: validation_errors([$prefix = ''[, $suffix = '']]) :param string $prefix: Error opening tag :param string $suffix: Error closing tag :returns: HTML-formatted form validation error message(s) :rtype: string - Similarly to the :func:`form_error()` function, returns all validation + Similarly to the :php:func:`form_error()` function, returns all validation error messages produced by the :doc:`Form Validation Library <../libraries/form_validation>`, with optional opening and closing tags around each of the messages. @@ -699,4 +701,21 @@ The following functions are available: <span class="error">The "email" field doesn't contain a valid e-mail address!</span> <span class="error">The "password" field doesn't match the "repeat_password" field!</span> - */
\ No newline at end of file + */ + +.. 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.
\ No newline at end of file diff --git a/user_guide_src/source/helpers/html_helper.rst b/user_guide_src/source/helpers/html_helper.rst index ff387be10..d35be396a 100644 --- a/user_guide_src/source/helpers/html_helper.rst +++ b/user_guide_src/source/helpers/html_helper.rst @@ -25,7 +25,7 @@ Available Functions The following functions are available: -.. function:: heading([$data = ''[, $h = '1'[, $attributes = '']]]) +.. php:function:: heading([$data = ''[, $h = '1'[, $attributes = '']]]) :param string $data: Content :param string $h: Heading level @@ -51,7 +51,7 @@ The following functions are available: <h3 class="pink">Welcome!<h3> -.. function:: img([$src = ''[, $index_page = FALSE[, $attributes = '']]]) +.. php:function:: img([$src = ''[, $index_page = FALSE[, $attributes = '']]]) :param string $src: Image source data :param bool $index_page: Whether to treat $src as a routed URI string @@ -90,7 +90,7 @@ The following functions are available: img($image_properties); // <img src="http://site.com/index.php/images/picture.jpg" alt="Me, demonstrating how to eat 4 slices of pizza at one time" class="post_images" width="200" height="200" title="That was quite a night" rel="lightbox" /> -.. function:: link_tag([$href = ''[, $rel = 'stylesheet'[, $type = 'text/css'[, $title = ''[, $media = ''[, $index_page = FALSE]]]]]]) +.. php:function:: link_tag([$href = ''[, $rel = 'stylesheet'[, $type = 'text/css'[, $title = ''[, $media = ''[, $index_page = FALSE]]]]]]) :param string $href: What are we linking to :param string $rel: Relation type @@ -135,7 +135,7 @@ The following functions are available: // <link href="http://site.com/css/printer.css" rel="stylesheet" type="text/css" media="print" /> -.. function:: ul($list[, $attributes = '']) +.. php:function:: ul($list[, $attributes = '']) :param array $list: List entries :param array $attributes: HTML attributes @@ -255,17 +255,17 @@ The following functions are available: </li> </ul> -.. function:: ol($list, $attributes = '') +.. php:function:: ol($list, $attributes = '') :param array $list: List entries :param array $attributes: HTML attributes :returns: HTML-formatted ordered list :rtype: string - Identical to :func:`ul()`, only it produces the <ol> tag for + Identical to :php:func:`ul()`, only it produces the <ol> tag for ordered lists instead of <ul>. -.. function:: meta([$name = ''[, $content = ''[, $type = 'name'[, $newline = "\n"]]]]) +.. php:function:: meta([$name = ''[, $content = ''[, $type = 'name'[, $newline = "\n"]]]]) :param string $name: Meta name :param string $content: Meta content @@ -321,7 +321,7 @@ The following functions are available: // <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> -.. function:: doctype([$type = 'xhtml1-strict']) +.. php:function:: doctype([$type = 'xhtml1-strict']) :param string $type: Doctype name :returns: HTML DocType tag @@ -363,7 +363,7 @@ The following functions are available: 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"> =============================== =================== ================================================================================================================================================== -.. function:: br([$count = 1]) +.. php:function:: br([$count = 1]) :param int $count: Number of times to repeat the tag :returns: HTML line break tag @@ -383,7 +383,7 @@ The following functions are available: .. note:: This function is DEPRECATED. Use the native ``str_repeat()`` in combination with ``<br />`` instead. -.. function:: nbs([$num = 1]) +.. php:function:: nbs([$num = 1]) :param int $num: Number of space entities to produce :returns: A sequence of non-breaking space HTML entities diff --git a/user_guide_src/source/helpers/inflector_helper.rst b/user_guide_src/source/helpers/inflector_helper.rst index d0cb17c18..ed1e2b30f 100644 --- a/user_guide_src/source/helpers/inflector_helper.rst +++ b/user_guide_src/source/helpers/inflector_helper.rst @@ -25,7 +25,7 @@ Available Functions The following functions are available: -.. function:: singular($str) +.. php:function:: singular($str) :param string $str: Input string :returns: A singular word @@ -35,7 +35,7 @@ The following functions are available: echo singular('dogs'); // Prints 'dog' -.. function:: plural($str) +.. php:function:: plural($str) :param string $str: Input string :returns: A plular word @@ -45,7 +45,7 @@ The following functions are available: echo plural('dog'); // Prints 'dogs' -.. function:: camelize($str) +.. php:function:: camelize($str) :param string $str: Input string :returns: Camelized string @@ -56,7 +56,7 @@ The following functions are available: echo camelize('my_dog_spot'); // Prints 'myDogSpot' -.. function:: underscore($str) +.. php:function:: underscore($str) :param string $str: Input string :returns: String containing underscores instead of spaces @@ -67,7 +67,7 @@ The following functions are available: echo underscore('my dog spot'); // Prints 'my_dog_spot' -.. function:: humanize($str[, $separator = '_']) +.. php:function:: humanize($str[, $separator = '_']) :param string $str: Input string :param string $separator: Input separator @@ -85,7 +85,7 @@ The following functions are available: echo humanize('my-dog-spot', '-'); // Prints 'My Dog Spot' -.. function:: is_countable($word) +.. php:function:: is_countable($word) :param string $word: Input string :returns: TRUE if the word is countable or FALSE if not diff --git a/user_guide_src/source/helpers/language_helper.rst b/user_guide_src/source/helpers/language_helper.rst index e4d093725..cadf3c0ce 100644 --- a/user_guide_src/source/helpers/language_helper.rst +++ b/user_guide_src/source/helpers/language_helper.rst @@ -25,7 +25,7 @@ Available Functions The following functions are available: -.. function:: lang($line[, $for = ''[, $attributes = array()]]) +.. 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) diff --git a/user_guide_src/source/helpers/number_helper.rst b/user_guide_src/source/helpers/number_helper.rst index 2de4457d9..9d5e98cfb 100644 --- a/user_guide_src/source/helpers/number_helper.rst +++ b/user_guide_src/source/helpers/number_helper.rst @@ -25,7 +25,7 @@ Available Functions The following functions are available: -.. function:: byte_format($num[, $precision = 1]) +.. php:function:: byte_format($num[, $precision = 1]) :param mixed $num: Number of bytes :param int $precision: Floating point precision diff --git a/user_guide_src/source/helpers/path_helper.rst b/user_guide_src/source/helpers/path_helper.rst index 705ca23b9..f46cbad44 100644 --- a/user_guide_src/source/helpers/path_helper.rst +++ b/user_guide_src/source/helpers/path_helper.rst @@ -25,7 +25,7 @@ Available Functions The following functions are available: -.. function:: set_realpath($path[, $check_existance = FALSE]) +.. php:function:: set_realpath($path[, $check_existance = FALSE]) :param string $path: Path :param bool $check_existance: Whether to check if the path actually exists diff --git a/user_guide_src/source/helpers/security_helper.rst b/user_guide_src/source/helpers/security_helper.rst index 2e26890b0..103880cf9 100644 --- a/user_guide_src/source/helpers/security_helper.rst +++ b/user_guide_src/source/helpers/security_helper.rst @@ -24,7 +24,7 @@ Available Functions The following functions are available: -.. function:: xss_clean($str[, $is_image = FALSE]) +.. php:function:: xss_clean($str[, $is_image = FALSE]) :param string $str: Input data :param bool $is_image: Whether we're dealing with an image @@ -36,7 +36,7 @@ The following functions are available: This function is an alias for ``CI_Input::xss_clean()``. For more info, please see the :doc:`Input Library <../libraries/input>` documentation. -.. function:: sanitize_filename($filename) +.. php:function:: sanitize_filename($filename) :param string $filename: Filename :returns: Sanitized file name @@ -49,7 +49,7 @@ The following functions are available: documentation. -.. function:: do_hash($str[, $type = 'sha1']) +.. php:function:: do_hash($str[, $type = 'sha1']) :param string $str: Input :param string $type: Algorithm @@ -73,7 +73,7 @@ The following functions are available: .. note:: This function is DEPRECATED. Use the native ``hash()`` instead. -.. function:: strip_image_tags($str) +.. php:function:: strip_image_tags($str) :param string $str: Input string :returns: The input string with no image tags @@ -91,7 +91,7 @@ The following functions are available: documentation. -.. function:: encode_php_tags($str) +.. php:function:: encode_php_tags($str) :param string $str: Input string :returns: Safely formatted string @@ -99,7 +99,7 @@ The following functions are available: This is a security function that converts PHP tags to entities. - .. note:: :func:`xss_clean()` does this automatically, if you use it. + .. note:: :php:func:`xss_clean()` does this automatically, if you use it. Example:: diff --git a/user_guide_src/source/helpers/smiley_helper.rst b/user_guide_src/source/helpers/smiley_helper.rst index 5de1d83bb..978d11e5f 100644 --- a/user_guide_src/source/helpers/smiley_helper.rst +++ b/user_guide_src/source/helpers/smiley_helper.rst @@ -54,7 +54,7 @@ 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 :func:`get_clickable_smileys()` +.. 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 @@ -115,7 +115,7 @@ To map the alias to the field id, pass them both into the Available Functions =================== -.. function:: get_clickable_smileys($image_url[, $alias = ''[, $smileys = NULL]]) +.. 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 @@ -130,7 +130,7 @@ Available Functions $image_array = get_clickable_smileys('http://example.com/images/smileys/', 'comment'); -.. function:: smiley_js([$alias = ''[, $field_id = ''[, $inline = TRUE]]]) +.. php:function:: smiley_js([$alias = ''[, $field_id = ''[, $inline = TRUE]]]) :param string $alias: Field alias :param string $field_id: Field ID @@ -148,7 +148,7 @@ Available Functions <?php echo smiley_js(); ?> -.. function:: parse_smileys([$str = ''[, $image_url = ''[, $smileys = NULL]]]) +.. 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 diff --git a/user_guide_src/source/helpers/string_helper.rst b/user_guide_src/source/helpers/string_helper.rst index 922bc6b8d..9d0d890b3 100644 --- a/user_guide_src/source/helpers/string_helper.rst +++ b/user_guide_src/source/helpers/string_helper.rst @@ -25,7 +25,7 @@ Available Functions The following functions are available: -.. function:: random_string([$type = 'alnum'[, $len = 8]]) +.. php:function:: random_string([$type = 'alnum'[, $len = 8]]) :param string $type: Randomization type :param int $len: Output string length @@ -53,7 +53,7 @@ The following functions are available: .. note:: Usage of the *unique* and *encrypt* types is DEPRECATED. They are just aliases for *md5* and *sha1* respectively. -.. function:: increment_string($str[, $separator = '_'[, $first = 1]]) +.. php:function:: increment_string($str[, $separator = '_'[, $first = 1]]) :param string $str: Input string :param string $separator: Separator to append a duplicate number with @@ -72,7 +72,7 @@ The following functions are available: echo increment_string('file_4'); // "file_5" -.. function:: alternator($args) +.. php:function:: alternator($args) :param mixed $args: A variable number of arguments :returns: Alternated string(s) @@ -99,7 +99,7 @@ The following functions are available: .. note:: To use multiple separate calls to this function simply call the function with no arguments to re-initialize. -.. function:: repeater($data[, $num = 1]) +.. php:function:: repeater($data[, $num = 1]) :param string $data: Input :param int $num: Number of times to repeat @@ -117,7 +117,7 @@ The following functions are available: instead. -.. function:: reduce_double_slashes($str) +.. php:function:: reduce_double_slashes($str) :param string $str: Input string :returns: A string with normalized slashes @@ -132,7 +132,7 @@ The following functions are available: echo reduce_double_slashes($string); // results in "http://example.com/index.php" -.. function:: strip_slashes($data) +.. php:function:: strip_slashes($data) :param mixed $data: Input string or an array of strings :returns: String(s) with stripped slashes @@ -160,7 +160,7 @@ The following functions are available: and handle string inputs. This however makes it just an alias for ``stripslashes()``. -.. function:: trim_slashes($str) +.. php:function:: trim_slashes($str) :param string $str: Input string :returns: Slash-trimmed string @@ -175,7 +175,7 @@ The following functions are available: | | trim($str, '/'); -.. function:: reduce_multiples($str[, $character = ''[, $trim = FALSE]]) +.. php:function:: reduce_multiples($str[, $character = ''[, $trim = FALSE]]) :param string $str: Text to search in :param string $character: Character to reduce @@ -195,7 +195,7 @@ The following functions are available: $string = ",Fred, Bill,, Joe, Jimmy,"; $string = reduce_multiples($string, ", ", TRUE); //results in "Fred, Bill, Joe, Jimmy" -.. function:: quotes_to_entities($str) +.. php:function:: quotes_to_entities($str) :param string $str: Input string :returns: String with quotes converted to HTML entities @@ -208,7 +208,7 @@ The following functions are available: $string = quotes_to_entities($string); //results in "Joe's "dinner"" -.. function:: strip_quotes($str) +.. php:function:: strip_quotes($str) :param string $str: Input string :returns: String with quotes stripped diff --git a/user_guide_src/source/helpers/text_helper.rst b/user_guide_src/source/helpers/text_helper.rst index 88a6d0658..d1723c58a 100644 --- a/user_guide_src/source/helpers/text_helper.rst +++ b/user_guide_src/source/helpers/text_helper.rst @@ -24,7 +24,7 @@ Available Functions The following functions are available: -.. function:: word_limiter($str[, $limit = 100[, $end_char = '…']]) +.. php:function:: word_limiter($str[, $limit = 100[, $end_char = '…']]) :param string $str: Input string :param int $limit: Limit @@ -42,7 +42,7 @@ The following functions are available: default it adds an ellipsis. -.. function:: character_limiter($str[, $n = 500[, $end_char = '…']]) +.. php:function:: character_limiter($str[, $n = 500[, $end_char = '…']]) :param string $str: Input string :param int $n: Number of characters @@ -64,9 +64,9 @@ The following functions are available: undeclared this helper uses an ellipsis. .. note:: If you need to truncate to an exact number of characters please - see the :func:`ellipsize()` function below. + see the :php:func:`ellipsize()` function below. -.. function:: ascii_to_entities($str) +.. php:function:: ascii_to_entities($str) :param string $str: Input string :returns: A string with ASCII values converted to entities @@ -84,17 +84,17 @@ The following functions are available: $string = ascii_to_entities($string); -.. function::entities_to_ascii($str[, $all = TRUE]) +.. php:function::entities_to_ascii($str[, $all = TRUE]) :param string $str: Input string :param bool $all: Whether to convert unsafe entities as well :returns: A string with HTML entities converted to ASCII characters :rtype: string - This function does the opposite of :func:`ascii_to_entities()`. + This function does the opposite of :php:func:`ascii_to_entities()`. It turns character entities back into ASCII. -.. function:: convert_accented_characters($str) +.. php:function:: convert_accented_characters($str) :param string $str: Input string :returns: A string with accented characters converted @@ -112,7 +112,7 @@ The following functions are available: `application/config/foreign_chars.php` to define the to and from array for transliteration. -.. function:: word_censor($str, $censored[, $replacement = '']) +.. php:function:: word_censor($str, $censored[, $replacement = '']) :param string $str: Input string :param array $censored: List of bad words to censor @@ -131,7 +131,7 @@ The following functions are available: $disallowed = array('darn', 'shucks', 'golly', 'phooey'); $string = word_censor($string, $disallowed, 'Beep!'); -.. function:: highlight_code($str) +.. php:function:: highlight_code($str) :param string $str: Input string :returns: String with code highlighted via HTML @@ -145,7 +145,7 @@ The following functions are available: colors used are the ones specified in your php.ini file. -.. function:: highlight_phrase($str, $phrase[, $tag_open = '<mark>'[, $tag_close = '</mark>']]) +.. php:function:: highlight_phrase($str, $phrase[, $tag_open = '<mark>'[, $tag_close = '</mark>']]) :param string $str: Input string :param string $phrase: Phrase to highlight @@ -178,7 +178,7 @@ The following functions are available: color: #000; }; -.. function:: word_wrap($str[, $charlim = 76]) +.. php:function:: word_wrap($str[, $charlim = 76]) :param string $str: Input string :param int $charlim: Character limit @@ -195,7 +195,7 @@ The following functions are available: // Would produce: Here is a simple string of text that will help us demonstrate this function -.. function:: ellipsize($str, $max_length[, $position = 1[, $ellipsis = '…']]) +.. php:function:: ellipsize($str, $max_length[, $position = 1[, $ellipsis = '…']]) :param string $str: Input string :param int $max_length: String length limit diff --git a/user_guide_src/source/helpers/typography_helper.rst b/user_guide_src/source/helpers/typography_helper.rst index deb3d164e..7eb4fceec 100644 --- a/user_guide_src/source/helpers/typography_helper.rst +++ b/user_guide_src/source/helpers/typography_helper.rst @@ -25,7 +25,7 @@ Available Functions The following functions are available: -.. function:: auto_typography($str[, $reduce_linebreaks = FALSE]) +.. php:function:: auto_typography($str[, $reduce_linebreaks = FALSE]) :param string $str: Input string :param bool $reduce_linebreaks: Whether to reduce multiple instances of double newlines to two @@ -49,7 +49,7 @@ The following functions are available: pages. -.. function:: nl2br_except_pre($str) +.. php:function:: nl2br_except_pre($str) :param string $str: Input string :returns: String with HTML-formatted line breaks @@ -63,7 +63,7 @@ The following functions are available: $string = nl2br_except_pre($string); -.. function:: entity_decode($str, $charset = NULL) +.. php:function:: entity_decode($str, $charset = NULL) :param string $str: Input string :param string $charset: Character set diff --git a/user_guide_src/source/helpers/url_helper.rst b/user_guide_src/source/helpers/url_helper.rst index 3bdcb8e17..83864d9d3 100644 --- a/user_guide_src/source/helpers/url_helper.rst +++ b/user_guide_src/source/helpers/url_helper.rst @@ -23,7 +23,7 @@ The following functions are available: Available Functions =================== -.. function:: site_url([$uri = ''[, $protocol = NULL]]) +.. php:function:: site_url([$uri = ''[, $protocol = NULL]]) :param string $uri: URI string :param string $protocol: Protocol, e.g. 'http' or 'https' @@ -55,7 +55,7 @@ Available Functions This function is an alias for ``CI_Config::site_url()``. For more info, please see the :doc:`Config Library <../libraries/config>` documentation. -.. function:: base_url($uri = '', $protocol = NULL) +.. php:function:: base_url($uri = '', $protocol = NULL) :param string $uri: URI string :param string $protocol: Protocol, e.g. 'http' or 'https' @@ -66,10 +66,10 @@ Available Functions echo base_url(); - This function returns the same thing as :func:`site_url()`, without + This function returns the same thing as :php:func:`site_url()`, without the *index_page* or *url_suffix* being appended. - Also like :func:`site_url()`, you can supply segments as a string or + Also like :php:func:`site_url()`, you can supply segments as a string or an array. Here is a string example:: echo base_url("blog/post/123"); @@ -77,7 +77,7 @@ Available Functions The above example would return something like: *http://example.com/blog/post/123* - This is useful because unlike :func:`site_url()`, you can supply a + This is useful because unlike :php:func:`site_url()`, you can supply a string to a file, such as an image or stylesheet. For example:: echo base_url("images/icons/edit.png"); @@ -88,7 +88,7 @@ Available Functions This function is an alias for ``CI_Config::base_url()``. For more info, please see the :doc:`Config Library <../libraries/config>` documentation. -.. function:: current_url() +.. php:function:: current_url() :returns: The current URL :rtype: string @@ -101,7 +101,7 @@ Available Functions | site_url(uri_string()); -.. function:: uri_string() +.. php:function:: uri_string() :returns: An URI string :rtype: string @@ -119,7 +119,7 @@ Available Functions please see the :doc:`Config Library <../libraries/config>` documentation. -.. function:: index_page() +.. php:function:: index_page() :returns: 'index_page' value :rtype: mixed @@ -129,7 +129,7 @@ Available Functions echo index_page(); -.. function:: anchor($uri = '', $title = '', $attributes = '') +.. php:function:: anchor($uri = '', $title = '', $attributes = '') :param string $uri: URI string :param string $title: Anchor title @@ -140,7 +140,7 @@ Available Functions Creates a standard HTML anchor link based on your local site URL. The first parameter can contain any segments you wish appended to the - URL. As with the :func:`site_url()` function above, segments can + URL. As with the :php:func:`site_url()` function above, segments can be a string or an array. .. note:: If you are building links that are internal to your application @@ -167,7 +167,7 @@ Available Functions // Prints: <a href="http://example.com">Click Here</a> -.. function:: anchor_popup($uri = '', $title = '', $attributes = FALSE) +.. php:function:: anchor_popup($uri = '', $title = '', $attributes = FALSE) :param string $uri: URI string :param string $title: Anchor title @@ -175,7 +175,7 @@ Available Functions :returns: Pop-up hyperlink :rtype: string - Nearly identical to the :func:`anchor()` function except that it + Nearly identical to the :php:func:`anchor()` function except that it opens the URL in a new window. You can specify JavaScript window attributes in the third parameter to control how the window is opened. If the third parameter is not set it will simply open a new window with @@ -211,7 +211,7 @@ Available Functions HTML attribute to the anchor tag. -.. function:: mailto($email, $title = '', $attributes = '') +.. php:function:: mailto($email, $title = '', $attributes = '') :param string $email: E-mail address :param string $title: Anchor title @@ -223,13 +223,13 @@ Available Functions echo mailto('me@my-site.com', 'Click Here to Contact Me'); - As with the :func:`anchor()` tab above, you can set attributes using the + As with the :php:func:`anchor()` tab above, you can set attributes using the third parameter:: $attributes = array('title' => 'Mail me'); echo mailto('me@my-site.com', 'Contact Me', $attributes); -.. function:: safe_mailto($email, $title = '', $attributes = '') +.. php:function:: safe_mailto($email, $title = '', $attributes = '') :param string $email: E-mail address :param string $title: Anchor title @@ -237,11 +237,11 @@ Available Functions :returns: A spam-safe "mail to" hyperlink :rtype: string - Identical to the :func:`mailto()` function except it writes an obfuscated + Identical to the :php:func:`mailto()` function except it writes an obfuscated version of the *mailto* tag using ordinal numbers written with JavaScript to help prevent the e-mail address from being harvested by spam bots. -.. function:: auto_link($str, $type = 'both', $popup = FALSE) +.. php:function:: auto_link($str, $type = 'both', $popup = FALSE) :param string $str: Input string :param string $type: Link type ('email', 'url' or 'both') @@ -256,7 +256,7 @@ Available Functions The second parameter determines whether URLs and e-mails are converted or just one or the other. Default behavior is both if the parameter is not - specified. E-mail links are encoded as :func:`safe_mailto()` as shown + specified. E-mail links are encoded as :php:func:`safe_mailto()` as shown above. Converts only URLs:: @@ -273,7 +273,7 @@ Available Functions $string = auto_link($string, 'both', TRUE); -.. function:: url_title($str, $separator = '-', $lowercase = FALSE) +.. php:function:: url_title($str, $separator = '-', $lowercase = FALSE) :param string $str: Input string :param string $separator: Word separator @@ -311,7 +311,7 @@ Available Functions // Produces: whats_wrong_with_css -.. function:: prep_url($str = '') +.. php:function:: prep_url($str = '') :param string $str: URL string :returns: Protocol-prefixed URL string @@ -325,7 +325,7 @@ Available Functions $url = prep_url('example.com'); -.. function:: redirect($uri = '', $method = 'auto', $code = NULL) +.. php:function:: redirect($uri = '', $method = 'auto', $code = NULL) :param string $uri: URI string :param string $method: Redirect method ('auto', 'location' or 'refresh') diff --git a/user_guide_src/source/helpers/xml_helper.rst b/user_guide_src/source/helpers/xml_helper.rst index a40ea9ad3..903e925c2 100644 --- a/user_guide_src/source/helpers/xml_helper.rst +++ b/user_guide_src/source/helpers/xml_helper.rst @@ -26,7 +26,7 @@ Available Functions The following functions are available: -.. function:: xml_convert($str[, $protect_all = FALSE]) +.. php:function:: xml_convert($str[, $protect_all = FALSE]) :param string $str: the text string to convert :param bool $protect_all: Whether to protect all content that looks like a potential entity instead of just numbered entities, e.g. &foo; diff --git a/user_guide_src/source/installation/downloads.rst b/user_guide_src/source/installation/downloads.rst index 63029856b..3b4ebe64b 100644 --- a/user_guide_src/source/installation/downloads.rst +++ b/user_guide_src/source/installation/downloads.rst @@ -2,40 +2,14 @@ Downloading CodeIgniter ####################### -- `CodeIgniter v3.0.0 (Current version) <http://ellislab.com/codeigniter/download>`_ -- `CodeIgniter v2.2.0 <http://ellislab.com/asset/ci_download_files/CodeIgniter_2.2.0.zip>`_ (MD5 Checksum: dbfddde4ec0b12027aee5156fbdd634b) -- `CodeIgniter v2.1.4 <http://ellislab.com/asset/ci_download_files/CodeIgniter_2.1.4.zip>`_ (MD5 Checksum: e74a296c1d412a855c025b9cd468a513) -- `CodeIgniter v2.1.3 <http://ellislab.com/asset/ci_download_files/CodeIgniter_2.1.3.zip>`_ (MD5 Checksum: 781d06be06eaa36f10759ef82c8594d5) -- `CodeIgniter v2.1.2 <http://ellislab.com/asset/ci_download_files/CodeIgniter_2.1.2.zip>`_ (MD5 Checksum: c7a2980dff2774c97bd38bfbf450d8d5) -- `CodeIgniter v2.1.1 <http://ellislab.com/asset/ci_download_files/CodeIgniter_2.1.1.zip>`_ (MD5 Checksum: c4aa5f188f4ff16f919607b46a16c76c) -- `CodeIgniter v2.1.0 <http://ellislab.com/asset/ci_download_files/CodeIgniter_2.1.0.zip>`_ (MD5 Checksum: 8cb676b0f831114935d7dd1ae2e0d490) -- `CodeIgniter v2.0.3 <http://ellislab.com/asset/ci_download_files/CodeIgniter_2.0.3.zip>`_ (MD5 Checksum: 910475d50daf088bdd949c3d35b444d9) -- `CodeIgniter v2.0.2 <http://ellislab.com/asset/ci_download_files/CodeIgniter_2.0.2.zip>`_ (MD5 Checksum: e75bab8cf27d2fb2483c5bb61b85a524) -- `CodeIgniter v2.0.1 <http://ellislab.com/asset/ci_download_files/CodeIgniter_2.0.1.zip>`_ (MD5 Checksum: 675aa95896bfb16467436c0484f15f1f) -- `CodeIgniter v2.0.0 <http://ellislab.com/asset/ci_download_files/CodeIgniter_2.0.0.zip>`_ (MD5 Checksum: bd657863de45dbb397f3b3dbc4f13abb) -- `CodeIgniter v1.7.3 <http://ellislab.com/asset/ci_download_files/CodeIgniter_1.7.3.zip>`_ (MD5 Checksum: 16f50e7df4f44c1defe18355131049e9) -- `CodeIgniter v1.7.2 <http://ellislab.com/asset/ci_download_files/CodeIgniter_1.7.2.zip>`_ (MD5 Checksum: ff2f4d1b3ab921f91e006f38b3ae6540) -- `CodeIgniter v1.7.1 <http://ellislab.com/asset/ci_download_files/CodeIgniter_1.7.1.zip>`_ (MD5 Checksum: deca9709cf21b26dc0e4ec040b37e866) -- `CodeIgniter v1.7.0 <http://ellislab.com/asset/ci_download_files/CodeIgniter_1.7.0.zip>`_ (MD5 Checksum: 28037f2071f940d8756864460d949045) -- `CodeIgniter v1.6.3 <http://ellislab.com/asset/ci_download_files/CodeIgniter_1.6.3.zip>`_ (MD5 Checksum: 5ffab52b39b235ed6bd08ee5dd64d2f6) -- `CodeIgniter v1.6.2 <http://ellislab.com/asset/ci_download_files/CodeIgniter_1.6.2.zip>`_ (MD5 Checksum: 0922830f96dfd40874b39ad018a49206) -- `CodeIgniter v1.6.1 <http://ellislab.com/asset/ci_download_files/CodeIgniter_1.6.1.zip>`_ (MD5 Checksum: cc3f0b566e3654d351fa067aeee9bced) -- `CodeIgniter v1.6.0 <http://ellislab.com/asset/ci_download_files/CodeIgniter_1.6.0.zip>`_ (MD5 Checksum: 89efabb8c1d57bb51071e6a20bb5590d) -- `CodeIgniter v1.5.4 <http://ellislab.com/asset/ci_download_files/CodeIgniter_1.5.4.zip>`_ (MD5 Checksum: 0d6cc66b01d5ddecde483b3d5f51e4f8) -- `CodeIgniter v1.5.3 <http://ellislab.com/asset/ci_download_files/CodeIgniter_1.5.3.zip>`_ (MD5 Checksum: f44dd21d34a2842bd052879ca5de6630) -- `CodeIgniter v1.5.2 <http://ellislab.com/asset/ci_download_files/CodeIgniter_1.5.2.zip>`_ (MD5 Checksum: 78e7106b271f75af48e626f6e923c1aa) -- `CodeIgniter v1.5.1 <http://ellislab.com/asset/ci_download_files/CodeIgniter_1.5.1.zip>`_ (MD5 Checksum: 9dfd0dbed4f283a42a817e1e88f97481) -- `CodeIgniter v1.5.0 <http://ellislab.com/asset/ci_download_files/CodeIgniter_1.5.0.zip>`_ (MD5 Checksum: 116b805eae4b7e78ddd43a8aee733632) -- `CodeIgniter v1.4.1 <http://ellislab.com/asset/ci_download_files/CodeIgniter_1.4.1.zip>`_ (MD5 Checksum: 470005a83772e9d2e99dec2b4058e584) -- `CodeIgniter v1.4.0 <http://ellislab.com/asset/ci_download_files/CodeIgniter_1.4.0.zip>`_ (MD5 Checksum: 43ca6ff3447d6b5681f98a328b386338) -- `CodeIgniter v1.3.3 <http://ellislab.com/asset/ci_download_files/CodeIgniter_1.3.3.zip>`_ (MD5 Checksum: 55692ba4b55b53b58e4514e310288981) -- `CodeIgniter v1.3.2 <http://ellislab.com/asset/ci_download_files/CodeIgniter_1.3.2.zip>`_ (MD5 Checksum: 7dace6e1d6245b569943e8df952c7637) -- `CodeIgniter v1.3.1 <http://ellislab.com/asset/ci_download_files/CodeIgniter_1.3.1.zip>`_ (MD5 Checksum: f6c6f00830c60d7f98b948269ee81069) -- `CodeIgniter v1.3 <http://ellislab.com/asset/ci_download_files/CodeIgniter_1.3.zip>`_ (MD5 Checksum: 03b2f796df6af808ecff3a18b6000477) -- `CodeIgniter v1.2 <http://ellislab.com/asset/ci_download_files/CodeIgniter_1.2.zip>`_ (MD5 Checksum: f9289814fabe102bc35beb791d0c0f62) -- `CodeIgniter v1.1 <http://ellislab.com/asset/ci_download_files/CodeIgniter_1.1b.zip>`_ (MD5 Checksum: bf4cabb6a3ea3122a974270b8044befb) -- `CodeIgniter v1.0 <http://ellislab.com/asset/ci_download_files/CodeIgniter_1.0b.zip>`_ (MD5 Checksum: 427ca4255e2bdaacee976de1aa143ea0) - +- `CodeIgniter v3.0.0 (Current version) <https://github.com/bcit-ci/CodeIgniter/archive/develop.zip>`_ +- `CodeIgniter v2.2.1 <https://github.com/bcit-ci/CodeIgniter/archive/2.2.1.zip>`_ +- `CodeIgniter v2.2.0 <https://github.com/bcit-ci/CodeIgniter/archive/2.2.0.zip>`_ +- `CodeIgniter v2.1.4 <https://github.com/bcit-ci/CodeIgniter/archive/2.1.4.zip>`_ +- `CodeIgniter v2.1.3 <https://github.com/bcit-ci/CodeIgniter/archive/2.1.3.zip>`_ +- `CodeIgniter v2.1.2 <https://github.com/bcit-ci/CodeIgniter/archive/2.1.2.zip>`_ +- `CodeIgniter v2.1.1 <https://github.com/bcit-ci/CodeIgniter/archive/2.1.1.zip>`_ +- `CodeIgniter v2.1.0 <https://github.com/bcit-ci/CodeIgniter/archive/v2.1.0.zip>`_ ****** GitHub diff --git a/user_guide_src/source/installation/upgrade_220.rst b/user_guide_src/source/installation/upgrade_220.rst index beb7bd7d7..b2e943223 100644 --- a/user_guide_src/source/installation/upgrade_220.rst +++ b/user_guide_src/source/installation/upgrade_220.rst @@ -2,7 +2,7 @@ Upgrading from 2.1.4 to 2.2.0 ############################# -.. note:: The :doc:`Encrypt Class <libraries/encrypt>` now requires the +.. note:: The :doc:`Encrypt Class </libraries/encrypt>` now requires the Mcrypt extension. If you were previously using the Encrypt Class without Mcrypt, then this is a breaking change. You must install the Mcrypt extension in order to upgrade. For information on diff --git a/user_guide_src/source/installation/upgrade_221.rst b/user_guide_src/source/installation/upgrade_221.rst new file mode 100644 index 000000000..4af73867e --- /dev/null +++ b/user_guide_src/source/installation/upgrade_221.rst @@ -0,0 +1,14 @@ +############################# +Upgrading from 2.2.0 to 2.2.1 +############################# + +Before performing an update you should take your site offline by +replacing the index.php file with a static one. + +Step 1: Update your CodeIgniter files +===================================== + +Replace all files and directories in your "system" folder. + +.. note:: If you have any custom developed files in these folders please + make copies of them first.
\ No newline at end of file diff --git a/user_guide_src/source/installation/upgrade_300.rst b/user_guide_src/source/installation/upgrade_300.rst index c84d16b31..8983f3d18 100644 --- a/user_guide_src/source/installation/upgrade_300.rst +++ b/user_guide_src/source/installation/upgrade_300.rst @@ -1,5 +1,5 @@ ############################# -Upgrading from 2.2.0 to 3.0.0 +Upgrading from 2.2.1 to 3.0.0 ############################# .. note:: These upgrade notes are for a version that is yet to be released. @@ -83,37 +83,117 @@ or extensions to work, you need to move them to **application/core/**:: application/libraries/Log.php -> application/core/Log.php application/libraries/MY_Log.php -> application/core/MY_Log.php -********************************************************* -Step 6: Convert your Session usage from library to driver -********************************************************* +***************************************** +Step 6: Update your Session library usage +***************************************** -When you load (or autoload) the Session library, you must now load it as a driver instead of a library. This means -calling ``$this->load->driver('session')`` instead of ``$this->load->library('session')`` and/or listing 'session' -in ``$autoload['drivers']`` instead of ``$autoload['libraries']``. +The :doc:`Session Library </libraries/sessions>` has been completely +re-written in CodeIgniter 3 and now comes with a bunch of new features, +but that also means that there are changes that you should make ... -With the change from a single Session Library to the new Session Driver, two new config items have been added: +Most notably, the library now uses separate storage drivers instead of +always relying on (encrypted) cookies. +In fact, cookies as storage have now been removed and you must always use +some kind of server-side storage engine, with the file-system being the +default option. - - ``$config['sess_driver']`` selects which driver to initially load. Options are: - - 'cookie' (the default) for classic CodeIgniter cookie-based sessions - - 'native' for native PHP Session support - - the name of a custom driver you have provided (see :doc:`Session Driver <../libraries/sessions>` for more info) - - ``$config['sess_valid_drivers']`` provides an array of additional custom drivers to make available for loading +The Session Class now utilizes PHP's own mechanisms for building custom +session handlers, which also means that your session data is now +accessible via the ``$_SESSION`` superglobal (though, we've kept the +possibility to use it as "userdata", like you've done until now). -As the new Session Driver library loads the classic Cookie driver by default and always makes 'cookie' and 'native' -available as valid drivers, neither of these configuration items are required. However, it is recommended that you -add them for clarity and ease of configuration in the future. +A few configuration options have been removed and a few have been added. +You should really read the whole :doc:`Session library manual +</libraries/sessions>` for the details, but here's a short list of changes +that you should make: -If you have written a Session extension, you must move it into a 'Session' sub-directory of 'libraries', following the -standard for Drivers. Also beware that some functions which are not part of the external Session API have moved into -the drivers, so your extension may have to be broken down into separate library and driver class extensions. + - Set your ``$config['sess_driver']`` value + + It will default to 'files', unles you've previously used + ``$config['sess_use_database']``, in which case it will be set to + 'database'. + + - Set a ``$config['sess_save_path']`` value + + For the 'database' driver, a fallback to ``$config['sess_table_name']`` + is in place, but otherwise requires you to read the manual for the + specific driver of your choice. + + - Update your ``ci_sessions`` table ('database' driver only) + + The table structure has changed a bit, and more specifically: + + - ``session_id`` field is renamed to ``id`` + - ``user_agent`` field is dropped + - ``user_data`` field is renamed to ``data`` and under MySQL is now of type BLOB + - ``last_activity`` field is renamed to ``timestamp`` + + This is accompanied by a slight change in the table indexes too, so + please read the manual about the `Session Database Driver + <../libraries/sessions.html#database-driver>`_ for more information. + + .. important:: Only MySQL and PostgreSQL are officially supported + now. Other databases may still work, but due to lack of advisory + locking features, they are unsafe for concurrent requests and + you should consider using another driver instead. + + - Remove ``$config['sess_match_useragent']`` + + The user-agent string is input supplied by the user's browser, or in + other words: client side input. As such, it is an ineffective feature + and hence why it has been removed. + + - Remove ``$config['sess_encrypt_cookie']`` + + As already noted, the library no longer uses cookies as a storage + mechanism, which renders this option useless. + + - Remove ``$config['sess_expire_on_close']`` + + This option is still usable, but only for backwards compatibility + purposes and it should be otherwise removed. The same effect is + achieved by setting ``$config['sess_expiration']`` to 0. + + - Check "flashdata" for collisions with "userdata" + + Flashdata is now just regular "userdata", only marked for deletion on + the next request. In other words: you can't have both "userdata" and + "flashdata" with the same name, because it's the same thing. + + - Check usage of session metadata + + Previously, you could access the 'session_id', 'ip_address', + 'user_agent' and 'last_activity' metadata items as userdata. + This is no longer possible, and you should read the notes about + `Session Metadata <../libraries/sessions.html#accessing-session-metadata>`_ + if your application relies on those values. + + - Check ``unset_userdata()`` usage + + Previously, this method used to accept an associative array of + ``'key' => 'dummy value'`` pairs for unsetting multiple keys. That + however makes no sense and you now have to pass *only* the keys, as + the elements of an array. + + :: + + // Old + $this->session->unset_userdata(array('item' => '', 'item2' => '')); + + // New + $this->session->unset_userdata(array('item', 'item2')); + +Finally, if you have written a Session extension, you must now move it to +the *application/libraries/Session/* directory, although chances are that +it will now also have to be re-factored. *************************************** Step 7: Update your config/database.php *************************************** -Due to 3.0.0's renaming of Active Record to Query Builder, inside your `config/database.php`, you will -need to rename the `$active_record` variable to `$query_builder` -:: +Due to 3.0.0's renaming of Active Record to Query Builder, inside your +**config/database.php**, you will need to rename the ``$active_record`` +variable to ``$query_builder``:: $active_group = 'default'; // $active_record = TRUE; @@ -217,7 +297,7 @@ Otherwise however, please review your usage of the following functions: - input->server() - input->input_stream() - - :doc:`Cookie Helper <../helpers/cookie_helper>` :func:`get_cookie()` + - :doc:`Cookie Helper <../helpers/cookie_helper>` :php:func:`get_cookie()` .. important:: Another related change is that the ``$_GET``, ``$_POST``, ``$_COOKIE`` and ``$_SERVER`` superglobals are no longer @@ -447,7 +527,7 @@ CodeIgniter 3.1+. String helper repeater() ======================== -:doc:`String Helper <../helpers/string_helper>` function :func:`repeater()` is now just an alias for +:doc:`String Helper <../helpers/string_helper>` function :php:func:`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 @@ -456,20 +536,32 @@ PHP's native ``str_repeat()`` function. It is deprecated and scheduled for remov String helper trim_slashes() ============================ -:doc:`String Helper <../helpers/string_helper>` function :func:`trim_slashes()` is now just an alias +:doc:`String Helper <../helpers/string_helper>` function :php:func:`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+. .. note:: This function is still available, but you're strongly encouraged to remove its usage sooner rather than later. +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>` +:func:`html_escape()`. It is deprecated and will be removed in the future. + +Please use :php:func:`html_escape()` instead. + +.. note:: This function is still available, but you're strongly encouraged + to remove its usage sooner rather than later. + Email helper functions ====================== :doc:`Email Helper <../helpers/email_helper>` only has two functions - - :func:`valid_email()` - - :func:`send_email()` + - :php:func:`valid_email()` + - :php:func:`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 @@ -531,7 +623,7 @@ CodeIgniter 3.1+. String helper random_string() types 'unique' and 'encrypt' ========================================================== -When using the :doc:`String Helper <../helpers/string_helper>` function :func:`random_string()`, +When using the :doc:`String Helper <../helpers/string_helper>` function :php:func:`random_string()`, you should no longer pass the **unique** and **encrypt** randomization types. They are only aliases for **md5** and **sha1** respectively and are now deprecated and scheduled for removal in CodeIgniter 3.1+. @@ -542,7 +634,7 @@ in CodeIgniter 3.1+. URL helper url_title() separators 'dash' and 'underscore' ========================================================= -When using the :doc:`URL Helper <../helpers/url_helper>` function :func:`url_title()`, you +When using the :doc:`URL Helper <../helpers/url_helper>` function :php:func:`url_title()`, you should no longer pass **dash** or **underscore** as the word separator. This function will now accept any character and you should just pass the chosen character directly, so you should write '-' instead of 'dash' and '_' instead of 'underscore'. @@ -622,7 +714,7 @@ Input library method is_cli_request() Calls to the ``CI_Input::is_cli_request()`` method are necessary at many places in the CodeIgniter internals and this is often before the :doc:`Input Library <../libraries/input>` is loaded. Because of that, it is being replaced by a common -function named :func:`is_cli()` and this method is now just an alias. +function named :php:func:`is_cli()` and this method is now just an alias. The new function is both available at all times for you to use and shorter to type. diff --git a/user_guide_src/source/installation/upgrading.rst b/user_guide_src/source/installation/upgrading.rst index 366aa13f7..ab36e9bfd 100644 --- a/user_guide_src/source/installation/upgrading.rst +++ b/user_guide_src/source/installation/upgrading.rst @@ -8,7 +8,9 @@ upgrading from. .. toctree:: :titlesonly: - Upgrading from 2.1.4 to 3.0.0 <upgrade_300> + Upgrading from 2.2.1 to 3.0.0 <upgrade_300> + Upgrading from 2.2.0 to 2.2.1 <upgrade_221> + Upgrading from 2.1.4 to 2.2.0 <upgrade_220> Upgrading from 2.1.3 to 2.1.4 <upgrade_214> Upgrading from 2.1.2 to 2.1.3 <upgrade_213> Upgrading from 2.1.1 to 2.1.2 <upgrade_212> diff --git a/user_guide_src/source/libraries/benchmark.rst b/user_guide_src/source/libraries/benchmark.rst index ddbe04869..8fc06be12 100644 --- a/user_guide_src/source/libraries/benchmark.rst +++ b/user_guide_src/source/libraries/benchmark.rst @@ -131,16 +131,16 @@ this pseudo-variable, if you prefer not to use the pure PHP:: Class Reference *************** -.. class:: CI_Benchmark +.. php:class:: CI_Benchmark - .. method:: mark($name) + .. php:method:: mark($name) :param string $name: the name you wish to assign to your marker :rtype: void Sets a benchmark marker. - .. method:: elapsed_time([$point1 = ''[, $point2 = ''[, $decimals = 4]]]) + .. php:method:: elapsed_time([$point1 = ''[, $point2 = ''[, $decimals = 4]]]) :param string $point1: a particular marked point :param string $point2: a particular marked point @@ -156,7 +156,7 @@ Class Reference swap the real value for this variable. - .. method:: memory_usage() + .. php:method:: memory_usage() :returns: Memory usage info :rtype: string diff --git a/user_guide_src/source/libraries/caching.rst b/user_guide_src/source/libraries/caching.rst index caece1aee..86439b4ee 100644 --- a/user_guide_src/source/libraries/caching.rst +++ b/user_guide_src/source/libraries/caching.rst @@ -52,9 +52,9 @@ to avoid collisions when you're running multiple applications on the same enviro Class Reference *************** -.. class:: CI_Cache +.. php:class:: CI_Cache - .. method:: is_supported($driver) + .. php:method:: is_supported($driver) :param string $driver: the name of the caching driver :returns: TRUE if supported, FALSE if not @@ -74,7 +74,7 @@ Class Reference } } - .. method:: get($id) + .. php:method:: get($id) :param string $id: Cache item name :returns: Item value or FALSE if not found @@ -86,7 +86,7 @@ Class Reference $foo = $this->cache->get('my_cached_item'); - .. method:: save($id, $data[, $ttl = 60[, $raw = FALSE]]) + .. php:method:: save($id, $data[, $ttl = 60[, $raw = FALSE]]) :param string $id: Cache item name :param mixed $data: the data to save @@ -104,7 +104,7 @@ Class Reference .. note:: The ``$raw`` parameter is only utilized by APC and Memcache, in order to allow usage of ``increment()`` and ``decrement()``. - .. method:: delete($id) + .. php:method:: delete($id) :param string $id: name of cached item :returns: TRUE on success, FALSE on failure @@ -116,7 +116,7 @@ Class Reference $this->cache->delete('cache_item_id'); - .. method:: increment($id[, $offset = 1]) + .. php:method:: increment($id[, $offset = 1]) :param string $id: Cache ID :param int $offset: Step/value to add @@ -132,7 +132,7 @@ Class Reference $this->cache->increment('iterator', 3); // 'iterator' is now 6 - .. method:: decrement($id[, $offset = 1]) + .. php:method:: decrement($id[, $offset = 1]) :param string $id: Cache ID :param int $offset: Step/value to reduce by @@ -148,7 +148,7 @@ Class Reference $this->cache->decrement('iterator', 2); // 'iterator' is now 3 - .. method:: clean() + .. php:method:: clean() :returns: TRUE on success, FALSE on failure :rtype: bool @@ -159,7 +159,7 @@ Class Reference $this->cache->clean(); - .. method:: cache_info() + .. php:method:: cache_info() :returns: Information on the entire cache database :rtype: mixed @@ -172,7 +172,7 @@ Class Reference .. note:: The information returned and the structure of the data is dependent on which adapter is being used. - .. method:: get_metadata($id) + .. php:method:: get_metadata($id) :param string $id: Cache item name :returns: Metadata for the cached item diff --git a/user_guide_src/source/libraries/calendar.rst b/user_guide_src/source/libraries/calendar.rst index 20832740b..52883d297 100644 --- a/user_guide_src/source/libraries/calendar.rst +++ b/user_guide_src/source/libraries/calendar.rst @@ -213,9 +213,9 @@ Example:: Class Reference *************** -.. class:: CI_Calendar +.. php:class:: CI_Calendar - .. method:: initialize([$config = array()]) + .. php:method:: initialize([$config = array()]) :param array $config: Configuration parameters :returns: CI_Calendar instance (method chaining) @@ -223,7 +223,7 @@ Class Reference Initializes the Calendaring preferences. Accepts an associative array as input, containing display preferences. - .. method:: generate([$year = ''[, $month = ''[, $data = array()]]]) + .. php:method:: generate([$year = ''[, $month = ''[, $data = array()]]]) :param int $year: Year :param int $month: Month @@ -234,7 +234,7 @@ Class Reference Generate the calendar. - .. method:: get_month_name($month) + .. php:method:: get_month_name($month) :param int $month: Month :returns: Month name @@ -242,7 +242,7 @@ Class Reference Generates a textual month name based on the numeric month provided. - .. method:: get_day_names($day_type = '') + .. php:method:: get_day_names($day_type = '') :param string $day_type: 'long', 'short', or 'abr' :returns: Array of day names @@ -253,7 +253,7 @@ Class Reference if an invalid type is provided) this method will return the "abbreviated" style. - .. method:: adjust_date($month, $year) + .. php:method:: adjust_date($month, $year) :param int $month: Month :param int $year: Year @@ -274,7 +274,7 @@ Class Reference [year] => '2015' ) - .. method:: get_total_days($month, $year) + .. php:method:: get_total_days($month, $year) :param int $month: Month :param int $year: Year @@ -287,9 +287,9 @@ Class Reference // 29 .. note:: This method is an alias for :doc:`Date Helper - <../helpers/date_helper>` function :func:`days_in_month()`. + <../helpers/date_helper>` function :php:func:`days_in_month()`. - .. method:: default_template() + .. php:method:: default_template() :returns: An array of template values :rtype: array @@ -298,7 +298,7 @@ Class Reference your own template. - .. method:: parse_template() + .. php:method:: parse_template() :returns: CI_Calendar instance (method chaining) :rtype: CI_Calendar diff --git a/user_guide_src/source/libraries/cart.rst b/user_guide_src/source/libraries/cart.rst index a023ccb36..be343320d 100644 --- a/user_guide_src/source/libraries/cart.rst +++ b/user_guide_src/source/libraries/cart.rst @@ -7,7 +7,7 @@ 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 Card library is DEPRECATED and should not be used. +.. 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" @@ -285,7 +285,7 @@ the update form is submitted. Please examine the construction of the Class Reference *************** -.. class:: CI_Cart +.. php:class:: CI_Cart .. attribute:: $product_id_rules = '\.a-z0-9_-' @@ -302,7 +302,7 @@ Class Reference Whether or not to only allow safe product names. Default TRUE. - .. method:: insert([$items = array()]) + .. php:method:: insert([$items = array()]) :param array $items: Items to insert into the cart :returns: TRUE on success, FALSE on failure @@ -312,7 +312,7 @@ Class Reference on success and FALSE on failure. - .. method:: update([$items = array()]) + .. php:method:: update([$items = array()]) :param array $items: Items to update in the cart :returns: TRUE on success, FALSE on failure @@ -323,7 +323,7 @@ Class Reference to the quantity before checkout. That array must contain the rowid for each item. - .. method:: remove($rowid) + .. php:method:: remove($rowid) :param int $rowid: ID of the item to remove from the cart :returns: TRUE on success, FALSE on failure @@ -332,7 +332,7 @@ Class Reference Allows you to remove an item from the shopping cart by passing it the ``$rowid``. - .. method:: total() + .. php:method:: total() :returns: Total amount :rtype: int @@ -340,7 +340,7 @@ Class Reference Displays the total amount in the cart. - .. method:: total_items() + .. php:method:: total_items() :returns: Total amount of items in the cart :rtype: int @@ -348,7 +348,7 @@ Class Reference Displays the total number of items in the cart. - .. method:: contents([$newest_first = FALSE]) + .. 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 @@ -359,7 +359,7 @@ Class Reference will be sorted from newest to oldest, otherwise it is sorted from oldest to newest. - .. method:: get_item($row_id) + .. php:method:: get_item($row_id) :param int $row_id: Row ID to retrieve :returns: Array of item data @@ -368,7 +368,7 @@ Class Reference Returns an array containing data for the item matching the specified row ID, or FALSE if no such item exists. - .. method:: has_options($row_id = '') + .. php:method:: has_options($row_id = '') :param int $row_id: Row ID to inspect :returns: TRUE if options exist, FALSE otherwise @@ -379,7 +379,7 @@ Class Reference you must pass the rowid to this method, as shown in the Displaying the Cart example above. - .. method:: product_options([$row_id = '']) + .. php:method:: product_options([$row_id = '']) :param int $row_id: Row ID :returns: Array of product options @@ -390,7 +390,7 @@ Class Reference must pass the rowid to this method, as shown in the Displaying the Cart example above. - .. method:: destroy() + .. php:method:: destroy() :rtype: void diff --git a/user_guide_src/source/libraries/config.rst b/user_guide_src/source/libraries/config.rst index 3116b768a..3138e3403 100644 --- a/user_guide_src/source/libraries/config.rst +++ b/user_guide_src/source/libraries/config.rst @@ -171,7 +171,7 @@ folders: Class Reference *************** -.. class:: CI_Config +.. php:class:: CI_Config .. attribute:: $config @@ -182,7 +182,7 @@ Class Reference Array of all loaded config files - .. method:: item($item[, $index='']) + .. php:method:: item($item[, $index='']) :param string $item: Config item name :param string $index: Index name @@ -191,7 +191,7 @@ Class Reference Fetch a config file item. - .. method:: set_item($item, $value) + .. php:method:: set_item($item, $value) :param string $item: Config item name :param string $value: Config item value @@ -199,7 +199,7 @@ Class Reference Sets a config file item to the specified value. - .. method:: slash_item($item) + .. php:method:: slash_item($item) :param string $item: config item name :returns: Config item value with a trailing forward slash or NULL if not found @@ -208,7 +208,7 @@ Class Reference This method is identical to ``item()``, except it appends a forward slash to the end of the item, if it exists. - .. method:: load([$file = ''[, $use_sections = FALSE[, $fail_gracefully = FALSE]]]) + .. 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) @@ -218,7 +218,7 @@ Class Reference Loads a configuration file. - .. method:: site_url() + .. php:method:: site_url() :returns: Site URL :rtype: string @@ -229,7 +229,7 @@ Class Reference This method is normally accessed via the corresponding functions in the :doc:`URL Helper </helpers/url_helper>`. - .. method:: base_url() + .. php:method:: base_url() :returns: Base URL :rtype: string @@ -240,7 +240,7 @@ Class Reference This method is normally accessed via the corresponding functions in the :doc:`URL Helper </helpers/url_helper>`. - .. method:: system_url() + .. php:method:: system_url() :returns: URL pointing at your CI system/ directory :rtype: string diff --git a/user_guide_src/source/libraries/email.rst b/user_guide_src/source/libraries/email.rst index ebfde809b..54fb53f44 100644 --- a/user_guide_src/source/libraries/email.rst +++ b/user_guide_src/source/libraries/email.rst @@ -141,9 +141,9 @@ Place the item you do not want word-wrapped between: {unwrap} {/unwrap} Class Reference *************** -.. class:: CI_Email +.. php:class:: CI_Email - .. method:: from($from[, $name = ''[, $return_path = NULL]]) + .. php:method:: from($from[, $name = ''[, $return_path = NULL]]) :param string $from: "From" e-mail address :param string $name: "From" display name @@ -162,7 +162,7 @@ Class Reference .. note:: Return-Path can't be used if you've configured 'smtp' as your protocol. - .. method:: reply_to($replyto[, $name = '']) + .. php:method:: reply_to($replyto[, $name = '']) :param string $replyto: E-mail address for replies :param string $name: Display name for the reply-to e-mail address @@ -174,7 +174,7 @@ Class Reference $this->email->reply_to('you@example.com', 'Your Name'); - .. method:: to($to) + .. php:method:: to($to) :param mixed $to: Comma-delimited string or an array of e-mail addresses :returns: CI_Email instance (method chaining) @@ -195,7 +195,7 @@ Class Reference array('one@example.com', 'two@example.com', 'three@example.com') ); - .. method:: cc($cc) + .. php:method:: cc($cc) :param mixed $cc: Comma-delimited string or an array of e-mail addresses :returns: CI_Email instance (method chaining) @@ -204,7 +204,7 @@ Class Reference Sets the CC email address(s). Just like the "to", can be a single e-mail, a comma-delimited list or an array. - .. method:: bcc($bcc[, $limit = '']) + .. php:method:: bcc($bcc[, $limit = '']) :param mixed $bcc: Comma-delimited string or an array of e-mail addresses :param int $limit: Maximum number of e-mails to send per batch @@ -218,7 +218,7 @@ Class Reference the emails to batches, with each batch not exceeding the specified ``$limit``. - .. method:: subject($subject) + .. php:method:: subject($subject) :param string $subject: E-mail subject line :returns: CI_Email instance (method chaining) @@ -228,7 +228,7 @@ Class Reference $this->email->subject('This is my subject'); - .. method:: message($body) + .. php:method:: message($body) :param string $body: E-mail message body :returns: CI_Email instance (method chaining) @@ -238,7 +238,7 @@ Class Reference $this->email->message('This is my message'); - .. method:: set_alt_message($str) + .. php:method:: set_alt_message($str) :param string $str: Alternative e-mail message body :returns: CI_Email instance (method chaining) @@ -255,7 +255,7 @@ Class Reference message CodeIgniter will extract the message from your HTML email and strip the tags. - .. method:: set_header($header, $value) + .. php:method:: set_header($header, $value) :param string $header: Header name :param string $value: Header value @@ -267,7 +267,7 @@ Class Reference $this->email->set_header('Header1', 'Value1'); $this->email->set_header('Header2', 'Value2'); - .. method:: clear([$clear_attachments = FALSE]) + .. php:method:: clear([$clear_attachments = FALSE]) :param bool $clear_attachments: Whether or not to clear attachments :returns: CI_Email instance (method chaining) @@ -295,7 +295,7 @@ Class Reference $this->email->clear(TRUE); - .. method:: send([$auto_clear = TRUE]) + .. php:method:: send([$auto_clear = TRUE]) :param bool $auto_clear: Whether to clear message data automatically :returns: TRUE on success, FALSE on failure @@ -320,7 +320,7 @@ Class Reference .. note:: In order to use the ``print_debugger()`` method, you need to avoid clearing the email parameters. - .. method:: attach($filename[, $disposition = ''[, $newname = NULL[, $mime = '']]]) + .. php:method:: attach($filename[, $disposition = ''[, $newname = NULL[, $mime = '']]]) :param string $filename: File name :param string $disposition: 'disposition' of the attachment. Most @@ -358,7 +358,7 @@ Class Reference $this->email->attach($buffer, 'attachment', 'report.pdf', 'application/pdf'); - .. method:: attachment_cid($filename) + .. php:method:: attachment_cid($filename) :param string $filename: Existing attachment filename :returns: Attachment Content-ID or FALSE if not found @@ -380,7 +380,7 @@ Class Reference .. note:: Content-ID for each e-mail must be re-created for it to be unique. - .. method:: print_debugger([$include = array('headers', 'subject', 'body')]) + .. php:method:: print_debugger([$include = array('headers', 'subject', 'body')]) :param array $include: Which parts of the message to print out :returns: Formatted debug data diff --git a/user_guide_src/source/libraries/encrypt.rst b/user_guide_src/source/libraries/encrypt.rst index 6b65099a6..67e2a0190 100644 --- a/user_guide_src/source/libraries/encrypt.rst +++ b/user_guide_src/source/libraries/encrypt.rst @@ -80,9 +80,9 @@ Once loaded, the Encrypt library object will be available using:: Class Reference *************** -.. class:: CI_Encrypt +.. php:class:: CI_Encrypt - .. method:: encode($string[, $key = '']) + .. php:method:: encode($string[, $key = '']) :param string $string: Data to encrypt :param string $key: Encryption key @@ -103,7 +103,7 @@ Class Reference $encrypted_string = $this->encrypt->encode($msg, $key); - .. method:: decode($string[, $key = '']) + .. php:method:: decode($string[, $key = '']) :param string $string: String to decrypt :param string $key: Encryption key @@ -124,7 +124,7 @@ Class Reference $encrypted_string = $this->encrypt->decode($msg, $key); - .. method:: set_cipher($cipher) + .. php:method:: set_cipher($cipher) :param int $cipher: Valid PHP MCrypt cypher constant :returns: CI_Encrypt instance (method chaining) @@ -142,7 +142,7 @@ Class Reference echo extension_loaded('mcrypt') ? 'Yup' : 'Nope'; - .. method:: set_mode($mode) + .. php:method:: set_mode($mode) :param int $mode: Valid PHP MCrypt mode constant :returns: CI_Encrypt instance (method chaining) @@ -155,7 +155,7 @@ Class Reference Please visit php.net for a list of `available modes <http://php.net/mcrypt>`_. - .. method:: encode_from_legacy($string[, $legacy_mode = MCRYPT_MODE_ECB[, $key = '']]) + .. php:method:: encode_from_legacy($string[, $legacy_mode = MCRYPT_MODE_ECB[, $key = '']]) :param string $string: String to encrypt :param int $legacy_mode: Valid PHP MCrypt cipher constant diff --git a/user_guide_src/source/libraries/encryption.rst b/user_guide_src/source/libraries/encryption.rst index 2d0ee23a3..d445bf42f 100644 --- a/user_guide_src/source/libraries/encryption.rst +++ b/user_guide_src/source/libraries/encryption.rst @@ -474,9 +474,9 @@ appear and become widely available. Class Reference *************** -.. class:: CI_Encryption +.. php:class:: CI_Encryption - .. method:: initialize($params) + .. php:method:: initialize($params) :param array $params: Configuration parameters :returns: CI_Encryption instance (method chaining) @@ -493,7 +493,7 @@ Class Reference Please refer to the :ref:`configuration` section for detailed info. - .. method:: encrypt($data[, $params = NULL]) + .. php:method:: encrypt($data[, $params = NULL]) :param string $data: Data to encrypt :param array $params: Optional parameters @@ -509,7 +509,7 @@ Class Reference Please refer to the :ref:`custom-parameters` section for information on the optional parameters. - .. method:: decrypt($data[, $params = NULL]) + .. php:method:: decrypt($data[, $params = NULL]) :param string $data: Data to decrypt :param array $params: Optional parameters @@ -525,7 +525,7 @@ Class Reference Please refer to the :ref:`custom-parameters` secrion for information on the optional parameters. - .. method:: hkdf($key[, $digest = 'sha512'[, $salt = NULL[, $length = NULL[, $info = '']]]]) + .. php:method:: hkdf($key[, $digest = 'sha512'[, $salt = NULL[, $length = NULL[, $info = '']]]]) :param string $key: Input key material :param string $digest: A SHA-2 family digest algorithm diff --git a/user_guide_src/source/libraries/file_uploading.rst b/user_guide_src/source/libraries/file_uploading.rst index d93acb842..ea2fef7f2 100644 --- a/user_guide_src/source/libraries/file_uploading.rst +++ b/user_guide_src/source/libraries/file_uploading.rst @@ -252,16 +252,16 @@ preferences in a config file. Class Reference *************** -.. class:: CI_Upload +.. php:class:: CI_Upload - .. method:: initialize([array $config = array()[, $reset = TRUE]]) + .. php:method:: initialize([array $config = array()[, $reset = TRUE]]) :param array $config: Preferences :param bool $reset: Whether to reset preferences (that are not provided in $config) to their defaults :returns: CI_Upload instance (method chaining) :rtype: CI_Upload - .. method:: do_upload([$field = 'userfile']) + .. php:method:: do_upload([$field = 'userfile']) :param string $field: Name of the form field :returns: TRUE on success, FALSE on failure @@ -283,7 +283,7 @@ Class Reference $field_name = "some_field_name"; $this->upload->do_upload($field_name); - .. method:: display_errors([$open = '<p>'[, $close = '</p>']]) + .. php:method:: display_errors([$open = '<p>'[, $close = '</p>']]) :param string $open: Opening markup :param string $close: Closing markup @@ -302,7 +302,7 @@ Class Reference $this->upload->display_errors('<p>', '</p>'); - .. method:: data([$index = NULL]) + .. php:method:: data([$index = NULL]) :param string $data: Element to return instead of the full array :returns: Information about the uploaded file diff --git a/user_guide_src/source/libraries/form_validation.rst b/user_guide_src/source/libraries/form_validation.rst index f964965ec..da43a4bec 100644 --- a/user_guide_src/source/libraries/form_validation.rst +++ b/user_guide_src/source/libraries/form_validation.rst @@ -352,9 +352,9 @@ commonly is:: set_value('field name') Open your myform.php view file and update the **value** in each field -using the :func:`set_value()` function: +using the :php:func:`set_value()` function: -**Don't forget to include each field name in the :func:`set_value()` +**Don't forget to include each field name in the :php:func:`set_value()` function calls!** :: @@ -643,7 +643,7 @@ Showing Errors Individually =========================== If you prefer to show an error message next to each form field, rather -than as a list, you can use the :func:`form_error()` function. +than as a list, you can use the :php:func:`form_error()` function. Try it! Change your form so that it looks like this:: @@ -961,6 +961,7 @@ Rule Parameter Description not numeric. **less_than_equal_to** Yes Returns FALSE if the form element is greater than the parameter value, less_than_equal_to[8] or not numeric. +**in_list** Yes Returns FALSE if the form element is not within a predetermined list. in_list[red,blue,green] **alpha** No Returns FALSE if the form element contains anything other than alphabetical characters. **alpha_numeric** No Returns FALSE if the form element contains anything other than alpha-numeric characters. **alpha_numeric_spaces** No Returns FALSE if the form element contains anything other than alpha-numeric characters @@ -1017,9 +1018,9 @@ Name Parameter Description Class Reference *************** -.. class:: CI_Form_validation +.. php:class:: CI_Form_validation - .. method:: set_rules($field[, $label = ''[, $rules = '']]) + .. php:method:: set_rules($field[, $label = ''[, $rules = '']]) :param string $field: Field name :param string $label: Field label @@ -1033,7 +1034,7 @@ Class Reference - :ref:`setting-validation-rules` - :ref:`saving-groups` - .. method:: run([$group = '']) + .. php:method:: run([$group = '']) :param string $group: The name of the validation group to run :returns: TRUE on success, FALSE if validation failed @@ -1043,7 +1044,7 @@ Class Reference on failure. You can optionally pass the name of the validation group via the method, as described in: :ref:`saving-groups` - .. method:: set_message($lang[, $val = '']) + .. php:method:: set_message($lang[, $val = '']) :param string $lang: The rule the message is for :param string $val: The message @@ -1052,7 +1053,7 @@ Class Reference Permits you to set custom error messages. See :ref:`setting-error-messages` - .. method:: set_error_delimiters([$prefix = '<p>'[, $suffix = '</p>']]) + .. php:method:: set_error_delimiters([$prefix = '<p>'[, $suffix = '</p>']]) :param string $prefix: Error message prefix :param string $suffix: Error message suffix @@ -1061,7 +1062,7 @@ Class Reference Sets the default prefix and suffix for error messages. - .. method:: set_data($data) + .. php:method:: set_data($data) :param array $data: Array of data validate :returns: CI_Form_validation instance (method chaining) @@ -1070,7 +1071,7 @@ Class Reference Permits you to set an array for validation, instead of using the default ``$_POST`` array. - .. method:: reset_validation() + .. php:method:: reset_validation() :returns: CI_Form_validation instance (method chaining) :rtype: CI_Form_validation @@ -1078,14 +1079,14 @@ Class Reference Permits you to reset the validation when you validate more than one array. This method should be called before validating each new array. - .. method:: error_array() + .. php:method:: error_array() :returns: Array of error messages :rtype: array Returns the error messages as an array. - .. method:: error_string([$prefix = ''[, $suffix = '']]) + .. php:method:: error_string([$prefix = ''[, $suffix = '']]) :param string $prefix: Error message prefix :param string $suffix: Error message suffix @@ -1095,7 +1096,7 @@ Class Reference Returns all error messages (as returned from error_array()) formatted as a string and separated by a newline character. - .. method:: error($field[, $prefix = ''[, $suffix = '']]) + .. php:method:: error($field[, $prefix = ''[, $suffix = '']]) :param string $field: Field name :param string $prefix: Optional prefix @@ -1106,7 +1107,7 @@ Class Reference Returns the error message for a specific field, optionally adding a prefix and/or suffix to it (usually HTML tags). - .. method:: has_rule($field) + .. php:method:: has_rule($field) :param string $field: Field name :returns: TRUE if the field has rules set, FALSE if not @@ -1123,12 +1124,12 @@ Helper Reference Please refer to the :doc:`Form Helper <../helpers/form_helper>` manual for the following functions: -- :func:`form_error()` -- :func:`validation_errors()` -- :func:`set_value()` -- :func:`set_select()` -- :func:`set_checkbox()` -- :func:`set_radio()` +- :php:func:`form_error()` +- :php:func:`validation_errors()` +- :php:func:`set_value()` +- :php:func:`set_select()` +- :php:func:`set_checkbox()` +- :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 diff --git a/user_guide_src/source/libraries/ftp.rst b/user_guide_src/source/libraries/ftp.rst index 4be1a6ea4..ddd4442fd 100644 --- a/user_guide_src/source/libraries/ftp.rst +++ b/user_guide_src/source/libraries/ftp.rst @@ -90,9 +90,9 @@ In this example a local directory is mirrored on the server. Class Reference *************** -.. class:: CI_FTP +.. php:class:: CI_FTP - .. method:: connect([$config = array()]) + .. php:method:: connect([$config = array()]) :param array $config: Connection values :returns: TRUE on success, FALSE on failure @@ -135,7 +135,7 @@ Class Reference **passive** TRUE TRUE/FALSE (boolean): Whether to use passive mode ============== =============== ============================================================================= - .. method:: upload($locpath, $rempath[, $mode = 'auto'[, $permissions = NULL]]) + .. php:method:: upload($locpath, $rempath[, $mode = 'auto'[, $permissions = NULL]]) :param string $locpath: Local file path :param string $rempath: Remote file path @@ -154,7 +154,7 @@ Class Reference If set, permissions have to be passed as an octal value. - .. method:: download($rempath, $locpath[, $mode = 'auto']) + .. php:method:: download($rempath, $locpath[, $mode = 'auto']) :param string $rempath: Remote file path :param string $locpath: Local file path @@ -172,7 +172,7 @@ Class Reference Returns FALSE if the download does not execute successfully (including if PHP does not have permission to write the local file). - .. method:: rename($old_file, $new_file[, $move = FALSE]) + .. php:method:: rename($old_file, $new_file[, $move = FALSE]) :param string $old_file: Old file name :param string $new_file: New file name @@ -186,7 +186,7 @@ Class Reference // Renames green.html to blue.html $this->ftp->rename('/public_html/foo/green.html', '/public_html/foo/blue.html'); - .. method:: move($old_file, $new_file) + .. php:method:: move($old_file, $new_file) :param string $old_file: Old file name :param string $new_file: New file name @@ -200,7 +200,7 @@ Class Reference .. note:: If the destination file name is different the file will be renamed. - .. method:: delete_file($filepath) + .. php:method:: delete_file($filepath) :param string $filepath: Path to file to delete :returns: TRUE on success, FALSE on failure @@ -211,7 +211,7 @@ Class Reference $this->ftp->delete_file('/public_html/joe/blog.html'); - .. method:: delete_dir($filepath) + .. php:method:: delete_dir($filepath) :param string $filepath: Path to directory to delete :returns: TRUE on success, FALSE on failure @@ -229,7 +229,7 @@ Class Reference $this->ftp->delete_dir('/public_html/path/to/folder/'); - .. method:: list_files([$path = '.']) + .. php:method:: list_files([$path = '.']) :param string $path: Directory path :returns: An array list of files or FALSE on failure @@ -242,7 +242,7 @@ Class Reference $list = $this->ftp->list_files('/public_html/'); print_r($list); - .. method:: mirror($locpath, $rempath) + .. php:method:: mirror($locpath, $rempath) :param string $locpath: Local path :param string $rempath: Remote path @@ -256,7 +256,7 @@ Class Reference $this->ftp->mirror('/path/to/myfolder/', '/public_html/myfolder/'); - .. method:: mkdir($path[, $permissions = NULL]) + .. php:method:: mkdir($path[, $permissions = NULL]) :param string $path: Path to directory to create :param int $permissions: Permissions (octal) @@ -272,7 +272,7 @@ Class Reference // Creates a folder named "bar" $this->ftp->mkdir('/public_html/foo/bar/', 0755); - .. method:: chmod($path, $perm) + .. php:method:: chmod($path, $perm) :param string $path: Path to alter permissions for :param int $perm: Permissions (octal) @@ -285,7 +285,7 @@ Class Reference // Chmod "bar" to 755 $this->ftp->chmod('/public_html/foo/bar/', 0755); - .. method:: changedir($path[, $suppress_debug = FALSE]) + .. php:method:: changedir($path[, $suppress_debug = FALSE]) :param string $path: Directory path :param bool $suppress_debug: Whether to turn off debug messages for this command @@ -297,7 +297,7 @@ Class Reference The ``$suppress_debug`` parameter is useful in case you want to use this method as an ``is_dir()`` alternative for FTP. - .. method:: close() + .. php:method:: close() :returns: TRUE on success, FALSE on failure :rtype: bool diff --git a/user_guide_src/source/libraries/image_lib.rst b/user_guide_src/source/libraries/image_lib.rst index a52cf3e02..ae2c8478e 100644 --- a/user_guide_src/source/libraries/image_lib.rst +++ b/user_guide_src/source/libraries/image_lib.rst @@ -316,9 +316,9 @@ Preference Default Value Options Description Class Reference *************** -.. class:: CI_Image_lib +.. php:class:: CI_Image_lib - .. method:: initialize([$props = array()]) + .. php:method:: initialize([$props = array()]) :param array $props: Image processing preferences :returns: TRUE on success, FALSE in case of invalid settings @@ -326,7 +326,7 @@ Class Reference Initializes the class for processing an image. - .. method:: resize() + .. php:method:: resize() :returns: TRUE on success, FALSE on failure :rtype: bool @@ -373,7 +373,7 @@ Class Reference new_image) are used, the resizing method will instead target the original image for processing. - .. method:: crop() + .. php:method:: crop() :returns: TRUE on success, FALSE on failure :rtype: bool @@ -409,7 +409,7 @@ Class Reference in ExpressionEngine, the CMS we develop. We added a JavaScript UI that lets the cropping area be selected. - .. method:: rotate() + .. php:method:: rotate() :returns: TRUE on success, FALSE on failure :rtype: bool @@ -441,7 +441,7 @@ Class Reference echo $this->image_lib->display_errors(); } - .. method:: watermark() + .. php:method:: watermark() :returns: TRUE on success, FALSE on failure :rtype: bool @@ -449,7 +449,7 @@ Class Reference Creates a watermark over an image, please refer to the :ref:`watermarking` section for more info. - .. method:: clear() + .. php:method:: clear() :rtype: void @@ -461,7 +461,7 @@ Class Reference $this->image_lib->clear(); - .. method:: display_errors([$open = '<p>[, $close = '</p>']]) + .. php:method:: display_errors([$open = '<p>[, $close = '</p>']]) :param string $open: Error message opening tag :param string $close: Error message closing tag diff --git a/user_guide_src/source/libraries/input.rst b/user_guide_src/source/libraries/input.rst index 4464e0fdc..967f69d13 100644 --- a/user_guide_src/source/libraries/input.rst +++ b/user_guide_src/source/libraries/input.rst @@ -112,9 +112,9 @@ a boolean value as the second parameter:: Class Reference *************** -.. class:: CI_Input +.. php:class:: CI_Input - .. method:: post([$index = NULL[, $xss_clean = NULL]]) + .. php:method:: post([$index = NULL[, $xss_clean = NULL]]) :param mixed $index: POST parameter name :param bool $xss_clean: Whether to apply XSS filtering @@ -157,7 +157,7 @@ Class Reference $this->input->post(array('field1', 'field2'), TRUE); - .. method:: get([$index = NULL[, $xss_clean = NULL]]) + .. php:method:: get([$index = NULL[, $xss_clean = NULL]]) :param mixed $index: GET parameter name :param bool $xss_clean: Whether to apply XSS filtering @@ -190,7 +190,7 @@ Class Reference $this->input->get(array('field1', 'field2'), TRUE); - .. method:: post_get($index[, $xss_clean = NULL]) + .. php:method:: post_get($index[, $xss_clean = NULL]) :param string $index: POST/GET parameter name :param bool $xss_clean: Whether to apply XSS filtering @@ -203,7 +203,7 @@ Class Reference $this->input->post_get('some_data', TRUE); - .. method:: get_post($index[, $xss_clean = NULL]) + .. php:method:: get_post($index[, $xss_clean = NULL]) :param string $index: GET/POST parameter name :param bool $xss_clean: Whether to apply XSS filtering @@ -218,7 +218,7 @@ Class Reference .. note:: This method used to act EXACTLY like ``post_get()``, but it's behavior has changed in CodeIgniter 3.0. - .. method:: cookie([$index = NULL[, $xss_clean = NULL]]) + .. php:method:: cookie([$index = NULL[, $xss_clean = NULL]]) :param mixed $index: COOKIE name :param bool $xss_clean: Whether to apply XSS filtering @@ -237,7 +237,11 @@ Class Reference $this->input->cookie(array('some_cookie', 'some_cookie2')); - .. method:: server($index[, $xss_clean = NULL]) + .. note:: Unlike the :doc:`Cookie Helper <../helpers/cookie_helper>` + function :php:func:`get_cookie()`, this method does NOT prepend + your configured ``$config['cookie_prefix']`` value. + + .. php:method:: server($index[, $xss_clean = NULL]) :param mixed $index: Value name :param bool $xss_clean: Whether to apply XSS filtering @@ -255,7 +259,7 @@ Class Reference $this->input->server(array('SERVER_PROTOCOL', 'REQUEST_URI')); - .. method:: input_stream([$index = NULL[, $xss_clean = NULL]]) + .. php:method:: input_stream([$index = NULL[, $xss_clean = NULL]]) :param mixed $index: Key name :param bool $xss_clean: Whether to apply XSS filtering @@ -265,7 +269,7 @@ Class Reference This method is identical to ``get()``, ``post()`` and ``cookie()``, only it fetches the *php://input* stream data. - .. method:: set_cookie($name = ''[, $value = ''[, $expire = ''[, $domain = ''[, $path = '/'[, $prefix = ''[, $secure = FALSE[, $httponly = FALSE]]]]]]]) + .. php:method:: set_cookie($name = ''[, $value = ''[, $expire = ''[, $domain = ''[, $path = '/'[, $prefix = ''[, $secure = FALSE[, $httponly = FALSE]]]]]]]) :param mixed $name: Cookie name or an array of parameters :param string $value: Cookie value @@ -328,7 +332,7 @@ Class Reference $this->input->set_cookie($name, $value, $expire, $domain, $path, $prefix, $secure); - .. method:: ip_address() + .. php:method:: ip_address() :returns: Visitor's IP address or '0.0.0.0' if not valid :rtype: string @@ -343,7 +347,7 @@ Class Reference HTTP_CLIENT_IP, HTTP_X_CLIENT_IP or HTTP_X_CLUSTER_CLIENT_IP address for the allowed IP addresses. - .. method:: valid_ip($ip[, $which = '']) + .. php:method:: valid_ip($ip[, $which = '']) :param string $ip: IP address :param string $which: IP protocol ('ipv4' or 'ipv6') @@ -370,7 +374,7 @@ Class Reference Accepts an optional second string parameter of 'ipv4' or 'ipv6' to specify an IP format. The default checks for both formats. - .. method:: user_agent([$xss_clean = NULL]) + .. php:method:: user_agent([$xss_clean = NULL]) :returns: User agent string or NULL if not set :param bool $xss_clean: Whether to apply XSS filtering @@ -385,7 +389,7 @@ Class Reference See the :doc:`User Agent Class <user_agent>` for methods which extract information from the user agent string. - .. method:: request_headers([$xss_clean = FALSE]) + .. php:method:: request_headers([$xss_clean = FALSE]) :param bool $xss_clean: Whether to apply XSS filtering :returns: An array of HTTP request headers @@ -399,7 +403,7 @@ Class Reference $headers = $this->input->request_headers(); - .. method:: get_request_header($index[, $xss_clean = FALSE]) + .. php:method:: get_request_header($index[, $xss_clean = FALSE]) :param string $index: HTTP request header name :param bool $xss_clean: Whether to apply XSS filtering @@ -412,7 +416,7 @@ Class Reference $this->input->get_request_header('some-header', TRUE); - .. method:: is_ajax_request() + .. php:method:: is_ajax_request() :returns: TRUE if it is an Ajax request, FALSE if not :rtype: bool @@ -420,7 +424,7 @@ 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. - .. method:: is_cli_request() + .. php:method:: is_cli_request() :returns: TRUE if it is a CLI request, FALSE if not :rtype: bool @@ -439,7 +443,7 @@ Class Reference .. note:: This method is DEPRECATED and is now just an alias for the :func:`is_cli()` function. - .. method:: method([$upper = FALSE]) + .. php:method:: method([$upper = FALSE]) :param bool $upper: Whether to return the request method name in upper or lower case :returns: HTTP request method diff --git a/user_guide_src/source/libraries/language.rst b/user_guide_src/source/libraries/language.rst index e833d9757..ee1cefcd0 100644 --- a/user_guide_src/source/libraries/language.rst +++ b/user_guide_src/source/libraries/language.rst @@ -169,7 +169,7 @@ Using language lines as form labels ----------------------------------- This feature has been deprecated from the language library and moved to -the :func:`lang()` function of the :doc:`Language Helper +the :php:func:`lang()` function of the :doc:`Language Helper <../helpers/language_helper>`. Auto-loading Languages @@ -185,9 +185,9 @@ language(s) to the autoload array. Class Reference *************** -.. class:: CI_Lang +.. php:class:: CI_Lang - .. method:: load($langfile[, $idiom = ''[, $return = FALSE[, $add_suffix = TRUE[, $alt_path = '']]]]) + .. php:method:: load($langfile[, $idiom = ''[, $return = FALSE[, $add_suffix = TRUE[, $alt_path = '']]]]) :param mixed $langfile: Language file to load or array with multiple files :param string $idiom: Language name (i.e. 'english') @@ -199,7 +199,7 @@ Class Reference Loads a language file. - .. method:: line($line[, $log_errors = TRUE]) + .. php:method:: line($line[, $log_errors = TRUE]) :param string $line: Language line key name :param bool $log_errors: Whether to log an error if the line isn't found diff --git a/user_guide_src/source/libraries/loader.rst b/user_guide_src/source/libraries/loader.rst index 48ac6e174..efa9d519b 100644 --- a/user_guide_src/source/libraries/loader.rst +++ b/user_guide_src/source/libraries/loader.rst @@ -77,9 +77,9 @@ calling ``add_package_path()``. Class Reference *************** -.. class:: CI_Loader +.. php:class:: CI_Loader - .. method:: library($library[, $params = NULL[, $object_name = NULL]]) + .. php:method:: library($library[, $params = NULL[, $object_name = NULL]]) :param mixed $library: Library name as a string or an array with multiple libraries :param array $params: Optional array of parameters to pass to the loaded library's constructor @@ -156,7 +156,7 @@ Class Reference Please take note, when multiple libraries are supplied in an array for the first parameter, this parameter is discarded. - .. method:: driver($library[, $params = NULL[, $object_name]]) + .. php:method:: driver($library[, $params = NULL[, $object_name]]) :param mixed $library: Library name as a string or an array with multiple libraries :param array $params: Optional array of parameters to pass to the loaded library's constructor @@ -217,7 +217,7 @@ Class Reference // Session class is now accessed using: $this->my_session - .. method:: view($view[, $vars = array()[, return = FALSE]]) + .. php:method:: view($view[, $vars = array()[, return = FALSE]]) :param string $view: View name :param array $vars: An associative array of variables @@ -251,7 +251,7 @@ Class Reference $string = $this->load->view('myfile', '', TRUE); - .. method:: vars($vars[, $val = '']) + .. php:method:: vars($vars[, $val = '']) :param mixed $vars: An array of variables or a single variable name :param mixed $val: Optional variable value @@ -268,7 +268,7 @@ Class Reference have multiple calls to this method. The data get cached and merged into one array for conversion to variables. - .. method:: get_var($key) + .. php:method:: get_var($key) :param string $key: Variable name key :returns: Value if key is found, NULL if not @@ -278,21 +278,21 @@ Class Reference your views. This is useful if for any reason a var is set in a library or another controller method using ``$this->load->vars()``. - .. method:: get_vars() + .. php:method:: get_vars() :returns: An array of all assigned view variables :rtype: array This method retrieves all variables available to your views. - .. method:: clear_vars() + .. php:method:: clear_vars() :returns: CI_Loader instance (method chaining) :rtype: CI_Loader Clears cached view variables. - .. method:: model($model[, $name = ''[, $db_conn = FALSE]]) + .. php:method:: model($model[, $name = ''[, $db_conn = FALSE]]) :param mixed $model: Model name or an array containing multiple models :param string $name: Optional object name to assign the model to @@ -317,7 +317,7 @@ Class Reference $this->load->model('model_name', 'fubar'); $this->fubar->method(); - .. method:: database([$params = ''[, $return = FALSE[, $query_builder = NULL]]]) + .. php:method:: database([$params = ''[, $return = FALSE[, $query_builder = NULL]]]) :param mixed $params: Database group name or configuration options :param bool $return: Whether to return the loaded database object @@ -329,7 +329,7 @@ Class Reference **optional**. Please see the :doc:`database <../database/index>` section for more info. - .. method:: dbforge([$db = NULL[, $return = FALSE]]) + .. php:method:: dbforge([$db = NULL[, $return = FALSE]]) :param object $db: Database object :param bool $return: Whether to return the Database Forge instance @@ -339,7 +339,7 @@ Class Reference Loads the :doc:`Database Forge <../database/forge>` class, please refer to that manual for more info. - .. method:: dbutil([$db = NULL[, $return = FALSE]]) + .. php:method:: dbutil([$db = NULL[, $return = FALSE]]) :param object $db: Database object :param bool $return: Whether to return the Database Utilities instance @@ -349,7 +349,7 @@ Class Reference Loads the :doc:`Database Utilities <../database/utilities>` class, please refer to that manual for more info. - .. method:: helper($helpers) + .. php:method:: helper($helpers) :param mixed $helpers: Helper name as a string or an array containing multiple helpers :returns: CI_Loader instance (method chaining) @@ -358,7 +358,7 @@ Class Reference This method loads helper files, where file_name is the name of the file, without the _helper.php extension. - .. method:: file($path[, $return = FALSE]) + .. php:method:: file($path[, $return = FALSE]) :param string $path: File path :param bool $return: Whether to return the loaded file @@ -371,7 +371,7 @@ Class Reference second parameter to boolean TRUE it will instead return the data as a string. - .. method:: language($files[, $lang = '']) + .. php:method:: language($files[, $lang = '']) :param mixed $files: Language file name or an array of multiple language files :param string $lang: Language name @@ -381,7 +381,7 @@ Class Reference This method is an alias of the :doc:`language loading method <language>`: ``$this->lang->load()``. - .. method:: config($file[, $use_sections = FALSE[, $fail_gracefully = FALSE]]) + .. php:method:: config($file[, $use_sections = FALSE[, $fail_gracefully = FALSE]]) :param string $file: Configuration file name :param bool $use_sections: Whether configuration values should be loaded into their own section @@ -392,7 +392,7 @@ Class Reference This method is an alias of the :doc:`config file loading method <config>`: ``$this->config->load()`` - .. method:: is_loaded($class) + .. php:method:: is_loaded($class) :param string $class: Class name :returns: Singleton property name if found, FALSE if not @@ -420,7 +420,7 @@ Class Reference $this->load->is_loaded('Form_validation'); // returns 'fv' - .. method:: add_package_path($path[, $view_cascade = TRUE]) + .. php:method:: add_package_path($path[, $view_cascade = TRUE]) :param string $path: Path to add :param bool $view_cascade: Whether to use cascading views @@ -435,7 +435,7 @@ Class Reference $this->load->add_package_path(APPPATH.'third_party/foo_bar/') ->library('foo_bar'); - .. method:: remove_package_path([$path = '']) + .. php:method:: remove_package_path([$path = '']) :param string $path: Path to remove :returns: CI_Loader instance (method chaining) @@ -452,7 +452,7 @@ Class Reference $this->load->remove_package_path(APPPATH.'third_party/foo_bar/'); - .. method:: get_package_paths([$include_base = TRUE]) + .. php:method:: get_package_paths([$include_base = TRUE]) :param bool $include_base: Whether to include BASEPATH :returns: An array of package paths diff --git a/user_guide_src/source/libraries/migration.rst b/user_guide_src/source/libraries/migration.rst index e8ea1d977..25be0c93c 100644 --- a/user_guide_src/source/libraries/migration.rst +++ b/user_guide_src/source/libraries/migration.rst @@ -138,9 +138,9 @@ Preference Default Options Des Class Reference *************** -.. class:: CI_Migration +.. php:class:: CI_Migration - .. method:: current() + .. php:method:: current() :returns: TRUE if no migrations are found, current version string on success, FALSE on failure :rtype: mixed @@ -148,21 +148,21 @@ Class Reference Migrates up to the current version (whatever is set for ``$config['migration_version']`` in *application/config/migration.php*). - .. method:: error_string() + .. php:method:: error_string() :returns: Error messages :rtype: string This returns a string of errors that were detected while performing a migration. - .. method:: find_migrations() + .. php:method:: find_migrations() :returns: An array of migration files :rtype: array An array of migration filenames are returned that are found in the **migration_path** property. - .. method:: latest() + .. php:method:: latest() :returns: TRUE if no migrations are found, current version string on success, FALSE on failure :rtype: mixed @@ -171,7 +171,7 @@ Class Reference the ``$config['migration_version']`` the Migration class will use the very newest migration found in the filesystem. - .. method:: version($target_version) + .. php:method:: version($target_version) :param mixed $target_version: Migration version to process :returns: TRUE if no migrations are found, current version string on success, FALSE on failure diff --git a/user_guide_src/source/libraries/output.rst b/user_guide_src/source/libraries/output.rst index e808561bd..4b36d2a03 100644 --- a/user_guide_src/source/libraries/output.rst +++ b/user_guide_src/source/libraries/output.rst @@ -29,7 +29,7 @@ need to. Class Reference *************** -.. class:: CI_Output +.. php:class:: CI_Output .. attribute:: $parse_exec_vars = TRUE; @@ -41,7 +41,7 @@ Class Reference $this->output->parse_exec_vars = FALSE; - .. method:: set_output($output) + .. php:method:: set_output($output) :param string $output: String to set the output to :returns: CI_Output instance (method chaining) @@ -55,7 +55,7 @@ Class Reference in the function you call it from. For example, if you build a page in one of your controller methods, don't set the output until the end. - .. method:: set_content_type($mime_type[, $charset = NULL]) + .. php:method:: set_content_type($mime_type[, $charset = NULL]) :param string $mime_type: MIME Type idenitifer string :param string $charset: Character set @@ -80,7 +80,7 @@ Class Reference $this->output->set_content_type('css', 'utf-8'); - .. method:: get_content_type() + .. php:method:: get_content_type() :returns: Content-Type string :rtype: string @@ -92,7 +92,7 @@ Class Reference .. note:: If not set, the default return value is 'text/html'. - .. method:: get_header($header) + .. php:method:: get_header($header) :param string $header: HTTP header name :returns: HTTP response header or NULL if not found @@ -109,7 +109,7 @@ Class Reference .. note:: Raw headers sent via PHP's native ``header()`` function are also detected. - .. method:: get_output() + .. php:method:: get_output() :returns: Output string :rtype: string @@ -123,7 +123,7 @@ Class Reference been previously sent to the output class by one of the CodeIgniter functions like ``$this->load->view()``. - .. method:: append_output($output) + .. php:method:: append_output($output) :param string $output: Additional output data to append :returns: CI_Output instance (method chaining) @@ -134,7 +134,7 @@ Class Reference $this->output->append_output($data); - .. method:: set_header($header[, $replace = TRUE]) + .. php:method:: set_header($header[, $replace = TRUE]) :param string $header: HTTP response header :param bool $replace: Whether to replace the old header value, if it is already set @@ -151,7 +151,7 @@ Class Reference $this->output->set_header('Cache-Control: post-check=0, pre-check=0'); $this->output->set_header('Pragma: no-cache'); - .. method:: set_status_header([$code = 200[, $text = '']]) + .. php:method:: set_status_header([$code = 200[, $text = '']]) :param int $code: HTTP status code :param string $text: Optional message @@ -168,7 +168,7 @@ Class Reference .. note:: This method is an alias for :doc:`Common function <../general/common_functions>` :func:`set_status_header()`. - .. method:: enable_profiler([$val = TRUE]) + .. php:method:: enable_profiler([$val = TRUE]) :param bool $val: Whether to enable or disable the Profiler :returns: CI_Output instance (method chaining) @@ -188,7 +188,7 @@ Class Reference $this->output->enable_profiler(FALSE); - .. method:: set_profiler_sections($sections) + .. php:method:: set_profiler_sections($sections) :param array $sections: Profiler sections :returns: CI_Output instance (method chaining) @@ -197,7 +197,7 @@ Class Reference Permits you to enable/disable specific sections of the Profiler when it is enabled. Please refer to the :doc:`Profiler <../general/profiling>` documentation for further information. - .. method:: cache($time) + .. php:method:: cache($time) :param int $time: Cache expiration time in seconds :returns: CI_Output instance (method chaining) @@ -207,7 +207,7 @@ Class Reference For more information, please see the :doc:`caching documentation <../general/caching>`. - .. method:: _display([$output = '']) + .. php:method:: _display([$output = '']) :param string $output: Output data override :returns: void diff --git a/user_guide_src/source/libraries/pagination.rst b/user_guide_src/source/libraries/pagination.rst index 8c5c2c63a..913717c67 100644 --- a/user_guide_src/source/libraries/pagination.rst +++ b/user_guide_src/source/libraries/pagination.rst @@ -131,6 +131,12 @@ the offset segment. A custom suffix added to the path. The sufix value will be right after the offset segment. +**$config['use_global_url_suffix'] = FALSE;** + +When set to TRUE, it will **override** the ``$config['suffix']`` value and +instead set it to the one that you have in ``$config['url_suffix']`` in +your **application/config/config.php** file. + *********************** Adding Enclosing Markup *********************** @@ -290,9 +296,9 @@ you can pass boolean FALSE as a regular attribute Class Reference *************** -.. class:: CI_Pagination +.. php:class:: CI_Pagination - .. method:: initialize([$params = array()]) + .. php:method:: initialize([$params = array()]) :param array $params: Configuration parameters :returns: CI_Pagination instance (method chaining) @@ -300,7 +306,7 @@ Class Reference Initializes the Pagination class with your preferred options. - .. method:: create_links() + .. php:method:: create_links() :returns: HTML-formatted pagination :rtype: string diff --git a/user_guide_src/source/libraries/parser.rst b/user_guide_src/source/libraries/parser.rst index d66684d9b..6c9d28959 100644 --- a/user_guide_src/source/libraries/parser.rst +++ b/user_guide_src/source/libraries/parser.rst @@ -276,9 +276,9 @@ Result:: Class Reference *************** -.. class:: CI_Parser +.. php:class:: CI_Parser - .. method:: parse($template, $data[, $return = FALSE]) + .. php:method:: parse($template, $data[, $return = FALSE]) :param string $template: Path to view file :param array $data: Variable data @@ -288,7 +288,7 @@ Class Reference Parses a template from the provided path and variables. - .. method:: parse_string($template, $data[, $return = FALSE]) + .. php:method:: parse_string($template, $data[, $return = FALSE]) :param string $template: Path to view file :param array $data: Variable data @@ -299,7 +299,7 @@ Class Reference This method works exactly like ``parse()``, only it accepts the template as a string instead of loading a view file. - .. method:: set_delimiters([$l = '{'[, $r = '}']]) + .. php:method:: set_delimiters([$l = '{'[, $r = '}']]) :param string $l: Left delimiter :param string $r: Right delimiter diff --git a/user_guide_src/source/libraries/security.rst b/user_guide_src/source/libraries/security.rst index a39ef5976..27e6e561b 100644 --- a/user_guide_src/source/libraries/security.rst +++ b/user_guide_src/source/libraries/security.rst @@ -110,9 +110,9 @@ Regular expressions are also supported (case-insensitive):: Class Reference *************** -.. class:: CI_Security +.. php:class:: CI_Security - .. method:: xss_clean($str[, $is_image = FALSE]) + .. php:method:: xss_clean($str[, $is_image = FALSE]) :param mixed $str: Input string or an array of strings :returns: XSS-clean data @@ -121,7 +121,7 @@ Class Reference Tries to remove XSS exploits from the input data and returns the cleaned string. If the optional second parameter is set to true, it will return boolean TRUE if the image is safe to use and FALSE if malicious data was detected in it. - .. method:: sanitize_filename($str[, $relative_path = FALSE]) + .. php:method:: sanitize_filename($str[, $relative_path = FALSE]) :param string $str: File name/path :param bool $relative_path: Whether to preserve any directories in the file path @@ -140,14 +140,14 @@ Class Reference $filename = $this->security->sanitize_filename($this->input->post('filename'), TRUE); - .. method:: get_csrf_token_name() + .. php:method:: get_csrf_token_name() :returns: CSRF token name :rtype: string Returns the CSRF token name (the ``$config['csrf_token_name']`` value). - .. method:: get_csrf_hash() + .. php:method:: get_csrf_hash() :returns: CSRF hash :rtype: string @@ -155,7 +155,7 @@ Class Reference Returns the CSRF hash value. Useful in combination with ``get_csrf_token_name()`` for manually building forms or sending valid AJAX POST requests. - .. method:: entity_decode($str[, $charset = NULL]) + .. php:method:: entity_decode($str[, $charset = NULL]) :param string $str: Input string :param string $charset: Character set of the input string @@ -167,7 +167,7 @@ Class Reference If the ``$charset`` parameter is left empty, then your configured ``$config['charset']`` value will be used. - .. method:: get_random_bytes($length) + .. php:method:: get_random_bytes($length) :param int $length: Output length :returns: A binary stream of random bytes or FALSE on failure diff --git a/user_guide_src/source/libraries/sessions.rst b/user_guide_src/source/libraries/sessions.rst index f05f86af1..e2780683f 100644 --- a/user_guide_src/source/libraries/sessions.rst +++ b/user_guide_src/source/libraries/sessions.rst @@ -1,13 +1,20 @@ -############## -Session Driver -############## +############### +Session Library +############### The Session class permits you maintain a user's "state" and track their -activity while they browse your site. CodeIgniter offers two default -session drivers: the classic `Cookie Driver`_, and the `Native Driver`_, -which supports usage of the native PHP Session mechanism. In addition, -you may create your own `Custom Drivers`_ to store session data however -you wish, while still taking advantage of the features of the Session class. +activity while they browse your site. + +CodeIgniter comes with a few session storage drivers: + + - files (default; file-system based) + - database + - redis + - memcached + +In addition, you may create your own, custom session drivers based on other +kinds of storage, while still taking advantage of the features of the +Session class. .. contents:: :local: @@ -23,122 +30,165 @@ Using the Session Class Initializing a Session ====================== -Sessions will typically run globally with each page load, so the session -class must either be :doc:`initialized <../general/drivers>` in your -:doc:`controller <../general/controllers>` constructors, or it can be -:doc:`auto-loaded <../general/autoloader>` by the system. For the most -part the session class will run unattended in the background, so simply -initializing the class will cause it to read, create, and update -sessions. +Sessions will typically run globally with each page load, so the Session +class should either be initialized in your :doc:`controller +<../general/controllers>` constructors, or it can be :doc:`auto-loaded +<../general/autoloader>` by the system. +For the most part the session class will run unattended in the background, +so simply initializing the class will cause it to read, create, and update +sessions when necessary. To initialize the Session class manually in your controller constructor, -use the ``$this->load->driver`` function:: +use the ``$this->load->library()`` method:: - $this->load->driver('session'); + $this->load->library('session'); Once loaded, the Sessions library object will be available using:: $this->session +.. important:: Because the :doc:`Loader Class </libraries/loader>` is instantiated + by CodeIgniter's base controller, make sure to call + ``parent::__construct()`` before trying to load a library from + inside a controller constructor. + How do Sessions work? ===================== When a page is loaded, the session class will check to see if valid -session data exists in the user's session. If sessions data does **not** -exist (or if it has expired) a new session will be created and saved. -If a session does exist, its information will be updated. With each update, -the session_id will be regenerated. +session cookie is sent by the user's browser. If a sessions cookie does +**not** exist (or if it doesn't match one stored on the server or has +expired) a new session will be created and saved. + +If a valid session does exist, its information will be updated. With each +update, the session ID may be regenerated if configured to do so. It's important for you to understand that once initialized, the Session class runs automatically. There is nothing you need to do to cause the -above behavior to happen. You can, as you'll see below, work with -session data or even add your own data to a user's session, but the -process of reading, writing, and updating a session is automatic. +above behavior to happen. You can, as you'll see below, work with session +data, but the process of reading, writing, and updating a session is +automatic. + +.. note:: Under CLI, the Session library will automatically halt itself, + as this is a concept based entirely on the HTTP protocol. + +A note about concurrency +------------------------ + +Unless you're developing a website with heavy AJAX usage, you can skip this +section. If you are, however, and if you're experiencing performance +issues, then this note is exactly what you're looking for. + +Sessions in previous versions of CodeIgniter didn't implement locking, +which meant that two HTTP requests using the same session could run exactly +at the same time. To use a more appropriate technical term - requests were +non-blocking. + +However, non-blocking requests in the context of sessions also means +unsafe, because modifications to session data (or session ID regeneration) +in one request can interfere with the execution of a second, concurrent +request. This detail was at the root of many issues and the main reason why +CodeIgniter 3.0 has a completely re-written Session library. + +Why are we telling you this? Because it is likely that after trying to +find the reason for your performance issues, you may conclude that locking +is the issue and therefore look into how to remove the locks ... + +DO NOT DO THAT! Removing locks would be **wrong** and it will cause you +more problems! + +Locking is not the issue, it is a solution. Your issue is that you still +have the session open, while you've already processed it and therefore no +longer need it. So, what you need is to close the session for the +current request after you no longer need it. + +Long story short - call ``session_write_close()`` once you no longer need +anything to do with session variables. What is Session Data? ===================== -A *session*, as far as CodeIgniter is concerned, is simply an array -containing the following information: - -- The user's unique Session ID (this is a statistically random string - with very strong entropy, hashed with MD5 for portability, and - regenerated (by default) every five minutes) -- The user's IP Address -- The user's User Agent data (the first 120 characters of the browser - data string) -- The "last activity" time stamp. - -The above data is stored in a cookie as a serialized array with this -prototype:: - - [array] - ( - 'session_id' => random hash, - 'ip_address' => 'string - user IP address', - 'user_agent' => 'string - user agent data', - 'last_activity' => timestamp - ) - -.. note:: Sessions are only updated every five minutes by default to - reduce processor load. If you repeatedly reload a page you'll notice - that the "last activity" time only updates if five minutes or more has - passed since the last time the cookie was written. This time is - configurable by changing the $config['sess_time_to_update'] line in - your system/config/config.php file. +Session data is simply an array associated with a particular session ID +(cookie). + +If you've used sessions in PHP before, you should be familiar with PHP's +`$_SESSION superglobal <http://php.net/manual/en/reserved.variables.session.php>`_ +(if not, please read the content on that link). + +CodeIgniter gives access to its session data through the same means, as it +uses the session handlers' mechanism provided by PHP. Using session data is +as simple as manipulating (read, set and unset values) the ``$_SESSION`` +array. + +In addition, CodeIgniter also provides 2 special types of session data +that are further explained below: flashdata and tempdata. + +.. note:: In previous versions, regular session data in CodeIgniter was + referred to as 'userdata'. Have this in mind if that term is used + elsewhere in the manual. Most of it is written to explain how + the custom 'userdata' methods work. Retrieving Session Data ======================= -Any piece of information from the session array is available using the -following function:: +Any piece of information from the session array is available through the +``$_SESSION`` superglobal:: + + $_SESSION['item'] + +Or through the magic getter:: + + $this->session->item + +And for backwards compatibility, through the ``userdata()`` method:: $this->session->userdata('item'); -Where item is the array index corresponding to the item you wish to -fetch. For example, to fetch the session ID you will do this:: +Where item is the array key corresponding to the item you wish to fetch. +For example, to assign a previously stored 'name' item to the ``$name`` +variable, you will do this:: + + $name = $_SESSION['name']; + + // or: + + $name = $this->session->name + + // or: - $session_id = $this->session->userdata('session_id'); + $name = $this->session->userdata('name'); -.. note:: The function returns NULL if the item you are - trying to access does not exist. +.. note:: The ``userdata()`` method returns NULL if the item you are trying + to access does not exist. If you want to retrieve all of the existing userdata, you can simply -omit the item key parameter:: +omit the item key (magic getter only works for properties):: - $this->session->userdata(); + $_SESSION - /** - * Produces something similar to: - * - * Array - * ( - * [session_id] => 4a5a5dca22728fb0a84364eeb405b601 - * [ip_address] => 127.0.0.1 - * [user_agent] => Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; - * [last_activity] => 1303142623 - * ) - */ - -Adding Custom Session Data -========================== + // or: -A useful aspect of the session array is that you can add your own data -to it and it will be stored in the user's cookie. Why would you want to -do this? Here's one example: + $this->session->userdata(); + +Adding Session Data +=================== Let's say a particular user logs into your site. Once authenticated, you -could add their username and email address to the session, making -that data globally available to you without having to run a database -query when you need it. +could add their username and e-mail address to the session, making that +data globally available to you without having to run a database query when +you need it. -To add your data to the session array involves passing an array -containing your new data to this function:: +You can simply assign data to the ``$_SESSION`` array, as with any other +variable. Or as a property of ``$this->session``. + +Alternatively, the old method of assigning it as "userdata" is also +available. That however passing an array containing your new data to the +``set_userdata()`` method:: $this->session->set_userdata($array); -Where $array is an associative array containing your new data. Here's an -example:: +Where ``$array`` is an associative array containing your new data. Here's +an example:: $newdata = array( 'username' => 'johndoe', @@ -149,68 +199,108 @@ example:: $this->session->set_userdata($newdata); If you want to add userdata one value at a time, ``set_userdata()`` also -supports this syntax. - -:: +supports this syntax:: $this->session->set_userdata('some_name', 'some_value'); -If you want to verify that a userdata value exists, call ``has_userdata()``. +If you want to verify that a session value exists, simply check with +``isset()``:: -:: + // returns FALSE if the 'some_name' item doesn't exist or is NULL, + // TRUE otherwise: + isset($_SESSION['some_name']) + +Or you can call ``has_userdata()``:: $this->session->has_userdata('some_name'); Removing Session Data ===================== -Just as set_userdata() can be used to add information into a session, -unset_userdata() can be used to remove it, by passing the session key. -For example, if you wanted to remove 'some_name' from your session -information:: +Just as with any other variable, unsetting a value in ``$_SESSION`` can be +done through ``unset()``:: - $this->session->unset_userdata('some_name'); + unset($_SESSION['some_name']); + // or multiple values: -This function can also be passed an associative array of items to unset. + unset( + $_SESSION['some_name'], + $_SESSION['another_name'] + ); -:: +Also, just as ``set_userdata()`` can be used to add information to a +session, ``unset_userdata()`` can be used to remove it, by passing the +session key. For example, if you wanted to remove 'some_name' from your +session data array:: + + $this->session->unset_userdata('some_name'); - $array_items = array('username' => '', 'email' => ''); +This method also accepts an array of item keys to unset:: + + $array_items = array('username', 'email'); $this->session->unset_userdata($array_items); +.. note:: In previous versions, the ``unset_userdata()`` method used + to accept an associative array of ``key => 'dummy value'`` + pairs. This is no longer supported. Flashdata ========= CodeIgniter supports "flashdata", or session data that will only be -available for the next server request, and are then automatically -cleared. These can be very useful, and are typically used for -informational or status messages (for example: "record 2 deleted"). +available for the next request, and is then automatically cleared. + +This can be very useful, especially for one-time informational, error or +status messages (for example: "Record 2 deleted"). + +It should be noted that flashdata variables are regular session vars, +only marked in a specific way under the '__ci_vars' key (please don't touch +that one, you've been warned). + +To mark an existing item as "flashdata":: + + $this->session->mark_as_flash('item'); + +If you want to mark multiple items as flashdata, simply pass the keys as an +array:: -.. note:: Flash variables are prefaced with "flash\_" so avoid this prefix - in your own session names. + $this->session->mark_as_flash(array('item', 'item2')); To add flashdata:: - $this->session->set_flashdata('item', 'value'); + $_SESSION['item'] = 'value'; + $this->session->mark_as_flash('item'); + +Or alternatively, using the ``set_flashdata()`` method:: + $this->session->set_flashdata('item', 'value'); You can also pass an array to ``set_flashdata()``, in the same manner as ``set_userdata()``. -To read a flashdata variable:: +Reading flashdata variables is the same as reading regular session data +through ``$_SESSION``:: + + $_SESSION['item'] + +.. important:: The ``userdata()`` method will NOT return flashdata items. + +However, if you want to be sure that you're reading "flashdata" (and not +any other kind), you can also use the ``flashdata()`` method:: $this->session->flashdata('item'); -An array of all flashdata can be retrieved as follows:: +Or to get an array with all flashdata, simply omit the key parameter:: $this->session->flashdata(); +.. note:: The ``flashdata()`` method returns NULL if the item cannot be + found. If you find that you need to preserve a flashdata variable through an -additional request, you can do so using the ``keep_flashdata()`` function. +additional request, you can do so using the ``keep_flashdata()`` method. You can either pass a single item or an array of flashdata items to keep. :: @@ -218,8 +308,6 @@ You can either pass a single item or an array of flashdata items to keep. $this->session->keep_flashdata('item'); $this->session->keep_flashdata(array('item1', 'item2', 'item3')); -.. note:: The function will return NULL if the item cannot be found. - Tempdata ======== @@ -227,22 +315,56 @@ CodeIgniter also supports "tempdata", or session data with a specific expiration time. After the value expires, or the session expires or is deleted, the value is automatically removed. +Similarly to flashdata, tempdata variables are regular session vars that +are marked in a specific way under the '__ci_vars' key (again, don't touch +that one). + +To mark an existing item as "tempdata", simply pass its key and expiry time +(in seconds!) to the ``mark_as_temp()`` method:: + + // 'item' will be erased after 300 seconds + $this->session->mark_as_temp('item', 300); + +You can mark multiple items as tempdata in two ways, depending on whether +you want them all to have the same expiry time or not:: + + // Both 'item' and 'item2' will expire after 300 seconds + $this->session->mark_as_temp(array('item', 'item2'), 300); + + // 'item' will be erased after 300 seconds, while 'item2' + // will do so after only 240 seconds + $this->session->mark_as_temp(array( + 'item' => 300, + 'item2' => 240 + )); + To add tempdata:: - $expire = 300; // Expire in 5 minutes + $_SESSION['item'] = 'value'; + $this->session->mark_as_temp('item', 300); // Expire in 5 minutes - $this->session->set_tempdata('item', 'value', $expire); +Or alternatively, using the ``set_tempdata()`` method:: + + $this->session->set_tempdata('item', 'value', 300); You can also pass an array to ``set_tempdata()``:: $tempdata = array('newuser' => TRUE, 'message' => 'Thanks for joining!'); - $this->session->set_tempdata($tempdata, '', $expire); + $this->session->set_tempdata($tempdata, NULL, $expire); + +.. note:: If the expiration is omitted or set to 0, the default + time-to-live value of 300 seconds (or 5 minutes) will be used. -.. note:: If the expiration is omitted or set to 0, the default expiration of - 5 minutes will be used. +To read a tempdata variable, again you can just access it through the +``$_SESSION`` superglobal array:: -To read a tempdata variable:: + $_SESSION['item'] + +.. important:: The ``userdata()`` method will NOT return tempdata items. + +Or if you want to be sure that you're reading "flashdata" (and not any +other kind), you can also use the ``tempdata()`` method:: $this->session->tempdata('item'); @@ -250,453 +372,675 @@ And of course, if you want to retrieve all existing tempdata:: $this->session->tempdata(); -If you need to remove a tempdata value before it expires, -use ``unset_tempdata()``:: +.. note:: The ``tempdata()`` method returns NULL if the item cannot be + found. + +If you need to remove a tempdata value before it expires, you can directly +unset it from the ``$_SESSION`` array:: + + unset($_SESSION['item']); + +However, this won't remove the marker that makes this specific item to be +tempdata (it will be invalidated on the next HTTP request), so if you +intend to reuse that same key in the same request, you'd want to use +``unset_tempdata()``:: $this->session->unset_tempdata('item'); Destroying a Session ==================== -To clear the current session:: +To clear the current session (for example, during a logout), you may +simply use either PHP's `session_destroy() <http://php.net/session_destroy>`_ +function, or the ``sess_destroy()`` method. Both will work in exactly the +same way:: + + session_destroy(); + + // or $this->session->sess_destroy(); -.. note:: This function should be the last one called, and even flash - variables will no longer be available. If you only want some items - destroyed and not all, use ``unset_userdata()``. +.. note:: This must be the last session-related operation that you do + during the same request. All session data (including flashdata and + tempdata) will be destroyed permanently and functions will be + unusable during the same request after you destroy the session. + +Accessing session metadata +========================== + +In previous CodeIgniter versions, the session data array included 4 items +by default: 'session_id', 'ip_address', 'user_agent', 'last_activity'. + +This was due to the specifics of how sessions worked, but is now no longer +necessary with our new implementation. However, it may happen that your +application relied on these values, so here are alternative methods of +accessing them: + + - session_id: ``session_id()`` + - ip_address: ``$_SERVER['REMOTE_ADDR']`` + - user_agent: ``$this->input->user_agent()`` (unused by sessions) + - last_activity: Depends on the storage, no straightforward way. Sorry! Session Preferences =================== +CodeIgniter will usually make everything work out of the box. However, +Sessions are a very sensitive component of any application, so some +careful configuration must be done. Please take your time to consider +all of the options and their effects. + You'll find the following Session related preferences in your -*application/config/config.php* file: - -=========================== =============== =========================== ========================================================================== -Preference Default Options Description -=========================== =============== =========================== ========================================================================== -**sess_driver** cookie cookie/native/*custom* The initial session driver to load. -**sess_valid_drivers** cookie, native None Additional valid drivers which may be loaded. -**sess_cookie_name** ci_session None The name you want the session cookie saved as (data for Cookie driver or - session ID for Native driver). -**sess_expiration** 7200 None The number of seconds you would like the session to last. The default - value is 2 hours (7200 seconds). If you would like a non-expiring - session set the value to zero: 0 -**sess_expire_on_close** FALSE TRUE/FALSE (boolean) Whether to cause the session to expire automatically when the browser - window is closed. -**sess_encrypt_cookie** FALSE TRUE/FALSE (boolean) Whether to encrypt the session data (Cookie driver only). -**sess_use_database** FALSE TRUE/FALSE (boolean) Whether to save the session data to a database. You must create the - table before enabling this option (Cookie driver only). -**sess_table_name** ci_sessions Any valid SQL table name The name of the session database table (Cookie driver only). -**sess_time_to_update** 300 Time in seconds This options controls how often the session class will regenerate itself - and create a new session ID. Setting it to 0 will disable session - ID regeneartion. -**sess_match_ip** FALSE TRUE/FALSE (boolean) Whether to match the user's IP address when reading the session data. - Note that some ISPs dynamically changes the IP, so if you want a - non-expiring session you will likely set this to FALSE. -**sess_match_useragent** TRUE TRUE/FALSE (boolean) Whether to match the User Agent when reading the session data. -=========================== =============== =========================== ========================================================================== +**application/config/config.php** file: + +======================== =============== ======================================== ============================================================================================ +Preference Default Options Description +======================== =============== ======================================== ============================================================================================ +**sess_driver** files files/database/redis/memcached/*custom* The session storage driver to use. +**sess_cookie_name** ci_session [A-Za-z\_-] characters only The name used for the session cookie. +**sess_expiration** 7200 (2 hours) Time in seconds (integer) The number of seconds you would like the session to last. + If you would like a non-expiring session (until browser is closed) set the value to zero: 0 +**sess_save_path** NULL None Specifies the storage location, depends on the driver being used. +**sess_time_to_update** 300 Time in seconds (integer) This option controls how often the session class will regenerate itself and create a new + session ID. Setting it to 0 will disable session ID regeneration. +**sess_match_ip** FALSE TRUE/FALSE (boolean) Whether to validate the user's IP address when reading the session cookie. + Note that some ISPs dynamically changes the IP, so if you want a non-expiring session you + will likely set this to FALSE. +======================== =============== ======================================== ============================================================================================ + +.. note:: As a last resort, the Session library will try to fetch PHP's + session related INI settings, as well as legacy CI settings such as + 'sess_expire_on_close' when any of the above is not configured. + However, you should never rely on this behavior as it can cause + unexpected results or be changed in the future. Please configure + everything properly. In addition to the values above, the cookie and native drivers apply the following configuration values shared by the :doc:`Input <input>` and :doc:`Security <security>` classes: -=========================== =============== ========================================================================== -Preference Default Description -=========================== =============== ========================================================================== -**cookie_prefix** '' Set a cookie name prefix in order to avoid name collisions -**cookie_domain** '' The domain for which the session is applicable -**cookie_path** / The path to which the session is applicable -=========================== =============== ========================================================================== +================== =============== =========================================================================== +Preference Default Description +================== =============== =========================================================================== +**cookie_domain** '' The domain for which the session is applicable +**cookie_path** / The path to which the session is applicable +**cookie_secure** FALSE Whether to create the session cookie only on encrypted (HTTPS) connections +================== =============== =========================================================================== + +.. 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 + ignored. Session Drivers =============== -By default, the `Cookie Driver`_ is loaded when a session is initialized. -However, any valid driver may be selected with the $config['sess_driver'] -line in your config.php file. - -The session driver library comes with the cookie and native drivers -installed, and `Custom Drivers`_ may also be installed by the user. - -Typically, only one driver will be used at a time, but CodeIgniter does -support loading multiple drivers. If a specific valid driver is called, it -will be automatically loaded. Or, an additional driver may be explicitly -loaded by ``calling load_driver()``:: - - $this->session->load_driver('native'); - -The Session library keeps track of the most recently selected driver to call -for driver methods. Normally, session class methods are called directly on -the parent class, as illustrated above. However, any methods called through -a specific driver will select that driver before invoking the parent method. - -So, alternation between multiple drivers can be achieved by specifying which -driver to use for each call:: - - $this->session->native->set_userdata('foo', 'bar'); - - $this->session->cookie->userdata('foo'); - - $this->session->native->unset_userdata('foo'); - -Notice in the previous example that the *native* userdata value 'foo' -would be set to 'bar', which would NOT be returned by the call for -the *cookie* userdata 'foo', nor would the *cookie* value be unset by -the call to unset the *native* 'foo' value. The drivers maintain independent -sets of values, regardless of key names. - -A specific driver may also be explicitly selected for use by pursuant -methods with the ``select_driver()`` call:: - - $this->session->select_driver('native'); - - $this->session->userdata('item'); // Uses the native driver - -Cookie Driver -------------- - -The Cookie driver stores session information for each user as serialized -(and optionally encrypted) data in a cookie. It can also store the session -data in a database table for added security, as this permits the session ID -in the user's cookie to be matched against the stored session ID. By default -only the cookie is saved. If you choose to use the database option you'll -need to create the session table as indicated below. - -If you have the encryption option enabled, the serialized array will be -encrypted before being stored in the cookie, making the data highly -secure and impervious to being read or altered by someone. More info -regarding encryption can be :doc:`found here <encryption>`, although -the Session class will take care of initializing and encrypting the data -automatically. - -.. note:: Even if you are not using encrypted sessions, you must set - an :doc:`encryption key <./encryption>` in your config file which is used - to aid in preventing session data manipulation. - -.. note:: Cookies can only hold 4KB of data, so be careful not to exceed - the capacity. The encryption process in particular produces a longer - data string than the original so keep careful track of how much data you - are storing. - -Saving Session Data to a Database -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -While the session data array stored in the user's cookie contains a -Session ID, unless you store session data in a database there is no way -to validate it. For some applications that require little or no -security, session ID validation may not be needed, but if your -application requires security, validation is mandatory. Otherwise, an -old session could be restored by a user modifying their cookies. - -When session data is available in a database, every time a valid session -is found in the user's cookie, a database query is performed to match -it. If the session ID does not match, the session is destroyed. Session -IDs can never be updated, they can only be generated when a new session -is created. - -In order to store sessions, you must first create a database table for -this purpose. Here is the basic prototype (for MySQL) required by the -session class:: - - CREATE TABLE IF NOT EXISTS `ci_sessions` ( - session_id varchar(40) DEFAULT '0' NOT NULL, - ip_address varchar(45) DEFAULT '0' NOT NULL, - user_agent varchar(120) NOT NULL, - last_activity int(10) unsigned DEFAULT 0 NOT NULL, - user_data text NOT NULL, - PRIMARY KEY (session_id, ip_address, user_agent), - KEY `last_activity_idx` (`last_activity`) +As already mentioned, the Session library comes with 4 drivers, or storage +engines, that you can use: + + - files + - database + - redis + - memcached + +By default, the `Files Driver`_ will be used when a session is initialized, +because it is the most safe choice and is expected to work everywhere +(virtually every environment has a file system). + +However, any other driver may be selected via the ``$config['sess_driver']`` +line in your **application/config/config.php** file, if you chose to do so. +Have it in mind though, every driver has different caveats, so be sure to +get yourself familiar with them (below) before you make that choice. + +In addition, you may also create and use `Custom Drivers`_, if the ones +provided by default don't satisfy your use case. + +.. note:: In previous CodeIgniter versions, a different, "cookie driver" + was the only option and we have received negative feedback on not + providing that option. While we do listen to feedback from the + community, we want to warn you that it was dropped because it is + **unsafe** and we advise you NOT to try to replicate it via a + custom driver. + +Files Driver +------------ + +The 'files' driver uses your file system for storing session data. + +It can safely be said that it works exactly like PHP's own default session +implementation, but in case this is an important detail for you, have it +mind that it is in fact not the same code and it has some limitations +(and advantages). + +To be more specific, it doesn't support PHP's `directory level and mode +formats used in session.save_path +<http://php.net/manual/en/session.configuration.php#ini.session.save-path>`_, +and it has most of the options hard-coded for safety. Instead, only +absolute paths are supported for ``$config['sess_save_path']``. + +Another important thing that you should know, is to make sure that you +don't use a publicly-readable or shared directory for storing your session +files. Make sure that *only you* have access to see the contents of your +chosen *sess_save_path* directory. Otherwise, anybody who can do that, can +also steal any of the current sessions (also known as "session fixation" +attack). + +On UNIX-like operating systems, this is usually achieved by setting the +0700 mode permissions on that directory via the `chmod` command, which +allows only the directory's owner to perform read and write operations on +it. But be careful because the system user *running* the script is usually +not your own, but something like 'www-data' instead, so only setting those +permissions will probable break your application. + +Instead, you should do something like this, depending on your environment +:: + + mkdir /<path to your application directory>/sessions/ + chmod 0700 /<path to your application directory>/sessions/ + chown www-data /<path to your application directory>/sessions/ + +Bonus Tip +^^^^^^^^^ + +Some of you will probably opt to choose another session driver because +file storage is usually slower. This is only half true. + +A very basic test will probably trick you into believing that an SQL +database is faster, but in 99% of the cases, this is only true while you +only have a few current sessions. As the sessions count and server loads +increase - which is the time when it matters - the file system will +consistently outperform almost all relational database setups. + +In addition, if performance is your only concern, you may want to look +into using `tmpfs <http://eddmann.com/posts/storing-php-sessions-file-caches-in-memory-using-tmpfs/>`_, +(warning: external resource), which can make your sessions blazing fast. + +Database Driver +--------------- + +The 'database' driver uses a relational database such as MySQL or +PostgreSQL to store sessions. This is a popular choice among many users, +because it allows the developer easy access to the session data within +an application - it is just another table in your database. + +However, there are some conditions that must be met: + + - Only your **default** database connection (or the one that you access + as ``$this->db`` from your controllers) can be used. + - You can NOT use a persistent connection. + - You must have the :doc:`Query Builder </database/query_builder>` + enabled. + +In order to use the 'database' session driver, you must also create this +table that we already mentioned and then set it as your +``$config['sess_save_path']`` value. +For example, if you would like to use 'ci_sessions' as your table name, +you would do this:: + + $config['sess_driver'] = 'database'; + $config['sess_save_path'] = 'ci_sessions'; + +.. note:: If you've upgraded from a previous version of CodeIgniter and + you don't have 'sess_save_path' configured, then the Session + library will look for the old 'sess_table_name' setting and use + it instead. Please don't rely on this behavior as it will get + removed in the future. + +And then of course, create the database table ... + +For MySQL:: + + CREATE TABLE IF NOT EXISTS `ci_sessions` ( + `id` varchar(40) NOT NULL, + `ip_address` varchar(45) NOT NULL, + `timestamp` int(10) unsigned DEFAULT 0 NOT NULL, + `data` blob DEFAULT '' NOT NULL, + PRIMARY KEY (id), + KEY `ci_sessions_timestamp` (`timestamp`) ); -Or if you're using PostgreSQL:: +For PostgreSQL:: - CREATE TABLE ci_sessions ( - session_id varchar(40) DEFAULT '0' NOT NULL, - ip_address varchar(45) DEFAULT '0' NOT NULL, - user_agent varchar(120) NOT NULL, - last_activity bigint DEFAULT 0 NOT NULL, - user_data text NOT NULL, - PRIMARY KEY (session_id) + CREATE TABLE "ci_sessions" ( + "id" varchar(40) NOT NULL, + "ip_address" varchar(45) NOT NULL, + "timestamp" bigint DEFAULT 0 NOT NULL, + "data" text DEFAULT '' NOT NULL, + PRIMARY KEY ("id") ); - CREATE INDEX last_activity_idx ON ci_sessions(last_activity); + 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:: + + // 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 + platforms. Using sessions without locks can cause all sorts of + problems, especially with heavy usage of AJAX, and we will not + support such cases. Use ``session_write_close()`` after you've + done processing session data if you're having performance + issues. + +Redis Driver +------------ + +Redis is a storage engine typically used for caching and popular because +of its high performance, which is also probably your reason to use the +'redis' session driver. + +The downside is that it is not as ubiquitous as relational databases and +requires the `phpredis <https://github.com/nicolasff/phpredis>`_ PHP +extension to be installed on your system, and that one doesn't come +bundled with PHP. +Chances are, you're only be using the 'redis' driver only if you're already +both familiar with Redis and using it for other purposes. + +Just as with the 'files' and 'database' drivers, you must also configure +the storage location for your sessions via the +``$config['sess_save_path']`` setting. +The format here is a bit different and complicated at the same time. It is +best explained by the *phpredis* extension's README file, so we'll simply +link you to it: + + https://github.com/phpredis/phpredis#php-session-handler + +.. warning:: CodeIgniter's Session library does NOT use the actual 'redis' + ``session.save_handler``. Take note **only** of the path format in + the link above. + +For the most common case however, a simple ``host:port`` pair should be +sufficient:: + + $config['sess_driver'] = 'redis'; + $config['sess_save_path'] = 'tcp://localhost:6379'; -.. note:: By default the table is called ci_sessions, but you can name - it anything you want as long as you update the - *application/config/config.php* file so that it contains the name - you have chosen. Once you have created your database table you - can enable the database option in your config.php file as follows:: +Memcached Driver +---------------- - $config['sess_use_database'] = TRUE; +The 'memcached' driver is very similar to the 'redis' one in all of its +properties, except perhaps for availability, because PHP's `Memcached +<http://php.net/memcached>`_ extension is distributed via PECL and some +Linux distrubutions make it available as an easy to install package. - Once enabled, the Session class will store session data in the DB. +Other than that, and without any intentional bias towards Redis, there's +not much different to be said about Memcached - it is also a popular +product that is usually used for caching and famed for its speed. - Make sure you've specified the table name in your config file as well:: +However, it is worth noting that the only guarantee given by Memcached +is that setting value X to expire after Y seconds will result in it being +deleted after Y seconds have passed (but not necessarily that it won't +expire earlier than that time). This happens very rarely, but should be +considered as it may result in loss of sessions. - $config['sess_table_name'] = 'ci_sessions'; +The ``$config['sess_save_path']`` format is fairly straightforward here, +being just a ``host:port`` pair:: -.. note:: The Cookie driver has built-in garbage collection which clears - out expired sessions so you do not need to write your own routine to do - it. + $config['sess_driver'] = 'memcached'; + $config['sess_save_path'] = 'localhost:11211'; -Native Driver -------------- +Bonus Tip +^^^^^^^^^ -The Native driver relies on native PHP sessions to store data in the -$_SESSION superglobal array. All stored values continue to be available -through $_SESSION, but flash- and temp- data items carry special prefixes. +Multi-server configuration with an optional *weight* parameter as the +third colon-separated (``:weight``) value is also supported, but we have +to note that we haven't tested if that is reliable. + +If you want to experiment with this feature (on your own risk), simply +separate the multiple server paths with commas:: + + // localhost will be given higher priority (5) here, + // compared to 192.0.2.1 with a weight of 1. + $config['sess_save_path'] = 'localhost:11211:5,192.0.2.1:11211:1'; Custom Drivers -------------- -You may also :doc:`create your own <../general/creating_drivers>` custom -session drivers. A session driver basically manages an array of name/value -pairs with some sort of storage mechanism. +You may also create your own, custom session drivers. However, have it in +mind that this is typically not an easy task, as it takes a lot of +knowledge to do it properly. + +You need to know not only how sessions work in general, but also how they +work specifically in PHP, how the underlying storage mechanism works, how +to handle concurrency, avoid deadlocks (but NOT through lack of locks) and +last but not least - how to handle the potential security issues, which +is far from trivial. + +Long story short - if you don't know how to do that already in raw PHP, +you shouldn't be trying to do it within CodeIgniter either. You've been +warned. + +If you only want to add some extra functionality to your sessions, just +extend the base Session class, which is a lot more easier. Read the +:doc:`Creating Libraries <../general/creating_libraries>` article to +learn how to do that. + +Now, to the point - there are three general rules that you must follow +when creating a session driver for CodeIgniter: + + - Put your driver's file under **application/libraries/Session/drivers/** + and follow the naming conventions used by the Session class. + + For example, if you were to create a 'dummy' driver, you would have + a ``Session_dummy_driver`` class name, that is declared in + *application/libraries/Session/drivers/Session_dummy_driver.php*. + + - Extend the ``CI_Session_driver`` class. + + This is just a basic class with a few internal helper methods. It is + also extendable like any other library, if you really need to do that, + but we are not going to explain how ... if you're familiar with how + class extensions/overrides work in CI, then you already know how to do + it. If not, well, you shouldn't be doing it in the first place. -To make a new driver, extend CI_Session_driver. Overload the ``initialize()`` -method and read or create session data. Then implement a save handler to -write changed data to storage (sess_save), a destroy handler to remove -deleted data (sess_destroy), a regenerate handler to make a new session ID -(sess_regenerate), and an access handler to expose the data (get_userdata). -Your initial class might look like:: - class CI_Session_custom extends CI_Session_driver { + - Implement the `SessionHandlerInterface + <http://php.net/sessionhandlerinterface>`_ interface. + + .. note:: You may notice that ``SessionHandlerInterface`` is provided + by PHP since version 5.4.0. CodeIgniter will automatically declare + the same interface if you're running an older PHP version. + + The link will explain why and how. + +So, based on our 'dummy' driver example above, you'd end up with something +like this:: + + // application/libraries/Session/drivers/Session_dummy_driver.php: + + class CI_Session_dummy_driver extends CI_Session_driver implements SessionHandlerInterface + { + + public function __construct(&$params) + { + // DO NOT forget this + parent::__construct($params); + + // Configuration & other initializations + } + + public function open($save_path, $name) + { + // Initialize storage mechanism (connection) + } - protected function initialize() + public function read($session_id) { - // Read existing session data or create a new one + // Read session data (if exists), acquire locks } - public function sess_save() + public function write($session_id, $session_data) { - // Save current data to storage + // Create / update session data (it might not exist!) } - public function sess_destroy() + public function close() { - // Destroy the current session and clean up storage + // Free locks, close connections / streams / etc. } - public function sess_regenerate() + public function destroy($session_id) { - // Create new session ID + // Call close() method & destroy data for current session (order may differ) } - public function &get_userdata() + public function gc($maxlifetime) { - // Return a reference to your userdata array + // Erase data for expired sessions } } -Notice that ``get_userdata()`` returns a reference so the parent library is -accessing the same array the driver object is using. This saves memory -and avoids synchronization issues during usage. +If you've done everything properly, you can now set your *sess_driver* +configuration value to 'dummy' and use your own driver. Congratulations! -Put your driver in the libraries/Session/drivers folder anywhere in your -package paths. This includes the application directory, the system directory, -or any path you add with ``$CI->load->add_package_path()``. Your driver must be -named CI_Session_<name>, and your filename must be Session_<name>.php, -preferably also capitalized, such as:: +*************** +Class Reference +*************** - CI_Session_foo in libraries/Session/drivers/Session_foo.php +.. php:class:: CI_Session -Then specify the driver by setting 'sess_driver' in your config.php file or as a -parameter when loading the CI_Session object:: + .. php:method:: userdata([$key = NULL]) - $config['sess_driver'] = 'foo'; + :param mixed $key: Session item key or NULL + :returns: Value of the specified item key, or an array of all userdata + :rtype: mixed -OR:: + Gets the value for a specific ``$_SESSION`` item, or an + array of all "userdata" items if not key was specified. + + .. note:: This is a legacy method kept only for backwards + compatibility with older applications. You should + directly access ``$_SESSION`` instead. - $CI->load->driver('session', array('sess_driver' => 'foo')); + .. php:method:: all_userdata() -The driver specified by 'sess_driver' is automatically included as a valid -driver. However, if you want to make a custom driver available as an option -without making it the initially loaded driver, set 'sess_valid_drivers' in -your config.php file to an array including your driver name:: + :returns: An array of all userdata + :rtype: array - $config['sess_valid_drivers'] = array('sess_driver'); + Returns an array containing all "userdata" items. -*************** -Class Reference -*************** + .. note:: This method is DEPRECATED. Use ``userdata()`` + with no parameters instead. -.. class:: CI_Session + .. php:method:: &get_usedata() - .. method:: load_driver($driver) + :returns: A reference to ``$_SESSION`` + :rtype: array - :param string $driver: Driver name - :returns: Instance of currently loaded session driver - :rtype: mixed + Returns a reference to the ``$_SESSION`` array. - Loads a session storage driver + .. note:: This is a legacy method kept only for backwards + compatibility with older applications. - .. method:: select_driver($driver) + .. php:method:: has_userdata($key) - :param string $driver: Driver name - :rtype: void + :param string $key: Session item key + :returns: TRUE if the specified key exists, FALSE if not + :rtype: bool + + Checks if an item exists in ``$_SESSION``. - Selects default session storage driver. + .. note:: This is a legacy method kept only for backwards + compatibility with older applications. It is just + an alias for ``isset($_SESSION[$key])`` - please + use that instead. - .. method:: sess_destroy() + .. php:method:: set_userdata($data[, $value = NULL]) + :param mixed $data: An array of key/value pairs to set as session data, or the key for a single item + :param mixed $value: The value to set for a specific session item, if $data is a key :rtype: void - Destroys current session + Assigns data to the ``$_SESSION`` superglobal. - .. note:: This method should be the last one called, and even flash - variables will no longer be available after it is used. - If you only want some items destroyed and not all, use - ``unset_userdata()``. + .. note:: This is a legacy method kept only for backwards + compatibility with older applications. - .. method:: sess_regenerate([$destroy = FALSE]) + .. php:method:: unset_userdata($key) - :param bool $destroy: Whether to destroy session data + :param mixed $key: Key for the session data item to unset, or an array of multiple keys :rtype: void - Regenerate the current session data. - - .. method:: userdata([$item = NULL]) + Unsets the specified key(s) from the ``$_SESSION`` + superglobal. - :param string $item: Session item name - :returns: Item value if found, NULL if not or an array of all userdata if $item parameter is not used - :rtype: mixed + .. note:: This is a legacy method kept only for backwards + compatibility with older applications. It is just + an alias for ``unset($_SESSION[$key])`` - please + use that instead. - If no parameter is passed, it will return an associative array of all existing userdata. + .. php:method:: mark_as_flash($key) - Otherwise returns a string containing the value of the passed item or NULL if the item is not found. - Example:: + :param mixed $key: Key to mark as flashdata, or an array of multiple keys + :returns: TRUE on success, FALSE on failure + :rtype: bool - $this->session->userdata('user'); - //returns example@example.com considering the set_userdata example. + Marks a ``$_SESSION`` item key (or multiple ones) as + "flashdata". - .. method:: all_userdata() + .. php:method:: get_flash_keys() - :returns: An array of all userdata + :returns: Array containing the keys of all "flashdata" items. :rtype: array - Returns an array with all of the session userdata items. + Gets a list of all ``$_SESSION`` that have been marked as + "flashdata". - .. note:: This method is DEPRECATED. Use ``userdata()`` with no parameters instead. + .. php:method:: umark_flash($key) - .. method:: &get_userdata() + :param mixed $key: Key to be un-marked as flashdata, or an array of multiple keys + :rtype: void - :returns: A reference to the userdata array - :rtype: &array + Unmarks a ``$_SESSION`` item key (or multiple ones) as + "flashdata". - Returns a reference to the userdata array. + .. php:method:: flashdata([$key = NULL]) - .. method:: set_userdata($newdata[, $newval = '']) + :param mixed $key: Flashdata item key or NULL + :returns: Value of the specified item key, or an array of all flashdata + :rtype: mixed - :param mixed $newdata: Item name or array of items - :param mixed $newval: Item value or empty string (not required if $newdata is array) - :rtype: void + Gets the value for a specific ``$_SESSION`` item that has + been marked as "flashdata", or an array of all "flashdata" + items if no key was specified. + + .. note:: This is a legacy method kept only for backwards + compatibility with older applications. You should + directly access ``$_SESSION`` instead. - Sets items into session example usages:: + .. php:method:: keep_flashdata($key) - $this->session->set_userdata('user', 'example@example.com'); - // adds item user with value example@example.com to the session + :param mixed $key: Flashdata key to keep, or an array of multiple keys + :returns: TRUE on success, FALSE on failure + :rtype: bool - $this->session->set_userdata(array('user'=>'example@example.com')); - // does the same as the above example - adds item user with value example@example.com to the session + Retains the specified session data key(s) as "flashdata" + through the next request. - .. method:: unset_userdata($item) + .. note:: This is a legacy method kept only for backwards + compatibility with older applications. It is just + an alias for the ``mark_as_flash()`` method. - :param mixed $item: Item name or an array containing multiple items - :rtype: void + .. php:method:: set_flashdata($data[, $value = NULL]) - Unsets previously set items from the session. Example:: + :param mixed $data: An array of key/value pairs to set as flashdata, or the key for a single item + :param mixed $value: The value to set for a specific session item, if $data is a key + :rtype: void - $this->session->unset_userdata('user'); - //unsets 'user' from session data. + Assigns data to the ``$_SESSION`` superglobal and marks it + as "flashdata". - $this->session->unset_userdata(array('user', 'useremail')); - //unsets both 'user' and 'useremail' from the session data. + .. note:: This is a legacy method kept only for backwards + compatibility with older applications. - .. method:: has_userdata($item) + .. php:method:: mark_as_temp($key[, $ttl = 300]) - :param string $item: Item name - :returns: TRUE if item exists, FALSE if not + :param mixed $key: Key to mark as tempdata, or an array of multiple keys + :param int $ttl: Time-to-live value for the tempdata, in seconds + :returns: TRUE on success, FALSE on failure :rtype: bool - Checks if an item exists in the session. - - .. method:: flashdata([$item = NULL]) + Marks a ``$_SESSION`` item key (or multiple ones) as + "tempdata". - :param string $item: Flashdata item name - :returns: Item value if found, NULL if not or an array of all flashdata if $item parameter is not used - :rtype: mixed + .. php:method:: get_temp_keys() - If no parameter is passed, it will return an associative array of all existing flashdata. + :returns: Array containing the keys of all "tempdata" items. + :rtype: array - Otherwise returns a string containing the value of the passed item or NULL if the item is not found. - Example:: + Gets a list of all ``$_SESSION`` that have been marked as + "tempdata". - $this->session->flashdata('message'); - //returns 'Test message.' considering the set_flashdata example. + .. php:method:: umark_temp($key) - .. method:: set_flashdata($newdata[, $newval = '']) + :param mixed $key: Key to be un-marked as tempdata, or an array of multiple keys + :rtype: void - :param mixed $newdata: Item name or an array of items - :param mixed $newval: Item value or empty string (not required if $newdata is array) - :rtype: void + Unmarks a ``$_SESSION`` item key (or multiple ones) as + "tempdata". - Sets items into session flashdata example usages:: + .. php:method:: tempdata([$key = NULL]) - $this->session->set_flashdata('message', 'Test message.'); - // adds item 'message' with value 'Test message.' to the session flashdata + :param mixed $key: Tempdata item key or NULL + :returns: Value of the specified item key, or an array of all tempdata + :rtype: mixed - $this->session->set_flashdata(array('message'=>'Test message.')); - // does the same as the above example - adds item 'message' with value 'Test message.' - to the session flashdata + Gets the value for a specific ``$_SESSION`` item that has + been marked as "tempdata", or an array of all "tempdata" + items if no key was specified. + + .. note:: This is a legacy method kept only for backwards + compatibility with older applications. You should + directly access ``$_SESSION`` instead. - .. method:: keep_flashdata($item) + .. php:method:: set_tempdata($data[, $value = NULL]) - :param mixed $item: Item name or an array containing multiple flashdata items + :param mixed $data: An array of key/value pairs to set as tempdata, or the key for a single item + :param mixed $value: The value to set for a specific session item, if $data is a key + :param int $ttl: Time-to-live value for the tempdata item(s), in seconds :rtype: void - Keeps items into flashdata for one more request. + Assigns data to the ``$_SESSION`` superglobal and marks it + as "tempdata". - .. method:: tempdata([$item = NULL]) + .. note:: This is a legacy method kept only for backwards + compatibility with older applications. - :param string $item: Tempdata item name - :returns: Item value if found, NULL if not or an array of all tempdata if $item parameter is not used - :rtype: mixed + .. php:method:: sess_regenerate([$destroy = FALSE]) - If no parameter is passed, it will return an associative array of all existing tempdata. + :param bool $destroy: Whether to destroy session data + :rtype: void - Otherwise returns a string containing the value of the passed item or NULL if the item is not found. - Example:: + Regenerate session ID, optionally destroying the current + session's data. - $this->session->tempdata('message'); - //returns 'Test message.' considering the set_tempdata example. + .. note:: This method is just an alias for PHP's native + `session_regenerate_id() + <http://php.net/session_regenerate_id>`_ function. - .. method:: set_tempdata($newdata[, $newval = ''[, $expire = 0]]) + .. php:method:: sess_destroy() - :param mixed $newdata: Item name or array containing multiple items - :param string $newval: Item value or empty string (not required if $newdata is array) - :param int $expire: Lifetime in seconds (0 for default) :rtype: void - Sets items into session tempdata example:: + Destroys the current session. - $this->session->set_tempdata('message', 'Test message.', '60'); - // adds item 'message' with value 'Test message.' to the session tempdata for 60 seconds + .. note:: This must be the *last* session-related function + that you call. All session data will be lost after + you do that. - $this->session->set_tempdata(array('message'=>'Test message.')); - // does the same as the above example - adds item 'message' with value 'Test message.' - to the session tempdata for the default value of + .. note:: This method is just an alias for PHP's native + `session_destroy() + <http://php.net/session_destroy>`_ function. - .. method:: unset_tempdata($item) + .. php:method:: __get($key) - :param mixed $item: Item name or an array containing multiple items - :rtype: void + :param string $key: Session item key + :returns: The requested session data item, or NULL if it doesn't exist + :rtype: mixed + + A magic method that allows you to use + ``$this->session->item`` instead of ``$_SESSION['item']``, + if that's what you prefer. + + It will also return the session ID by calling + ``session_id()`` if you try to access + ``$this->session->session_id``. + + .. php:method:: __set($key, $value) + + :param string $key: Session item key + :param mixed $value: Value to assign to the session item key + :returns: void - Unsets previously set items from tempdata. Example:: + A magic method that allows you to assign items to + ``$_SESSION`` by accessing them as ``$this->session`` + properties:: - $this->session->unset_tempdata('user'); - //unsets 'user' from tempdata. + $this->session->foo = 'bar'; - $this->session->unset_tempdata(array('user', 'useremail')); - //unsets both 'user' and 'useremail' from the tempdata.
\ No newline at end of file + // Results in: + // $_SESSION['foo'] = 'bar';
\ No newline at end of file diff --git a/user_guide_src/source/libraries/table.rst b/user_guide_src/source/libraries/table.rst index bb001e84c..91ae1ae8d 100644 --- a/user_guide_src/source/libraries/table.rst +++ b/user_guide_src/source/libraries/table.rst @@ -143,7 +143,7 @@ You can also set defaults for these in a config file. Class Reference *************** -.. class:: CI_Table +.. php:class:: CI_Table .. attribute:: $function = NULL @@ -162,7 +162,7 @@ Class Reference <td>Fred</td><td><strong>Blue</strong></td><td>Small</td> - .. method:: generate([$table_data = NULL]) + .. php:method:: generate([$table_data = NULL]) :param mixed $table_data: Data to populate the table rows with :returns: HTML table @@ -170,7 +170,7 @@ Class Reference Returns a string containing the generated table. Accepts an optional parameter which can be an array or a database result object. - .. method:: set_caption($caption) + .. php:method:: set_caption($caption) :param string $caption: Table caption :returns: CI_Table instance (method chaining) @@ -181,7 +181,7 @@ Class Reference $this->table->set_caption('Colors'); - .. method:: set_heading([$args = array()[, ...]]) + .. php:method:: set_heading([$args = array()[, ...]]) :param mixed $args: An array or multiple strings containing the table column titles :returns: CI_Table instance (method chaining) @@ -193,7 +193,7 @@ Class Reference $this->table->set_heading(array('Name', 'Color', 'Size')); - .. method:: add_row([$args = array()[, ...]]) + .. php:method:: add_row([$args = array()[, ...]]) :param mixed $args: An array or multiple strings containing the row values :returns: CI_Table instance (method chaining) @@ -214,7 +214,7 @@ Class Reference // generates // <td class='highlight' colspan='2'>Blue</td><td>Red</td><td>Green</td> - .. method:: make_columns([$array = array()[, $col_limit = 0]]) + .. php:method:: make_columns([$array = array()[, $col_limit = 0]]) :param array $array: An array containing multiple rows' data :param int $col_limit: Count of columns in the table @@ -244,7 +244,7 @@ Class Reference </table> - .. method:: set_template($template) + .. php:method:: set_template($template) :param array $template: An associative array containing template values :returns: TRUE on success, FALSE on failure @@ -259,7 +259,7 @@ Class Reference $this->table->set_template($template); - .. method:: set_empty($value) + .. php:method:: set_empty($value) :param mixed $value: Value to put in empty cells :returns: CI_Table instance (method chaining) @@ -270,7 +270,7 @@ Class Reference $this->table->set_empty(" "); - .. method:: clear() + .. php:method:: clear() :returns: CI_Table instance (method chaining) :rtype: CI_Table diff --git a/user_guide_src/source/libraries/trackback.rst b/user_guide_src/source/libraries/trackback.rst index 22859a13d..4e0cb5541 100644 --- a/user_guide_src/source/libraries/trackback.rst +++ b/user_guide_src/source/libraries/trackback.rst @@ -67,7 +67,7 @@ Description of array data: - **blog_name** - The name of your weblog. - **charset** - The character encoding your weblog is written in. If omitted, UTF-8 will be used. -.. note:: the Trackback class will automatically send only the first 500 characters of your +.. note:: The Trackback class will automatically send only the first 500 characters of your entry. It will also strip all HTML. The Trackback sending method returns TRUE/FALSE (boolean) on success @@ -213,7 +213,7 @@ message using:: Class Reference *************** -.. class:: CI_Trackback +.. php:class:: CI_Trackback .. attribute:: $data = array('url' => '', 'title' => '', 'excerpt' => '', 'blog_name' => '', 'charset' => '') @@ -223,7 +223,7 @@ Class Reference Whether to convert high ASCII and MS Word characters to HTML entities. - .. method:: send($tb_data) + .. php:method:: send($tb_data) :param array $tb_data: Trackback data :returns: TRUE on success, FALSE on failure @@ -231,7 +231,7 @@ Class Reference Send trackback. - .. method:: receive() + .. php:method:: receive() :returns: TRUE on success, FALSE on failure :rtype: bool @@ -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. - .. method:: send_error([$message = 'Incomplete information') + .. php:method:: send_error([$message = 'Incomplete information') :param string $message: Error message :rtype: void @@ -248,7 +248,7 @@ Class Reference .. note:: This method will terminate script execution. - .. method:: send_success() + .. php:method:: send_success() :rtype: void @@ -256,7 +256,7 @@ Class Reference .. note:: This method will terminate script execution. - .. method:: data($item) + .. php:method:: data($item) :param string $item: Data key :returns: Data value or empty string if not found @@ -264,7 +264,7 @@ Class Reference Returns a single item from the reponse data array. - .. method:: process($url, $data) + .. php:method:: process($url, $data) :param string $url: Target url :param string $data: Raw POST data @@ -273,7 +273,7 @@ Class Reference Opens a socket connection and passes the data to the server, returning TRUE on success and FALSE on failure. - .. method:: extract_urls($urls) + .. php:method:: extract_urls($urls) :param string $urls: Comma-separated URL list :returns: Array of URLs @@ -281,14 +281,14 @@ Class Reference This method lets multiple trackbacks to be sent. It takes a string of URLs (separated by comma or space) and puts each URL into an array. - .. method:: validate_url(&$url) + .. php:method:: validate_url(&$url) :param string $url: Trackback URL :rtype: void Simply adds the *http://* prefix it it's not already present in the URL. - .. method:: get_id($url) + .. php:method:: get_id($url) :param string $url: Trackback URL :returns: URL ID or FALSE on failure @@ -296,7 +296,7 @@ Class Reference Find and return a trackback URL's ID or FALSE on failure. - .. method:: convert_xml($str) + .. php:method:: convert_xml($str) :param string $str: Input string :returns: Converted string @@ -304,7 +304,7 @@ Class Reference Converts reserved XML characters to entities. - .. method:: limit_characters($str[, $n = 500[, $end_char = '…']]) + .. php:method:: limit_characters($str[, $n = 500[, $end_char = '…']]) :param string $str: Input string :param int $n: Max characters number @@ -314,7 +314,7 @@ Class Reference Limits the string based on the character count. Will preserve complete words. - .. method:: convert_ascii($str) + .. php:method:: convert_ascii($str) :param string $str: Input string :returns: Converted string @@ -322,14 +322,14 @@ Class Reference Converts high ASCII text and MS Word special characterss to HTML entities. - .. method:: set_error($msg) + .. php:method:: set_error($msg) :param string $msg: Error message :rtype: void Set an log an error message. - .. method:: display_errors([$open = '<p>'[, $close = '</p>']]) + .. php:method:: display_errors([$open = '<p>'[, $close = '</p>']]) :param string $open: Open tag :param string $close: Close tag diff --git a/user_guide_src/source/libraries/typography.rst b/user_guide_src/source/libraries/typography.rst index 65fea9d8e..1d1e4f3c4 100644 --- a/user_guide_src/source/libraries/typography.rst +++ b/user_guide_src/source/libraries/typography.rst @@ -31,7 +31,7 @@ Once loaded, the Typography library object will be available using:: Class Reference *************** -.. class:: CI_Typography +.. php:class:: CI_Typography .. attribute:: $protect_braced_quotes = FALSE @@ -75,7 +75,7 @@ Class Reference .. note:: Typographic formatting can be processor intensive, particularly if you have a lot of content being formatted. If you choose to use this method you may want to consider :doc:`caching <../general/caching>` your pages. - .. method:: format_characters($str) + .. php:method:: format_characters($str) :param string $str: Input string :returns: Formatted string @@ -93,7 +93,7 @@ Class Reference $string = $this->typography->format_characters($string); - .. method:: nl2br_except_pre($str) + .. php:method:: nl2br_except_pre($str) :param string $str: Input string :returns: Formatted string diff --git a/user_guide_src/source/libraries/unit_testing.rst b/user_guide_src/source/libraries/unit_testing.rst index 7e91a7b95..026781cb7 100644 --- a/user_guide_src/source/libraries/unit_testing.rst +++ b/user_guide_src/source/libraries/unit_testing.rst @@ -177,9 +177,9 @@ template. Note the required pseudo-variables:: Class Reference *************** -.. class:: CI_Unit_test +.. php:class:: CI_Unit_test - .. method:: set_test_items($items) + .. php:method:: set_test_items($items) :param array $items: List of visible test items :returns: void @@ -195,7 +195,7 @@ Class Reference - line - notes - .. method:: run($test[, $expected = TRUE[, $test_name = 'undefined'[, $notes = '']]]) + .. php:method:: run($test[, $expected = TRUE[, $test_name = 'undefined'[, $notes = '']]]) :param mixed $test: Test data :param mixed $expected: Expected result @@ -206,7 +206,7 @@ Class Reference Runs unit tests. - .. method:: report([$result = array()]) + .. php:method:: report([$result = array()]) :param array $result: Array containing tests results :returns: Test report @@ -214,21 +214,21 @@ Class Reference Generates a report about already complete tests. - .. method:: use_strict([$state = TRUE]) + .. php:method:: use_strict([$state = TRUE]) :param bool $state: Strict state flag :rtype: void Enables/disables strict type comparison in tests. - .. method:: active([$state = TRUE]) + .. php:method:: active([$state = TRUE]) :param bool $state: Whether to enable testing :rtype: void Enables/disables unit testing. - .. method:: result([$results = array()]) + .. php:method:: result([$results = array()]) :param array $results: Tests results list :returns: Array of raw result data @@ -236,7 +236,7 @@ Class Reference Returns raw tests results data. - .. method:: set_template($template) + .. php:method:: set_template($template) :param string $template: Test result template :rtype: void diff --git a/user_guide_src/source/libraries/uri.rst b/user_guide_src/source/libraries/uri.rst index 7db758ce7..ae56184cc 100644 --- a/user_guide_src/source/libraries/uri.rst +++ b/user_guide_src/source/libraries/uri.rst @@ -20,9 +20,9 @@ information about the re-routed segments. Class Reference *************** -.. class:: CI_URI +.. php:class:: CI_URI - .. method:: segment($n[, $no_result = NULL]) + .. php:method:: segment($n[, $no_result = NULL]) :param int $n: Segment index number :param mixed $no_result: What to return if the searched segment is not found @@ -59,7 +59,7 @@ Class Reference $product_id = $this->uri->segment(3); } - .. method:: rsegment($n[, $no_result = NULL]) + .. php:method:: rsegment($n[, $no_result = NULL]) :param int $n: Segment index number :param mixed $no_result: What to return if the searched segment is not found @@ -70,7 +70,7 @@ Class Reference a specific segment from your re-routed URI in the event you are using CodeIgniter's :doc:`URI Routing <../general/routing>` feature. - .. method:: slash_segment($n[, $where = 'trailing']) + .. php:method:: slash_segment($n[, $where = 'trailing']) :param int $n: Segment index number :param string $where: Where to add the slash ('trailing' or 'leading') @@ -91,7 +91,7 @@ Class Reference #. /segment #. /segment/ - .. method:: slash_rsegment($n[, $where = 'trailing']) + .. php:method:: slash_rsegment($n[, $where = 'trailing']) :param int $n: Segment index number :param string $where: Where to add the slash ('trailing' or 'leading') @@ -103,7 +103,7 @@ Class Reference are using CodeIgniter's :doc:`URI Routing <../general/routing>` feature. - .. method:: uri_to_assoc([$n = 3[, $default = array()]]) + .. php:method:: uri_to_assoc([$n = 3[, $default = array()]]) :param int $n: Segment index number :param array $default: Default values @@ -145,7 +145,7 @@ Class Reference Lastly, if a corresponding value is not found for a given key (if there is an odd number of URI segments) the value will be set to NULL. - .. method:: ruri_to_assoc([$n = 3[, $default = array()]]) + .. php:method:: ruri_to_assoc([$n = 3[, $default = array()]]) :param int $n: Segment index number :param array $default: Default values @@ -156,7 +156,7 @@ Class Reference an associative array using the re-routed URI in the event you are using CodeIgniter's :doc:`URI Routing <../general/routing>` feature. - .. method:: assoc_to_uri($array) + .. php:method:: assoc_to_uri($array) :param array $array: Input array of key/value pairs :returns: URI string @@ -170,7 +170,7 @@ Class Reference // Produces: product/shoes/size/large/color/red - .. method:: uri_string() + .. php:method:: uri_string() :returns: URI string :rtype: string @@ -183,7 +183,7 @@ Class Reference news/local/345 - .. method:: ruri_string() + .. php:method:: ruri_string() :returns: Routed URI string :rtype: string @@ -192,14 +192,14 @@ Class Reference the re-routed URI in the event you are using CodeIgniter's :doc:`URI Routing <../general/routing>` feature. - .. method:: total_segments() + .. php:method:: total_segments() :returns: Count of URI segments :rtype: int Returns the total number of segments. - .. method:: total_rsegments() + .. php:method:: total_rsegments() :returns: Count of routed URI segments :rtype: int @@ -208,7 +208,7 @@ Class Reference the total number of segments in your re-routed URI in the event you are using CodeIgniter's :doc:`URI Routing <../general/routing>` feature. - .. method:: segment_array() + .. php:method:: segment_array() :returns: URI segments array :rtype: array @@ -223,7 +223,7 @@ Class Reference echo '<br />'; } - .. method:: rsegment_array() + .. php:method:: rsegment_array() :returns: Routed URI segments array :rtype: array diff --git a/user_guide_src/source/libraries/user_agent.rst b/user_guide_src/source/libraries/user_agent.rst index 517382a65..a1d969abf 100644 --- a/user_guide_src/source/libraries/user_agent.rst +++ b/user_guide_src/source/libraries/user_agent.rst @@ -72,9 +72,9 @@ is available. Class Reference *************** -.. class:: CI_User_agent +.. php:class:: CI_User_agent - .. method:: is_browser([$key = NULL]) + .. php:method:: is_browser([$key = NULL]) :param string $key: Optional browser name :returns: TRUE if the user agent is a (specified) browser, FALSE if not @@ -96,7 +96,7 @@ Class Reference You can find this list in **application/config/user_agents.php** if you want to add new browsers or change the stings. - .. method:: is_mobile([$key = NULL]) + .. php:method:: is_mobile([$key = NULL]) :param string $key: Optional mobile device name :returns: TRUE if the user agent is a (specified) mobile device, FALSE if not @@ -118,7 +118,7 @@ Class Reference $this->load->view('web/home'); } - .. method:: is_robot([$key = NULL]) + .. php:method:: is_robot([$key = NULL]) :param string $key: Optional robot name :returns: TRUE if the user agent is a (specified) robot, FALSE if not @@ -131,49 +131,49 @@ Class Reference that commonly visit your site are missing from the list you can add them to your **application/config/user_agents.php** file. - .. method:: is_referral() + .. php:method:: is_referral() :returns: TRUE if the user agent is a referral, FALSE if not :rtype: bool Returns TRUE/FALSE (boolean) if the user agent was referred from another site. - .. method:: browser() + .. php:method:: browser() :returns: Detected browser or an empty string :rtype: string Returns a string containing the name of the web browser viewing your site. - .. method:: version() + .. php:method:: version() :returns: Detected browser version or an empty string :rtype: string Returns a string containing the version number of the web browser viewing your site. - .. method:: mobile() + .. php:method:: mobile() :returns: Detected mobile device brand or an empty string :rtype: string Returns a string containing the name of the mobile device viewing your site. - .. method:: robot() + .. php:method:: robot() :returns: Detected robot name or an empty string :rtype: string Returns a string containing the name of the robot viewing your site. - .. method:: platform() + .. php:method:: platform() :returns: Detected operating system or an empty string :rtype: string Returns a string containing the platform viewing your site (Linux, Windows, OS X, etc.). - .. method:: referrer() + .. php:method:: referrer() :returns: Detected referrer or an empty string :rtype: string @@ -185,7 +185,7 @@ Class Reference echo $this->agent->referrer(); } - .. method:: agent_string() + .. php:method:: agent_string() :returns: Full user agent string or an empty string :rtype: string @@ -194,7 +194,7 @@ Class Reference Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.0.4) Gecko/20060613 Camino/1.0.2 - .. method:: accept_lang([$lang = 'en']) + .. php:method:: accept_lang([$lang = 'en']) :param string $lang: Language key :returns: TRUE if provided language is accepted, FALSE if not @@ -210,14 +210,14 @@ Class Reference .. note:: This method is not typically very reliable since some browsers do not provide language info, and even among those that do, it is not always accurate. - .. method:: languages() + .. php:method:: languages() :returns: An array list of accepted languages :rtype: array Returns an array of languages supported by the user agent. - .. method:: accept_charset([$charset = 'utf-8']) + .. php:method:: accept_charset([$charset = 'utf-8']) :param string $charset: Character set :returns: TRUE if the character set is accepted, FALSE if not @@ -233,14 +233,14 @@ Class Reference .. note:: This method is not typically very reliable since some browsers do not provide character-set info, and even among those that do, it is not always accurate. - .. method:: charsets() + .. php:method:: charsets() :returns: An array list of accepted character sets :rtype: array Returns an array of character sets accepted by the user agent. - .. method:: parse($string) + .. php:method:: parse($string) :param string $string: A custom user-agent string :rtype: void diff --git a/user_guide_src/source/libraries/xmlrpc.rst b/user_guide_src/source/libraries/xmlrpc.rst index 5f1c917a9..4d7ed66d5 100644 --- a/user_guide_src/source/libraries/xmlrpc.rst +++ b/user_guide_src/source/libraries/xmlrpc.rst @@ -456,16 +456,16 @@ seven types of values that you can send via XML-RPC: Class Reference *************** -.. class:: CI_Xmlrpc +.. php:class:: CI_Xmlrpc - .. method:: initialize([$config = array()]) + .. php:method:: initialize([$config = array()]) :param array $config: Configuration data :rtype: void Initializes the XML-RPC library. Accepts an associative array containing your settings. - .. method:: server($url[, $port = 80[, $proxy = FALSE[, $proxy_port = 8080]]]) + .. php:method:: server($url[, $port = 80[, $proxy = FALSE[, $proxy_port = 8080]]]) :param string $url: XML-RPC server URL :param int $port: Server port @@ -481,7 +481,7 @@ Class Reference $this->xmlrpc->server('http://user:pass@localhost/', 80); - .. method:: timeout($seconds = 5) + .. php:method:: timeout($seconds = 5) :param int $seconds: Timeout in seconds :rtype: void @@ -490,7 +490,7 @@ Class Reference $this->xmlrpc->timeout(6); - .. method:: method($function) + .. php:method:: method($function) :param string $function: Method name :rtype: void @@ -501,7 +501,7 @@ Class Reference Where method is the name of the method. - .. method:: request($incoming) + .. php:method:: request($incoming) :param array $incoming: Request data :rtype: void @@ -511,7 +511,7 @@ Class Reference $request = array(array('My Photoblog', 'string'), 'http://www.yoursite.com/photoblog/'); $this->xmlrpc->request($request); - .. method:: send_request() + .. php:method:: send_request() :returns: TRUE on success, FALSE on failure :rtype: bool @@ -525,7 +525,7 @@ Class Reference Enables or disables debugging, which will display a variety of information and error data helpful during development. - .. method:: display_error() + .. php:method:: display_error() :returns: Error message string :rtype: string @@ -535,7 +535,7 @@ Class Reference echo $this->xmlrpc->display_error(); - .. method:: display_response() + .. php:method:: display_response() :returns: Response :rtype: mixed @@ -545,7 +545,7 @@ Class Reference $this->xmlrpc->display_response(); - .. method:: send_error_message($number, $message) + .. php:method:: send_error_message($number, $message) :param int $number: Error number :param string $message: Error message diff --git a/user_guide_src/source/libraries/zip.rst b/user_guide_src/source/libraries/zip.rst index b509236de..816f49ca1 100644 --- a/user_guide_src/source/libraries/zip.rst +++ b/user_guide_src/source/libraries/zip.rst @@ -2,9 +2,8 @@ Zip Encoding Class ################## -CodeIgniter's Zip Encoding Class classes permit you to create Zip -archives. Archives can be downloaded to your desktop or saved to a -directory. +CodeIgniter's Zip Encoding Class permits you to create Zip archives. +Archives can be downloaded to your desktop or saved to a directory. .. contents:: :local: @@ -52,7 +51,7 @@ your server, and download it to your desktop. Class Reference *************** -.. class:: CI_Zip +.. php:class:: CI_Zip .. attribute:: $compression_level = 2 @@ -62,7 +61,7 @@ Class Reference $this->zip->compression_level = 0; - .. method:: add_data($filepath[, $data = NULL]) + .. php:method:: add_data($filepath[, $data = NULL]) :param mixed $filepath: A single file path or an array of file => data pairs :param array $data: File contents (ignored if $filepath is an array) @@ -101,7 +100,7 @@ Class Reference The above example will place my_bio.txt inside a folder called personal. - .. method:: add_dir($directory) + .. php:method:: add_dir($directory) :param mixed $directory: Directory name string or an array of multiple directories :rtype: void @@ -112,7 +111,7 @@ Class Reference $this->zip->add_dir('myfolder'); // Creates a directory called "myfolder" - .. method:: read_file($path[, $archive_filepath = FALSE]) + .. php:method:: read_file($path[, $archive_filepath = FALSE]) :param string $path: Path to file :param mixed $archive_filepath: New file name/path (string) or (boolean) whether to maintain the original filepath @@ -151,7 +150,7 @@ Class Reference // Download ZIP archive containing /new/path/some_photo.jpg $this->zip->download('my_archive.zip'); - .. method:: read_dir($path[, $preserve_filepath = TRUE[, $root_path = NULL]]) + .. php:method:: read_dir($path[, $preserve_filepath = TRUE[, $root_path = NULL]]) :param string $path: Path to directory :param bool $preserve_filepath: Whether to maintain the original path @@ -181,7 +180,7 @@ Class Reference This will create a ZIP with a directory named "directory" inside, then all sub-directories stored correctly inside that, but will not include the */path/to/your* part of the path. - .. method:: archive($filepath) + .. php:method:: archive($filepath) :param string $filepath: Path to target zip archive :returns: TRUE on success, FALSE on failure @@ -193,7 +192,7 @@ Class Reference $this->zip->archive('/path/to/folder/myarchive.zip'); // Creates a file named myarchive.zip - .. method:: download($filename = 'backup.zip') + .. php:method:: download($filename = 'backup.zip') :param string $filename: Archive file name :rtype: void @@ -207,7 +206,7 @@ Class Reference this method since it sends various server headers that cause the download to happen and the file to be treated as binary. - .. method:: get_zip() + .. php:method:: get_zip() :returns: Zip file content :rtype: string @@ -222,7 +221,7 @@ Class Reference $zip_file = $this->zip->get_zip(); - .. method:: clear_data() + .. php:method:: clear_data() :rtype: void |