From 50f261f7d8fd4138fab3fca8c9b9eea290a3885b Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Sat, 26 Jan 2013 18:24:07 +0100 Subject: Fix set_doku_pref cookie date and value --- inc/common.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/inc/common.php b/inc/common.php index e436ec263..88e60f02c 100644 --- a/inc/common.php +++ b/inc/common.php @@ -1574,15 +1574,16 @@ function set_doku_pref($pref, $val) { for($i = 0; $i < $cnt; $i += 2) { if($parts[$i] == $pref) { $parts[$i + 1] = urlencode($val); + break; } } $cookieVal = implode('#', $parts); } else if (!$orig) { - $cookieVal = $_COOKIE['DOKU_PREFS'].'#'.urlencode($pref).'#'.urlencode($val); + $cookieVal = ($_COOKIE['DOKU_PREFS'] ? $_COOKIE['DOKU_PREFS'].'#' : '').urlencode($pref).'#'.urlencode($val); } if (!empty($cookieVal)) { - setcookie('DOKU_PREFS', $cookieVal, strtotime('+1 year'), DOKU_BASE, '', ($conf['securecookie'] && is_ssl())); + setcookie('DOKU_PREFS', $cookieVal, time()+365*24*3600, DOKU_BASE, '', ($conf['securecookie'] && is_ssl())); } } -- cgit v1.2.3