diff options
author | Florian Pritz <bluewind@server-speed.net> | 2011-01-28 22:51:06 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@server-speed.net> | 2011-01-28 22:58:52 +0100 |
commit | ce2b69675075444c9e40b72bcdd42ab7edbbe633 (patch) | |
tree | 2932f13b0db14fe53dc0622d888318db638a017f /system/helpers/cookie_helper.php | |
parent | b6b8a6587c399bfd89e13e92ce04ee8486688e6e (diff) |
update to CI 2.0
Signed-off-by: Florian Pritz <bluewind@server-speed.net>
Diffstat (limited to 'system/helpers/cookie_helper.php')
-rwxr-xr-x[-rw-r--r--] | system/helpers/cookie_helper.php | 55 |
1 files changed, 7 insertions, 48 deletions
diff --git a/system/helpers/cookie_helper.php b/system/helpers/cookie_helper.php index 40afadb57..7701d503f 100644..100755 --- a/system/helpers/cookie_helper.php +++ b/system/helpers/cookie_helper.php @@ -2,11 +2,11 @@ /** * CodeIgniter * - * An open source application development framework for PHP 4.3.2 or newer + * An open source application development framework for PHP 5.1.6 or newer * * @package CodeIgniter * @author ExpressionEngine Dev Team - * @copyright Copyright (c) 2008 - 2010, EllisLab, Inc. + * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. * @license http://codeigniter.com/user_guide/license.html * @link http://codeigniter.com * @since Version 1.0 @@ -46,53 +46,12 @@ if ( ! function_exists('set_cookie')) { function set_cookie($name = '', $value = '', $expire = '', $domain = '', $path = '/', $prefix = '') { - if (is_array($name)) - { - foreach (array('value', 'expire', 'domain', 'path', 'prefix', 'name') as $item) - { - if (isset($name[$item])) - { - $$item = $name[$item]; - } - } - } - // Set the config file options $CI =& get_instance(); - - if ($prefix == '' AND $CI->config->item('cookie_prefix') != '') - { - $prefix = $CI->config->item('cookie_prefix'); - } - if ($domain == '' AND $CI->config->item('cookie_domain') != '') - { - $domain = $CI->config->item('cookie_domain'); - } - if ($path == '/' AND $CI->config->item('cookie_path') != '/') - { - $path = $CI->config->item('cookie_path'); - } - - if ( ! is_numeric($expire)) - { - $expire = time() - 86500; - } - else - { - if ($expire > 0) - { - $expire = time() + $expire; - } - else - { - $expire = 0; - } - } - - setcookie($prefix.$name, $value, $expire, $path, $domain, 0); + $CI->input->set_cookie($name, $value, $expire, $domain, $path, $prefix); } } - + // -------------------------------------------------------------------- /** @@ -108,14 +67,14 @@ 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'); } - + return $CI->input->cookie($prefix.$index, $xss_clean); } } |