Remove direct calls to App->user

This commit is contained in:
Michael 2021-08-08 10:14:56 +00:00
parent 266ee26240
commit fc283ab928
51 changed files with 238 additions and 166 deletions

View file

@ -38,13 +38,13 @@ class Display extends BaseSettings
{
public static function post(array $parameters = [])
{
if (!local_user() || !empty(DI::app()->user['uid']) && DI::app()->user['uid'] != local_user()) {
if (!local_user() || empty(DI::app()->getUserId()) || DI::app()->getUserId() != local_user()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
}
self::checkFormSecurityTokenRedirectOnError('/settings/display', 'settings_display');
$theme = !empty($_POST['theme']) ? Strings::escapeTags(trim($_POST['theme'])) : DI::app()->user['theme'];
$theme = !empty($_POST['theme']) ? Strings::escapeTags(trim($_POST['theme'])) : DI::app()->getUserValue('theme');
$mobile_theme = !empty($_POST['mobile_theme']) ? Strings::escapeTags(trim($_POST['mobile_theme'])) : '';
$nosmile = !empty($_POST['nosmile']) ? intval($_POST['nosmile']) : 0;
$first_day_of_week = !empty($_POST['first_day_of_week']) ? intval($_POST['first_day_of_week']) : 0;
@ -92,7 +92,7 @@ class Display extends BaseSettings
DI::pConfig()->set(local_user(), 'system', 'first_day_of_week' , $first_day_of_week);
if (in_array($theme, Theme::getAllowedList())) {
if ($theme == DI::app()->user['theme']) {
if ($theme == DI::app()->getUserValue('theme')) {
// call theme_post only if theme has not been changed
if (($themeconfigfile = Theme::getConfigFile($theme)) !== null) {
require_once $themeconfigfile;
@ -152,7 +152,7 @@ class Display extends BaseSettings
}
}
$theme_selected = DI::app()->user['theme'] ?: $default_theme;
$theme_selected = DI::app()->getUserValue('theme') ?: $default_theme;
$mobile_theme_selected = Session::get('mobile-theme', $default_mobile_theme);
$itemspage_network = intval(DI::pConfig()->get(local_user(), 'system', 'itemspage_network'));