diff --git a/dev/boot.js b/dev/boot.js
index 36e6a2bd0..bfc0717ac 100644
--- a/dev/boot.js
+++ b/dev/boot.js
@@ -144,10 +144,6 @@ win.rl = {
rl.hash.set();
if (appData) {
- if (appData.NewThemeLink) {
- eId('app-theme-link').href = appData.NewThemeLink;
- }
-
loadScript(appData.StaticLibJsLink)
.then(() => loadScript(appData.StaticAppJsLink))
.then(() => appData.PluginsLink ? loadScript(appData.PluginsLink) : Promise.resolve())
diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php
index 373221056..f246dd7e6 100644
--- a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php
+++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php
@@ -1026,7 +1026,7 @@ class Actions
/*
required by Index.html and rl.js:
- NewThemeLink TemplatesLink LangLink PluginsLink AuthAccountHash
+ PluginsLink AuthAccountHash
*/
$value = \ini_get('upload_max_filesize');
@@ -1107,7 +1107,6 @@ class Actions
$sLanguage = $oConfig->Get('webmail', 'language', 'en');
$sLanguageAdmin = $oConfig->Get('webmail', 'language_admin', 'en');
$UserLanguageRaw = $this->detectUserLanguage($bAdmin);
- $sTheme = $oConfig->Get('webmail', 'theme', 'Default');
if (!$bAdmin) {
$oAccount = $this->getAccountFromToken(false);
@@ -1202,10 +1201,6 @@ class Actions
if ($oSettingsLocal instanceof Settings) {
$aResult['UseThreads'] = (bool)$oSettingsLocal->GetConf('UseThreads', $aResult['UseThreads']);
$aResult['ReplySameFolder'] = (bool)$oSettingsLocal->GetConf('ReplySameFolder', $aResult['ReplySameFolder']);
-
- if ($this->GetCapa(false, Enumerations\Capa::THEMES, $oAccount)) {
- $sTheme = (string)$oSettingsLocal->GetConf('Theme', $sTheme);
- }
}
}
}
@@ -1262,9 +1257,7 @@ class Actions
$sStaticCache = $this->StaticCache();
- $sTheme = $this->ValidateTheme($sTheme);
- $aResult['Theme'] = $sTheme;
- $aResult['NewThemeLink'] = $this->ThemeLink($sTheme, $bAdmin);
+ $aResult['Theme'] = $this->GetTheme($bAdmin);
$aResult['Language'] = $this->ValidateLanguage($sLanguage, '', false);
$aResult['UserLanguage'] = $this->ValidateLanguage($UserLanguageRaw, '', false, true);
diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Localization.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Localization.php
index 0cf98c357..7ef4c62f6 100644
--- a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Localization.php
+++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Localization.php
@@ -4,44 +4,6 @@ namespace RainLoop\Actions;
trait Localization
{
-/*
- 'DetermineUserLanguage' => (bool)$oConfig->Get('login', 'determine_user_language', true),
- 'AllowLanguagesOnSettings' => (bool) $oConfig->Get('webmail', 'allow_languages_on_settings', true),
- 'AllowLanguagesOnLogin' => (bool) $oConfig->Get('login', 'allow_languages_on_login', true),
- $sLanguage = $oConfig->Get('webmail', 'language', 'en');
- $sLanguageAdmin = $oConfig->Get('webmail', 'language_admin', 'en');
-
- $UserLanguageRaw = $this->detectUserLanguage($bAdmin);
-
- if (!$bAdmin) {
- $oAccount = $this->getAccountFromToken(false);
- if ($oAccount) {
- $oSettings = $this->SettingsProvider()->Load($oAccount);
- if ($oSettings instanceof Settings) {
- if ($this->GetCapa(false, Enumerations\Capa::SETTINGS, $oAccount)) {
- if ($oConfig->Get('webmail', 'allow_languages_on_settings', true)) {
- $sLanguage = (string)$oSettings->GetConf('Language', $sLanguage);
- }
- }
- }
- }
- if (!$aResult['Auth']) {
- if ($oConfig->Get('login', 'allow_languages_on_login', true) &&
- $oConfig->Get('login', 'determine_user_language', true)) {
- $sLanguage = $this->ValidateLanguage($UserLanguageRaw, $sLanguage, false);
- }
- }
- }
-
- $aResult['Language'] = $this->ValidateLanguage($sLanguage, '', false);
- $aResult['LanguageAdmin'] = $this->ValidateLanguage($sLanguageAdmin, '', true);
-
- $aResult['UserLanguage'] = $this->ValidateLanguage($UserLanguageRaw, '', false, true);
-
-// $aResult['LangLink'] = './?/Lang/0/' . ($bAdmin ? 'Admin' : 'App') . '/' .
-// ($bAdmin ? $aResult['LanguageAdmin'] : $aResult['Language']) . '/' . $sStaticCache . '/';
-*/
-
public function GetLanguage(bool $bAdmin = false): string
{
$oConfig = $this->Config();
@@ -49,12 +11,10 @@ trait Localization
$sLanguage = $oConfig->Get('webmail', 'language_admin', 'en');
} else {
$sLanguage = $oConfig->Get('webmail', 'language', 'en');
-// $oAccount = $this->getAccountFromToken(false);
- if ($oAccount = $this->GetAccount()) {
- $oSettings = $this->SettingsProvider()->Load($oAccount);
- if ($oSettings instanceof Settings) {
-// if ($this->GetCapa(false, Enumerations\Capa::SETTINGS, $oAccount)) {
-// if ($oConfig->Get('webmail', 'allow_languages_on_settings', true)) {
+ if ($oAccount = $this->getAccountFromToken(false)) {
+ if ($oConfig->Get('webmail', 'allow_languages_on_settings', true)
+ && $this->GetCapa(false, \RainLoop\Enumerations\Capa::SETTINGS, $oAccount)
+ && ($oSettings = $this->SettingsProvider()->Load($oAccount))) {
$sLanguage = $oSettings->GetConf('Language', $sLanguage);
}
} else if ($oConfig->Get('login', 'allow_languages_on_login', true) && $oConfig->Get('login', 'determine_user_language', true)) {
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 30a3098f9..4341c5944 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
@@ -4,35 +4,22 @@ namespace RainLoop\Actions;
trait Themes
{
-/*
- $sTheme = $oConfig->Get('webmail', 'theme', 'Default');
- if (!$bAdmin && $oAccount) {
- $oSettingsLocal = $this->SettingsProvider(true)->Load($oAccount);
- if ($this->GetCapa(false, Enumerations\Capa::SETTINGS, $oAccount)) {
- if ($oSettingsLocal instanceof Settings) {
- if ($this->GetCapa(false, Enumerations\Capa::THEMES, $oAccount)) {
- $sTheme = (string) $oSettingsLocal->GetConf('Theme', $sTheme);
- $sTheme = $this->ValidateTheme($sTheme);
- $aResult['Theme'] = $sTheme;
- $aResult['NewThemeLink'] = $this->ThemeLink($sTheme, $bAdmin);
-
- if ($oConfig->Get('webmail', 'allow_themes', false)) {
- $aResult[] = Enumerations\Capa::THEMES;
- }
-*/
-
public function GetTheme(bool $bAdmin): string
{
- $sTheme = $this->Config()->Get('webmail', 'theme', 'Default');
- if (!$bAdmin) {
- if ($oAccount = $this->GetAccount()) {
- $oSettingsLocal = $this->SettingsProvider(true)->Load($oAccount);
- if ($oSettingsLocal instanceof Settings) {
- $sTheme = $oSettingsLocal->GetConf('Theme', $sTheme);
- }
- }
+ static $sTheme;
+ if ($sTheme) {
+ return $sTheme;
}
- return $this->ValidateTheme($sTheme) ?: 'Default';
+ $sTheme = $this->Config()->Get('webmail', 'theme', 'Default');
+ if (!$bAdmin
+ && ($oAccount = $this->getAccountFromToken(false))
+ && $this->GetCapa(false, \RainLoop\Enumerations\Capa::SETTINGS, $oAccount)
+ && $this->GetCapa(false, \RainLoop\Enumerations\Capa::THEMES, $oAccount)
+ && ($oSettingsLocal = $this->SettingsProvider(true)->Load($oAccount))) {
+ $sTheme = (string) $oSettingsLocal->GetConf('Theme', $sTheme);
+ }
+ $sTheme = $this->ValidateTheme($sTheme) ?: 'Default';
+ return $sTheme;
}
/**
@@ -95,9 +82,9 @@ trait Themes
return $aCache;
}
- public function ThemeLink(string $sTheme, bool $bAdmin): string
+ public function ThemeLink(bool $bAdmin): string
{
- return './?/Css/0/' . ($bAdmin ? 'Admin' : 'User') . '/-/' . $sTheme . '/-/' . $this->StaticCache() . '/Hash/-/';
+ return './?/Css/0/' . ($bAdmin ? 'Admin' : 'User') . '/-/' . $this->GetTheme($bAdmin) . '/-/' . $this->StaticCache() . '/Hash/-/';
}
public function ValidateTheme(string $sTheme): string
diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Service.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Service.php
index 3cff2578d..e4594cd9e 100644
--- a/snappymail/v/0.0.0/app/libraries/RainLoop/Service.php
+++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Service.php
@@ -170,6 +170,7 @@ class Service
if (0 === \strlen($sResult))
{
+// $aTemplateParameters['{{BaseAppThemeCss}}'] = $this->oServiceActions->compileCss($this->oActions->GetTheme($bAdmin));
$aTemplateParameters['{{BaseLanguage}}'] = $this->oServiceActions->compileLanguage($sLanguage, $bAdmin);
$aTemplateParameters['{{BaseTemplates}}'] = $this->oServiceActions->compileTemplates($bAdmin, false);
$sResult = \strtr(\file_get_contents(APP_VERSION_ROOT_PATH.'app/templates/Index.html'), $aTemplateParameters);
@@ -228,7 +229,7 @@ class Service
'{{BaseAppFaviconPngLinkTag}}' => $sFaviconPngLink ? '' : '',
'{{BaseAppFaviconTouchLinkTag}}' => $sAppleTouchLink ? '' : '',
'{{BaseAppMainCssLink}}' => $this->staticPath('css/'.($bAdmin ? 'admin' : 'app').($bAppCssDebug ? '' : '.min').'.css'),
- '{{BaseAppThemeCssLink}}' => $this->oActions->ThemeLink($this->oActions->GetTheme($bAdmin), $bAdmin),
+ '{{BaseAppThemeCssLink}}' => $this->oActions->ThemeLink($bAdmin),
'{{BaseAppBootScript}}' => \file_get_contents(APP_VERSION_ROOT_PATH.'static/js/min/boot.min.js'),
// '{{BaseDir}}' => false && \in_array($sLanguage, array('ar', 'he', 'ur')) ? 'rtl' : 'ltr',
'{{BaseAppManifestLink}}' => $this->staticPath('manifest.json'),
diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/ServiceActions.php b/snappymail/v/0.0.0/app/libraries/RainLoop/ServiceActions.php
index 713fa1244..624fe8996 100644
--- a/snappymail/v/0.0.0/app/libraries/RainLoop/ServiceActions.php
+++ b/snappymail/v/0.0.0/app/libraries/RainLoop/ServiceActions.php
@@ -505,43 +505,6 @@ class ServiceActions
return $sResult;
}
- public function ServiceTemplates() : string
- {
- $sResult = '';
- \header('Content-Type: application/javascript; charset=utf-8');
-
- $bCacheEnabled = $this->Config()->Get('labs', 'cache_system_data', true);
- if ($bCacheEnabled)
- {
- $this->oActions->verifyCacheByKey($this->sQuery);
- }
-
- $bAdmin = false !== \strpos($this->sQuery, 'Admin');
-
- $sCacheFileName = '';
- if ($bCacheEnabled)
- {
- $sCacheFileName = KeyPathHelper::TemplatesCache($bAdmin, $this->oActions->Plugins()->Hash());
- $sResult = $this->Cacher()->Get($sCacheFileName);
- }
-
- if (0 === \strlen($sResult))
- {
- $sResult = $this->compileTemplates($bAdmin);
- if ($bCacheEnabled && 0 < \strlen($sCacheFileName))
- {
- $this->Cacher()->Set($sCacheFileName, $sResult);
- }
- }
-
- if ($bCacheEnabled)
- {
- $this->oActions->cacheByKey($this->sQuery);
- }
-
- return $sResult;
- }
-
public function ServicePlugins() : string
{
$sResult = '';
@@ -599,13 +562,6 @@ class ServiceActions
if (!empty($this->aPaths[4]))
{
$sTheme = $this->oActions->ValidateTheme($this->aPaths[4]);
- $sRealTheme = $sTheme;
-
- $bCustomTheme = '@custom' === \substr($sTheme, -7);
- if ($bCustomTheme)
- {
- $sRealTheme = \substr($sTheme, 0, -7);
- }
$bCacheEnabled = $this->Config()->Get('labs', 'cache_system_data', true);
if ($bCacheEnabled)
@@ -624,25 +580,7 @@ class ServiceActions
{
try
{
- $oLess = new \LessPHP\lessc();
- $oLess->setFormatter('compressed');
-
- $aResult = array();
-
- $sThemeFile = ($bCustomTheme ? APP_INDEX_ROOT_PATH : APP_VERSION_ROOT_PATH).'themes/'.$sRealTheme.'/styles.less';
-
- if (\is_file($sThemeFile))
- {
- $aResult[] = '@base: "'
- . ($bCustomTheme ? Utils::WebPath() : Utils::WebVersionPath())
- . 'themes/'.$sRealTheme.'/";';
-
- $aResult[] = \file_get_contents($sThemeFile);
- }
-
- $aResult[] = $this->Plugins()->CompileCss($bAdmin);
-
- $sResult = $oLess->compile(\implode("\n", $aResult));
+ $sResult = $this->compileCss($sTheme);
if ($bCacheEnabled)
{
@@ -987,6 +925,34 @@ class ServiceActions
return $sResult;
}
+ public function compileCss(string $sTheme) : string
+ {
+ $bCustomTheme = '@custom' === \substr($sTheme, -7);
+ if ($bCustomTheme) {
+ $sTheme = \substr($sTheme, 0, -7);
+ }
+
+ $oLess = new \LessPHP\lessc();
+ $oLess->setFormatter('compressed');
+
+ $aResult = array();
+
+ $sThemeFile = ($bCustomTheme ? APP_INDEX_ROOT_PATH : APP_VERSION_ROOT_PATH).'themes/'.$sTheme.'/styles.less';
+
+ if (\is_file($sThemeFile))
+ {
+ $aResult[] = '@base: "'
+ . ($bCustomTheme ? Utils::WebPath() : Utils::WebVersionPath())
+ . 'themes/'.$sTheme.'/";';
+
+ $aResult[] = \file_get_contents($sThemeFile);
+ }
+
+ $aResult[] = $this->Plugins()->CompileCss($bAdmin);
+
+ return $oLess->compile(\implode("\n", $aResult));
+ }
+
public function compileTemplates(bool $bAdmin = false, bool $bJsOutput = true) : string
{
$aTemplates = array();
@@ -1026,7 +992,7 @@ class ServiceActions
$this->Plugins()->ReadLang($sLanguage, $aResultLang);
- $sResult = \json_encode($aResultLang, JSON_UNESCAPED_UNICODE);
+ $sResult = \json_encode($aResultLang, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
$sTimeFormat = '';
$options = [$sLanguage, \substr($sLanguage, 0, 2), 'en'];