summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Smith <chris@jalakai.co.uk>2013-02-03 21:20:42 +0000
committerChristopher Smith <chris@jalakai.co.uk>2013-02-03 21:20:42 +0000
commit646a531a33fe5c5e32a932e2a889c43702505c48 (patch)
treeb46c8aaf64d81ea4d56a21b4dfcc67c247203f6d
parent36ec377e95e1b932a063729ea6582386dbafdb91 (diff)
downloadrpg-646a531a33fe5c5e32a932e2a889c43702505c48.tar.gz
rpg-646a531a33fe5c5e32a932e2a889c43702505c48.tar.bz2
ensure getter works with keys & values containing '#'
-rw-r--r--inc/common.php12
1 files changed, 6 insertions, 6 deletions
diff --git a/inc/common.php b/inc/common.php
index 730f4dc80..be369d28a 100644
--- a/inc/common.php
+++ b/inc/common.php
@@ -1546,16 +1546,16 @@ function valid_input_set($param, $valid_values, $array, $exc = '') {
/**
* Read a preference from the DokuWiki cookie
+ * (remembering both keys & values are urlencoded)
*/
function get_doku_pref($pref, $default) {
- // first, urldecode the cookie value
- $doku_prefs = urldecode($_COOKIE['DOKU_PREFS']);
- if(strpos($doku_prefs, $pref) !== false) {
- $parts = explode('#', $doku_prefs);
+ $enc_pref = urlencode($pref);
+ if(strpos($_COOKIE['DOKU_PREFS'], $enc_pref) !== false) {
+ $parts = explode('#', $_COOKIE['DOKU_PREFS']);
$cnt = count($parts);
for($i = 0; $i < $cnt; $i += 2) {
- if($parts[$i] == $pref) {
- return $parts[$i + 1];
+ if($parts[$i] == $enc_pref) {
+ return urldecode($parts[$i + 1]);
}
}
}