From 7e335de7b85b07ca66b10a4bae0d0f1928d5552c Mon Sep 17 00:00:00 2001 From: wn_ Date: Tue, 4 Mar 2025 02:21:21 +0000 Subject: [PATCH] Get rid of the 'language' session variable. It had issues (no profile usage, only set at login), so it's cleanest to just replace its one usage with 'Prefs::get()'. --- classes/Pref_Prefs.php | 8 ++------ classes/UserHelper.php | 6 ------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/classes/Pref_Prefs.php b/classes/Pref_Prefs.php index 94c38c177..c96c84100 100644 --- a/classes/Pref_Prefs.php +++ b/classes/Pref_Prefs.php @@ -207,14 +207,10 @@ class Pref_Prefs extends Handler_Protected { } break; - case Prefs::USER_LANGUAGE: - if (!$need_reload) $need_reload = $_SESSION["language"] != $value; - break; - case Prefs::USER_CSS_THEME: - if (!$need_reload) $need_reload = Prefs::get(Prefs::USER_CSS_THEME, $_SESSION['uid'], $profile) != $value; + case Prefs::USER_LANGUAGE: + if (!$need_reload) $need_reload = Prefs::get($pref_name, $_SESSION['uid'], $profile) != $value; break; - case Prefs::BLACKLISTED_TAGS: $cats = FeedItem_Common::normalize_categories(explode(",", $value)); asort($cats); diff --git a/classes/UserHelper.php b/classes/UserHelper.php index de0b5a6ed..c0540258f 100644 --- a/classes/UserHelper.php +++ b/classes/UserHelper.php @@ -125,12 +125,6 @@ class UserHelper { if (empty($_SESSION["csrf_token"])) $_SESSION["csrf_token"] = bin2hex(get_random_bytes(16)); - - if (Config::get_schema_version() >= 120) { - // TODO: USER_LANGUAGE is currently profile-specific, so we should pass it in here, - // but $_SESSION['profile'] isn't currently available until after the login flow completes. - $_SESSION["language"] = Prefs::get(Prefs::USER_LANGUAGE, $owner_uid); - } } static function load_user_plugins(int $owner_uid, ?PluginHost $pluginhost = null): void {