mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-11-01 18:08:49 +03:00
Almost all JSON properties to JavaScript camelCase
This commit is contained in:
parent
7a53cae32f
commit
f080a302b1
50 changed files with 501 additions and 562 deletions
|
|
@ -67,7 +67,7 @@ class BodyStructure implements \JsonSerializable
|
|||
|
||||
$sIdx = '-' . $this->PartID();
|
||||
|
||||
$sMimeType = \strtolower(\trim($this->ContentType()));
|
||||
$sMimeType = $this->sContentType;
|
||||
if ('message/rfc822' === $sMimeType) {
|
||||
return "message{$sIdx}.eml";
|
||||
}
|
||||
|
|
@ -85,7 +85,7 @@ class BodyStructure implements \JsonSerializable
|
|||
return \str_replace('/', $sIdx.'.', $sMimeType);
|
||||
}
|
||||
|
||||
return ($this->IsInline() ? 'inline' : 'part' ) . $sIdx;
|
||||
return ($this->isInline() ? 'inline' : 'part' ) . $sIdx;
|
||||
}
|
||||
|
||||
public function ContentType() : string
|
||||
|
|
@ -93,16 +93,6 @@ class BodyStructure implements \JsonSerializable
|
|||
return $this->sContentType;
|
||||
}
|
||||
|
||||
public function ContentTypeParameters() : array
|
||||
{
|
||||
return $this->aContentTypeParams;
|
||||
}
|
||||
|
||||
public function Size() : int
|
||||
{
|
||||
return $this->iSize;
|
||||
}
|
||||
|
||||
public function EstimatedSize() : int
|
||||
{
|
||||
$fCoefficient = 1;
|
||||
|
|
@ -124,26 +114,21 @@ class BodyStructure implements \JsonSerializable
|
|||
return $this->sCharset;
|
||||
}
|
||||
|
||||
public function ContentID() : string
|
||||
{
|
||||
return $this->sContentID;
|
||||
}
|
||||
|
||||
public function ContentLocation() : string
|
||||
{
|
||||
return $this->sLocation;
|
||||
}
|
||||
|
||||
public function SubParts() : array
|
||||
{
|
||||
return $this->aSubParts;
|
||||
}
|
||||
|
||||
public function IsInline() : bool
|
||||
public function isInline() : bool
|
||||
{
|
||||
return 'inline' === $this->sDisposition || \strlen($this->sContentID);
|
||||
}
|
||||
|
||||
public function isText() : bool
|
||||
{
|
||||
return 'text/html' === $this->sContentType || 'text/plain' === $this->sContentType;
|
||||
}
|
||||
|
||||
public function IsPgpEncrypted() : bool
|
||||
{
|
||||
// https://datatracker.ietf.org/doc/html/rfc3156#section-4
|
||||
|
|
@ -179,8 +164,7 @@ class BodyStructure implements \JsonSerializable
|
|||
&& (
|
||||
'attachment' === $this->sDisposition || (
|
||||
!\str_starts_with($this->sContentType, 'multipart/')
|
||||
&& 'text/html' !== $this->sContentType
|
||||
&& 'text/plain' !== $this->sContentType
|
||||
&& !$this->isText()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
@ -197,8 +181,7 @@ class BodyStructure implements \JsonSerializable
|
|||
$aParts = [];
|
||||
|
||||
$gParts = $this->SearchByCallback(function ($oItem) {
|
||||
return ('text/html' === $oItem->sContentType || 'text/plain' === $oItem->sContentType)
|
||||
&& !$oItem->IsAttachment();
|
||||
return $oItem->isText() && !$oItem->IsAttachment();
|
||||
});
|
||||
foreach ($gParts as $oPart) {
|
||||
$aParts[] = $oPart;
|
||||
|
|
@ -211,7 +194,7 @@ class BodyStructure implements \JsonSerializable
|
|||
if (!$aParts) {
|
||||
$gEncryptedParts = $this->SearchByContentType('multipart/encrypted');
|
||||
foreach ($gEncryptedParts as $oPart) {
|
||||
if ($oPart->IsPgpEncrypted() && $oPart->SubParts()[1]->IsInline()) {
|
||||
if ($oPart->IsPgpEncrypted() && $oPart->SubParts()[1]->isInline()) {
|
||||
return array($oPart->SubParts()[1]);
|
||||
}
|
||||
}
|
||||
|
|
@ -223,9 +206,7 @@ class BodyStructure implements \JsonSerializable
|
|||
public function SearchCharset() : string
|
||||
{
|
||||
$gParts = $this->SearchByCallback(function ($oPart) {
|
||||
return $oPart->Charset()
|
||||
&& ('text/html' === $oPart->sContentType || 'text/plain' === $oPart->sContentType)
|
||||
&& !$oPart->IsAttachment();
|
||||
return $oPart->Charset() && $oPart->isText() && !$oPart->IsAttachment();
|
||||
});
|
||||
|
||||
if (!$gParts->valid()) {
|
||||
|
|
@ -494,7 +475,7 @@ class BodyStructure implements \JsonSerializable
|
|||
}
|
||||
|
||||
$oStructure = new self;
|
||||
$oStructure->sContentType = \strtolower($sContentTypeMain.'/'.$sContentTypeSub);
|
||||
$oStructure->sContentType = \strtolower(\trim($sContentTypeMain.'/'.$sContentTypeSub));
|
||||
$oStructure->aContentTypeParams = $aContentTypeParams;
|
||||
$oStructure->sCharset = $sCharset;
|
||||
$oStructure->sContentID = $sContentID;
|
||||
|
|
@ -541,18 +522,18 @@ class BodyStructure implements \JsonSerializable
|
|||
return $aDict;
|
||||
}
|
||||
|
||||
#[\ReturnTypeWillChange]
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return array(
|
||||
'MimeIndex' => $this->PartID(),
|
||||
'MimeType' => $this->ContentType(),
|
||||
'MimeTypeParams' => $this->ContentTypeParameters(),
|
||||
'FileName' => \MailSo\Base\Utils::SecureFileName($this->FileName(true)),
|
||||
'EstimatedSize' => $this->EstimatedSize(),
|
||||
'Cid' => $this->ContentID(),
|
||||
'ContentLocation' => $this->ContentLocation(),
|
||||
'IsInline' => $this->IsInline()
|
||||
'mimeIndex' => $this->sPartID,
|
||||
'mimeType' => $this->sContentType,
|
||||
'mimeTypeParams' => $this->aContentTypeParams,
|
||||
'fileName' => \MailSo\Base\Utils::SecureFileName($this->FileName(true)),
|
||||
'estimatedSize' => $this->EstimatedSize(),
|
||||
'cId' => $this->sContentID,
|
||||
'contentLocation' => $this->sLocation,
|
||||
'isInline' => $this->isInline()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -171,8 +171,8 @@ class Folder implements \JsonSerializable
|
|||
$aExtended = array(
|
||||
'totalEmails' => (int) $this->MESSAGES,
|
||||
'unreadEmails' => (int) $this->UNSEEN,
|
||||
'UidNext' => (int) $this->UIDNEXT,
|
||||
// 'Hash' => $this->Hash($this->ImapClient()->Hash())
|
||||
'uidNext' => (int) $this->UIDNEXT,
|
||||
// 'hash' => $this->Hash($this->ImapClient()->Hash())
|
||||
);
|
||||
}
|
||||
*/
|
||||
|
|
@ -185,16 +185,16 @@ class Folder implements \JsonSerializable
|
|||
return array(
|
||||
'@Object' => 'Object/Folder',
|
||||
'name' => $this->Name(),
|
||||
'FullName' => $this->FolderName,
|
||||
'Delimiter' => (string) $this->sDelimiter,
|
||||
'fullName' => $this->FolderName,
|
||||
'delimiter' => (string) $this->sDelimiter,
|
||||
'isSubscribed' => $this->IsSubscribed(),
|
||||
'Exists' => $this->Exists(),
|
||||
'Selectable' => $this->Selectable(),
|
||||
'Flags' => $this->aFlagsLowerCase,
|
||||
// 'Extended' => $aExtended,
|
||||
// 'PermanentFlags' => $this->PermanentFlags,
|
||||
'Metadata' => $this->aMetadata,
|
||||
'UidNext' => $this->UIDNEXT,
|
||||
'exists' => $this->Exists(),
|
||||
'selectable' => $this->Selectable(),
|
||||
'flags' => $this->aFlagsLowerCase,
|
||||
// 'extended' => $aExtended,
|
||||
// 'permanentFlags' => $this->PermanentFlags,
|
||||
'metadata' => $this->aMetadata,
|
||||
'uidNext' => $this->UIDNEXT,
|
||||
// https://datatracker.ietf.org/doc/html/rfc8621#section-2
|
||||
'totalEmails' => $this->MESSAGES,
|
||||
'unreadEmails' => $this->UNSEEN,
|
||||
|
|
|
|||
|
|
@ -49,24 +49,24 @@ class FolderInformation implements \JsonSerializable
|
|||
{
|
||||
$result = array(
|
||||
'id' => $this->MAILBOXID,
|
||||
'Name' => $this->FolderName,
|
||||
'Flags' => $this->Flags,
|
||||
'PermanentFlags' => $this->PermanentFlags,
|
||||
'UidNext' => $this->UIDNEXT,
|
||||
'UidValidity' => $this->UIDVALIDITY
|
||||
'name' => $this->FolderName,
|
||||
'flags' => $this->Flags,
|
||||
'permanentFlags' => $this->PermanentFlags,
|
||||
'uidNext' => $this->UIDNEXT,
|
||||
'uidValidity' => $this->UIDVALIDITY
|
||||
);
|
||||
if (isset($this->MESSAGES)) {
|
||||
$result['totalEmails'] = $this->MESSAGES;
|
||||
$result['unreadEmails'] = $this->UNSEEN;
|
||||
}
|
||||
if (isset($this->HIGHESTMODSEQ)) {
|
||||
$result['HighestModSeq'] = $this->HIGHESTMODSEQ;
|
||||
$result['highestModSeq'] = $this->HIGHESTMODSEQ;
|
||||
}
|
||||
if (isset($this->APPENDLIMIT)) {
|
||||
$result['Appendlimit'] = $this->APPENDLIMIT;
|
||||
$result['appendLimit'] = $this->APPENDLIMIT;
|
||||
}
|
||||
if (isset($this->SIZE)) {
|
||||
$result['Size'] = $this->SIZE;
|
||||
$result['size'] = $this->SIZE;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,8 +61,8 @@ class Attachment implements \JsonSerializable
|
|||
{
|
||||
return \array_merge([
|
||||
'@Object' => 'Object/Attachment',
|
||||
'Folder' => $this->sFolder,
|
||||
'Uid' => $this->iUid
|
||||
'folder' => $this->sFolder,
|
||||
'uid' => $this->iUid
|
||||
], $this->oBodyStructure->jsonSerialize());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -327,10 +327,10 @@ class MailClient
|
|||
}
|
||||
|
||||
$aNewMessages[] = array(
|
||||
'Folder' => $sFolderName,
|
||||
'Uid' => $iUid,
|
||||
'folder' => $sFolderName,
|
||||
'uid' => $iUid,
|
||||
'subject' => $oHeaders->ValueByName(MimeHeader::SUBJECT, !$sContentTypeCharset),
|
||||
'From' => $oHeaders->GetAsEmailCollection(MimeHeader::FROM_, !$sContentTypeCharset)
|
||||
'from' => $oHeaders->GetAsEmailCollection(MimeHeader::FROM_, !$sContentTypeCharset)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -359,8 +359,8 @@ class MailClient
|
|||
$iUid = (int) $oFetchResponse->GetFetchValue(FetchType::UID);
|
||||
$aLowerFlags = \array_map('mb_strtolower', \array_map('\\MailSo\\Base\\Utils::Utf7ModifiedToUtf8', $oFetchResponse->GetFetchValue(FetchType::FLAGS)));
|
||||
$aFlags[] = array(
|
||||
'Uid' => $iUid,
|
||||
'Flags' => $aLowerFlags
|
||||
'uid' => $iUid,
|
||||
'flags' => $aLowerFlags
|
||||
);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -368,18 +368,18 @@ class MailClient
|
|||
}
|
||||
|
||||
return array(
|
||||
'Folder' => $sFolderName,
|
||||
'folder' => $sFolderName,
|
||||
'totalEmails' => $oInfo->MESSAGES,
|
||||
'unreadEmails' => $oInfo->UNSEEN,
|
||||
'UidNext' => $oInfo->UIDNEXT,
|
||||
'UidValidity' => $oInfo->UIDVALIDITY,
|
||||
'HighestModSeq' => $oInfo->HIGHESTMODSEQ,
|
||||
'AppendLimit' => $oInfo->APPENDLIMIT ?: $this->oImapClient->AppendLimit(),
|
||||
'MailboxId' => $oInfo->MAILBOXID ?: '',
|
||||
// 'Flags' => $oInfo->Flags,
|
||||
// 'PermanentFlags' => $oInfo->PermanentFlags,
|
||||
'Hash' => $oInfo->getHash($this->oImapClient->Hash()),
|
||||
'MessagesFlags' => $aFlags,
|
||||
'uidNext' => $oInfo->UIDNEXT,
|
||||
'uidValidity' => $oInfo->UIDVALIDITY,
|
||||
'highestModSeq' => $oInfo->HIGHESTMODSEQ,
|
||||
'appendLimit' => $oInfo->APPENDLIMIT ?: $this->oImapClient->AppendLimit(),
|
||||
'mailboxId' => $oInfo->MAILBOXID ?: '',
|
||||
// 'flags' => $oInfo->Flags,
|
||||
// 'permanentFlags' => $oInfo->PermanentFlags,
|
||||
'hash' => $oInfo->getHash($this->oImapClient->Hash()),
|
||||
'messagesFlags' => $aFlags,
|
||||
'newMessages' => $this->getFolderNextMessageInformation(
|
||||
$sFolderName,
|
||||
$iPrevUidNext,
|
||||
|
|
|
|||
|
|
@ -353,7 +353,7 @@ class Message implements \JsonSerializable
|
|||
foreach ($gEncryptedParts as $oPart) {
|
||||
if ($oPart->IsPgpEncrypted()) {
|
||||
$oMessage->pgpEncrypted = [
|
||||
'PartId' => $oPart->SubParts()[1]->PartID()
|
||||
'partId' => $oPart->SubParts()[1]->PartID()
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -367,22 +367,22 @@ class Message implements \JsonSerializable
|
|||
$oMessage->pgpSigned = [
|
||||
// /?/Raw/&q[]=/0/Download/&q[]=/...
|
||||
// /?/Raw/&q[]=/0/View/&q[]=/...
|
||||
'BodyPartId' => $oPart->SubParts()[0]->PartID(),
|
||||
'SigPartId' => $oPgpSignaturePart->PartID(),
|
||||
'MicAlg' => $oHeaders ? (string) $oHeaders->ParameterValue(\MailSo\Mime\Enumerations\Header::CONTENT_TYPE, 'micalg') : ''
|
||||
'bodyPartId' => $oPart->SubParts()[0]->PartID(),
|
||||
'sigPartId' => $oPgpSignaturePart->PartID(),
|
||||
'micAlg' => $oHeaders ? (string) $oHeaders->ParameterValue(\MailSo\Mime\Enumerations\Header::CONTENT_TYPE, 'micalg') : ''
|
||||
];
|
||||
/*
|
||||
// An empty section specification refers to the entire message, including the header.
|
||||
// But Dovecot does not return it with BODY.PEEK[1], so we also use BODY.PEEK[1.MIME].
|
||||
$sPgpText = \trim(
|
||||
\trim($oFetchResponse->GetFetchValue(FetchType::BODY.'['.$oMessage->pgpSigned['BodyPartId'].'.MIME]'))
|
||||
\trim($oFetchResponse->GetFetchValue(FetchType::BODY.'['.$oMessage->pgpSigned['bodyPartId'].'.MIME]'))
|
||||
. "\r\n\r\n"
|
||||
. \trim($oFetchResponse->GetFetchValue(FetchType::BODY.'['.$oMessage->pgpSigned['BodyPartId'].']'))
|
||||
. \trim($oFetchResponse->GetFetchValue(FetchType::BODY.'['.$oMessage->pgpSigned['bodyPartId'].']'))
|
||||
);
|
||||
if ($sPgpText) {
|
||||
$oMessage->pgpSigned['Body'] = $sPgpText;
|
||||
}
|
||||
$sPgpSignatureText = $oFetchResponse->GetFetchValue(FetchType::BODY.'['.$oMessage->pgpSigned['SigPartId'].']');
|
||||
$sPgpSignatureText = $oFetchResponse->GetFetchValue(FetchType::BODY.'['.$oMessage->pgpSigned['sigPartId'].']');
|
||||
if ($sPgpSignatureText && 0 < \strpos($sPgpSignatureText, 'BEGIN PGP SIGNATURE')) {
|
||||
$oMessage->pgpSigned['Signature'] = $oPart->SubParts()[0]->PartID();
|
||||
}
|
||||
|
|
@ -416,7 +416,7 @@ class Message implements \JsonSerializable
|
|||
// Cleartext Signature
|
||||
if (!$oMessage->pgpSigned && \str_contains($sText, '-----BEGIN PGP SIGNED MESSAGE-----')) {
|
||||
$oMessage->pgpSigned = [
|
||||
'BodyPartId' => $oPart->PartID()
|
||||
'bodyPartId' => $oPart->PartID()
|
||||
];
|
||||
}
|
||||
|
||||
|
|
@ -427,8 +427,8 @@ class Message implements \JsonSerializable
|
|||
$keyIds = $GPG->getEncryptedMessageKeys($sText);
|
||||
}
|
||||
$oMessage->pgpEncrypted = [
|
||||
'PartId' => $oPart->PartID(),
|
||||
'KeyIds' => $keyIds
|
||||
'partId' => $oPart->PartID(),
|
||||
'keyIds' => $keyIds
|
||||
];
|
||||
}
|
||||
|
||||
|
|
@ -487,42 +487,42 @@ class Message implements \JsonSerializable
|
|||
|
||||
return array(
|
||||
'@Object' => 'Object/Message',
|
||||
'Folder' => $this->sFolder,
|
||||
'Uid' => $this->Uid,
|
||||
'folder' => $this->sFolder,
|
||||
'uid' => $this->Uid,
|
||||
'subject' => \trim(Utils::Utf8Clear($this->sSubject)),
|
||||
'encrypted' => 'multipart/encrypted' == $this->sContentType || $this->pgpEncrypted,
|
||||
'MessageId' => $this->sMessageId,
|
||||
'SpamScore' => $this->bIsSpam ? 100 : $this->SpamScore,
|
||||
'SpamResult' => $this->sSpamResult,
|
||||
'IsSpam' => $this->bIsSpam,
|
||||
'HasVirus' => $this->bHasVirus,
|
||||
// 'VirusScanned' => $this->sVirusScanned,
|
||||
'DateTimeStampInUTC' => $this->iInternalTimeStampInUTC,
|
||||
'messageId' => $this->sMessageId,
|
||||
'spamScore' => $this->bIsSpam ? 100 : $this->SpamScore,
|
||||
'spamResult' => $this->sSpamResult,
|
||||
'isSpam' => $this->bIsSpam,
|
||||
'hasVirus' => $this->bHasVirus,
|
||||
// 'virusScanned' => $this->sVirusScanned,
|
||||
'dateTimeStampInUTC' => $this->iInternalTimeStampInUTC,
|
||||
|
||||
// \MailSo\Mime\EmailCollection
|
||||
'From' => $this->oFrom,
|
||||
'ReplyTo' => $this->oReplyTo,
|
||||
'To' => $this->oTo,
|
||||
'Cc' => $this->oCc,
|
||||
'Bcc' => $this->oBcc,
|
||||
'Sender' => $this->oSender,
|
||||
'DeliveredTo' => $this->oDeliveredTo,
|
||||
'from' => $this->oFrom,
|
||||
'replyTo' => $this->oReplyTo,
|
||||
'to' => $this->oTo,
|
||||
'cc' => $this->oCc,
|
||||
'bcc' => $this->oBcc,
|
||||
'sender' => $this->oSender,
|
||||
'deliveredTo' => $this->oDeliveredTo,
|
||||
|
||||
'Priority' => $this->iPriority,
|
||||
'Threads' => $this->aThreads,
|
||||
'UnsubsribeLinks' => $this->UnsubsribeLinks,
|
||||
'ReadReceipt' => '',
|
||||
'Autocrypt' => $this->sAutocrypt,
|
||||
'priority' => $this->iPriority,
|
||||
'threads' => $this->aThreads,
|
||||
'unsubsribeLinks' => $this->UnsubsribeLinks,
|
||||
'readReceipt' => '',
|
||||
'autocrypt' => $this->sAutocrypt,
|
||||
|
||||
'Attachments' => $this->Attachments,
|
||||
'attachments' => $this->Attachments,
|
||||
|
||||
'spf' => $this->SPF,
|
||||
'dkim' => $this->DKIM,
|
||||
'dmarc' => $this->DMARC,
|
||||
|
||||
'Flags' => $aFlags,
|
||||
'flags' => $aFlags,
|
||||
|
||||
'InReplyTo' => $this->InReplyTo,
|
||||
'inReplyTo' => $this->InReplyTo,
|
||||
|
||||
// https://datatracker.ietf.org/doc/html/rfc8621#section-4.1.1
|
||||
'id' => $this->sEmailId,
|
||||
|
|
|
|||
|
|
@ -62,12 +62,12 @@ class MessageCollection extends \MailSo\Base\Collection
|
|||
return array_merge(parent::jsonSerialize(), array(
|
||||
'totalEmails' => $this->totalEmails,
|
||||
'totalThreads' => $this->totalThreads,
|
||||
'Folder' => $this->FolderName,
|
||||
'folder' => $this->FolderName,
|
||||
'folderHash' => $this->FolderHash,
|
||||
'folderInfo' => $this->FolderInfo,
|
||||
'threadUid' => $this->ThreadUid,
|
||||
'newMessages' => $this->NewMessages,
|
||||
// 'Filtered' => $this->Filtered,
|
||||
// 'filtered' => $this->Filtered,
|
||||
'offset' => $this->Offset,
|
||||
'limit' => $this->Limit,
|
||||
'search' => $this->Search,
|
||||
|
|
|
|||
|
|
@ -24,9 +24,9 @@ class Attachment
|
|||
|
||||
private string $sFileName;
|
||||
|
||||
private int $iFileSize;
|
||||
// private int $iFileSize;
|
||||
|
||||
private string $sCID;
|
||||
private string $sContentID;
|
||||
|
||||
private bool $bIsInline;
|
||||
|
||||
|
|
@ -42,15 +42,15 @@ class Attachment
|
|||
* @param resource $rResource
|
||||
*/
|
||||
function __construct($rResource, string $sFileName, int $iFileSize, bool $bIsInline,
|
||||
bool $bIsLinked, string $sCID, array $aCustomContentTypeParams = [],
|
||||
bool $bIsLinked, string $sContentID, array $aCustomContentTypeParams = [],
|
||||
string $sContentLocation = '', string $sContentType = '')
|
||||
{
|
||||
$this->rResource = $rResource;
|
||||
$this->sFileName = $sFileName;
|
||||
$this->iFileSize = $iFileSize;
|
||||
// $this->iFileSize = $iFileSize;
|
||||
$this->bIsInline = $bIsInline;
|
||||
$this->bIsLinked = $bIsLinked;
|
||||
$this->sCID = $sCID;
|
||||
$this->sContentID = $sContentID;
|
||||
$this->aCustomContentTypeParams = $aCustomContentTypeParams;
|
||||
$this->sContentLocation = $sContentLocation;
|
||||
$this->sContentType = $sContentType
|
||||
|
|
@ -77,34 +77,19 @@ class Attachment
|
|||
return $this->aCustomContentTypeParams;
|
||||
}
|
||||
|
||||
public function CID() : string
|
||||
{
|
||||
return $this->sCID;
|
||||
}
|
||||
|
||||
public function ContentLocation() : string
|
||||
{
|
||||
return $this->sContentLocation;
|
||||
}
|
||||
|
||||
public function FileName() : string
|
||||
{
|
||||
return $this->sFileName;
|
||||
}
|
||||
|
||||
public function FileSize() : int
|
||||
{
|
||||
return $this->iFileSize;
|
||||
}
|
||||
|
||||
public function IsInline() : bool
|
||||
public function isInline() : bool
|
||||
{
|
||||
return $this->bIsInline;
|
||||
}
|
||||
|
||||
public function IsLinked() : bool
|
||||
public function isLinked() : bool
|
||||
{
|
||||
return $this->bIsLinked && \strlen($this->sCID);
|
||||
return $this->bIsLinked && \strlen($this->sContentID);
|
||||
}
|
||||
|
||||
public function ToPart() : Part
|
||||
|
|
@ -112,8 +97,8 @@ class Attachment
|
|||
$oAttachmentPart = new Part;
|
||||
|
||||
$sFileName = \trim($this->sFileName);
|
||||
$sCID = $this->CID();
|
||||
$sContentLocation = $this->ContentLocation();
|
||||
$sContentID = $this->sContentID;
|
||||
$sContentLocation = $this->sContentLocation;
|
||||
|
||||
$oContentTypeParameters = null;
|
||||
$oContentDispositionParameters = null;
|
||||
|
|
@ -137,14 +122,14 @@ class Attachment
|
|||
|
||||
$oAttachmentPart->Headers->append(
|
||||
new Header(Enumerations\Header::CONTENT_DISPOSITION,
|
||||
($this->IsInline() ? 'inline' : 'attachment').
|
||||
($this->isInline() ? 'inline' : 'attachment').
|
||||
($oContentDispositionParameters ? '; '.$oContentDispositionParameters : '')
|
||||
)
|
||||
);
|
||||
|
||||
if (\strlen($sCID)) {
|
||||
if (\strlen($sContentID)) {
|
||||
$oAttachmentPart->Headers->append(
|
||||
new Header(Enumerations\Header::CONTENT_ID, $sCID)
|
||||
new Header(Enumerations\Header::CONTENT_ID, $sContentID)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -210,9 +210,9 @@ class Email implements \JsonSerializable
|
|||
{
|
||||
return array(
|
||||
'@Object' => 'Object/Email',
|
||||
'Name' => \MailSo\Base\Utils::Utf8Clear($this->GetDisplayName()),
|
||||
'Email' => \MailSo\Base\Utils::Utf8Clear($this->GetEmail(true)),
|
||||
'DkimStatus' => $this->sDkimStatus
|
||||
'name' => \MailSo\Base\Utils::Utf8Clear($this->GetDisplayName()),
|
||||
'email' => \MailSo\Base\Utils::Utf8Clear($this->GetEmail(true)),
|
||||
'dkimStatus' => $this->sDkimStatus
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -365,7 +365,7 @@ class Message extends Part
|
|||
if (1 == \count($this->SubParts)) {
|
||||
$oRootPart = $this->SubParts[0];
|
||||
foreach ($this->oAttachmentCollection as $oAttachment) {
|
||||
if ($oAttachment->IsLinked()) {
|
||||
if ($oAttachment->isLinked()) {
|
||||
$oRelatedPart = new Part;
|
||||
$oRelatedPart->Headers->append(
|
||||
new Header(Enumerations\Header::CONTENT_TYPE, 'multipart/related')
|
||||
|
|
@ -383,7 +383,7 @@ class Message extends Part
|
|||
|
||||
$oMixedPart = null;
|
||||
foreach ($this->oAttachmentCollection as $oAttachment) {
|
||||
if ($oRelatedPart && $oAttachment->IsLinked()) {
|
||||
if ($oRelatedPart && $oAttachment->isLinked()) {
|
||||
$oRelatedPart->SubParts->append($oAttachment->ToPart());
|
||||
} else {
|
||||
if (!$oMixedPart) {
|
||||
|
|
|
|||
|
|
@ -51,21 +51,6 @@ class Part
|
|||
{
|
||||
return \trim(\strtolower($this->Headers->ValueByName(Enumerations\Header::CONTENT_TYPE)));
|
||||
}
|
||||
/*
|
||||
public function ContentTypeParameters() : ParameterCollection
|
||||
{
|
||||
return $this->Headers->ParametersByName(\MailSo\Mime\Enumerations\Header::CONTENT_TYPE);
|
||||
}
|
||||
*/
|
||||
public function ContentID() : string
|
||||
{
|
||||
return \trim($this->Headers->ValueByName(Enumerations\Header::CONTENT_ID));
|
||||
}
|
||||
|
||||
public function ContentLocation() : string
|
||||
{
|
||||
return \trim($this->Headers->ValueByName(Enumerations\Header::CONTENT_LOCATION));
|
||||
}
|
||||
|
||||
public function IsFlowedFormat() : bool
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1012,10 +1012,10 @@ class Actions
|
|||
$iError = Enumerations\UploadError::ON_SAVING;
|
||||
} else {
|
||||
$aResponse['Attachment'] = array(
|
||||
'Name' => $aFile['name'],
|
||||
'TempName' => $sSavedName,
|
||||
'MimeType' => $aFile['type'],
|
||||
'Size' => (int) $aFile['size']
|
||||
'name' => $aFile['name'],
|
||||
'tempName' => $sSavedName,
|
||||
'mimeType' => $aFile['type'],
|
||||
'size' => (int) $aFile['size']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ trait Attachments
|
|||
public function DoAttachmentsActions() : array
|
||||
{
|
||||
$sAction = $this->GetActionParam('Do', '');
|
||||
$sFolder = $this->GetActionParam('Folder', '');
|
||||
$sFolder = $this->GetActionParam('folder', '');
|
||||
$aHashes = $this->GetActionParam('Hashes', null);
|
||||
$oFilesProvider = $this->FilesProvider();
|
||||
if (empty($sAction) || !$this->GetCapa(Capa::ATTACHMENTS_ACTIONS) || !$oFilesProvider || !$oFilesProvider->IsActive()) {
|
||||
|
|
@ -29,13 +29,13 @@ trait Attachments
|
|||
if (\is_array($aHashes) && \count($aHashes)) {
|
||||
foreach ($aHashes as $sZipHash) {
|
||||
$aResult = $this->getMimeFileByHash($oAccount, $sZipHash);
|
||||
if (empty($aResult['FileHash'])) {
|
||||
if (empty($aResult['fileHash'])) {
|
||||
$bError = true;
|
||||
break;
|
||||
}
|
||||
$aData[] = $aResult;
|
||||
if (!empty($aResult['MimeIndex'])) {
|
||||
$mUIDs[$aResult['Uid']] = $aResult['Uid'];
|
||||
if (!empty($aResult['mimeIndex'])) {
|
||||
$mUIDs[$aResult['uid']] = $aResult['uid'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -59,8 +59,8 @@ trait Attachments
|
|||
$oZip->open($sZipFileName, \ZIPARCHIVE::CREATE | \ZIPARCHIVE::OVERWRITE);
|
||||
$oZip->setArchiveComment('SnappyMail/'.APP_VERSION);
|
||||
foreach ($aData as $aItem) {
|
||||
$sFullFileNameHash = $oFilesProvider->GetFileName($oAccount, $aItem['FileHash']);
|
||||
$sFileName = ($mUIDs ? "{$aItem['Uid']}/" : ($sFolder ? "{$aItem['Uid']}-" : '')) . $aItem['FileName'];
|
||||
$sFullFileNameHash = $oFilesProvider->GetFileName($oAccount, $aItem['fileHash']);
|
||||
$sFileName = ($mUIDs ? "{$aItem['uid']}/" : ($sFolder ? "{$aItem['uid']}-" : '')) . $aItem['fileName'];
|
||||
if (!$oZip->addFile($sFullFileNameHash, $sFileName)) {
|
||||
$bError = true;
|
||||
}
|
||||
|
|
@ -77,9 +77,9 @@ trait Attachments
|
|||
$oZip = new \SnappyMail\Stream\ZIP($sZipFileName);
|
||||
// $oZip->setArchiveComment('SnappyMail/'.APP_VERSION);
|
||||
foreach ($aData as $aItem) {
|
||||
if ($aItem['FileHash']) {
|
||||
$sFullFileNameHash = $oFilesProvider->GetFileName($oAccount, $aItem['FileHash']);
|
||||
if (!$oZip->addFile($sFullFileNameHash, $aItem['FileName'])) {
|
||||
if ($aItem['fileHash']) {
|
||||
$sFullFileNameHash = $oFilesProvider->GetFileName($oAccount, $aItem['fileHash']);
|
||||
if (!$oZip->addFile($sFullFileNameHash, $aItem['fileName'])) {
|
||||
$bError = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -92,8 +92,8 @@ trait Attachments
|
|||
$oZip->compressFiles(\Phar::GZ);
|
||||
foreach ($aData as $aItem) {
|
||||
$oZip->addFile(
|
||||
$oFilesProvider->GetFileName($oAccount, $aItem['FileHash']),
|
||||
($mUIDs ? "{$aItem['Uid']}/" : ($sFolder ? "{$aItem['Uid']}-" : '')) . $aItem['FileName']
|
||||
$oFilesProvider->GetFileName($oAccount, $aItem['fileHash']),
|
||||
($mUIDs ? "{$aItem['uid']}/" : ($sFolder ? "{$aItem['uid']}-" : '')) . $aItem['fileName']
|
||||
);
|
||||
}
|
||||
$oZip->compressFiles(\Phar::GZ);
|
||||
|
|
@ -102,15 +102,15 @@ trait Attachments
|
|||
}
|
||||
|
||||
foreach ($aData as $aItem) {
|
||||
$oFilesProvider->Clear($oAccount, $aItem['FileHash']);
|
||||
$oFilesProvider->Clear($oAccount, $aItem['fileHash']);
|
||||
}
|
||||
|
||||
if (!$bError) {
|
||||
$mResult = array(
|
||||
'FileHash' => $this->encodeRawKey($oAccount, array(
|
||||
'FileName' => ($sFolder ? 'messages' : 'attachments') . \date('-YmdHis') . '.zip',
|
||||
'MimeType' => 'application/zip',
|
||||
'FileHash' => $sZipHash
|
||||
'fileHash' => $this->encodeRawKey($oAccount, array(
|
||||
'fileName' => ($sFolder ? 'messages' : 'attachments') . \date('-YmdHis') . '.zip',
|
||||
'mimeType' => 'application/zip',
|
||||
'fileHash' => $sZipHash
|
||||
))
|
||||
);
|
||||
}
|
||||
|
|
@ -136,12 +136,12 @@ trait Attachments
|
|||
{
|
||||
$aValues = $this->decodeRawKey($oAccount, $sHash);
|
||||
|
||||
$sFolder = isset($aValues['Folder']) ? (string) $aValues['Folder'] : '';
|
||||
$iUid = isset($aValues['Uid']) ? (int) $aValues['Uid'] : 0;
|
||||
$sMimeIndex = isset($aValues['MimeIndex']) ? (string) $aValues['MimeIndex'] : '';
|
||||
$sFolder = isset($aValues['folder']) ? (string) $aValues['folder'] : '';
|
||||
$iUid = isset($aValues['uid']) ? (int) $aValues['uid'] : 0;
|
||||
$sMimeIndex = isset($aValues['mimeIndex']) ? (string) $aValues['mimeIndex'] : '';
|
||||
|
||||
$sContentTypeIn = isset($aValues['MimeType']) ? (string) $aValues['MimeType'] : '';
|
||||
$sFileNameIn = isset($aValues['FileName']) ? (string) $aValues['FileName'] : 'file.dat';
|
||||
$sContentTypeIn = isset($aValues['mimeType']) ? (string) $aValues['mimeType'] : '';
|
||||
$sFileNameIn = isset($aValues['fileName']) ? (string) $aValues['fileName'] : 'file.dat';
|
||||
|
||||
$oFileProvider = $this->FilesProvider();
|
||||
|
||||
|
|
@ -170,8 +170,8 @@ trait Attachments
|
|||
|
||||
}, $sFolder, $iUid, $sMimeIndex);
|
||||
|
||||
$aValues['FileName'] = $sFileNameIn;
|
||||
$aValues['FileHash'] = $mResult ? $sResultHash : '';
|
||||
$aValues['fileName'] = $sFileNameIn;
|
||||
$aValues['fileHash'] = $mResult ? $sResultHash : '';
|
||||
|
||||
return $aValues;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,14 +95,14 @@ trait Contacts
|
|||
|
||||
$bResult = false;
|
||||
|
||||
if ($this->HasActionParam('Uid') && $this->HasActionParam('jCard')) {
|
||||
if ($this->HasActionParam('uid') && $this->HasActionParam('jCard')) {
|
||||
$oAddressBookProvider = $this->AddressBookProvider($oAccount);
|
||||
if ($oAddressBookProvider && $oAddressBookProvider->IsActive()) {
|
||||
$vCard = \Sabre\VObject\Reader::readJson($this->GetActionParam('jCard'));
|
||||
if ($vCard && $vCard instanceof \Sabre\VObject\Component\VCard) {
|
||||
$vCard->REV = \gmdate('Ymd\\THis\\Z');
|
||||
$vCard->PRODID = 'SnappyMail-'.APP_VERSION;
|
||||
$sUid = \trim($this->GetActionParam('Uid'));
|
||||
$sUid = \trim($this->GetActionParam('uid'));
|
||||
$oContact = $sUid ? $oAddressBookProvider->GetContactByID($sUid) : null;
|
||||
if (!$oContact) {
|
||||
$oContact = new \RainLoop\Providers\AddressBook\Classes\Contact();
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ trait Folders
|
|||
{
|
||||
$oAccount = $this->initMailClientConnection();
|
||||
|
||||
$sFolderFullName = $this->GetActionParam('Folder', '');
|
||||
$sFolderFullName = $this->GetActionParam('folder', '');
|
||||
|
||||
if ($oAccount
|
||||
&& !empty($sFolderFullName)
|
||||
|
|
@ -89,9 +89,9 @@ trait Folders
|
|||
try
|
||||
{
|
||||
$oFolder = $this->MailClient()->FolderCreate(
|
||||
$this->GetActionParam('Folder', ''),
|
||||
$this->GetActionParam('Parent', ''),
|
||||
!!$this->GetActionParam('Subscribe', 1)
|
||||
$this->GetActionParam('folder', ''),
|
||||
$this->GetActionParam('parent', ''),
|
||||
!!$this->GetActionParam('subscribe', 1)
|
||||
);
|
||||
|
||||
// FolderInformation(string $sFolderName, int $iPrevUidNext = 0, array $aUids = array())
|
||||
|
|
@ -106,7 +106,7 @@ trait Folders
|
|||
public function DoFolderSetMetadata() : array
|
||||
{
|
||||
$this->initMailClientConnection();
|
||||
$sFolderFullName = $this->GetActionParam('Folder');
|
||||
$sFolderFullName = $this->GetActionParam('folder');
|
||||
$sMetadataKey = $this->GetActionParam('Key');
|
||||
if ($sFolderFullName && $sMetadataKey) {
|
||||
$this->MailClient()->FolderSetMetadata($sFolderFullName, [
|
||||
|
|
@ -120,8 +120,8 @@ trait Folders
|
|||
{
|
||||
$this->initMailClientConnection();
|
||||
|
||||
$sFolderFullName = $this->GetActionParam('Folder', '');
|
||||
$bSubscribe = '1' === (string) $this->GetActionParam('Subscribe', '0');
|
||||
$sFolderFullName = $this->GetActionParam('folder', '');
|
||||
$bSubscribe = '1' === (string) $this->GetActionParam('subscribe', '0');
|
||||
|
||||
try
|
||||
{
|
||||
|
|
@ -142,7 +142,7 @@ trait Folders
|
|||
{
|
||||
$oAccount = $this->getAccountFromToken();
|
||||
|
||||
$sFolderFullName = $this->GetActionParam('Folder', '');
|
||||
$sFolderFullName = $this->GetActionParam('folder', '');
|
||||
|
||||
$oSettingsLocal = $this->SettingsProvider(true)->Load($oAccount);
|
||||
|
||||
|
|
@ -152,7 +152,7 @@ trait Folders
|
|||
$aCheckableFolder = array();
|
||||
}
|
||||
|
||||
if (!empty($this->GetActionParam('Checkable', '0'))) {
|
||||
if (!empty($this->GetActionParam('checkable', '0'))) {
|
||||
$aCheckableFolder[] = $sFolderFullName;
|
||||
} else {
|
||||
$aCheckableFolderNew = array();
|
||||
|
|
@ -181,9 +181,9 @@ trait Folders
|
|||
try
|
||||
{
|
||||
$this->MailClient()->FolderMove(
|
||||
$this->GetActionParam('Folder', ''),
|
||||
$this->GetActionParam('NewFolder', ''),
|
||||
!!$this->GetActionParam('Subscribe', 1)
|
||||
$this->GetActionParam('folder', ''),
|
||||
$this->GetActionParam('newFolder', ''),
|
||||
!!$this->GetActionParam('subscribe', 1)
|
||||
);
|
||||
}
|
||||
catch (\Throwable $oException)
|
||||
|
|
@ -201,13 +201,13 @@ trait Folders
|
|||
{
|
||||
$this->initMailClientConnection();
|
||||
|
||||
$sName = $this->GetActionParam('NewFolderName', '');
|
||||
$sName = $this->GetActionParam('newFolderName', '');
|
||||
try
|
||||
{
|
||||
$sFullName = $this->MailClient()->FolderRename(
|
||||
$this->GetActionParam('Folder', ''),
|
||||
$this->GetActionParam('folder', ''),
|
||||
$sName,
|
||||
!!$this->GetActionParam('Subscribe', 1)
|
||||
!!$this->GetActionParam('subscribe', 1)
|
||||
);
|
||||
}
|
||||
catch (\Throwable $oException)
|
||||
|
|
@ -217,8 +217,8 @@ trait Folders
|
|||
|
||||
// FolderInformation(string $sFolderName, int $iPrevUidNext = 0, array $aUids = array())
|
||||
return $this->DefaultResponse(array(
|
||||
'Name' => $sName,
|
||||
'FullName' => $sFullName,
|
||||
'name' => $sName,
|
||||
'fullName' => $sFullName,
|
||||
));
|
||||
}
|
||||
|
||||
|
|
@ -231,7 +231,7 @@ trait Folders
|
|||
|
||||
try
|
||||
{
|
||||
$this->MailClient()->FolderDelete($this->GetActionParam('Folder', ''));
|
||||
$this->MailClient()->FolderDelete($this->GetActionParam('folder', ''));
|
||||
}
|
||||
catch (\MailSo\Mail\Exceptions\NonEmptyFolder $oException)
|
||||
{
|
||||
|
|
@ -254,7 +254,7 @@ trait Folders
|
|||
|
||||
try
|
||||
{
|
||||
$this->MailClient()->FolderClear($this->GetActionParam('Folder', ''));
|
||||
$this->MailClient()->FolderClear($this->GetActionParam('folder', ''));
|
||||
}
|
||||
catch (\Throwable $oException)
|
||||
{
|
||||
|
|
@ -274,9 +274,9 @@ trait Folders
|
|||
try
|
||||
{
|
||||
return $this->DefaultResponse($this->MailClient()->FolderInformation(
|
||||
$this->GetActionParam('Folder', ''),
|
||||
(int) $this->GetActionParam('UidNext', 0),
|
||||
new \MailSo\Imap\SequenceSet($this->GetActionParam('FlagsUids', []))
|
||||
$this->GetActionParam('folder', ''),
|
||||
(int) $this->GetActionParam('uidNext', 0),
|
||||
new \MailSo\Imap\SequenceSet($this->GetActionParam('flagsUids', []))
|
||||
));
|
||||
}
|
||||
catch (\Throwable $oException)
|
||||
|
|
@ -302,10 +302,10 @@ trait Folders
|
|||
try
|
||||
{
|
||||
$aInboxInformation = $this->MailClient()->FolderInformation($sFolder);
|
||||
if (isset($aInboxInformation['Folder'])) {
|
||||
if (isset($aInboxInformation['folder'])) {
|
||||
$aResult[] = [
|
||||
'Folder' => $aInboxInformation['Folder'],
|
||||
'Hash' => $aInboxInformation['Hash'],
|
||||
'folder' => $aInboxInformation['folder'],
|
||||
'hash' => $aInboxInformation['hash'],
|
||||
'totalEmails' => $aInboxInformation['totalEmails'],
|
||||
'unreadEmails' => $aInboxInformation['unreadEmails'],
|
||||
];
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ trait Messages
|
|||
{
|
||||
$oAccount = $this->initMailClientConnection();
|
||||
|
||||
$sDraftFolder = $this->GetActionParam('SaveFolder', '');
|
||||
$sDraftFolder = $this->GetActionParam('saveFolder', '');
|
||||
if (!\strlen($sDraftFolder)) {
|
||||
throw new ClientException(Notifications::UnknownError);
|
||||
}
|
||||
|
|
@ -132,16 +132,16 @@ trait Messages
|
|||
|
||||
$mResult = true;
|
||||
|
||||
$sMessageFolder = $this->GetActionParam('MessageFolder', '');
|
||||
$iMessageUid = (int) $this->GetActionParam('MessageUid', 0);
|
||||
$sMessageFolder = $this->GetActionParam('messageFolder', '');
|
||||
$iMessageUid = (int) $this->GetActionParam('messageUid', 0);
|
||||
if (\strlen($sMessageFolder) && 0 < $iMessageUid) {
|
||||
$this->MailClient()->MessageDelete($sMessageFolder, new SequenceSet($iMessageUid));
|
||||
}
|
||||
|
||||
if (null !== $iNewUid && 0 < $iNewUid) {
|
||||
$mResult = array(
|
||||
'NewFolder' => $sDraftFolder,
|
||||
'NewUid' => $iNewUid
|
||||
'folder' => $sDraftFolder,
|
||||
'uid' => $iNewUid
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -156,8 +156,8 @@ trait Messages
|
|||
|
||||
$oConfig = $this->Config();
|
||||
|
||||
$sSentFolder = $this->GetActionParam('SaveFolder', '');
|
||||
$aDraftInfo = $this->GetActionParam('DraftInfo', null);
|
||||
$sSentFolder = $this->GetActionParam('saveFolder', '');
|
||||
$aDraftInfo = $this->GetActionParam('draftInfo', null);
|
||||
|
||||
$oMessage = $this->buildMessage($oAccount, false);
|
||||
|
||||
|
|
@ -173,7 +173,7 @@ trait Messages
|
|||
$oMessage->ToStream(true), array($rMessageStream), 8192, true, true, true);
|
||||
|
||||
if (false !== $iMessageStreamSize) {
|
||||
$bDsn = !empty($this->GetActionParam('Dsn', 0));
|
||||
$bDsn = !empty($this->GetActionParam('dsn', 0));
|
||||
$this->smtpSendMessage($oAccount, $oMessage, $rMessageStream, $iMessageStreamSize, $bDsn, true);
|
||||
|
||||
if (\is_array($aDraftInfo) && 3 === \count($aDraftInfo)) {
|
||||
|
|
@ -244,8 +244,8 @@ trait Messages
|
|||
|
||||
$this->deleteMessageAttachments($oAccount);
|
||||
|
||||
$sDraftFolder = $this->GetActionParam('MessageFolder', '');
|
||||
$iDraftUid = (int) $this->GetActionParam('MessageUid', 0);
|
||||
$sDraftFolder = $this->GetActionParam('messageFolder', '');
|
||||
$iDraftUid = (int) $this->GetActionParam('messageUid', 0);
|
||||
if (\strlen($sDraftFolder) && 0 < $iDraftUid) {
|
||||
try
|
||||
{
|
||||
|
|
@ -329,8 +329,8 @@ trait Messages
|
|||
|
||||
$mResult = true;
|
||||
|
||||
$sFolderFullName = $this->GetActionParam('MessageFolder', '');
|
||||
$iUid = (int) $this->GetActionParam('MessageUid', 0);
|
||||
$sFolderFullName = $this->GetActionParam('messageFolder', '');
|
||||
$iUid = (int) $this->GetActionParam('messageUid', 0);
|
||||
|
||||
$this->Cacher($oAccount)->Set(\RainLoop\KeyPathHelper::ReadReceiptCache($oAccount->Email(), $sFolderFullName, $iUid), '1');
|
||||
|
||||
|
|
@ -374,7 +374,7 @@ trait Messages
|
|||
try
|
||||
{
|
||||
$this->MailClient()->MessageSetFlag(
|
||||
$this->GetActionParam('Folder', ''),
|
||||
$this->GetActionParam('folder', ''),
|
||||
empty($sThreadUids) ? new SequenceSet('1:*', false) : new SequenceSet(\explode(',', $sThreadUids)),
|
||||
MessageFlag::SEEN,
|
||||
!empty($this->GetActionParam('SetAction', '0'))
|
||||
|
|
@ -415,8 +415,8 @@ trait Messages
|
|||
|
||||
$this->verifyCacheByKey($sRawKey);
|
||||
} else {
|
||||
$sFolder = $this->GetActionParam('Folder', '');
|
||||
$iUid = (int) $this->GetActionParam('Uid', 0);
|
||||
$sFolder = $this->GetActionParam('folder', '');
|
||||
$iUid = (int) $this->GetActionParam('uid', 0);
|
||||
}
|
||||
|
||||
$oAccount = $this->initMailClientConnection();
|
||||
|
|
@ -446,7 +446,7 @@ trait Messages
|
|||
{
|
||||
$this->initMailClientConnection();
|
||||
|
||||
$sFolder = $this->GetActionParam('Folder', '');
|
||||
$sFolder = $this->GetActionParam('folder', '');
|
||||
$aUids = \explode(',', (string) $this->GetActionParam('Uids', ''));
|
||||
|
||||
try
|
||||
|
|
@ -566,7 +566,7 @@ trait Messages
|
|||
|
||||
try
|
||||
{
|
||||
$aAttachments = $this->GetActionParam('Attachments', array());
|
||||
$aAttachments = $this->GetActionParam('attachments', array());
|
||||
if (!\is_array($aAttachments)) {
|
||||
$aAttachments = [];
|
||||
}
|
||||
|
|
@ -575,9 +575,9 @@ trait Messages
|
|||
foreach ($aAttachments as $mIndex => $sAttachment) {
|
||||
$aAttachments[$mIndex] = false;
|
||||
if ($aValues = $this->decodeRawKey($oAccount, $sAttachment)) {
|
||||
$sFolder = isset($aValues['Folder']) ? (string) $aValues['Folder'] : '';
|
||||
$iUid = isset($aValues['Uid']) ? (int) $aValues['Uid'] : 0;
|
||||
$sMimeIndex = isset($aValues['MimeIndex']) ? (string) $aValues['MimeIndex'] : '';
|
||||
$sFolder = isset($aValues['folder']) ? (string) $aValues['folder'] : '';
|
||||
$iUid = isset($aValues['uid']) ? (int) $aValues['uid'] : 0;
|
||||
$sMimeIndex = isset($aValues['mimeIndex']) ? (string) $aValues['mimeIndex'] : '';
|
||||
|
||||
$sTempName = \sha1($sAttachment);
|
||||
if (!$oFilesProvider->FileExists($oAccount, $sTempName)) {
|
||||
|
|
@ -595,10 +595,10 @@ trait Messages
|
|||
|
||||
if ($self->FilesProvider()->PutFile($oAccount, $sTempName, $rResource)) {
|
||||
$aAttachments[$mIndex] = [
|
||||
// 'Name' => $sFileName,
|
||||
'TempName' => $sTempName,
|
||||
'MimeType' => $sContentType
|
||||
// 'Size' => 0
|
||||
// 'name' => $sFileName,
|
||||
'tempName' => $sTempName,
|
||||
'mimeType' => $sContentType
|
||||
// 'size' => 0
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -609,10 +609,10 @@ trait Messages
|
|||
?: \SnappyMail\File\MimeType::fromFilename($sTempName)
|
||||
?: 'application/octet-stream'; // 'text/plain'
|
||||
$aAttachments[$mIndex] = [
|
||||
// 'Name' => $sFileName,
|
||||
'TempName' => $sTempName,
|
||||
'MimeType' => $sContentType
|
||||
// 'Size' => $oFilesProvider->FileSize($oAccount, $sTempName)
|
||||
// 'name' => $sFileName,
|
||||
'tempName' => $sTempName,
|
||||
'mimeType' => $sContentType
|
||||
// 'size' => $oFilesProvider->FileSize($oAccount, $sTempName)
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -632,19 +632,19 @@ trait Messages
|
|||
*/
|
||||
public function DoMessagePgpVerify() : array
|
||||
{
|
||||
$sFolderName = $this->GetActionParam('Folder', '');
|
||||
$iUid = (int) $this->GetActionParam('Uid', 0);
|
||||
$sBodyPart = $this->GetActionParam('BodyPart', '');
|
||||
$sSigPart = $this->GetActionParam('SigPart', '');
|
||||
$sFolderName = $this->GetActionParam('folder', '');
|
||||
$iUid = (int) $this->GetActionParam('uid', 0);
|
||||
$sBodyPart = $this->GetActionParam('bodyPart', '');
|
||||
$sSigPart = $this->GetActionParam('sigPart', '');
|
||||
if ($sBodyPart) {
|
||||
$result = [
|
||||
'text' => \preg_replace('/\\r?\\n/su', "\r\n", $sBodyPart),
|
||||
'signature' => $this->GetActionParam('SigPart', '')
|
||||
'signature' => $this->GetActionParam('sigPart', '')
|
||||
];
|
||||
} else {
|
||||
$sBodyPartId = $this->GetActionParam('BodyPartId', '');
|
||||
$sSigPartId = $this->GetActionParam('SigPartId', '');
|
||||
// $sMicAlg = $this->GetActionParam('MicAlg', '');
|
||||
$sBodyPartId = $this->GetActionParam('bodyPartId', '');
|
||||
$sSigPartId = $this->GetActionParam('sigPartId', '');
|
||||
// $sMicAlg = $this->GetActionParam('micAlg', '');
|
||||
|
||||
$oAccount = $this->initMailClientConnection();
|
||||
|
||||
|
|
@ -872,7 +872,7 @@ trait Messages
|
|||
try
|
||||
{
|
||||
$this->MailClient()->MessageSetFlag(
|
||||
$this->GetActionParam('Folder', ''),
|
||||
$this->GetActionParam('folder', ''),
|
||||
new SequenceSet(\explode(',', (string) $this->GetActionParam('Uids', ''))),
|
||||
$sMessageFlag,
|
||||
!empty($this->GetActionParam('SetAction', '0')),
|
||||
|
|
@ -889,7 +889,7 @@ trait Messages
|
|||
|
||||
private function deleteMessageAttachments(Account $oAccount) : void
|
||||
{
|
||||
$aAttachments = $this->GetActionParam('Attachments', null);
|
||||
$aAttachments = $this->GetActionParam('attachments', null);
|
||||
|
||||
if (\is_array($aAttachments)) {
|
||||
foreach (\array_keys($aAttachments) as $sTempName) {
|
||||
|
|
@ -902,9 +902,9 @@ trait Messages
|
|||
|
||||
private function buildReadReceiptMessage(Account $oAccount) : \MailSo\Mime\Message
|
||||
{
|
||||
$sReadReceipt = $this->GetActionParam('ReadReceipt', '');
|
||||
$sReadReceipt = $this->GetActionParam('readReceipt', '');
|
||||
$sSubject = $this->GetActionParam('subject', '');
|
||||
$sText = $this->GetActionParam('Text', '');
|
||||
$sText = $this->GetActionParam('plain', '');
|
||||
|
||||
$oIdentity = $this->GetIdentityByID($oAccount, '', true);
|
||||
|
||||
|
|
@ -966,10 +966,10 @@ trait Messages
|
|||
$oMessage->SetXMailer('SnappyMail/'.APP_VERSION);
|
||||
}
|
||||
|
||||
$sFrom = $this->GetActionParam('From', '');
|
||||
$sFrom = $this->GetActionParam('from', '');
|
||||
$oMessage->SetFrom(\MailSo\Mime\Email::Parse($sFrom));
|
||||
/*
|
||||
$oFromIdentity = $this->GetIdentityByID($oAccount, $this->GetActionParam('IdentityID', ''));
|
||||
$oFromIdentity = $this->GetIdentityByID($oAccount, $this->GetActionParam('identityID', ''));
|
||||
if ($oFromIdentity)
|
||||
{
|
||||
$oMessage->SetFrom(new \MailSo\Mime\Email(
|
||||
|
|
@ -986,49 +986,49 @@ trait Messages
|
|||
$oFrom = $oMessage->GetFrom();
|
||||
$oMessage->RegenerateMessageId($oFrom ? $oFrom->GetDomain() : '');
|
||||
|
||||
$oReplyTo = new \MailSo\Mime\EmailCollection($this->GetActionParam('ReplyTo', ''));
|
||||
$oReplyTo = new \MailSo\Mime\EmailCollection($this->GetActionParam('replyTo', ''));
|
||||
if ($oReplyTo->count()) {
|
||||
$oMessage->SetReplyTo($oReplyTo);
|
||||
}
|
||||
|
||||
if (!empty($this->GetActionParam('ReadReceiptRequest', 0))) {
|
||||
if (!empty($this->GetActionParam('readReceiptRequest', 0))) {
|
||||
// Read Receipts Reference Main Account Email, Not Identities #147
|
||||
// $oMessage->SetReadReceipt(($oFromIdentity ?: $oAccount)->Email());
|
||||
$oMessage->SetReadReceipt($oFrom->GetEmail());
|
||||
}
|
||||
|
||||
if (!empty($this->GetActionParam('MarkAsImportant', 0))) {
|
||||
if (!empty($this->GetActionParam('markAsImportant', 0))) {
|
||||
$oMessage->SetPriority(\MailSo\Mime\Enumerations\MessagePriority::HIGH);
|
||||
}
|
||||
|
||||
$oMessage->SetSubject($this->GetActionParam('subject', ''));
|
||||
|
||||
$oToEmails = new \MailSo\Mime\EmailCollection($this->GetActionParam('To', ''));
|
||||
$oToEmails = new \MailSo\Mime\EmailCollection($this->GetActionParam('to', ''));
|
||||
if ($oToEmails->count()) {
|
||||
$oMessage->SetTo($oToEmails);
|
||||
}
|
||||
|
||||
$oCcEmails = new \MailSo\Mime\EmailCollection($this->GetActionParam('Cc', ''));
|
||||
$oCcEmails = new \MailSo\Mime\EmailCollection($this->GetActionParam('cc', ''));
|
||||
if ($oCcEmails->count()) {
|
||||
$oMessage->SetCc($oCcEmails);
|
||||
}
|
||||
|
||||
$oBccEmails = new \MailSo\Mime\EmailCollection($this->GetActionParam('Bcc', ''));
|
||||
$oBccEmails = new \MailSo\Mime\EmailCollection($this->GetActionParam('bcc', ''));
|
||||
if ($oBccEmails->count()) {
|
||||
$oMessage->SetBcc($oBccEmails);
|
||||
}
|
||||
|
||||
$aDraftInfo = $this->GetActionParam('DraftInfo', null);
|
||||
$aDraftInfo = $this->GetActionParam('draftInfo', null);
|
||||
if ($bWithDraftInfo && \is_array($aDraftInfo) && !empty($aDraftInfo[0]) && !empty($aDraftInfo[1]) && !empty($aDraftInfo[2])) {
|
||||
$oMessage->SetDraftInfo($aDraftInfo[0], $aDraftInfo[1], $aDraftInfo[2]);
|
||||
}
|
||||
|
||||
$sInReplyTo = $this->GetActionParam('InReplyTo', '');
|
||||
$sInReplyTo = $this->GetActionParam('inReplyTo', '');
|
||||
if (\strlen($sInReplyTo)) {
|
||||
$oMessage->SetInReplyTo($sInReplyTo);
|
||||
}
|
||||
|
||||
$sReferences = $this->GetActionParam('References', '');
|
||||
$sReferences = $this->GetActionParam('references', '');
|
||||
if (\strlen($sReferences)) {
|
||||
$oMessage->SetReferences($sReferences);
|
||||
}
|
||||
|
|
@ -1038,7 +1038,7 @@ trait Messages
|
|||
$aFoundContentLocationUrls = array();
|
||||
$oPart;
|
||||
|
||||
if ($sSigned = $this->GetActionParam('Signed', '')) {
|
||||
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', '');
|
||||
|
|
@ -1055,7 +1055,7 @@ trait Messages
|
|||
unset($oAlternativePart);
|
||||
unset($sSigned);
|
||||
|
||||
} else if ($sEncrypted = $this->GetActionParam('Encrypted', '')) {
|
||||
} else if ($sEncrypted = $this->GetActionParam('encrypted', '')) {
|
||||
$oPart = new MimePart;
|
||||
$oPart->Headers->AddByName(
|
||||
MimeEnumHeader::CONTENT_TYPE,
|
||||
|
|
@ -1081,7 +1081,7 @@ trait Messages
|
|||
unset($sEncrypted);
|
||||
|
||||
} else {
|
||||
if ($sHtml = $this->GetActionParam('Html', '')) {
|
||||
if ($sHtml = $this->GetActionParam('html', '')) {
|
||||
$oPart = new MimePart;
|
||||
$oPart->Headers->AddByName(MimeEnumHeader::CONTENT_TYPE, 'multipart/alternative');
|
||||
$oMessage->SubParts->append($oPart);
|
||||
|
|
@ -1090,7 +1090,7 @@ trait Messages
|
|||
$this->Plugins()->RunHook('filter.message-html', array($oAccount, $oMessage, &$sHtml));
|
||||
|
||||
// First add plain
|
||||
$sPlain = $this->GetActionParam('Text', '') ?: \MailSo\Base\HtmlUtils::ConvertHtmlToPlain($sHtml);
|
||||
$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');
|
||||
|
|
@ -1116,7 +1116,7 @@ trait Messages
|
|||
unset($sHtml);
|
||||
|
||||
} else {
|
||||
$sPlain = $this->GetActionParam('Text', '');
|
||||
$sPlain = $this->GetActionParam('plain', '');
|
||||
if ($sSignature = $this->GetActionParam('Signature', null)) {
|
||||
$oPart = new MimePart;
|
||||
$oPart->Headers->AddByName(
|
||||
|
|
@ -1154,7 +1154,7 @@ trait Messages
|
|||
}
|
||||
unset($oPart);
|
||||
|
||||
$aAttachments = $this->GetActionParam('Attachments', null);
|
||||
$aAttachments = $this->GetActionParam('attachments', null);
|
||||
if (\is_array($aAttachments)) {
|
||||
foreach ($aAttachments as $sTempName => $aData) {
|
||||
$sFileName = (string) $aData['name'];
|
||||
|
|
@ -1200,8 +1200,8 @@ trait Messages
|
|||
}
|
||||
}
|
||||
|
||||
$sFingerprint = $this->GetActionParam('SignFingerprint', '');
|
||||
$sPassphrase = $this->GetActionParam('SignPassphrase', '');
|
||||
$sFingerprint = $this->GetActionParam('signFingerprint', '');
|
||||
$sPassphrase = $this->GetActionParam('signPassphrase', '');
|
||||
if ($sFingerprint) {
|
||||
$GPG = $this->GnuPG();
|
||||
$oBody = $oMessage->GetRootPart();
|
||||
|
|
@ -1242,7 +1242,7 @@ trait Messages
|
|||
$oPart->SubParts->append($oSignaturePart);
|
||||
}
|
||||
|
||||
$aFingerprints = \json_decode($this->GetActionParam('EncryptFingerprints', ''), true);
|
||||
$aFingerprints = \json_decode($this->GetActionParam('encryptFingerprints', ''), true);
|
||||
if ($aFingerprints) {
|
||||
$GPG = $this->GnuPG();
|
||||
$oBody = $oMessage->GetRootPart();
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ trait Pgp
|
|||
}
|
||||
|
||||
$GPG->addDecryptKey(
|
||||
$this->GetActionParam('KeyId', ''),
|
||||
$this->GetActionParam('keyId', ''),
|
||||
$this->GetActionParam('Passphrase', '')
|
||||
);
|
||||
|
||||
|
|
@ -102,9 +102,9 @@ trait Pgp
|
|||
// $oPart = \MailSo\Mime\Part::FromStream($rStreamHandle);
|
||||
}
|
||||
},
|
||||
$this->GetActionParam('Folder', ''),
|
||||
(int) $this->GetActionParam('Uid', ''),
|
||||
$this->GetActionParam('PartId', '')
|
||||
$this->GetActionParam('folder', ''),
|
||||
(int) $this->GetActionParam('uid', ''),
|
||||
$this->GetActionParam('partId', '')
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -126,7 +126,7 @@ trait Pgp
|
|||
{
|
||||
$GPG = $this->GnuPG();
|
||||
return $this->DefaultResponse($GPG ? $GPG->export(
|
||||
$this->GetActionParam('KeyId', ''),
|
||||
$this->GetActionParam('keyId', ''),
|
||||
$this->GetActionParam('Passphrase', '')
|
||||
) : false);
|
||||
}
|
||||
|
|
@ -149,7 +149,7 @@ trait Pgp
|
|||
public function DoGnupgDeleteKey() : array
|
||||
{
|
||||
$GPG = $this->GnuPG();
|
||||
$sKeyId = $this->GetActionParam('KeyId', '');
|
||||
$sKeyId = $this->GetActionParam('keyId', '');
|
||||
$bPrivate = !!$this->GetActionParam('isPrivate', 0);
|
||||
return $this->DefaultResponse($GPG ? $GPG->deleteKey($sKeyId, $bPrivate) : false);
|
||||
}
|
||||
|
|
@ -157,7 +157,7 @@ trait Pgp
|
|||
public function DoGnupgImportKey() : array
|
||||
{
|
||||
$sKey = $this->GetActionParam('Key', '');
|
||||
$sKeyId = $this->GetActionParam('KeyId', '');
|
||||
$sKeyId = $this->GetActionParam('keyId', '');
|
||||
$sEmail = $this->GetActionParam('Email', '');
|
||||
|
||||
if (!$sKey) {
|
||||
|
|
@ -266,7 +266,7 @@ trait Pgp
|
|||
public function DoStorePGPKey() : array
|
||||
{
|
||||
$key = $this->GetActionParam('Key', '');
|
||||
$keyId = $this->GetActionParam('KeyId', '');
|
||||
$keyId = $this->GetActionParam('keyId', '');
|
||||
return $this->DefaultResponse(($key && $keyId && $this->StorePGPKey($key, $keyId)));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@ trait Raw
|
|||
(string) $this->GetActionParam('RawKey', '')
|
||||
);
|
||||
|
||||
$sFolder = isset($aValues['Folder']) ? (string) $aValues['Folder'] : '';
|
||||
$iUid = isset($aValues['Uid']) ? (int) $aValues['Uid'] : 0;
|
||||
$sMimeIndex = isset($aValues['MimeIndex']) ? (string) $aValues['MimeIndex'] : '';
|
||||
$sFolder = isset($aValues['folder']) ? (string) $aValues['folder'] : '';
|
||||
$iUid = isset($aValues['uid']) ? (int) $aValues['uid'] : 0;
|
||||
$sMimeIndex = isset($aValues['mimeIndex']) ? (string) $aValues['mimeIndex'] : '';
|
||||
|
||||
\header('Content-Type: text/plain');
|
||||
|
||||
|
|
@ -51,24 +51,19 @@ trait Raw
|
|||
|
||||
$oAccount = $this->getAccountFromToken();
|
||||
|
||||
$sData = $this->StorageProvider()->Get($oAccount,
|
||||
$mData = $this->StorageProvider()->Get($oAccount,
|
||||
\RainLoop\Providers\Storage\Enumerations\StorageType::CONFIG,
|
||||
'background'
|
||||
);
|
||||
|
||||
if (!empty($sData))
|
||||
{
|
||||
$aData = \json_decode($sData, true);
|
||||
unset($sData);
|
||||
|
||||
if (!empty($aData['ContentType']) && !empty($aData['Raw']) &&
|
||||
\in_array($aData['ContentType'], array('image/png', 'image/jpg', 'image/jpeg')))
|
||||
{
|
||||
if (!empty($mData)) {
|
||||
$mData = \json_decode($mData, true);
|
||||
if (!empty($mData['ContentType']) && !empty($mData['Raw'])) {
|
||||
$this->cacheByKey($sRawKey);
|
||||
|
||||
\header('Content-Type: '.$aData['ContentType']);
|
||||
echo \base64_decode($aData['Raw']);
|
||||
unset($aData);
|
||||
\header('Content-Type: '.$mData['ContentType']);
|
||||
echo \base64_decode($mData['Raw']);
|
||||
unset($mData);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -133,13 +128,13 @@ trait Raw
|
|||
$bIsRangeRequest = true;
|
||||
}
|
||||
|
||||
$sFolder = isset($aValues['Folder']) ? (string) $aValues['Folder'] : '';
|
||||
$iUid = isset($aValues['Uid']) ? (int) $aValues['Uid'] : 0;
|
||||
$sMimeIndex = isset($aValues['MimeIndex']) ? (string) $aValues['MimeIndex'] : '';
|
||||
$sFolder = isset($aValues['folder']) ? (string) $aValues['folder'] : '';
|
||||
$iUid = isset($aValues['uid']) ? (int) $aValues['uid'] : 0;
|
||||
$sMimeIndex = isset($aValues['mimeIndex']) ? (string) $aValues['mimeIndex'] : '';
|
||||
|
||||
$sContentTypeIn = isset($aValues['MimeType']) ? (string) $aValues['MimeType'] : '';
|
||||
$sFileNameIn = isset($aValues['FileName']) ? (string) $aValues['FileName'] : '';
|
||||
$sFileHashIn = isset($aValues['FileHash']) ? (string) $aValues['FileHash'] : '';
|
||||
$sContentTypeIn = isset($aValues['mimeType']) ? (string) $aValues['mimeType'] : '';
|
||||
$sFileNameIn = isset($aValues['fileName']) ? (string) $aValues['fileName'] : '';
|
||||
$sFileHashIn = isset($aValues['fileHash']) ? (string) $aValues['fileHash'] : '';
|
||||
|
||||
if (!empty($sFileHashIn)) {
|
||||
$this->verifyCacheByKey($sRawKey);
|
||||
|
|
|
|||
|
|
@ -116,59 +116,59 @@ trait Response
|
|||
|
||||
$oAccount = $this->getAccountFromToken();
|
||||
|
||||
if (!$mResult['DateTimeStampInUTC'] || $this->Config()->Get('labs', 'date_from_headers', true)) {
|
||||
if (!$mResult['dateTimeStampInUTC'] || $this->Config()->Get('labs', 'date_from_headers', true)) {
|
||||
$iDateTimeStampInUTC = $mResponse->HeaderTimeStampInUTC;
|
||||
if ($iDateTimeStampInUTC) {
|
||||
$mResult['DateTimeStampInUTC'] = $iDateTimeStampInUTC;
|
||||
$mResult['dateTimeStampInUTC'] = $iDateTimeStampInUTC;
|
||||
}
|
||||
}
|
||||
|
||||
// \MailSo\Mime\EmailCollection
|
||||
foreach (['ReplyTo','From','To','Cc','Bcc','Sender','DeliveredTo'] as $prop) {
|
||||
foreach (['replyTo','from','to','cc','bcc','sender','deliveredTo'] as $prop) {
|
||||
$mResult[$prop] = $this->responseObject($mResult[$prop], $prop);
|
||||
}
|
||||
|
||||
$sSubject = $mResult['subject'];
|
||||
$mResult['Hash'] = \md5($mResult['Folder'].$mResult['Uid']);
|
||||
$mResult['RequestHash'] = $this->encodeRawKey($oAccount, array(
|
||||
'Folder' => $mResult['Folder'],
|
||||
'Uid' => $mResult['Uid'],
|
||||
'MimeType' => 'message/rfc822',
|
||||
'FileName' => (\strlen($sSubject) ? \MailSo\Base\Utils::SecureFileName($sSubject) : 'message-'.$mResult['Uid']) . '.eml'
|
||||
$mResult['hash'] = \md5($mResult['folder'].$mResult['uid']);
|
||||
$mResult['requestHash'] = $this->encodeRawKey($oAccount, array(
|
||||
'folder' => $mResult['folder'],
|
||||
'uid' => $mResult['uid'],
|
||||
'mimeType' => 'message/rfc822',
|
||||
'fileName' => (\strlen($sSubject) ? \MailSo\Base\Utils::SecureFileName($sSubject) : 'message-'.$mResult['uid']) . '.eml'
|
||||
));
|
||||
|
||||
$mResult['Attachments'] = $this->responseObject($mResponse->Attachments, 'Attachments');
|
||||
$mResult['attachments'] = $this->responseObject($mResponse->Attachments, 'attachments');
|
||||
|
||||
if (!$sParent) {
|
||||
$mResult['DraftInfo'] = $mResponse->DraftInfo;
|
||||
$mResult['UnsubsribeLinks'] = $mResponse->UnsubsribeLinks;
|
||||
$mResult['References'] = $mResponse->References;
|
||||
$mResult['draftInfo'] = $mResponse->DraftInfo;
|
||||
$mResult['unsubsribeLinks'] = $mResponse->UnsubsribeLinks;
|
||||
$mResult['references'] = $mResponse->References;
|
||||
|
||||
$mResult['Html'] = $mResponse->Html();
|
||||
$mResult['Plain'] = $mResponse->Plain();
|
||||
$mResult['html'] = $mResponse->Html();
|
||||
$mResult['plain'] = $mResponse->Plain();
|
||||
|
||||
// $this->GetCapa(Capa::OPEN_PGP) || $this->GetCapa(Capa::GNUPG)
|
||||
$mResult['PgpSigned'] = $mResponse->pgpSigned;
|
||||
$mResult['PgpEncrypted'] = $mResponse->pgpEncrypted;
|
||||
$mResult['pgpSigned'] = $mResponse->pgpSigned;
|
||||
$mResult['pgpEncrypted'] = $mResponse->pgpEncrypted;
|
||||
|
||||
$mResult['ReadReceipt'] = $mResponse->ReadReceipt;
|
||||
if (\strlen($mResult['ReadReceipt']) && !\in_array('$forwarded', $mResult['Flags'])) {
|
||||
// \in_array('$mdnsent', $mResult['Flags'])
|
||||
if (\strlen($mResult['ReadReceipt'])) {
|
||||
$mResult['readReceipt'] = $mResponse->ReadReceipt;
|
||||
if (\strlen($mResult['readReceipt']) && !\in_array('$forwarded', $mResult['flags'])) {
|
||||
// \in_array('$mdnsent', $mResult['flags'])
|
||||
if (\strlen($mResult['readReceipt'])) {
|
||||
try
|
||||
{
|
||||
$oReadReceipt = \MailSo\Mime\Email::Parse($mResult['ReadReceipt']);
|
||||
$oReadReceipt = \MailSo\Mime\Email::Parse($mResult['readReceipt']);
|
||||
if (!$oReadReceipt) {
|
||||
$mResult['ReadReceipt'] = '';
|
||||
$mResult['readReceipt'] = '';
|
||||
}
|
||||
}
|
||||
catch (\Throwable $oException) { unset($oException); }
|
||||
}
|
||||
|
||||
if (\strlen($mResult['ReadReceipt']) && '1' === $this->Cacher($oAccount)->Get(
|
||||
\RainLoop\KeyPathHelper::ReadReceiptCache($oAccount->Email(), $mResult['Folder'], $mResult['Uid']), '0'))
|
||||
if (\strlen($mResult['readReceipt']) && '1' === $this->Cacher($oAccount)->Get(
|
||||
\RainLoop\KeyPathHelper::ReadReceiptCache($oAccount->Email(), $mResult['folder'], $mResult['uid']), '0'))
|
||||
{
|
||||
$mResult['ReadReceipt'] = '';
|
||||
$mResult['readReceipt'] = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -177,13 +177,13 @@ trait Response
|
|||
|
||||
if ($mResponse instanceof \MailSo\Mail\Attachment) {
|
||||
$mResult = $mResponse->jsonSerialize();
|
||||
$mResult['IsThumbnail'] = $this->GetCapa(Capa::ATTACHMENT_THUMBNAILS) && $this->isFileHasThumbnail($mResult['FileName']);
|
||||
$mResult['Download'] = $this->encodeRawKey($this->getAccountFromToken(), array(
|
||||
'Folder' => $mResult['Folder'],
|
||||
'Uid' => $mResult['Uid'],
|
||||
'MimeIndex' => $mResult['MimeIndex'],
|
||||
'MimeType' => $mResult['MimeType'],
|
||||
'FileName' => $mResult['FileName']
|
||||
$mResult['isThumbnail'] = $this->GetCapa(Capa::ATTACHMENT_THUMBNAILS) && $this->isFileHasThumbnail($mResult['fileName']);
|
||||
$mResult['download'] = $this->encodeRawKey($this->getAccountFromToken(), array(
|
||||
'folder' => $mResult['folder'],
|
||||
'uid' => $mResult['uid'],
|
||||
'mimeIndex' => $mResult['mimeIndex'],
|
||||
'mimeType' => $mResult['mimeType'],
|
||||
'fileName' => $mResult['fileName']
|
||||
));
|
||||
return $mResult;
|
||||
}
|
||||
|
|
@ -193,7 +193,7 @@ trait Response
|
|||
|
||||
$sHash = $mResponse->Hash($this->MailClient()->ImapClient()->Hash());
|
||||
if ($sHash) {
|
||||
$aResult['Hash'] = $sHash;
|
||||
$aResult['hash'] = $sHash;
|
||||
}
|
||||
|
||||
if (null === $this->aCheckableFolder) {
|
||||
|
|
@ -204,7 +204,7 @@ trait Response
|
|||
);
|
||||
$this->aCheckableFolder = \is_array($aCheckable) ? $aCheckable : array();
|
||||
}
|
||||
$aResult['Checkable'] = \in_array($mResponse->FullName(), $this->aCheckableFolder);
|
||||
$aResult['checkable'] = \in_array($mResponse->FullName(), $this->aCheckableFolder);
|
||||
|
||||
return $aResult;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -159,8 +159,8 @@ trait Themes
|
|||
if ($this->StorageProvider()->Put($oAccount,
|
||||
\RainLoop\Providers\Storage\Enumerations\StorageType::CONFIG,
|
||||
'background',
|
||||
// Used by RawUserBackground()
|
||||
\RainLoop\Utils::jsonEncode(array(
|
||||
'Name' => $aFile['name'],
|
||||
'ContentType' => $sMimeType,
|
||||
'Raw' => \base64_encode($sData)
|
||||
))
|
||||
|
|
@ -201,8 +201,8 @@ trait Themes
|
|||
}
|
||||
|
||||
return $this->DefaultResponse(!empty($sName) && !empty($sHash) ? array(
|
||||
'Name' => $sName,
|
||||
'Hash' => $sHash
|
||||
'name' => $sName,
|
||||
'hash' => $sHash
|
||||
) : false);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue