Improved fix for #941 and #944

This commit is contained in:
the-djmaze 2023-02-10 17:31:10 +01:00
parent 7dbcc3a58d
commit 8b02d7f892

View file

@ -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