More JSON properties to JavaScript camelCase

This commit is contained in:
the-djmaze 2023-02-21 11:52:50 +01:00
parent 07f6b7545a
commit d1823af111
21 changed files with 83 additions and 80 deletions

View file

@ -27,7 +27,7 @@ export class AdminApp extends AbstractApp {
rl.route.root(); rl.route.root();
setTimeout(() => location.href = '/', 1); setTimeout(() => location.href = '/', 1);
} else if (SettingsGet('Auth')) { } else if (SettingsGet('Auth')) {
this.weakPassword(SettingsGet('WeakPassword')); this.weakPassword(SettingsGet('weakPassword'));
startScreens([SettingsAdminScreen]); startScreens([SettingsAdminScreen]);
} else { } else {
startScreens([LoginAdminScreen]); startScreens([LoginAdminScreen]);

View file

@ -156,7 +156,7 @@ export class AppUser extends AbstractApp {
? items.map(oValue => new AccountModel(oValue.email, oValue.name)) ? items.map(oValue => new AccountModel(oValue.email, oValue.name))
: [] : []
); );
AccountUserStore.unshift(new AccountModel(SettingsGet('MainEmail'), '', false)); AccountUserStore.unshift(new AccountModel(SettingsGet('mainEmail'), '', false));
items = oData.Result.Identities; items = oData.Result.Identities;
IdentityUserStore(isArray(items) IdentityUserStore(isArray(items)
@ -204,7 +204,7 @@ export class AppUser extends AbstractApp {
refresh() { refresh() {
ThemeStore.populate(); ThemeStore.populate();
LanguageStore.language(SettingsGet('Language')); LanguageStore.language(SettingsGet('language'));
changeTheme(SettingsGet('Theme')); changeTheme(SettingsGet('Theme'));
this.start(); this.start();
} }

View file

@ -31,7 +31,7 @@ export const
*/ */
serverRequestRaw = (type, hash) => serverRequestRaw = (type, hash) =>
BASE + '?/Raw/' + SUB_QUERY_PREFIX + '/' BASE + '?/Raw/' + SUB_QUERY_PREFIX + '/'
+ '0/' // Settings.get('AccountHash') ? + '0/' // Settings.get('accountHash') ?
+ (type + (type
? type + '/' + (hash ? SUB_QUERY_PREFIX + '/' + hash : '') ? type + '/' + (hash ? SUB_QUERY_PREFIX + '/' + hash : '')
: ''), : ''),

View file

@ -41,7 +41,7 @@ class RemoteUserFetch extends AbstractFetchRemote {
let sGetAdd = ''; let sGetAdd = '';
if (folderETag) { if (folderETag) {
params.hash = folderETag + '-' + SettingsGet('AccountHash'); params.hash = folderETag + '-' + SettingsGet('accountHash');
sGetAdd = 'MessageList/' + SUB_QUERY_PREFIX + '/' + b64EncodeJSONSafe(params); sGetAdd = 'MessageList/' + SUB_QUERY_PREFIX + '/' + b64EncodeJSONSafe(params);
params = {}; params = {};
} }
@ -77,7 +77,7 @@ class RemoteUserFetch extends AbstractFetchRemote {
sFolderFullName, sFolderFullName,
iUid, iUid,
AppUserStore.threadsAllowed() && SettingsUserStore.useThreads() ? 1 : 0, AppUserStore.threadsAllowed() && SettingsUserStore.useThreads() ? 1 : 0,
SettingsGet('AccountHash') SettingsGet('accountHash')
]) ])
); );

View file

@ -13,10 +13,10 @@ export class AdminSettingsContacts extends AbstractViewSettings {
super(); super();
this.defaultOptionsAfterRender = defaultOptionsAfterRender; this.defaultOptionsAfterRender = defaultOptionsAfterRender;
this.addSetting('ContactsPdoDsn'); this.addSetting('contactsPdoDsn');
this.addSetting('ContactsPdoUser'); this.addSetting('contactsPdoUser');
this.addSetting('ContactsPdoPassword'); this.addSetting('contactsPdoPassword');
this.addSetting('ContactsPdoType', () => { this.addSetting('contactsPdoType', () => {
this.testContactsSuccess(false); this.testContactsSuccess(false);
this.testContactsError(false); this.testContactsError(false);
this.testContactsErrorMessage(''); this.testContactsErrorMessage('');
@ -31,7 +31,7 @@ export class AdminSettingsContacts extends AbstractViewSettings {
testContactsErrorMessage: '' testContactsErrorMessage: ''
}); });
this.addSetting('ContactsSuggestionsLimit'); this.addSetting('contactsSuggestionsLimit');
const supportedTypes = SettingsGet('supportedPdoDrivers') || [], const supportedTypes = SettingsGet('supportedPdoDrivers') || [],
types = [{ types = [{
@ -92,10 +92,10 @@ export class AdminSettingsContacts extends AbstractViewSettings {
this.testing(false); this.testing(false);
}, { }, {
ContactsPdoType: this.contactsPdoType(), contactsPdoType: this.contactsPdoType(),
ContactsPdoDsn: this.contactsPdoDsn(), contactsPdoDsn: this.contactsPdoDsn(),
ContactsPdoUser: this.contactsPdoUser(), contactsPdoUser: this.contactsPdoUser(),
ContactsPdoPassword: this.contactsPdoPassword() contactsPdoPassword: this.contactsPdoPassword()
} }
); );
} }

View file

@ -28,7 +28,7 @@ export class AdminSettingsGeneral extends AbstractViewSettings {
const aLanguagesAdmin = Settings.app('languagesAdmin'); const aLanguagesAdmin = Settings.app('languagesAdmin');
this.languagesAdmin = ko.observableArray(isArray(aLanguagesAdmin) ? aLanguagesAdmin : []); this.languagesAdmin = ko.observableArray(isArray(aLanguagesAdmin) ? aLanguagesAdmin : []);
this.languageAdmin = ko.observable(SettingsGet('LanguageAdmin')); this.languageAdmin = ko.observable(SettingsGet('languageAdmin'));
this.theme = ThemeStore.theme; this.theme = ThemeStore.theme;
this.themes = ThemeStore.themes; this.themes = ThemeStore.themes;
@ -53,11 +53,11 @@ export class AdminSettingsGeneral extends AbstractViewSettings {
*/ */
this.attachmentLimit = ko this.attachmentLimit = ko
.observable(SettingsGet('AttachmentLimit') / (1024 * 1024)) .observable(SettingsGet('attachmentLimit') / (1024 * 1024))
.extend({ debounce: 500 }); .extend({ debounce: 500 });
this.addSetting('Language'); this.addSetting('language');
this.addSetting('AttachmentLimit'); this.addSetting('attachmentLimit');
this.addSetting('Theme', value => changeTheme(value, this.themeTrigger)); this.addSetting('Theme', value => changeTheme(value, this.themeTrigger));
this.uploadData = SettingsGet('phpUploadSizes'); this.uploadData = SettingsGet('phpUploadSizes');
@ -91,7 +91,7 @@ export class AdminSettingsGeneral extends AbstractViewSettings {
this.languageAdminTrigger(SaveSettingStatus.Saving); this.languageAdminTrigger(SaveSettingStatus.Saving);
translatorReload(value, 1) translatorReload(value, 1)
.then(fReloadLanguageHelper(SaveSettingStatus.Success), fReloadLanguageHelper(SaveSettingStatus.Failed)) .then(fReloadLanguageHelper(SaveSettingStatus.Success), fReloadLanguageHelper(SaveSettingStatus.Failed))
.then(() => Remote.saveSetting('LanguageAdmin', value)); .then(() => Remote.saveSetting('languageAdmin', value));
}, },
capaAdditionalAccounts: fSaveHelper('CapaAdditionalAccounts'), capaAdditionalAccounts: fSaveHelper('CapaAdditionalAccounts'),
@ -114,7 +114,7 @@ export class AdminSettingsGeneral extends AbstractViewSettings {
showScreenPopup(LanguagesPopupView, [ showScreenPopup(LanguagesPopupView, [
this.languageAdmin, this.languageAdmin,
this.languagesAdmin(), this.languagesAdmin(),
SettingsGet('UserLanguageAdmin') SettingsGet('languageUsers')
]); ]);
} }
} }

View file

@ -15,7 +15,7 @@ export class AdminSettingsSecurity extends AbstractViewSettings {
this.weakPassword = rl.app.weakPassword; this.weakPassword = rl.app.weakPassword;
addObservablesTo(this, { addObservablesTo(this, {
adminLogin: SettingsGet('AdminLogin'), adminLogin: SettingsGet('adminLogin'),
adminLoginError: false, adminLoginError: false,
adminPassword: '', adminPassword: '',
adminPasswordNew: '', adminPasswordNew: '',
@ -68,7 +68,7 @@ export class AdminSettingsSecurity extends AbstractViewSettings {
capaOpenPGP: value => Remote.saveSetting('CapaOpenPGP', value) capaOpenPGP: value => Remote.saveSetting('CapaOpenPGP', value)
}); });
this.adminTOTP(SettingsGet('AdminTOTP')); this.adminTOTP(SettingsGet('adminTOTP'));
decorateKoCommands(this, { decorateKoCommands(this, {
saveAdminUserCommand: self => self.adminLogin().trim() && self.adminPassword() saveAdminUserCommand: self => self.adminLogin().trim() && self.adminPassword()

View file

@ -21,7 +21,7 @@ export class UserSettingsAccounts /*extends AbstractViewSettings*/ {
this.accounts = AccountUserStore; this.accounts = AccountUserStore;
this.loading = AccountUserStore.loading; this.loading = AccountUserStore.loading;
this.identities = IdentityUserStore; this.identities = IdentityUserStore;
this.mainEmail = SettingsGet('MainEmail'); this.mainEmail = SettingsGet('mainEmail');
this.accountForDeletion = ko.observable(null).askDeleteHelper(); this.accountForDeletion = ko.observable(null).askDeleteHelper();
this.identityForDeletion = ko.observable(null).askDeleteHelper(); this.identityForDeletion = ko.observable(null).askDeleteHelper();
@ -88,7 +88,7 @@ export class UserSettingsAccounts /*extends AbstractViewSettings*/ {
accountsAndIdentitiesAfterMove() { accountsAndIdentitiesAfterMove() {
Remote.request('AccountsAndIdentitiesSortOrder', null, { Remote.request('AccountsAndIdentitiesSortOrder', null, {
Accounts: AccountUserStore.getEmailAddresses().filter(v => v != SettingsGet('MainEmail')), Accounts: AccountUserStore.getEmailAddresses().filter(v => v != SettingsGet('mainEmail')),
Identities: IdentityUserStore.map(item => (item ? item.id() : "")) Identities: IdentityUserStore.map(item => (item ? item.id() : ""))
}); });
} }

View file

@ -116,7 +116,7 @@ export class UserSettingsGeneral extends AbstractViewSettings {
this.languageTrigger(SaveSettingStatus.Saving); this.languageTrigger(SaveSettingStatus.Saving);
translatorReload(value) translatorReload(value)
.then(fReloadLanguageHelper(SaveSettingStatus.Success), fReloadLanguageHelper(SaveSettingStatus.Failed)) .then(fReloadLanguageHelper(SaveSettingStatus.Success), fReloadLanguageHelper(SaveSettingStatus.Failed))
.then(() => Remote.saveSetting('Language', value)); .then(() => Remote.saveSetting('language', value));
}, },
hourCycle: value => hourCycle: value =>

View file

@ -11,8 +11,8 @@ export const LanguageStore = {
populate: function() { populate: function() {
const aLanguages = Settings.app('languages'); const aLanguages = Settings.app('languages');
this.languages(isArray(aLanguages) ? aLanguages : []); this.languages(isArray(aLanguages) ? aLanguages : []);
this.language(SettingsGet('Language')); this.language(SettingsGet('language'));
this.userLanguage(SettingsGet('UserLanguage')); this.userLanguage(SettingsGet('userLanguage'));
this.hourCycle(SettingsGet('hourCycle')); this.hourCycle(SettingsGet('hourCycle'));
} }
} }

View file

@ -3,7 +3,7 @@ import { addObservablesTo } from 'External/ko';
import { ThemeStore } from 'Stores/Theme'; import { ThemeStore } from 'Stores/Theme';
export const AppUserStore = { export const AppUserStore = {
allowContacts: () => !!SettingsGet('ContactsIsAllowed') allowContacts: () => !!SettingsGet('contactsAllowed')
}; };
addObservablesTo(AppUserStore, { addObservablesTo(AppUserStore, {

View file

@ -65,7 +65,7 @@ export const SettingsUserStore = new class {
let iAutoLogoutTimer; let iAutoLogoutTimer;
self.delayLogout = (() => { self.delayLogout = (() => {
clearTimeout(iAutoLogoutTimer); clearTimeout(iAutoLogoutTimer);
if (0 < self.autoLogout() && !SettingsGet('AccountSignMe')) { if (0 < self.autoLogout() && !SettingsGet('accountSignMe')) {
iAutoLogoutTimer = setTimeout( iAutoLogoutTimer = setTimeout(
rl.app.logout, rl.app.logout,
self.autoLogout() * 60000 self.autoLogout() * 60000

View file

@ -1005,7 +1005,7 @@ export class ComposePopupView extends AbstractViewPopup {
clickElement: dom.querySelector('#composeUploadButton'), clickElement: dom.querySelector('#composeUploadButton'),
dragAndDropElement: dom.querySelector('.b-attachment-place') dragAndDropElement: dom.querySelector('.b-attachment-place')
}), }),
attachmentSizeLimit = pInt(SettingsGet('AttachmentLimit')); attachmentSizeLimit = pInt(SettingsGet('attachmentLimit'));
oJua oJua
.on('onDragEnter', () => { .on('onDragEnter', () => {

View file

@ -110,7 +110,7 @@ export class LoginUserView extends AbstractViewLogin {
if (valid) { if (valid) {
this.submitRequest(true); this.submitRequest(true);
data.set('Language', this.bSendLanguage ? this.language() : ''); data.set('language', this.bSendLanguage ? this.language() : '');
data.set('signMe', this.signMe() ? 1 : 0); data.set('signMe', this.signMe() ? 1 : 0);
Remote.request('Login', Remote.request('Login',
(iError, oData) => { (iError, oData) => {

View file

@ -635,8 +635,8 @@ class Actions
if ($bAdmin) { if ($bAdmin) {
$aResult['Auth'] = $this->IsAdminLoggined(false); $aResult['Auth'] = $this->IsAdminLoggined(false);
if ($aResult['Auth']) { if ($aResult['Auth']) {
$aResult['AdminLogin'] = (string)$oConfig->Get('security', 'admin_login', ''); $aResult['adminLogin'] = (string)$oConfig->Get('security', 'admin_login', '');
$aResult['AdminTOTP'] = (string)$oConfig->Get('security', 'admin_totp', ''); $aResult['adminTOTP'] = (string)$oConfig->Get('security', 'admin_totp', '');
$aResult['pluginsEnable'] = (bool)$oConfig->Get('plugins', 'enable', false); $aResult['pluginsEnable'] = (bool)$oConfig->Get('plugins', 'enable', false);
$aResult['loginDefaultDomain'] = $oConfig->Get('login', 'default_domain', ''); $aResult['loginDefaultDomain'] = $oConfig->Get('login', 'default_domain', '');
@ -647,20 +647,20 @@ class Actions
$aResult['contactsEnable'] = (bool)$oConfig->Get('contacts', 'enable', false); $aResult['contactsEnable'] = (bool)$oConfig->Get('contacts', 'enable', false);
$aResult['contactsSync'] = (bool)$oConfig->Get('contacts', 'allow_sync', false); $aResult['contactsSync'] = (bool)$oConfig->Get('contacts', 'allow_sync', false);
$aResult['ContactsPdoType'] = Providers\AddressBook\PdoAddressBook::validPdoType($this->oConfig->Get('contacts', 'type', 'sqlite')); $aResult['contactsPdoType'] = Providers\AddressBook\PdoAddressBook::validPdoType($this->oConfig->Get('contacts', 'type', 'sqlite'));
$aResult['ContactsPdoDsn'] = (string)$oConfig->Get('contacts', 'pdo_dsn', ''); $aResult['contactsPdoDsn'] = (string)$oConfig->Get('contacts', 'pdo_dsn', '');
$aResult['ContactsPdoType'] = (string)$oConfig->Get('contacts', 'type', ''); $aResult['contactsPdoType'] = (string)$oConfig->Get('contacts', 'type', '');
$aResult['ContactsPdoUser'] = (string)$oConfig->Get('contacts', 'pdo_user', ''); $aResult['contactsPdoUser'] = (string)$oConfig->Get('contacts', 'pdo_user', '');
$aResult['ContactsPdoPassword'] = static::APP_DUMMY; $aResult['contactsPdoPassword'] = static::APP_DUMMY;
$aResult['ContactsSuggestionsLimit'] = (int)$oConfig->Get('contacts', 'suggestions_limit', 20); $aResult['contactsSuggestionsLimit'] = (int)$oConfig->Get('contacts', 'suggestions_limit', 20);
$aResult['faviconUrl'] = $oConfig->Get('webmail', 'favicon_url', ''); $aResult['faviconUrl'] = $oConfig->Get('webmail', 'favicon_url', '');
$aResult['WeakPassword'] = \is_file(APP_PRIVATE_DATA.'admin_password.txt'); $aResult['weakPassword'] = \is_file(APP_PRIVATE_DATA.'admin_password.txt');
$aResult['System']['languagesAdmin'] = \SnappyMail\L10n::getLanguages(true); $aResult['System']['languagesAdmin'] = \SnappyMail\L10n::getLanguages(true);
$aResult['LanguageAdmin'] = $this->ValidateLanguage($oConfig->Get('webmail', 'language_admin', 'en'), '', true); $aResult['languageAdmin'] = $this->ValidateLanguage($oConfig->Get('webmail', 'language_admin', 'en'), '', true);
$aResult['UserLanguageAdmin'] = $this->ValidateLanguage($UserLanguageRaw, '', true, true); $aResult['languageUsers'] = $this->ValidateLanguage($UserLanguageRaw, '', true, true);
} else { } else {
$passfile = APP_PRIVATE_DATA.'admin_password.txt'; $passfile = APP_PRIVATE_DATA.'admin_password.txt';
$sPassword = $oConfig->Get('security', 'admin_password', ''); $sPassword = $oConfig->Get('security', 'admin_password', '');
@ -678,11 +678,11 @@ class Actions
$aResult = \array_merge($aResult, [ $aResult = \array_merge($aResult, [
'Auth' => true, 'Auth' => true,
'Email' => \MailSo\Base\Utils::IdnToUtf8($oAccount->Email()), 'Email' => \MailSo\Base\Utils::IdnToUtf8($oAccount->Email()),
'AccountHash' => $oAccount->Hash(), 'accountHash' => $oAccount->Hash(),
'AccountSignMe' => isset($_COOKIE[self::AUTH_SIGN_ME_TOKEN_KEY]), 'accountSignMe' => isset($_COOKIE[self::AUTH_SIGN_ME_TOKEN_KEY]),
'MainEmail' => \MailSo\Base\Utils::IdnToUtf8($this->getMainAccountFromToken()->Email()), 'mainEmail' => \MailSo\Base\Utils::IdnToUtf8($this->getMainAccountFromToken()->Email()),
'ContactsIsAllowed' => $this->AddressBookProvider($oAccount)->IsActive(), 'contactsAllowed' => $this->AddressBookProvider($oAccount)->IsActive(),
'ViewHTML' => (bool) $oConfig->Get('defaults', 'view_html', true), 'ViewHTML' => (bool) $oConfig->Get('defaults', 'view_html', true),
'ViewImages' => 'ask', 'ViewImages' => 'ask',
@ -732,7 +732,7 @@ class Actions
) )
); );
if ($aResult['ContactsIsAllowed'] && $oConfig->Get('contacts', 'allow_sync', false)) { if ($aResult['contactsAllowed'] && $oConfig->Get('contacts', 'allow_sync', false)) {
$aData = $this->getContactsSyncData($oAccount) ?: [ $aData = $this->getContactsSyncData($oAccount) ?: [
'Mode' => 0, 'Mode' => 0,
'Url' => '', 'Url' => '',
@ -792,7 +792,7 @@ class Actions
} }
*/ */
if ($oConfig->Get('webmail', 'allow_languages_on_settings', true)) { if ($oConfig->Get('webmail', 'allow_languages_on_settings', true)) {
$sLanguage = (string) $oSettings->GetConf('Language', $sLanguage); $sLanguage = (string) $oSettings->GetConf('language', $sLanguage);
} }
$aResult['hourCycle'] = $oSettings->GetConf('hourCycle', ''); $aResult['hourCycle'] = $oSettings->GetConf('hourCycle', '');
@ -840,8 +840,8 @@ class Actions
$aResult['fontMono'] = $oSettings->GetConf('fontMono', ''); $aResult['fontMono'] = $oSettings->GetConf('fontMono', '');
if ($this->GetCapa(Enumerations\Capa::USER_BACKGROUND)) { if ($this->GetCapa(Enumerations\Capa::USER_BACKGROUND)) {
$aResult['userBackgroundName'] = (string)$oSettings->GetConf('UserBackgroundName', $aResult['UserBackgroundName']); $aResult['userBackgroundName'] = (string)$oSettings->GetConf('UserBackgroundName', '');
$aResult['userBackgroundHash'] = (string)$oSettings->GetConf('UserBackgroundHash', $aResult['UserBackgroundHash']); $aResult['userBackgroundHash'] = (string)$oSettings->GetConf('UserBackgroundHash', '');
} }
} }
@ -878,7 +878,7 @@ class Actions
case 'M': $upload_max_filesize *= 1024; case 'M': $upload_max_filesize *= 1024;
case 'K': $upload_max_filesize *= 1024; case 'K': $upload_max_filesize *= 1024;
} }
$aResult['AttachmentLimit'] = \min($upload_max_filesize, ((int) $oConfig->Get('webmail', 'attachment_size_limit', 10)) * 1024 * 1024); $aResult['attachmentLimit'] = \min($upload_max_filesize, ((int) $oConfig->Get('webmail', 'attachment_size_limit', 10)) * 1024 * 1024);
$aResult['phpUploadSizes'] = array( $aResult['phpUploadSizes'] = array(
'upload_max_filesize' => $value, 'upload_max_filesize' => $value,
'post_max_size' => \ini_get('post_max_size') 'post_max_size' => \ini_get('post_max_size')
@ -888,8 +888,8 @@ class Actions
$aResult['Theme'] = $this->GetTheme($bAdmin); $aResult['Theme'] = $this->GetTheme($bAdmin);
$aResult['Language'] = $this->ValidateLanguage($sLanguage, '', false); $aResult['language'] = $this->ValidateLanguage($sLanguage, '', false);
$aResult['UserLanguage'] = $this->ValidateLanguage($UserLanguageRaw, '', false, true); $aResult['userLanguage'] = $this->ValidateLanguage($UserLanguageRaw, '', false, true);
$aResult['PluginsLink'] = $this->oPlugins->HaveJs($bAdmin) $aResult['PluginsLink'] = $this->oPlugins->HaveJs($bAdmin)
? 'Plugins/0/' . ($bAdmin ? 'Admin' : 'User') . '/' . $this->StaticCache() . '/' ? 'Plugins/0/' . ($bAdmin ? 'Admin' : 'User') . '/' . $this->StaticCache() . '/'

View file

@ -202,10 +202,10 @@ trait Accounts
if ($this->switchAccount(\trim($this->GetActionParam('Email', '')))) { if ($this->switchAccount(\trim($this->GetActionParam('Email', '')))) {
$oAccount = $this->getAccountFromToken(); $oAccount = $this->getAccountFromToken();
$aResult['Email'] = $oAccount->Email(); $aResult['Email'] = $oAccount->Email();
$aResult['AccountHash'] = $oAccount->Hash(); $aResult['accountHash'] = $oAccount->Hash();
$aResult['MainEmail'] = ($oAccount instanceof AdditionalAccount) $aResult['mainEmail'] = ($oAccount instanceof AdditionalAccount)
? $oAccount->ParentEmail() : ''; ? $oAccount->ParentEmail() : '';
$aResult['ContactsIsAllowed'] = $this->AddressBookProvider($oAccount)->IsActive(); $aResult['contactsAllowed'] = $this->AddressBookProvider($oAccount)->IsActive();
$oSettingsLocal = $this->SettingsProvider(true)->Load($oAccount); $oSettingsLocal = $this->SettingsProvider(true)->Load($oAccount);
if ($oSettingsLocal instanceof \RainLoop\Settings) { if ($oSettingsLocal instanceof \RainLoop\Settings) {
$oConfig = $this->Config(); $oConfig = $this->Config();

View file

@ -14,7 +14,7 @@ trait Localization
if ($oAccount = $this->getAccountFromToken(false)) { if ($oAccount = $this->getAccountFromToken(false)) {
if ($oConfig->Get('webmail', 'allow_languages_on_settings', true) if ($oConfig->Get('webmail', 'allow_languages_on_settings', true)
&& ($oSettings = $this->SettingsProvider()->Load($oAccount))) { && ($oSettings = $this->SettingsProvider()->Load($oAccount))) {
$sLanguage = $oSettings->GetConf('Language', $sLanguage); $sLanguage = $oSettings->GetConf('language', $sLanguage);
} }
} else if ($oConfig->Get('login', 'allow_languages_on_login', true) && $oConfig->Get('login', 'determine_user_language', true)) { } else if ($oConfig->Get('login', 'allow_languages_on_login', true) && $oConfig->Get('login', 'determine_user_language', true)) {
$sLanguage = $this->ValidateLanguage($this->detectUserLanguage($bAdmin), $sLanguage, false); $sLanguage = $this->ValidateLanguage($this->detectUserLanguage($bAdmin), $sLanguage, false);

View file

@ -51,15 +51,15 @@ trait User
$this->Plugins()->RunHook('login.success', array($oAccount)); $this->Plugins()->RunHook('login.success', array($oAccount));
$sLanguage = $this->GetActionParam('Language', ''); $sLanguage = $this->GetActionParam('language', '');
if ($oAccount && $sLanguage) { if ($oAccount && $sLanguage) {
$oSettings = $this->SettingsProvider()->Load($oAccount); $oSettings = $this->SettingsProvider()->Load($oAccount);
if ($oSettings) { if ($oSettings) {
$sLanguage = $this->ValidateLanguage($sLanguage); $sLanguage = $this->ValidateLanguage($sLanguage);
$sCurrentLanguage = $oSettings->GetConf('Language', ''); $sCurrentLanguage = $oSettings->GetConf('language', '');
if ($sCurrentLanguage !== $sLanguage) { if ($sCurrentLanguage !== $sLanguage) {
$oSettings->SetConf('Language', $sLanguage); $oSettings->SetConf('language', $sLanguage);
$this->SettingsProvider()->Save($oAccount, $oSettings); $this->SettingsProvider()->Save($oAccount, $oSettings);
} }
} }
@ -145,11 +145,11 @@ trait User
$oSettingsLocal = $this->SettingsProvider(true)->Load($oAccount); $oSettingsLocal = $this->SettingsProvider(true)->Load($oAccount);
if ($oConfig->Get('webmail', 'allow_languages_on_settings', true)) { if ($oConfig->Get('webmail', 'allow_languages_on_settings', true)) {
$this->setSettingsFromParams($oSettings, 'Language', 'string', function ($sLanguage) use ($self) { $this->setSettingsFromParams($oSettings, 'language', 'string', function ($sLanguage) use ($self) {
return $self->ValidateLanguage($sLanguage); return $self->ValidateLanguage($sLanguage);
}); });
} else { } else {
// $oSettings->SetConf('Language', $this->ValidateLanguage($oConfig->Get('webmail', 'language', 'en'))); // $oSettings->SetConf('language', $this->ValidateLanguage($oConfig->Get('webmail', 'language', 'en')));
} }
$this->setSettingsFromParams($oSettings, 'hourCycle', 'string'); $this->setSettingsFromParams($oSettings, 'hourCycle', 'string');

View file

@ -48,11 +48,11 @@ class ActionsAdmin extends Actions
$self = $this; $self = $this;
$this->setConfigFromParams($oConfig, 'Language', 'webmail', 'language', 'string', function ($sLanguage) use ($self) { $this->setConfigFromParams($oConfig, 'language', 'webmail', 'language', 'string', function ($sLanguage) use ($self) {
return $self->ValidateLanguage($sLanguage, '', false); return $self->ValidateLanguage($sLanguage, '', false);
}); });
$this->setConfigFromParams($oConfig, 'LanguageAdmin', 'webmail', 'language_admin', 'string', function ($sLanguage) use ($self) { $this->setConfigFromParams($oConfig, 'languageAdmin', 'webmail', 'language_admin', 'string', function ($sLanguage) use ($self) {
return $self->ValidateLanguage($sLanguage, '', true); return $self->ValidateLanguage($sLanguage, '', true);
}); });
@ -64,18 +64,17 @@ class ActionsAdmin extends Actions
$this->setConfigFromParams($oConfig, 'allowLanguagesOnSettings', 'webmail', 'allow_languages_on_settings', 'bool'); $this->setConfigFromParams($oConfig, 'allowLanguagesOnSettings', 'webmail', 'allow_languages_on_settings', 'bool');
$this->setConfigFromParams($oConfig, 'allowLanguagesOnLogin', 'login', 'allow_languages_on_login', 'bool'); $this->setConfigFromParams($oConfig, 'allowLanguagesOnLogin', 'login', 'allow_languages_on_login', 'bool');
$this->setConfigFromParams($oConfig, 'AttachmentLimit', 'webmail', 'attachment_size_limit', 'int'); $this->setConfigFromParams($oConfig, 'attachmentLimit', 'webmail', 'attachment_size_limit', 'int');
$this->setConfigFromParams($oConfig, 'loginDefaultDomain', 'login', 'default_domain', 'string'); $this->setConfigFromParams($oConfig, 'loginDefaultDomain', 'login', 'default_domain', 'string');
$this->setConfigFromParams($oConfig, 'contactsEnable', 'contacts', 'enable', 'bool'); $this->setConfigFromParams($oConfig, 'contactsEnable', 'contacts', 'enable', 'bool');
$this->setConfigFromParams($oConfig, 'contactsSync', 'contacts', 'allow_sync', 'bool'); $this->setConfigFromParams($oConfig, 'contactsSync', 'contacts', 'allow_sync', 'bool');
$this->setConfigFromParams($oConfig, 'ContactsPdoDsn', 'contacts', 'pdo_dsn', 'string'); $this->setConfigFromParams($oConfig, 'contactsPdoDsn', 'contacts', 'pdo_dsn', 'string');
$this->setConfigFromParams($oConfig, 'ContactsPdoUser', 'contacts', 'pdo_user', 'string'); $this->setConfigFromParams($oConfig, 'contactsPdoUser', 'contacts', 'pdo_user', 'string');
$this->setConfigFromParams($oConfig, 'ContactsPdoPassword', 'contacts', 'pdo_password', 'dummy'); $this->setConfigFromParams($oConfig, 'contactsPdoPassword', 'contacts', 'pdo_password', 'dummy');
$this->setConfigFromParams($oConfig, 'ContactsSuggestionsLimit', 'contacts', 'suggestions_limit', 'int'); $this->setConfigFromParams($oConfig, 'contactsSuggestionsLimit', 'contacts', 'suggestions_limit', 'int');
$this->setConfigFromParams($oConfig, 'contactsPdoType', 'contacts', 'type', 'string', function ($sType) use ($self) {
$this->setConfigFromParams($oConfig, 'ContactsPdoType', 'contacts', 'type', 'string', function ($sType) use ($self) {
return Providers\AddressBook\PdoAddressBook::validPdoType($sType); return Providers\AddressBook\PdoAddressBook::validPdoType($sType);
}); });
@ -142,10 +141,10 @@ class ActionsAdmin extends Actions
$this->IsAdminLoggined(); $this->IsAdminLoggined();
$oConfig = $this->Config(); $oConfig = $this->Config();
$this->setConfigFromParams($oConfig, 'ContactsPdoDsn', 'contacts', 'pdo_dsn', 'string'); $this->setConfigFromParams($oConfig, 'contactsPdoDsn', 'contacts', 'pdo_dsn', 'string');
$this->setConfigFromParams($oConfig, 'ContactsPdoUser', 'contacts', 'pdo_user', 'string'); $this->setConfigFromParams($oConfig, 'contactsPdoUser', 'contacts', 'pdo_user', 'string');
$this->setConfigFromParams($oConfig, 'ContactsPdoPassword', 'contacts', 'pdo_password', 'dummy'); $this->setConfigFromParams($oConfig, 'contactsPdoPassword', 'contacts', 'pdo_password', 'dummy');
$this->setConfigFromParams($oConfig, 'ContactsPdoType', 'contacts', 'type', 'string', function ($sType) { $this->setConfigFromParams($oConfig, 'contactsPdoType', 'contacts', 'type', 'string', function ($sType) {
return Providers\AddressBook\PdoAddressBook::validPdoType($sType); return Providers\AddressBook\PdoAddressBook::validPdoType($sType);
}); });

View file

@ -578,14 +578,14 @@ class ServiceActions
$oSettings = $this->SettingsProvider()->Load($oAccount); $oSettings = $this->SettingsProvider()->Load($oAccount);
if ($oSettings) { if ($oSettings) {
$sLanguage = isset($aAdditionalOptions['Language']) ? $sLanguage = isset($aAdditionalOptions['language']) ?
$aAdditionalOptions['Language'] : ''; $aAdditionalOptions['language'] : '';
if ($sLanguage) { if ($sLanguage) {
$sLanguage = $this->oActions->ValidateLanguage($sLanguage); $sLanguage = $this->oActions->ValidateLanguage($sLanguage);
if ($sLanguage !== $oSettings->GetConf('Language', '')) { if ($sLanguage !== $oSettings->GetConf('language', '')) {
$bNeedToSettings = true; $bNeedToSettings = true;
$oSettings->SetConf('Language', $sLanguage); $oSettings->SetConf('language', $sLanguage);
} }
} }
} }

View file

@ -14,6 +14,10 @@ class Settings implements \JsonSerializable
if (isset($aData['DraftFolder']) && !isset($aData['DraftsFolder'])) { if (isset($aData['DraftFolder']) && !isset($aData['DraftsFolder'])) {
$aData['DraftsFolder'] = $aData['DraftFolder']; $aData['DraftsFolder'] = $aData['DraftFolder'];
} }
if (isset($aData['Language']) && !isset($aData['language'])) {
$aData['language'] = $aData['Language'];
unset($aData['Language']);
}
$this->aData = $aData; $this->aData = $aData;
} }