diff options
| author | wn_ <invalid@email.com> | 2024-11-17 22:14:08 +0000 |
|---|---|---|
| committer | wn_ <invalid@email.com> | 2024-11-18 21:59:45 +0000 |
| commit | 154abc61a0f81bee7757fc57e594f3f4bccc0fdf (patch) | |
| tree | 19deb331e4204003b11b88cc2f1e98cc2440b402 /classes/UserHelper.php | |
| parent | 394d606fe977a331f733c62e5509469c2eb3ef31 (diff) | |
Eliminate use of deprecated 'get_pref()' and 'set_pref()'.
Diffstat (limited to 'classes/UserHelper.php')
| -rw-r--r-- | classes/UserHelper.php | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/classes/UserHelper.php b/classes/UserHelper.php index 27e022624..aa2d4ce19 100644 --- a/classes/UserHelper.php +++ b/classes/UserHelper.php @@ -127,7 +127,9 @@ class UserHelper { $_SESSION["csrf_token"] = bin2hex(get_random_bytes(16)); if (Config::get_schema_version() >= 120) { - $_SESSION["language"] = get_pref(Prefs::USER_LANGUAGE, $owner_uid); + // 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); } } @@ -136,7 +138,8 @@ class UserHelper { if (!$pluginhost) $pluginhost = PluginHost::getInstance(); if ($owner_uid && Config::get_schema_version() >= 100 && empty($_SESSION["safe_mode"])) { - $plugins = get_pref(Prefs::_ENABLED_PLUGINS, $owner_uid); + $profile = isset($_SESSION['uid']) && $owner_uid == $_SESSION['uid'] && isset($_SESSION['profile']) ? $_SESSION['profile'] : null; + $plugins = Prefs::get(Prefs::_ENABLED_PLUGINS, $owner_uid, $profile); $pluginhost->load((string)$plugins, PluginHost::KIND_USER, $owner_uid); @@ -192,7 +195,7 @@ class UserHelper { } static function print_user_stylesheet(): void { - $value = get_pref(Prefs::USER_STYLESHEET); + $value = Prefs::get(Prefs::USER_STYLESHEET, $_SESSION['uid'], $_SESSION['profile'] ?? null); if ($value) { print "<style type='text/css' id='user_css_style'>"; |