From 4fdcc923f089e96b537f75c5cac8f8ebd0db9e62 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 7 Dec 2018 10:35:46 +0300 Subject: [PATCH] prefs: reload on user theme change --- classes/pref/prefs.php | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/classes/pref/prefs.php b/classes/pref/prefs.php index e717db938..ac3eae13f 100644 --- a/classes/pref/prefs.php +++ b/classes/pref/prefs.php @@ -101,20 +101,23 @@ class Pref_Prefs extends Handler_Protected { $value = $_POST[$pref_name]; - if ($pref_name == 'DIGEST_PREFERRED_TIME') { - if (get_pref('DIGEST_PREFERRED_TIME') != $value) { + switch ($pref_name) { + case 'DIGEST_PREFERRED_TIME': + if (get_pref('DIGEST_PREFERRED_TIME') != $value) { - $sth = $this->pdo->prepare("UPDATE ttrss_users SET + $sth = $this->pdo->prepare("UPDATE ttrss_users SET last_digest_sent = NULL WHERE id = ?"); - $sth->execute([$_SESSION['uid']]); + $sth->execute([$_SESSION['uid']]); - } - } + } + break; + case 'USER_LANGUAGE': + if (!$need_reload) $need_reload = $_SESSION["language"] != $value; + break; - if ($pref_name == "USER_LANGUAGE") { - if ($_SESSION["language"] != $value) { - $need_reload = true; - } + case 'USER_CSS_THEME': + if (!$need_reload) $need_reload = get_pref($pref_name) != $value; + break; } set_pref($pref_name, $value);