diff options
author | Andreas Gohr <andi@splitbrain.org> | 2015-05-07 17:46:33 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2015-05-07 17:46:33 +0200 |
commit | a57b28b008c626be39db862fc76aecde52f8fa00 (patch) | |
tree | f137cdb013df007f6933c3ebbe197dbfa80ca086 /inc/common.php | |
parent | 9234bce90e1297ac66acc321827cb0f832864fe4 (diff) | |
parent | 3a97088971109f1611a03329d12e5296a8c3c515 (diff) | |
download | rpg-a57b28b008c626be39db862fc76aecde52f8fa00.tar.gz rpg-a57b28b008c626be39db862fc76aecde52f8fa00.tar.bz2 |
Merge pull request #1129 from splitbrain/remove-from-doku-prefs
Make it possible to remove entries from DOKU_PREFS cookie
Diffstat (limited to 'inc/common.php')
-rw-r--r-- | inc/common.php | 10 |
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); } |