diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-03-20 15:59:04 +0100 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-03-20 15:59:04 +0100 |
commit | 817164d822ce5dc1159ddc3e8fad2fa094dfc5ea (patch) | |
tree | 125069e2089d0e0ee3b8337b7acac6050ca1e045 /system/helpers/cookie_helper.php | |
parent | 4b4363871256df9009bb4245def8f89420331cfd (diff) | |
parent | 8480f7c35af9aacaf2ebee43677ff1d31a5cce13 (diff) |
Merge upstream branch
Diffstat (limited to 'system/helpers/cookie_helper.php')
-rw-r--r-- | system/helpers/cookie_helper.php | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/system/helpers/cookie_helper.php b/system/helpers/cookie_helper.php index 7b439c47f..ec8aa3250 100644 --- a/system/helpers/cookie_helper.php +++ b/system/helpers/cookie_helper.php @@ -1,13 +1,13 @@ -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); +<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * CodeIgniter * - * An open source application development framework for PHP 5.1.6 or newer + * An open source application development framework for PHP 5.2.4 or newer * * NOTICE OF LICENSE - * + * * Licensed under the Open Software License version 3.0 - * + * * This source file is subject to the Open Software License (OSL 3.0) that is * bundled with this package in the files license.txt / license.rst. It is * also available through the world wide web at this URL: @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * CodeIgniter Cookie Helpers * @@ -42,25 +40,26 @@ /** * Set cookie * - * Accepts six parameter, or you can submit an associative + * Accepts seven parameters, or you can submit an associative * array in the first parameter containing all the values. * - * @access public * @param mixed * @param string the value of the cookie * @param string the number of seconds until expiration * @param string the cookie domain. Usually: .yourdomain.com * @param string the cookie path * @param string the cookie prefix + * @param bool true makes the cookie secure + * @param bool true makes the cookie accessible via http(s) only (no javascript) * @return void */ if ( ! function_exists('set_cookie')) { - function set_cookie($name = '', $value = '', $expire = '', $domain = '', $path = '/', $prefix = '', $secure = FALSE) + function set_cookie($name = '', $value = '', $expire = '', $domain = '', $path = '/', $prefix = '', $secure = FALSE, $httponly = FALSE) { // Set the config file options $CI =& get_instance(); - $CI->input->set_cookie($name, $value, $expire, $domain, $path, $prefix, $secure); + $CI->input->set_cookie($name, $value, $expire, $domain, $path, $prefix, $secure, $httponly); } } @@ -69,7 +68,6 @@ if ( ! function_exists('set_cookie')) /** * Fetch an item from the COOKIE array * - * @access public * @param string * @param bool * @return mixed @@ -79,14 +77,7 @@ if ( ! function_exists('get_cookie')) function get_cookie($index = '', $xss_clean = FALSE) { $CI =& get_instance(); - - $prefix = ''; - - if ( ! isset($_COOKIE[$index]) && config_item('cookie_prefix') != '') - { - $prefix = config_item('cookie_prefix'); - } - + $prefix = isset($_COOKIE[$index]) ? '' : config_item('cookie_prefix'); return $CI->input->cookie($prefix.$index, $xss_clean); } } @@ -97,7 +88,7 @@ if ( ! function_exists('get_cookie')) * Delete a COOKIE * * @param mixed - * @param string the cookie domain. Usually: .yourdomain.com + * @param string the cookie domain. Usually: .yourdomain.com * @param string the cookie path * @param string the cookie prefix * @return void @@ -110,6 +101,5 @@ if ( ! function_exists('delete_cookie')) } } - /* End of file cookie_helper.php */ -/* Location: ./system/helpers/cookie_helper.php */
\ No newline at end of file +/* Location: ./system/helpers/cookie_helper.php */ |