From 2c8dc585dd4134e71a7356f99b6a0dac12bf9d1a Mon Sep 17 00:00:00 2001
From: Derek Jones
Date: Tue, 10 Feb 2009 20:15:49 +0000
Subject: added global cookie prefix to get_cookie() unless the cookie exists
as-requested
---
system/helpers/cookie_helper.php | 10 ++++++++--
user_guide/changelog.html | 1 +
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/system/helpers/cookie_helper.php b/system/helpers/cookie_helper.php
index d906882ae..77f86e489 100644
--- a/system/helpers/cookie_helper.php
+++ b/system/helpers/cookie_helper.php
@@ -107,8 +107,14 @@ if ( ! function_exists('get_cookie'))
{
function get_cookie($index = '', $xss_clean = FALSE)
{
- $CI =& get_instance();
- return $CI->input->cookie($index, $xss_clean);
+ $prefix = '';
+
+ if ( ! isset($_COOKIE[$index]) && config_item('cookie_prefix') != '')
+ {
+ $prefix = config_item('cookie_prefix');
+ }
+
+ return $CI->input->cookie($prefix.$index, $xss_clean);
}
}
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index 5f76c000b..65950cdc3 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -87,6 +87,7 @@ SVN Revision:
Added ability to force lowercase for url_title() in the URL helper.
Changed the default "type" of form_button() to "button" from "submit" in the form helper.
Changed redirect() in the URL helper to allow redirections to URLs outside of the CI site.
+ Updated get_cookie() to try to fetch the cookie using the global cookie prefix if the requested cookie name doesn't exist.
Other Changes
--
cgit v1.2.3-24-g4f1b