mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-11-03 19:08:50 +03:00
Found more JSON properties to change into JavaScript camelCase
This commit is contained in:
parent
b9ef8ae2c9
commit
974350ebee
45 changed files with 361 additions and 412 deletions
|
|
@ -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']);
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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', '')
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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'])) {
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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)));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ trait Response
|
|||
}
|
||||
|
||||
return \array_merge(array(
|
||||
// 'Version' => APP_VERSION,
|
||||
// 'version' => APP_VERSION,
|
||||
'Action' => $sActionName,
|
||||
'Result' => $this->responseObject($mResult)
|
||||
), $aAdditionalParams);
|
||||
|
|
|
|||
|
|
@ -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'])
|
||||
|
|
|
|||
|
|
@ -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
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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' => [
|
||||
|
|
|
|||
|
|
@ -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, [
|
||||
|
|
|
|||
|
|
@ -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)) {
|
||||
|
|
|
|||
|
|
@ -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 -->
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue