summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorAnika Henke <anika@selfthinker.org>2015-05-03 11:25:06 +0100
committerAnika Henke <anika@selfthinker.org>2015-05-03 13:57:32 +0100
commit3a97088971109f1611a03329d12e5296a8c3c515 (patch)
tree0376a85d1c6079c50e5458b937965de2ba89279d /inc
parentdfe7cc3f3bfbfccec6a38a94ac0f2242e8bc59e7 (diff)
downloadrpg-3a97088971109f1611a03329d12e5296a8c3c515.tar.gz
rpg-3a97088971109f1611a03329d12e5296a8c3c515.tar.bz2
make it possible to remove entries from DOKU_PREFS cookie
Diffstat (limited to 'inc')
-rw-r--r--inc/common.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/inc/common.php b/inc/common.php
index 5a8b5c900..e14bd7af4 100644
--- a/inc/common.php
+++ b/inc/common.php
@@ -1875,6 +1875,7 @@ function get_doku_pref($pref, $default) {
/**
* Add a preference to the DokuWiki cookie
* (remembering $_COOKIE['DOKU_PREFS'] is urlencoded)
+ * Remove it by setting $val to false
*
* @param string $pref preference key
* @param string $val preference value
@@ -1891,12 +1892,17 @@ function set_doku_pref($pref, $val) {
$enc_pref = rawurlencode($pref);
for($i = 0; $i < $cnt; $i += 2) {
if($parts[$i] == $enc_pref) {
- $parts[$i + 1] = rawurlencode($val);
+ if ($val !== false) {
+ $parts[$i + 1] = rawurlencode($val);
+ } else {
+ unset($parts[$i]);
+ unset($parts[$i + 1]);
+ }
break;
}
}
$cookieVal = implode('#', $parts);
- } else if (!$orig) {
+ } else if (!$orig && $val !== false) {
$cookieVal = ($_COOKIE['DOKU_PREFS'] ? $_COOKIE['DOKU_PREFS'].'#' : '').rawurlencode($pref).'#'.rawurlencode($val);
}