From 8b02d7f892980160428d4d884578fe26fb02ad27 Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Fri, 10 Feb 2023 17:31:10 +0100 Subject: [PATCH] Improved fix for #941 and #944 --- .../0.0.0/app/libraries/RainLoop/Actions/Themes.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Themes.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Themes.php index adda3e439..6b26f36c8 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Themes.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Themes.php @@ -13,9 +13,9 @@ trait Themes && ($oAccount = $this->getAccountFromToken(false)) && $this->GetCapa(\RainLoop\Enumerations\Capa::THEMES) && ($oSettingsLocal = $this->SettingsProvider(true)->Load($oAccount))) { - $sTheme = $this->ValidateTheme((string) $oSettingsLocal->GetConf('Theme', $sTheme)) ?: $sTheme; + $sTheme = (string) $oSettingsLocal->GetConf('Theme', $sTheme); } - $sTheme = $this->ValidateTheme($sTheme) ?: 'Default'; + $sTheme = $this->ValidateTheme($sTheme); } return $sTheme; } @@ -92,7 +92,13 @@ trait Themes public function ValidateTheme(string $sTheme): string { - return \in_array($sTheme, $this->GetThemes()) ? $sTheme : $this->Config()->Get('webmail', 'theme', 'Default'); + if (!\in_array($sTheme, $this->GetThemes())) { + $sTheme = $this->Config()->Get('webmail', 'theme', 'Default'); + if (!\in_array($sTheme, $this->GetThemes())) { + $sTheme = 'Default'; + } + } + return $sTheme; } public function compileCss(string $sTheme, bool $bAdmin, bool $bMinified = false) : string