Found more JSON properties to change into JavaScript camelCase

This commit is contained in:
the-djmaze 2023-01-26 10:41:55 +01:00
parent b9ef8ae2c9
commit 974350ebee
45 changed files with 361 additions and 412 deletions

View file

@ -79,7 +79,7 @@ export class AppUser extends AbstractApp {
(currentTime > (lastTime + interval + 1000))
&& Remote.request('Version',
iError => (100 < iError) && location.reload(),
{ Version: Settings.app('version') }
{ version: Settings.app('version') }
);
lastTime = currentTime;
}, interval);

View file

@ -198,7 +198,7 @@ folderInformationMultiply = (boot = false) => {
boot && setTimeout(() => folderInformationMultiply(true), 2000);
}
}, {
Folders: folders
folders: folders
});
}
},
@ -226,11 +226,11 @@ messagesMoveHelper = (fromFolderFullName, toFolderFullName, uidsForMove) => {
Remote.abort('MessageList').request('MessageMove',
moveOrDeleteResponseHelper,
{
FromFolder: fromFolderFullName,
ToFolder: toFolderFullName,
Uids: [...uidsForMove].join(','),
MarkAsRead: (isSpam || FolderUserStore.trashFolder() === toFolderFullName) ? 1 : 0,
Learning: isSpam ? 'SPAM' : isHam ? 'HAM' : ''
fromFolder: fromFolderFullName,
toFolder: toFolderFullName,
uids: [...uidsForMove].join(','),
markAsRead: (isSpam || FolderUserStore.trashFolder() === toFolderFullName) ? 1 : 0,
learning: isSpam ? 'SPAM' : isHam ? 'HAM' : ''
}
);
},
@ -240,7 +240,7 @@ messagesDeleteHelper = (sFromFolderFullName, aUidForRemove) => {
moveOrDeleteResponseHelper,
{
folder: sFromFolderFullName,
Uids: [...aUidForRemove].join(',')
uids: [...aUidForRemove].join(',')
}
);
},
@ -259,9 +259,9 @@ moveMessagesToFolder = (sFromFolderFullName, oUids, sToFolderFullName, bCopy) =>
if (oFromFolder && oToFolder) {
bCopy
? Remote.request('MessageCopy', null, {
FromFolder: oFromFolder.fullName,
ToFolder: oToFolder.fullName,
Uids: [...oUids].join(',')
fromFolder: oFromFolder.fullName,
toFolder: oToFolder.fullName,
uids: [...oUids].join(',')
})
: messagesMoveHelper(oFromFolder.fullName, oToFolder.fullName, oUids);
@ -283,7 +283,7 @@ dropFilesInFolder = (sFolderFullName, files) => {
++count;
let data = new FormData;
data.append('folder', sFolderFullName);
data.append('AppendFile', file);
data.append('appendFile', file);
data.XToken = Settings.app('token');
fetch(serverRequest('Append'), {
method: 'POST',

View file

@ -12,6 +12,7 @@ import { SettingsUserStore } from 'Stores/User/Settings';
import * as Local from 'Storage/Client';
import { ThemeStore } from 'Stores/Theme';
import Remote from 'Remote/User/Fetch';
import { attachmentDownload } from 'Common/Links';
export const
@ -42,6 +43,28 @@ download = (link, name = "") => {
}
},
downloadZip = (hashes, onError, fTrigger, folder) => {
if (hashes.length) {
let params = {
target: 'zip',
hashes: hashes
};
if (!onError) {
onError = () => alert('Download failed');
}
if (folder) {
params.folder = folder;
// params.uids = uids;
}
Remote.post('AttachmentsActions', fTrigger || null, params)
.then(result => {
let hash = result?.Result?.fileHash;
hash ? download(attachmentDownload(hash), hash+'.zip') : onError();
})
.catch(onError);
}
},
/**
* @returns {function}
*/

View file

@ -301,8 +301,8 @@ export class FolderModel extends AbstractModel {
this.exists = true;
this.hash = '';
// this.id = null;
this.uidNext = null;
this.id = 0;
this.uidNext = 0;
addObservablesTo(this, {
name: '',

View file

@ -44,9 +44,9 @@ const
}
}, {
folder: message.folder,
Uids: message.uid,
Keyword: keyword,
SetAction: isSet ? 0 : 1
uids: message.uid,
keyword: keyword,
setAction: isSet ? 0 : 1
})
},

View file

@ -59,10 +59,10 @@ export class AdminSettingsAbout /*extends AbstractViewSettings*/ {
this.coreChecking(false);
if (!iError && data?.Result) {
this.coreReal(true);
this.coreUpdatable(!!data.Result.Updatable);
this.coreWarning(!!data.Result.Warning);
this.coreVersion(data.Result.Version || '');
this.coreVersionCompare(data.Result.VersionCompare);
this.coreUpdatable(!!data.Result.updatable);
this.coreWarning(!!data.Result.warning);
this.coreVersion(data.Result.version || '');
this.coreVersionCompare(data.Result.versionCompare);
} else {
this.coreReal(false);
this.coreWarning(false);

View file

@ -25,7 +25,7 @@ export class AdminSettingsDomains /*extends AbstractViewSettings*/ {
}
},
{
username: this.username()
username: this.username
}
);
}
@ -41,15 +41,15 @@ export class AdminSettingsDomains /*extends AbstractViewSettings*/ {
deleteDomain(domain) {
DomainAdminStore.remove(domain);
Remote.request('AdminDomainDelete', DomainAdminStore.fetch, {
Name: domain.name
name: domain.name
});
}
disableDomain(domain) {
domain.disabled(!domain.disabled());
Remote.request('AdminDomainDisable', DomainAdminStore.fetch, {
Name: domain.name,
Disabled: domain.disabled() ? 1 : 0
name: domain.name,
disabled: domain.disabled() ? 1 : 0
});
}
@ -59,7 +59,7 @@ export class AdminSettingsDomains /*extends AbstractViewSettings*/ {
el && ko.dataFor(el) && Remote.request('AdminDomainLoad',
(iError, oData) => iError || showScreenPopup(DomainPopupView, [oData.Result]),
{
Name: ko.dataFor(el).name
name: ko.dataFor(el).name
}
);

View file

@ -46,7 +46,7 @@ export class AdminSettingsPackages extends AbstractViewSettings {
data && Remote.request('AdminPluginLoad',
(iError, data) => iError || showScreenPopup(PluginPopupView, [data.Result]),
{
Id: data.id
id: data.id
}
);
// disablePlugin
@ -84,7 +84,7 @@ export class AdminSettingsPackages extends AbstractViewSettings {
Remote.request('AdminPackageDelete',
this.requestHelper(packageToDelete, false),
{
Id: packageToDelete.id
id: packageToDelete.id
}
);
}
@ -96,9 +96,9 @@ export class AdminSettingsPackages extends AbstractViewSettings {
Remote.request('AdminPackageInstall',
this.requestHelper(packageToInstall, true),
{
Id: packageToInstall.id,
Type: packageToInstall.type,
File: packageToInstall.file
id: packageToInstall.id,
type: packageToInstall.type,
file: packageToInstall.file
},
60000
);
@ -120,8 +120,8 @@ export class AdminSettingsPackages extends AbstractViewSettings {
}
// PackageAdminStore.fetch();
}, {
Id: plugin.id,
Disabled: disable ? 1 : 0
id: plugin.id,
disabled: disable ? 1 : 0
}
);
}

View file

@ -102,10 +102,10 @@ export class AdminSettingsSecurity extends AbstractViewSettings {
this.weakPassword(!!data.Result.Weak);
}
}, {
'Login': this.adminLogin(),
'Password': this.adminPassword(),
'NewPassword': this.adminPasswordNew(),
'TOTP': this.adminTOTP()
Login: this.adminLogin(),
Password: this.adminPassword(),
newPassword: this.adminPasswordNew(),
TOTP: this.adminTOTP()
});
return true;

View file

@ -67,7 +67,7 @@ export class UserSettingsAccounts /*extends AbstractViewSettings*/ {
rl.app.accountsAndIdentities();
}
}, {
EmailToDelete: accountToRemove.email
emailToDelete: accountToRemove.email
});
}
}
@ -81,7 +81,7 @@ export class UserSettingsAccounts /*extends AbstractViewSettings*/ {
this.identityForDeletion(null);
IdentityUserStore.remove(oIdentity => identityToRemove === oIdentity);
Remote.request('IdentityDelete', () => rl.app.accountsAndIdentities(), {
IdToDelete: identityToRemove.id()
idToDelete: identityToRemove.id()
});
}
}

View file

@ -160,8 +160,8 @@ export class UserSettingsFolders /*extends AbstractViewSettings*/ {
// TODO: append '.default' ?
Remote.request('FolderSetMetadata', null, {
folder: folder.fullName,
Key: FolderMetadataKeys.KolabFolderType,
Value: type
key: FolderMetadataKeys.KolabFolderType,
value: type
});
folder.kolabType(type);
}

View file

@ -20,6 +20,6 @@ DomainAdminStore.fetch = () => {
);
}
}, {
IncludeAliases: 1
includeAliases: 1
});
};

View file

@ -79,7 +79,7 @@ export const GnuPGUserStore = new class {
}, {
keyId: key.id,
isPrivate: isPrivate,
Passphrase: pass
passphrase: pass
}
);
if (isPrivate) {
@ -115,7 +115,7 @@ export const GnuPGUserStore = new class {
}
callback?.(iError, oData);
}, {
Key: key
key: key
}
);
}
@ -181,10 +181,10 @@ export const GnuPGUserStore = new class {
uid: message.uid,
partId: pgpInfo.PartId,
keyId: key.id,
Passphrase: await askPassphrase(key, 'BUTTON_DECRYPT'),
Data: '' // message.plain() optional
passphrase: await askPassphrase(key, 'BUTTON_DECRYPT'),
data: '' // message.plain() optional
}
if (null !== params.Passphrase) {
if (null !== params.passphrase) {
const result = await Remote.post('GnupgDecrypt', null, params);
if (result?.Result && false !== result.Result.data) {
return result.Result;
@ -202,9 +202,9 @@ export const GnuPGUserStore = new class {
// let mode = await this.hasPublicKeyForEmails([sender]);
data.folder = message.folder;
data.uid = message.uid;
if (data.BodyPart) {
data.BodyPart = data.BodyPart.raw;
data.SigPart = data.SigPart.body;
if (data.bodyPart) {
data.bodyPart = data.bodyPart.raw;
data.sigPart = data.sigPart.body;
}
let response = await Remote.post('MessagePgpVerify', null, data);
if (response?.Result) {

View file

@ -331,8 +331,8 @@ MessagelistUserStore.setAction = (sFolderFullName, iSetAction, messages) => {
}
Remote.request('MessageSetSeen', null, {
folder: sFolderFullName,
Uids: rootUids.join(','),
SetAction: iSetAction == MessageSetAction.SetSeen ? 1 : 0
uids: rootUids.join(','),
setAction: iSetAction == MessageSetAction.SetSeen ? 1 : 0
});
break;
@ -340,8 +340,8 @@ MessagelistUserStore.setAction = (sFolderFullName, iSetAction, messages) => {
case MessageSetAction.UnsetFlag:
Remote.request('MessageSetFlagged', null, {
folder: sFolderFullName,
Uids: rootUids.join(','),
SetAction: iSetAction == MessageSetAction.SetFlag ? 1 : 0
uids: rootUids.join(','),
setAction: iSetAction == MessageSetAction.SetFlag ? 1 : 0
});
break;
// no default

View file

@ -219,12 +219,13 @@ export const OpenPGPUserStore = new class {
if (data && publicKey) {
data.folder = message.folder;
data.uid = message.uid;
data.GnuPG = 0;
data.tryGnuPG = 0;
let response;
if (data.sigPartId) {
response = await Remote.post('MessagePgpVerify', null, data);
} else if (data.BodyPart) {
response = { Result: { text: data.BodyPart.raw, signature: data.SigPart.body } };
} else if (data.bodyPart) {
// MimePart
response = { Result: { text: data.bodyPart.raw, signature: data.sigPart.body } };
} else {
response = { Result: { text: message.plain(), signature: null } };
}

View file

@ -29,7 +29,7 @@ export class AccountPopupView extends AbstractViewPopup {
submitForm(form) {
if (!this.submitRequest() && form.reportValidity()) {
const data = new FormData(form);
data.set('New', this.isNew() ? 1 : 0);
data.set('new', this.isNew() ? 1 : 0);
this.submitRequest(true);
Remote.request('AccountSetup', (iError, data) => {
this.submitRequest(false);

View file

@ -1482,7 +1482,7 @@ export class ComposePopupView extends AbstractViewPopup {
signature.body = await OpenPGPUserStore.sign(data.toString(), sign[1], 1);
signed.children.push(signature);
params.signed = signed.toString();
params.Boundary = signed.boundary;
params.boundary = signed.boundary;
data = signed;
} else if ('gnupg' == sign[0]) {
// TODO: sign in PHP fails

View file

@ -104,10 +104,10 @@ export class ContactsPopupView extends AbstractViewPopup {
const contacts = this.contactsCheckedOrSelected();
if (contacts.length) {
let selectorContact = this.selectorContact(),
Uids = [],
uids = [],
count = 0;
contacts.forEach(contact => {
Uids.push(contact.id());
uids.push(contact.id());
if (selectorContact && selectorContact.id() === contact.id()) {
this.selectorContact(selectorContact = null);
}
@ -127,7 +127,7 @@ export class ContactsPopupView extends AbstractViewPopup {
}
this.reloadContactList();
}, {
Uids: Uids.join(',')
uids: uids.join(',')
}
);
}

View file

@ -14,13 +14,64 @@ import { AskPopupView } from 'View/Popup/Ask';
const
capitalize = string => string.charAt(0).toUpperCase() + string.slice(1),
domainDefaults = {
enableSmartPorts: false,
savingError: '',
name: '',
imapHost: '',
imapPort: 143,
imapType: 0,
imapTimeout: 300,
imapShortLogin: false,
// SSL
imapSslVerify_peer: false,
imapSslAllow_self_signed: false,
// Options
imapDisable_list_status: false,
imapDisable_metadata: false,
imapDisable_move: false,
imapDisable_sort: false,
imapDisable_thread: false,
imapExpunge_all_on_delete: false,
imapFast_simple_search: true,
imapFetch_new_messages: true,
imapForce_select: false,
imapFolder_list_limit: 200,
imapMessage_all_headers: false,
imapMessage_list_limit: 0,
imapSearch_filter: '',
sieveEnabled: false,
sieveHost: '',
sievePort: 4190,
sieveType: 0,
sieveTimeout: 10,
smtpHost: '',
smtpPort: 25,
smtpType: 0,
smtpTimeout: 60,
smtpShortLogin: false,
smtpUseAuth: true,
smtpSetSender: false,
smtpUsePhpMail: false,
// SSL
smtpSslVerify_peer: false,
smtpSslAllow_self_signed: false,
whiteList: '',
aliasName: ''
},
domainToParams = oDomain => ({
Name: oDomain.name(),
name: oDomain.name,
IMAP: {
host: oDomain.imapHost(),
port: oDomain.imapPort(),
host: oDomain.imapHost,
port: oDomain.imapPort,
secure: pInt(oDomain.imapType()),
timeout: oDomain.imapTimeout(),
timeout: oDomain.imapTimeout,
shortLogin: !!oDomain.imapShortLogin(),
ssl: {
verify_peer: !!oDomain.imapSslVerify_peer(),
@ -44,10 +95,10 @@ const
*/
},
SMTP: {
host: oDomain.smtpHost(),
port: oDomain.smtpPort(),
host: oDomain.smtpHost,
port: oDomain.smtpPort,
secure: pInt(oDomain.smtpType()),
timeout: oDomain.smtpTimeout(),
timeout: oDomain.smtpTimeout,
shortLogin: !!oDomain.smtpShortLogin(),
ssl: {
verify_peer: !!oDomain.smtpSslVerify_peer(),
@ -60,10 +111,10 @@ const
},
Sieve: {
enabled: !!oDomain.sieveEnabled(),
host: oDomain.sieveHost(),
port: oDomain.sievePort(),
host: oDomain.sieveHost,
port: oDomain.sievePort,
secure: pInt(oDomain.sieveType()),
timeout: oDomain.sieveTimeout(),
timeout: oDomain.sieveTimeout,
shortLogin: !!oDomain.imapShortLogin(),
ssl: {
verify_peer: !!oDomain.imapSslVerify_peer(),
@ -71,14 +122,14 @@ const
allow_self_signed: !!oDomain.imapSslAllow_self_signed()
}
},
whiteList: oDomain.whiteList()
whiteList: oDomain.whiteList
});
export class DomainPopupView extends AbstractViewPopup {
constructor() {
super('Domain');
addObservablesTo(this, this.getDefaults());
addObservablesTo(this, domainDefaults);
addObservablesTo(this, {
edit: false,
@ -99,21 +150,11 @@ export class DomainPopupView extends AbstractViewPopup {
headerText: () => {
const name = this.name(),
aliasName = this.aliasName();
let result = '';
if (this.edit()) {
result = i18n('POPUPS_DOMAIN/TITLE_EDIT_DOMAIN', { NAME: name });
if (aliasName) {
result += ' ⫘ ' + aliasName;
}
} else {
result = name
? i18n('POPUPS_DOMAIN/TITLE_ADD_DOMAIN_WITH_NAME', { NAME: name })
: i18n('POPUPS_DOMAIN/TITLE_ADD_DOMAIN');
}
return result;
return this.edit()
? i18n('POPUPS_DOMAIN/TITLE_EDIT_DOMAIN', { NAME: name }) + (aliasName ? ' ⫘ ' + aliasName : '')
: (name
? i18n('POPUPS_DOMAIN/TITLE_ADD_DOMAIN_WITH_NAME', { NAME: name })
: i18n('POPUPS_DOMAIN/TITLE_ADD_DOMAIN'));
},
domainDesc: () => {
@ -213,7 +254,7 @@ export class DomainPopupView extends AbstractViewPopup {
}
},
Object.assign(domainToParams(this), {
Create: this.edit() ? 0 : 1
create: this.edit() ? 0 : 1
})
);
}
@ -260,7 +301,9 @@ export class DomainPopupView extends AbstractViewPopup {
onShow(oDomain) {
this.saving(false);
this.clearTesting();
this.clearForm();
this.edit(false);
forEachObjectEntry(domainDefaults, (key, value) => this[key](value));
this.enableSmartPorts(true);
if (oDomain) {
this.enableSmartPorts(false);
this.edit(true);
@ -284,64 +327,4 @@ export class DomainPopupView extends AbstractViewPopup {
this.enableSmartPorts(true);
}
}
getDefaults() {
return {
enableSmartPorts: false,
savingError: '',
name: '',
imapHost: '',
imapPort: 143,
imapType: 0,
imapTimeout: 300,
imapShortLogin: false,
// SSL
imapSslVerify_peer: false,
imapSslAllow_self_signed: false,
// Options
imapDisable_list_status: false,
imapDisable_metadata: false,
imapDisable_move: false,
imapDisable_sort: false,
imapDisable_thread: false,
imapExpunge_all_on_delete: false,
imapFast_simple_search: true,
imapFetch_new_messages: true,
imapForce_select: false,
imapFolder_list_limit: 200,
imapMessage_all_headers: false,
imapMessage_list_limit: 0,
imapSearch_filter: '',
sieveEnabled: false,
sieveHost: '',
sievePort: 4190,
sieveType: 0,
sieveTimeout: 10,
smtpHost: '',
smtpPort: 25,
smtpType: 0,
smtpTimeout: 60,
smtpShortLogin: false,
smtpUseAuth: true,
smtpSetSender: false,
smtpUsePhpMail: false,
// SSL
smtpSslVerify_peer: false,
smtpSslAllow_self_signed: false,
whiteList: '',
aliasName: ''
};
}
clearForm() {
this.edit(false);
forEachObjectEntry(this.getDefaults(), (key, value) => this[key](value));
this.enableSmartPorts(true);
}
}

View file

@ -46,21 +46,15 @@ export class DomainAliasPopupView extends AbstractViewPopup {
this.close();
}
}, {
Name: this.name(),
Alias: this.alias()
name: this.name,
alias: this.alias
});
}
onShow() {
this.clearForm();
}
clearForm() {
this.saving(false);
this.savingError('');
this.name('');
this.alias('');
}
}

View file

@ -41,19 +41,19 @@ export class PluginPopupView extends AbstractViewPopup {
saveCommand() {
const oConfig = {
Id: this.id(),
Settings: {}
id: this.id,
settings: {}
},
setItem = item => {
let value = item.value();
if (false === value || true === value) {
value = value ? 1 : 0;
}
oConfig.Settings[item.Name] = value;
oConfig.settings[item.name] = value;
};
this.config.forEach(oItem => {
if (7 == oItem.Type) {
if (7 == oItem.type) {
// Group
oItem.config.forEach(oSubItem => setItem(oSubItem));
} else {
@ -76,15 +76,15 @@ export class PluginPopupView extends AbstractViewPopup {
this.config([]);
if (oPlugin) {
this.id(oPlugin.Id);
this.name(oPlugin.Name);
this.readme(oPlugin.Readme);
this.id(oPlugin.id);
this.name(oPlugin.name);
this.readme(oPlugin.readme);
const config = oPlugin.Config;
const config = oPlugin.config;
if (arrayLength(config)) {
this.config(
config.map(item => {
if (7 == item.Type) {
if (7 == item.type) {
// Group
item.config.forEach(subItem => {
subItem.value = ko.observable(subItem.value);

View file

@ -13,11 +13,11 @@ import { doc,
} from 'Common/Globals';
import { arrayLength } from 'Common/Utils';
import { computedPaginatorHelper, showMessageComposer, populateMessageBody, download, moveAction } from 'Common/UtilsUser';
import { computedPaginatorHelper, showMessageComposer, populateMessageBody, downloadZip, moveAction } from 'Common/UtilsUser';
import { FileInfo } from 'Common/File';
import { isFullscreen, toggleFullscreen } from 'Common/Fullscreen';
import { mailBox, attachmentDownload } from 'Common/Links';
import { mailBox } from 'Common/Links';
import { Selector } from 'Common/Selector';
import { i18n } from 'Common/Translator';
@ -367,23 +367,7 @@ export class MailMessageList extends AbstractViewRight {
let hashes = []/*, uids = []*/;
// MessagelistUserStore.forEach(message => message.checked() && uids.push(message.uid));
MessagelistUserStore.forEach(message => message.checked() && hashes.push(message.requestHash));
if (hashes.length) {
Remote.post('AttachmentsActions', null, {
Do: 'Zip',
folder: MessagelistUserStore().folder,
// Uids: uids,
Hashes: hashes
})
.then(result => {
let hash = result?.Result?.fileHash;
if (hash) {
download(attachmentDownload(hash), hash+'.zip');
} else {
alert('Download failed');
}
})
.catch(() => alert('Download failed'));
}
downloadZip(hashes, null, null, MessagelistUserStore().folder);
}
downloadAttachCommand() {
@ -397,21 +381,7 @@ export class MailMessageList extends AbstractViewRight {
});
}
});
if (hashes.length) {
Remote.post('AttachmentsActions', null, {
Do: 'Zip',
Hashes: hashes
})
.then(result => {
let hash = result?.Result?.fileHash;
if (hash) {
download(attachmentDownload(hash), hash+'.zip');
} else {
alert('Download failed');
}
})
.catch(() => alert('Download failed'));
}
downloadZip(hashes);
}
deleteWithoutMoveCommand() {
@ -505,8 +475,8 @@ export class MailMessageList extends AbstractViewRight {
Remote.request('MessageSetSeenToAll', null, {
folder: sFolderFullName,
SetAction: 1,
ThreadUids: uids.join(',')
setAction: 1,
threadUids: uids.join(',')
});
MessagelistUserStore.reloadFlagsAndCachedMessage();

View file

@ -23,13 +23,12 @@ import {
} from 'Common/Globals';
import { arrayLength } from 'Common/Utils';
import { download, mailToHelper, showMessageComposer, moveAction } from 'Common/UtilsUser';
import { download, downloadZip, mailToHelper, showMessageComposer, moveAction } from 'Common/UtilsUser';
import { isFullscreen, exitFullscreen, toggleFullscreen } from 'Common/Fullscreen';
import { SMAudio } from 'Common/Audio';
import { i18n } from 'Common/Translator';
import { attachmentDownload } from 'Common/Links';
import { MessageFlagsCache } from 'Common/Cache';
@ -486,21 +485,10 @@ export class MailMessageView extends AbstractViewRight {
const hashes = (currentMessage()?.attachments || [])
.map(item => item?.checked() /*&& !item?.isLinked()*/ ? item.download : '')
.filter(v => v);
if (hashes.length) {
Remote.post('AttachmentsActions', this.downloadAsZipLoading, {
Do: 'Zip',
Hashes: hashes
})
.then(result => {
let hash = result?.Result?.fileHash;
if (hash) {
download(attachmentDownload(hash), hash+'.zip');
} else {
this.downloadAsZipError(true);
}
})
.catch(() => this.downloadAsZipError(true));
}
downloadZip(hashes,
() => this.downloadAsZipError(true),
this.downloadAsZipLoading
);
}
/**

View file

@ -455,11 +455,18 @@ Converts HTML to text
Converts text to HTML
## rl.addSettingsViewModel(SettingsViewModelClass, template, labelName, route)
Examples in
* ./change-password/js/ChangePasswordUserSettings.js
* ./example/js/ExampleUserSettings.js
* ./kolab/js/settings.js
* ./two-factor-auth/js/TwoFactorAuthSettings.js
## rl.addSettingsViewModelForAdmin(SettingsViewModelClass, template, labelName, route)
Examples in
* ./example/js/ExampleAdminSettings.js:34: rl.addSettingsViewModelForAdmin(ExampleAdminSettings, 'ExampleAdminSettingsTab',
## rl.adminArea()
Returns true or false
Returns true or false when in '?admin' area
## rl.app.Remote.abort(action)

View file

@ -63,8 +63,8 @@
if (folder) {
rl.fetchJSON('./?/Json/&q[]=/0/', {}, {
Action: 'AttachmentsActions',
Do: 'nextcloud',
Hashes: hashes,
target: 'nextcloud',
hashes: hashes,
NcFolder: folder
})
.then(result => {

View file

@ -28,9 +28,8 @@
}
});
let template = document.getElementById('MailMessageList');
const msgMenu = template.content.querySelector('#more-list-dropdown-id + menu [data-bind*="forwardCommand"]');
const msgMenu = document.getElementById('MailMessageList')
.content.querySelector('#more-list-dropdown-id + menu [data-bind*="forwardCommand"]');
if (msgMenu) {
msgMenu.after(Element.fromHTML(`<li role="presentation" data-bind="css:{disabled:!messageList.hasChecked()}">
<a href="#" tabindex="-1" data-icon="📥" data-bind="click: nextcloudSaveMsgs" data-i18n="NEXTCLOUD/SAVE_EML"></a>

View file

@ -926,7 +926,7 @@ class Actions
public function DoVersion(): array
{
return $this->DefaultResponse(APP_VERSION === (string)$this->GetActionParam('Version', ''));
return $this->DefaultResponse(APP_VERSION === (string)$this->GetActionParam('version', ''));
}
public function MainClearFileName(string $sFileName, string $sContentType, string $sMimeIndex, int $iMaxLength = 250): string
@ -988,15 +988,12 @@ class Actions
return $sError;
}
public function Upload(): array
public function Upload(?array $aFile, int $iError): array
{
$oAccount = $this->getAccountFromToken();
$aResponse = array();
$aFile = $this->GetActionParam('File', null);
$iError = $this->GetActionParam('Error', Enumerations\UploadError::UNKNOWN);
if ($oAccount && UPLOAD_ERR_OK === $iError && \is_array($aFile)) {
$sSavedName = 'upload-post-' . \md5($aFile['name'] . $aFile['tmp_name']);

View file

@ -80,10 +80,10 @@ trait Accounts
$aAccounts = $this->GetAccounts($oMainAccount);
$sEmail = \trim($this->GetActionParam('Email', ''));
$sPassword = $this->GetActionParam('Password', '');
$sName = $this->GetActionParam('Name', '');
$bNew = '1' === (string)$this->GetActionParam('New', '1');
$sEmail = \trim($this->GetActionParam('email', ''));
$sPassword = $this->GetActionParam('password', '');
$sName = \trim($this->GetActionParam('name', ''));
$bNew = !empty($this->GetActionParam('new', 1));
$sEmail = \MailSo\Base\Utils::IdnToAscii($sEmail, true);
if ($bNew && ($oMainAccount->Email() === $sEmail || isset($aAccounts[$sEmail]))) {
@ -172,7 +172,7 @@ trait Accounts
return $this->FalseResponse();
}
$sEmailToDelete = \trim($this->GetActionParam('EmailToDelete', ''));
$sEmailToDelete = \trim($this->GetActionParam('emailToDelete', ''));
$sEmailToDelete = \MailSo\Base\Utils::IdnToAscii($sEmailToDelete, true);
$aAccounts = $this->GetAccounts($oMainAccount);
@ -255,7 +255,7 @@ trait Accounts
return $this->FalseResponse();
}
$sId = \trim($this->GetActionParam('IdToDelete', ''));
$sId = \trim($this->GetActionParam('idToDelete', ''));
if (empty($sId)) {
throw new ClientException(Notifications::UnknownError);
}

View file

@ -11,13 +11,13 @@ trait AdminDomains
{
$this->IsAdminLoggined();
return $this->DefaultResponse($this->DomainProvider()->Load($this->GetActionParam('Name', ''), false, false));
return $this->DefaultResponse($this->DomainProvider()->Load($this->GetActionParam('name', ''), false, false));
}
public function DoAdminDomainList() : array
{
$this->IsAdminLoggined();
$bIncludeAliases = !empty($this->GetActionParam('IncludeAliases', '1'));
$bIncludeAliases = !empty($this->GetActionParam('includeAliases', '1'));
return $this->DefaultResponse($this->DomainProvider()->GetList($bIncludeAliases));
}
@ -25,7 +25,7 @@ trait AdminDomains
{
$this->IsAdminLoggined();
return $this->DefaultResponse($this->DomainProvider()->Delete((string) $this->GetActionParam('Name', '')));
return $this->DefaultResponse($this->DomainProvider()->Delete((string) $this->GetActionParam('name', '')));
}
public function DoAdminDomainDisable() : array
@ -33,8 +33,8 @@ trait AdminDomains
$this->IsAdminLoggined();
return $this->DefaultResponse($this->DomainProvider()->Disable(
(string) $this->GetActionParam('Name', ''),
'1' === (string) $this->GetActionParam('Disabled', '0')
(string) $this->GetActionParam('name', ''),
!empty($this->GetActionParam('disabled', '0'))
));
}
@ -52,8 +52,8 @@ trait AdminDomains
$this->IsAdminLoggined();
return $this->DefaultResponse($this->DomainProvider()->SaveAlias(
(string) $this->GetActionParam('Name', ''),
(string) $this->GetActionParam('Alias', '')
(string) $this->GetActionParam('name', ''),
(string) $this->GetActionParam('alias', '')
));
}

View file

@ -16,7 +16,7 @@ trait AdminExtensions
public function DoAdminPackageDelete() : array
{
$sId = $this->GetActionParam('Id', '');
$sId = $this->GetActionParam('id', '');
$bResult = \SnappyMail\Repository::deletePackage($sId);
static::pluginEnable($sId, false);
return $this->DefaultResponse($bResult);
@ -24,11 +24,11 @@ trait AdminExtensions
public function DoAdminPackageInstall() : array
{
$sType = $this->GetActionParam('Type', '');
$sType = $this->GetActionParam('type', '');
$bResult = \SnappyMail\Repository::installPackage(
$sType,
$this->GetActionParam('Id', ''),
$this->GetActionParam('File', '')
$this->GetActionParam('id', ''),
$this->GetActionParam('file', '')
);
return $this->DefaultResponse($bResult ?
('plugin' !== $sType ? array('Reload' => true) : true) : false);
@ -38,8 +38,8 @@ trait AdminExtensions
{
$this->IsAdminLoggined();
$sId = (string) $this->GetActionParam('Id', '');
$bDisable = '1' === (string) $this->GetActionParam('Disabled', '1');
$sId = (string) $this->GetActionParam('id', '');
$bDisable = '1' === (string) $this->GetActionParam('disabled', '1');
if (!$bDisable) {
$oPlugin = $this->Plugins()->CreatePluginByName($sId);
@ -61,17 +61,17 @@ trait AdminExtensions
$this->IsAdminLoggined();
$mResult = false;
$sId = (string) $this->GetActionParam('Id', '');
$sId = (string) $this->GetActionParam('id', '');
if (!empty($sId)) {
$oPlugin = $this->Plugins()->CreatePluginByName($sId);
if ($oPlugin) {
$mResult = array(
'@Object' => 'Object/Plugin',
'Id' => $sId,
'Name' => $oPlugin->Name(),
'Readme' => $oPlugin->Description(),
'Config' => array()
'id' => $sId,
'name' => $oPlugin->Name(),
'readme' => $oPlugin->Description(),
'config' => array()
);
$aMap = $oPlugin->ConfigMap();
@ -85,7 +85,7 @@ trait AdminExtensions
} else {
$oItem->SetValue($oConfig->Get('plugin', $oItem->Name(), ''));
}
$mResult['Config'][] = $oItem;
$mResult['config'][] = $oItem;
} else if ($oItem instanceof \RainLoop\Plugins\PropertyCollection) {
foreach ($oItem as $oSubItem) {
if ($oSubItem && $oSubItem instanceof \RainLoop\Plugins\Property) {
@ -96,7 +96,7 @@ trait AdminExtensions
}
}
}
$mResult['Config'][] = $oItem;
$mResult['config'][] = $oItem;
}
}
}
@ -111,7 +111,7 @@ trait AdminExtensions
{
$this->IsAdminLoggined();
$sId = (string) $this->GetActionParam('Id', '');
$sId = (string) $this->GetActionParam('id', '');
if (!empty($sId)) {
$oPlugin = $this->Plugins()->CreatePluginByName($sId);
@ -119,7 +119,7 @@ trait AdminExtensions
$oConfig = $oPlugin->Config();
$aMap = $oPlugin->ConfigMap(true);
if (\is_array($aMap)) {
$aSettings = (array) $this->GetActionParam('Settings', []);
$aSettings = (array) $this->GetActionParam('settings', []);
foreach ($aMap as $oItem) {
$sKey = $oItem->Name();
$sValue = $aSettings[$sKey] ?? $oConfig->Get('plugin', $sKey);

View file

@ -12,9 +12,9 @@ trait Attachments
*/
public function DoAttachmentsActions() : array
{
$sAction = $this->GetActionParam('Do', '');
$sAction = $this->GetActionParam('target', '');
$sFolder = $this->GetActionParam('folder', '');
$aHashes = $this->GetActionParam('Hashes', null);
$aHashes = $this->GetActionParam('hashes', null);
$oFilesProvider = $this->FilesProvider();
if (empty($sAction) || !$this->GetCapa(Capa::ATTACHMENTS_ACTIONS) || !$oFilesProvider || !$oFilesProvider->IsActive()) {
return $this->FalseResponse();

View file

@ -77,7 +77,7 @@ trait Contacts
public function DoContactsDelete() : array
{
$oAccount = $this->getAccountFromToken();
$aUids = \explode(',', (string) $this->GetActionParam('Uids', ''));
$aUids = \explode(',', (string) $this->GetActionParam('uids', ''));
$aFilteredUids = \array_filter(\array_map('intval', $aUids));
@ -119,15 +119,12 @@ trait Contacts
));
}
public function UploadContacts() : array
public function UploadContacts(?array $aFile, int $iError) : array
{
$oAccount = $this->getAccountFromToken();
$mResponse = false;
$aFile = $this->GetActionParam('File', null);
$iError = $this->GetActionParam('Error', \RainLoop\Enumerations\UploadError::UNKNOWN);
if ($oAccount && UPLOAD_ERR_OK === $iError && \is_array($aFile)) {
$sSavedName = 'upload-post-'.\md5($aFile['name'].$aFile['tmp_name']);
if (!$this->FilesProvider()->MoveUploadedFile($oAccount, $sSavedName, $aFile['tmp_name'])) {

View file

@ -22,13 +22,13 @@ trait Folders
if ($oAccount
&& !empty($sFolderFullName)
&& !empty($_FILES['AppendFile'])
&& \is_uploaded_file($_FILES['AppendFile']['tmp_name'])
&& \UPLOAD_ERR_OK == $_FILES['AppendFile']['error']
&& !empty($_FILES['appendFile'])
&& \is_uploaded_file($_FILES['appendFile']['tmp_name'])
&& \UPLOAD_ERR_OK == $_FILES['appendFile']['error']
&& $this->oConfig->Get('labs', 'allow_message_append', false)
) {
$sSavedName = 'append-post-' . \md5($sFolderFullName . $_FILES['AppendFile']['name'] . $_FILES['AppendFile']['tmp_name']);
if ($this->FilesProvider()->MoveUploadedFile($oAccount, $sSavedName, $_FILES['AppendFile']['tmp_name'])) {
$sSavedName = 'append-post-' . \md5($sFolderFullName . $_FILES['appendFile']['name'] . $_FILES['appendFile']['tmp_name']);
if ($this->FilesProvider()->MoveUploadedFile($oAccount, $sSavedName, $_FILES['appendFile']['tmp_name'])) {
$iMessageStreamSize = $this->FilesProvider()->FileSize($oAccount, $sSavedName);
$rMessageStream = $this->FilesProvider()->GetFile($oAccount, $sSavedName);
@ -107,10 +107,10 @@ trait Folders
{
$this->initMailClientConnection();
$sFolderFullName = $this->GetActionParam('folder');
$sMetadataKey = $this->GetActionParam('Key');
$sMetadataKey = $this->GetActionParam('key');
if ($sFolderFullName && $sMetadataKey) {
$this->MailClient()->FolderSetMetadata($sFolderFullName, [
$sMetadataKey => $this->GetActionParam('Value') ?: null
$sMetadataKey => $this->GetActionParam('value') ?: null
]);
}
return $this->TrueResponse();
@ -292,7 +292,7 @@ trait Folders
{
$aResult = array();
$aFolders = $this->GetActionParam('Folders', null);
$aFolders = $this->GetActionParam('folders', null);
if (\is_array($aFolders)) {
$this->initMailClientConnection();

View file

@ -369,7 +369,7 @@ trait Messages
{
$this->initMailClientConnection();
$sThreadUids = \trim($this->GetActionParam('ThreadUids', ''));
$sThreadUids = \trim($this->GetActionParam('threadUids', ''));
try
{
@ -377,7 +377,7 @@ trait Messages
$this->GetActionParam('folder', ''),
empty($sThreadUids) ? new SequenceSet('1:*', false) : new SequenceSet(\explode(',', $sThreadUids)),
MessageFlag::SEEN,
!empty($this->GetActionParam('SetAction', '0'))
!empty($this->GetActionParam('setAction', '0'))
);
}
catch (\Throwable $oException)
@ -395,7 +395,7 @@ trait Messages
public function DoMessageSetKeyword() : array
{
return $this->messageSetFlag($this->GetActionParam('Keyword', ''), true);
return $this->messageSetFlag($this->GetActionParam('keyword', ''), true);
}
/**
@ -447,7 +447,7 @@ trait Messages
$this->initMailClientConnection();
$sFolder = $this->GetActionParam('folder', '');
$aUids = \explode(',', (string) $this->GetActionParam('Uids', ''));
$aUids = \explode(',', (string) $this->GetActionParam('uids', ''));
try
{
@ -478,12 +478,12 @@ trait Messages
{
$this->initMailClientConnection();
$sFromFolder = $this->GetActionParam('FromFolder', '');
$sToFolder = $this->GetActionParam('ToFolder', '');
$sFromFolder = $this->GetActionParam('fromFolder', '');
$sToFolder = $this->GetActionParam('toFolder', '');
$oUids = new SequenceSet(\explode(',', (string) $this->GetActionParam('Uids', '')));
$oUids = new SequenceSet(\explode(',', (string) $this->GetActionParam('uids', '')));
if (!empty($this->GetActionParam('MarkAsRead', '0'))) {
if (!empty($this->GetActionParam('markAsRead', '0'))) {
try
{
$this->MailClient()->MessageSetFlag($sFromFolder, $oUids, MessageFlag::SEEN);
@ -494,7 +494,7 @@ trait Messages
}
}
$sLearning = $this->GetActionParam('Learning', '');
$sLearning = $this->GetActionParam('learning', '');
if ($sLearning) {
try
{
@ -544,9 +544,9 @@ trait Messages
try
{
$this->MailClient()->MessageCopy(
$this->GetActionParam('FromFolder', ''),
$this->GetActionParam('ToFolder', ''),
new SequenceSet(\explode(',', (string) $this->GetActionParam('Uids', '')))
$this->GetActionParam('fromFolder', ''),
$this->GetActionParam('toFolder', ''),
new SequenceSet(\explode(',', (string) $this->GetActionParam('uids', '')))
);
}
catch (\Throwable $oException)
@ -688,8 +688,8 @@ trait Messages
}
}
// Try by default as OpenPGP.js sets GnuPG to 0
if ($this->GetActionParam('GnuPG', 1)) {
// Try by default as OpenPGP.js sets useGnuPG to 0
if ($this->GetActionParam('tryGnuPG', 1)) {
$GPG = $this->GnuPG();
if ($GPG) {
$info = $this->GnuPG()->verify($result['text'], $result['signature']);
@ -873,9 +873,9 @@ trait Messages
{
$this->MailClient()->MessageSetFlag(
$this->GetActionParam('folder', ''),
new SequenceSet(\explode(',', (string) $this->GetActionParam('Uids', ''))),
new SequenceSet(\explode(',', (string) $this->GetActionParam('uids', ''))),
$sMessageFlag,
!empty($this->GetActionParam('SetAction', '0')),
!empty($this->GetActionParam('setAction', '0')),
$bSkipUnsupportedFlag
);
}
@ -1041,7 +1041,7 @@ trait Messages
if ($sSigned = $this->GetActionParam('signed', '')) {
$aSigned = \explode("\r\n\r\n", $sSigned, 2);
// $sBoundary = \preg_replace('/^.+boundary="([^"]+)".+$/Dsi', '$1', $aSigned[0]);
$sBoundary = $this->GetActionParam('Boundary', '');
$sBoundary = $this->GetActionParam('boundary', '');
$oPart = new MimePart;
$oPart->Headers->AddByName(
@ -1080,77 +1080,77 @@ trait Messages
unset($oAlternativePart);
unset($sEncrypted);
} else if ($sHtml = $this->GetActionParam('html', '')) {
$oPart = new MimePart;
$oPart->Headers->AddByName(MimeEnumHeader::CONTENT_TYPE, 'multipart/alternative');
$oMessage->SubParts->append($oPart);
$sHtml = \MailSo\Base\HtmlUtils::BuildHtml($sHtml, $aFoundCids, $aFoundDataURL, $aFoundContentLocationUrls);
$this->Plugins()->RunHook('filter.message-html', array($oAccount, $oMessage, &$sHtml));
// First add plain
$sPlain = $this->GetActionParam('plain', '') ?: \MailSo\Base\HtmlUtils::ConvertHtmlToPlain($sHtml);
$this->Plugins()->RunHook('filter.message-plain', array($oAccount, $oMessage, &$sPlain));
$oAlternativePart = new MimePart;
$oAlternativePart->Headers->AddByName(MimeEnumHeader::CONTENT_TYPE, 'text/plain; charset=utf-8');
$oAlternativePart->Headers->AddByName(MimeEnumHeader::CONTENT_TRANSFER_ENCODING, 'quoted-printable');
$oAlternativePart->Body = \MailSo\Base\StreamWrappers\Binary::CreateStream(
\MailSo\Base\ResourceRegistry::CreateMemoryResourceFromString(\preg_replace('/\\r?\\n/su', "\r\n", \trim($sPlain))),
'convert.quoted-printable-encode'
);
$oPart->SubParts->append($oAlternativePart);
unset($sPlain);
// Now add HTML
$oAlternativePart = new MimePart;
$oAlternativePart->Headers->AddByName(MimeEnumHeader::CONTENT_TYPE, 'text/html; charset=utf-8');
$oAlternativePart->Headers->AddByName(MimeEnumHeader::CONTENT_TRANSFER_ENCODING, 'quoted-printable');
$oAlternativePart->Body = \MailSo\Base\StreamWrappers\Binary::CreateStream(
\MailSo\Base\ResourceRegistry::CreateMemoryResourceFromString(\preg_replace('/\\r?\\n/su', "\r\n", \trim($sHtml))),
'convert.quoted-printable-encode'
);
$oPart->SubParts->append($oAlternativePart);
unset($oAlternativePart);
unset($sHtml);
} else {
if ($sHtml = $this->GetActionParam('html', '')) {
$sPlain = $this->GetActionParam('plain', '');
/*
if ($sSignature = $this->GetActionParam('pgpSignature', null)) {
$oPart = new MimePart;
$oPart->Headers->AddByName(MimeEnumHeader::CONTENT_TYPE, 'multipart/alternative');
$oPart->Headers->AddByName(
MimeEnumHeader::CONTENT_TYPE,
'multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"'
);
$oMessage->SubParts->append($oPart);
$sHtml = \MailSo\Base\HtmlUtils::BuildHtml($sHtml, $aFoundCids, $aFoundDataURL, $aFoundContentLocationUrls);
$this->Plugins()->RunHook('filter.message-html', array($oAccount, $oMessage, &$sHtml));
// First add plain
$sPlain = $this->GetActionParam('plain', '') ?: \MailSo\Base\HtmlUtils::ConvertHtmlToPlain($sHtml);
$this->Plugins()->RunHook('filter.message-plain', array($oAccount, $oMessage, &$sPlain));
$oAlternativePart = new MimePart;
$oAlternativePart->Headers->AddByName(MimeEnumHeader::CONTENT_TYPE, 'text/plain; charset=utf-8');
$oAlternativePart->Headers->AddByName(MimeEnumHeader::CONTENT_TRANSFER_ENCODING, 'quoted-printable');
$oAlternativePart->Body = \MailSo\Base\StreamWrappers\Binary::CreateStream(
\MailSo\Base\ResourceRegistry::CreateMemoryResourceFromString(\preg_replace('/\\r?\\n/su', "\r\n", \trim($sPlain))),
'convert.quoted-printable-encode'
);
$oPart->SubParts->append($oAlternativePart);
unset($sPlain);
// Now add HTML
$oAlternativePart = new MimePart;
$oAlternativePart->Headers->AddByName(MimeEnumHeader::CONTENT_TYPE, 'text/html; charset=utf-8');
$oAlternativePart->Headers->AddByName(MimeEnumHeader::CONTENT_TRANSFER_ENCODING, 'quoted-printable');
$oAlternativePart->Body = \MailSo\Base\StreamWrappers\Binary::CreateStream(
\MailSo\Base\ResourceRegistry::CreateMemoryResourceFromString(\preg_replace('/\\r?\\n/su', "\r\n", \trim($sHtml))),
'convert.quoted-printable-encode'
);
$oAlternativePart->Headers->AddByName(MimeEnumHeader::CONTENT_TYPE, 'text/plain; charset="utf-8"; protected-headers="v1"');
$oAlternativePart->Headers->AddByName(MimeEnumHeader::CONTENT_TRANSFER_ENCODING, 'base64');
$oAlternativePart->Body = \MailSo\Base\ResourceRegistry::CreateMemoryResourceFromString(\preg_replace('/\\r?\\n/su', "\r\n", \trim($sPlain)));
$oPart->SubParts->append($oAlternativePart);
unset($oAlternativePart);
unset($sHtml);
$oAlternativePart = new MimePart;
$oAlternativePart->Headers->AddByName(MimeEnumHeader::CONTENT_TYPE, 'application/pgp-signature; name="signature.asc"');
$oAlternativePart->Headers->AddByName(MimeEnumHeader::CONTENT_TRANSFER_ENCODING, '7Bit');
$oAlternativePart->Body = \MailSo\Base\ResourceRegistry::CreateMemoryResourceFromString(\preg_replace('/\\r?\\n/su', "\r\n", \trim($sSignature)));
$oPart->SubParts->append($oAlternativePart);
} else {
$sPlain = $this->GetActionParam('plain', '');
if ($sSignature = $this->GetActionParam('Signature', null)) {
$oPart = new MimePart;
$oPart->Headers->AddByName(
MimeEnumHeader::CONTENT_TYPE,
'multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"'
);
$oMessage->SubParts->append($oPart);
$oAlternativePart = new MimePart;
$oAlternativePart->Headers->AddByName(MimeEnumHeader::CONTENT_TYPE, 'text/plain; charset="utf-8"; protected-headers="v1"');
$oAlternativePart->Headers->AddByName(MimeEnumHeader::CONTENT_TRANSFER_ENCODING, 'base64');
$oAlternativePart->Body = \MailSo\Base\ResourceRegistry::CreateMemoryResourceFromString(\preg_replace('/\\r?\\n/su', "\r\n", \trim($sPlain)));
$oPart->SubParts->append($oAlternativePart);
$oAlternativePart = new MimePart;
$oAlternativePart->Headers->AddByName(MimeEnumHeader::CONTENT_TYPE, 'application/pgp-signature; name="signature.asc"');
$oAlternativePart->Headers->AddByName(MimeEnumHeader::CONTENT_TRANSFER_ENCODING, '7Bit');
$oAlternativePart->Body = \MailSo\Base\ResourceRegistry::CreateMemoryResourceFromString(\preg_replace('/\\r?\\n/su', "\r\n", \trim($sSignature)));
$oPart->SubParts->append($oAlternativePart);
} else {
$this->Plugins()->RunHook('filter.message-plain', array($oAccount, $oMessage, &$sPlain));
$oAlternativePart = new MimePart;
$oAlternativePart->Headers->AddByName(MimeEnumHeader::CONTENT_TYPE, 'text/plain; charset="utf-8"');
$oAlternativePart->Headers->AddByName(MimeEnumHeader::CONTENT_TRANSFER_ENCODING, 'quoted-printable');
$oAlternativePart->Body = \MailSo\Base\StreamWrappers\Binary::CreateStream(
\MailSo\Base\ResourceRegistry::CreateMemoryResourceFromString(\preg_replace('/\\r?\\n/su', "\r\n", \trim($sPlain))),
'convert.quoted-printable-encode'
);
$oMessage->SubParts->append($oAlternativePart);
}
unset($oAlternativePart);
unset($sSignature);
unset($sPlain);
}
} else {
*/
$this->Plugins()->RunHook('filter.message-plain', array($oAccount, $oMessage, &$sPlain));
$oAlternativePart = new MimePart;
$oAlternativePart->Headers->AddByName(MimeEnumHeader::CONTENT_TYPE, 'text/plain; charset="utf-8"');
$oAlternativePart->Headers->AddByName(MimeEnumHeader::CONTENT_TRANSFER_ENCODING, 'quoted-printable');
$oAlternativePart->Body = \MailSo\Base\StreamWrappers\Binary::CreateStream(
\MailSo\Base\ResourceRegistry::CreateMemoryResourceFromString(\preg_replace('/\\r?\\n/su', "\r\n", \trim($sPlain))),
'convert.quoted-printable-encode'
);
$oMessage->SubParts->append($oAlternativePart);
unset($oAlternativePart);
unset($sPlain);
}
unset($oPart);

View file

@ -79,10 +79,10 @@ trait Pgp
$GPG->addDecryptKey(
$this->GetActionParam('keyId', ''),
$this->GetActionParam('Passphrase', '')
$this->GetActionParam('passphrase', '')
);
$sData = $this->GetActionParam('Data', '');
$sData = $this->GetActionParam('data', '');
$oPart = null;
$result = [
'data' => '',
@ -127,7 +127,7 @@ trait Pgp
$GPG = $this->GnuPG();
return $this->DefaultResponse($GPG ? $GPG->export(
$this->GetActionParam('keyId', ''),
$this->GetActionParam('Passphrase', '')
$this->GetActionParam('passphrase', '')
) : false);
}
@ -136,11 +136,11 @@ trait Pgp
$fingerprint = false;
$GPG = $this->GnuPG();
if ($GPG) {
$sName = $this->GetActionParam('Name', '');
$sEmail = $this->GetActionParam('Email', '');
$sName = $this->GetActionParam('name', '');
$sEmail = $this->GetActionParam('email', '');
$fingerprint = $GPG->generateKey(
$sName ? "{$sName} <{$sEmail}>" : $sEmail,
$this->GetActionParam('Passphrase', '')
$this->GetActionParam('passphrase', '')
);
}
return $this->DefaultResponse($fingerprint);
@ -156,9 +156,9 @@ trait Pgp
public function DoGnupgImportKey() : array
{
$sKey = $this->GetActionParam('Key', '');
$sKey = $this->GetActionParam('key', '');
$sKeyId = $this->GetActionParam('keyId', '');
$sEmail = $this->GetActionParam('Email', '');
$sEmail = $this->GetActionParam('email', '');
if (!$sKey) {
try {
@ -265,7 +265,7 @@ trait Pgp
*/
public function DoStorePGPKey() : array
{
$key = $this->GetActionParam('Key', '');
$key = $this->GetActionParam('key', '');
$keyId = $this->GetActionParam('keyId', '');
return $this->DefaultResponse(($key && $keyId && $this->StorePGPKey($key, $keyId)));
}

View file

@ -23,7 +23,7 @@ trait Response
}
return \array_merge(array(
// 'Version' => APP_VERSION,
// 'version' => APP_VERSION,
'Action' => $sActionName,
'Result' => $this->responseObject($mResult)
), $aAdditionalParams);

View file

@ -123,7 +123,7 @@ trait Themes
// : \str_replace(';}', '}', \preg_replace('/\\s*([:;{},])\\s*/', '\1', \preg_replace('/\\s+/', ' ', \preg_replace('#/\\*.*?\\*/#s', '', $mResult))));
}
public function UploadBackground(): array
public function UploadBackground(?array $aFile, int $iError): array
{
$oAccount = $this->getAccountFromToken();
@ -134,9 +134,6 @@ trait Themes
$sName = '';
$sHash = '';
$aFile = $this->GetActionParam('File', null);
$iError = $this->GetActionParam('Error', \RainLoop\Enumerations\UploadError::UNKNOWN);
if ($oAccount && UPLOAD_ERR_OK === $iError && \is_array($aFile)) {
$sMimeType = \SnappyMail\File\MimeType::fromFile($aFile['tmp_name'], $aFile['name'])
?: \SnappyMail\File\MimeType::fromFilename($aFile['name'])

View file

@ -175,7 +175,7 @@ class ActionsAdmin extends Actions
$sPassword = $this->GetActionParam('Password', '');
$this->Logger()->AddSecret($sPassword);
$sNewPassword = $this->GetActionParam('NewPassword', '');
$sNewPassword = $this->GetActionParam('newPassword', '');
if (\strlen($sNewPassword)) {
$this->Logger()->AddSecret($sNewPassword);
}
@ -295,11 +295,11 @@ class ActionsAdmin extends Actions
}
return $this->DefaultResponse(array(
'Updatable' => \SnappyMail\Repository::canUpdateCore(),
'Warning' => $bShowWarning,
'Version' => $sVersion,
'VersionCompare' => \version_compare(APP_VERSION, $sVersion),
'Warnings' => $aWarnings
'updatable' => \SnappyMail\Repository::canUpdateCore(),
'warning' => $bShowWarning,
'version' => $sVersion,
'versionCompare' => \version_compare(APP_VERSION, $sVersion),
'warnings' => $aWarnings
));
}

View file

@ -190,12 +190,12 @@ class Property implements \JsonSerializable
'@Object' => 'Object/PluginProperty',
'value' => $this->mValue,
'placeholder' => $this->sPlaceholder,
'Name' => $this->sName,
'Type' => $this->iType,
'Label' => $this->sLabel,
'Default' => $this->mDefaultValue,
'Options' => $this->aOptions,
'Desc' => $this->sDesc
'name' => $this->sName,
'type' => $this->iType,
'label' => $this->sLabel,
'default' => $this->mDefaultValue,
'options' => $this->aOptions,
'desc' => $this->sDesc
);
}
}

View file

@ -20,8 +20,8 @@ class PropertyCollection extends \ArrayObject implements \JsonSerializable
{
return array(
'@Object' => 'Object/PluginProperty',
'Type' => \RainLoop\Enumerations\PluginPropertyType::GROUP,
'Label' => $this->sLabel,
'type' => \RainLoop\Enumerations\PluginPropertyType::GROUP,
'label' => $this->sLabel,
'config' => $this->getArrayCopy()
/*
'config' => [

View file

@ -57,12 +57,12 @@ class Domain extends AbstractProvider
public function LoadOrCreateNewFromAction(\RainLoop\Actions $oActions, string $sNameForTest = null) : ?\RainLoop\Model\Domain
{
$sName = \mb_strtolower((string) $oActions->GetActionParam('Name', ''));
$sName = \mb_strtolower((string) $oActions->GetActionParam('name', ''));
if (\strlen($sName) && $sNameForTest && !\str_contains($sName, '*')) {
$sNameForTest = null;
}
if (\strlen($sName) || $sNameForTest) {
if (!$sNameForTest && !empty($oActions->GetActionParam('Create', 0)) && $this->Load($sName)) {
if (!$sNameForTest && !empty($oActions->GetActionParam('create', 0)) && $this->Load($sName)) {
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::DomainAlreadyExists);
}
return \RainLoop\Model\Domain::fromArray($sNameForTest ?: $sName, [

View file

@ -259,14 +259,7 @@ class ServiceActions
}
if (\method_exists($this->oActions, $sAction) && \is_callable(array($this->oActions, $sAction))) {
$aActionParams = isset($_GET) && \is_array($_GET) ? $_GET : null;
$aActionParams['File'] = $aFile;
$aActionParams['Error'] = $iError;
$this->oActions->SetActionParams($aActionParams, $sAction);
$aResponse = $this->oActions->{$sAction}();
$aResponse = $this->oActions->{$sAction}($aFile, $iError);
}
if (!is_array($aResponse)) {

View file

@ -1,36 +1,36 @@
<label data-bind="text: Label, visible: 5 !== Type"></label>
<!-- ko if: 0 === Type -->
<label data-bind="text: label, visible: 5 !== type"></label>
<!-- ko if: 0 === type -->
<input type="text" autocomplete="off" autocorrect="off" autocapitalize="off"
data-bind="value: value, attr: {placeholder: placeholder}">
<!-- /ko -->
<!-- ko if: 1 === Type -->
<!-- ko if: 1 === type -->
<input type="number" step="1"
data-bind="value: value, attr: {placeholder: placeholder}">
<!-- /ko -->
<!-- ko if: 3 === Type -->
<!-- ko if: 3 === type -->
<input type="password" autocomplete="off" autocorrect="off" autocapitalize="off"
data-bind="value: value, attr: {placeholder: placeholder}">
<!-- /ko -->
<!-- ko if: 2 === Type -->
<!-- ko if: 2 === type -->
<textarea rows="5" autocomplete="off" autocorrect="off" autocapitalize="off"
data-bind="value: value, attr: {placeholder: placeholder }"></textarea>
<!-- /ko -->
<!-- ko if: 4 === Type -->
<select data-bind="options: Options, value: value"></select>
<!-- ko if: 4 === type -->
<select data-bind="options: options, value: value"></select>
<!-- /ko -->
<!-- ko if: 5 === Type -->
<!-- ko if: 5 === type -->
<div data-bind="component: {
name: 'Checkbox',
params: { value: value, label: Label }
params: { value: value, label: label }
}"></div>
<!-- /ko -->
<!-- ko if: 6 === Type -->
<!-- ko if: 6 === type -->
<input type="url"
data-bind="value: value, attr: {placeholder: placeholder}">
<!-- /ko -->
<!-- ko if: 8 === Type -->
<select data-bind="options: Options, optionsText: 'name', optionsValue: 'id', value: value"></select>
<!-- ko if: 8 === type -->
<select data-bind="options: options, optionsText: 'name', optionsValue: 'id', value: value"></select>
<!-- /ko -->
<!-- ko if: '' !== Desc -->
<span tabindex="0" class="help-block"><span data-bind="text: Desc"></span></span>
<!-- ko if: '' !== desc -->
<span tabindex="0" class="help-block"><span data-bind="text: desc"></span></span>
<!-- /ko -->

View file

@ -14,15 +14,15 @@
<span data-bind="text: saveError"></span>
</div>
<div data-bind="foreach: config, visible: hasConfiguration">
<!-- ko if: 7 == Type -->
<!-- ko if: 7 == type -->
<details open="">
<summary class="legend" data-bind="text: Label"></summary>
<summary class="legend" data-bind="text: label"></summary>
<div data-bind="foreach: config">
<div class="control-group" data-bind="template: { name: 'AdminSettingsPluginProperty' }"></div>
</div>
</details>
<!-- /ko -->
<!-- ko if: 7 != Type -->
<!-- ko if: 7 != type -->
<div class="control-group" data-bind="template: { name: 'AdminSettingsPluginProperty' }"></div>
<!-- /ko -->
</div>

View file

@ -12,18 +12,18 @@
<div class="control-group">
<label data-i18n="GLOBAL/EMAIL"></label>
<strong style="margin-top: 5px;" data-bind="visible: !isNew(), text: email"></strong>
<input name="Email" type="text" class="input-xlarge"
<input name="email" type="text" class="input-xlarge"
autofocus="" autocorrect="off" autocapitalize="off"
data-bind="visible: isNew, textInput: email, attr: {required: isNew}">
</div>
<div class="control-group">
<label data-i18n="GLOBAL/PASSWORD"></label>
<input name="Password" type="password" class="input-xlarge" autocomplete="new-password" autocorrect="off" autocapitalize="off"
<input name="password" type="password" class="input-xlarge" autocomplete="new-password" autocorrect="off" autocapitalize="off"
data-bind="value: password, attr: {required:isNew}">
</div>
<div class="control-group">
<label data-i18n="GLOBAL/NAME"></label>
<input name="Name" type="text" class="input-xlarge" data-bind="value: name">
<input name="name" type="text" class="input-xlarge" data-bind="value: name">
</div>
</form>
<footer>