]> jfr.im git - z_archive/KronOS.git/blame - system/helpers/cookie_helper.php
Fixing filestructure again
[z_archive/KronOS.git] / system / helpers / cookie_helper.php
CommitLineData
59c06b17
CS
1<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
2/**
3 * CodeIgniter
4 *
5 * An open source application development framework for PHP 5.1.6 or newer
6 *
7 * @package CodeIgniter
8 * @author ExpressionEngine Dev Team
9 * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
10 * @license http://codeigniter.com/user_guide/license.html
11 * @link http://codeigniter.com
12 * @since Version 1.0
13 * @filesource
14 */
15
16// ------------------------------------------------------------------------
17
18/**
19 * CodeIgniter Cookie Helpers
20 *
21 * @package CodeIgniter
22 * @subpackage Helpers
23 * @category Helpers
24 * @author ExpressionEngine Dev Team
25 * @link http://codeigniter.com/user_guide/helpers/cookie_helper.html
26 */
27
28// ------------------------------------------------------------------------
29
30/**
31 * Set cookie
32 *
33 * Accepts six parameter, or you can submit an associative
34 * array in the first parameter containing all the values.
35 *
36 * @access public
37 * @param mixed
38 * @param string the value of the cookie
39 * @param string the number of seconds until expiration
40 * @param string the cookie domain. Usually: .yourdomain.com
41 * @param string the cookie path
42 * @param string the cookie prefix
43 * @return void
44 */
45if ( ! function_exists('set_cookie'))
46{
47 function set_cookie($name = '', $value = '', $expire = '', $domain = '', $path = '/', $prefix = '', $secure = FALSE)
48 {
49 // Set the config file options
50 $CI =& get_instance();
51 $CI->input->set_cookie($name, $value, $expire, $domain, $path, $prefix, $secure);
52 }
53}
54
55// --------------------------------------------------------------------
56
57/**
58 * Fetch an item from the COOKIE array
59 *
60 * @access public
61 * @param string
62 * @param bool
63 * @return mixed
64 */
65if ( ! function_exists('get_cookie'))
66{
67 function get_cookie($index = '', $xss_clean = FALSE)
68 {
69 $CI =& get_instance();
70
71 $prefix = '';
72
73 if ( ! isset($_COOKIE[$index]) && config_item('cookie_prefix') != '')
74 {
75 $prefix = config_item('cookie_prefix');
76 }
77
78 return $CI->input->cookie($prefix.$index, $xss_clean);
79 }
80}
81
82// --------------------------------------------------------------------
83
84/**
85 * Delete a COOKIE
86 *
87 * @param mixed
88 * @param string the cookie domain. Usually: .yourdomain.com
89 * @param string the cookie path
90 * @param string the cookie prefix
91 * @return void
92 */
93if ( ! function_exists('delete_cookie'))
94{
95 function delete_cookie($name = '', $domain = '', $path = '/', $prefix = '')
96 {
97 set_cookie($name, '', '', $domain, $path, $prefix);
98 }
99}
100
101
102/* End of file cookie_helper.php */
103/* Location: ./system/helpers/cookie_helper.php */