diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Base/Utils.php b/snappymail/v/0.0.0/app/libraries/MailSo/Base/Utils.php index 7a4c5f9b8..2c44801de 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Base/Utils.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Base/Utils.php @@ -196,10 +196,10 @@ abstract class Utils return \round($iSize, $iRound).$aSizes[$iIndex]; } - public static function DecodeEncodingValue(string $sEncodedValue, string $sEncodeingType) : string + public static function DecodeEncodingValue(string $sEncodedValue, string $sEncodingType) : string { $sResult = $sEncodedValue; - switch (\strtolower($sEncodeingType)) + switch (\strtolower($sEncodingType)) { case 'q': case 'quoted_printable': diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/BodyStructure.php b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/BodyStructure.php index 16f7975af..8e8c7bf6f 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/BodyStructure.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/BodyStructure.php @@ -19,38 +19,40 @@ use MailSo\Mime\Enumerations\ContentType; */ class BodyStructure implements \JsonSerializable { - private string $sContentType; - private array $aContentTypeParams; - private string $sCharset; + private string + $sCharset = '', + $sContentID = '', + $sContentTransferEncoding = '', + $sContentType = '', + $sDescription = '', + $sDisposition = '', + $sFileName = '', + $sLanguage = '', + $sLocation = '', + $sPartID = ''; - private string $sContentID; - - private string $sDescription; - - private string $sMailEncodingName; - - private string $sDisposition; - - private string $sFileName; - - private string $sLanguage = ''; - - private string $sLocation = ''; - - private int $iSize; - - private string $sPartID; + private int $iSize = 0; /** * \MailSo\Imap\BodyStructure[] */ private array $aSubParts; - public function MailEncodingName() : string + public function Charset() : string { - return $this->sMailEncodingName; + return $this->sCharset; + } + + public function ContentTransferEncoding() : string + { + return $this->sContentTransferEncoding; + } + + public function ContentType() : string + { + return $this->sContentType; } public function PartID() : string @@ -88,15 +90,10 @@ class BodyStructure implements \JsonSerializable return ($this->isInline() ? 'inline' : 'part' ) . $sIdx; } - public function ContentType() : string - { - return $this->sContentType; - } - public function EstimatedSize() : int { $fCoefficient = 1; - switch ($this->sMailEncodingName) + switch ($this->sContentTransferEncoding) { case 'base64': $fCoefficient = 0.75; @@ -109,11 +106,6 @@ class BodyStructure implements \JsonSerializable return (int) ($this->iSize * $fCoefficient); } - public function Charset() : string - { - return $this->sCharset; - } - public function SubParts() : array { return $this->aSubParts; @@ -192,7 +184,7 @@ class BodyStructure implements \JsonSerializable { return !empty($this->aContentTypeParams['format']) && 'flowed' === \strtolower(\trim($this->aContentTypeParams['format'])) - && !\in_array($this->sMailEncodingName, array('base64', 'quoted-printable')); + && !\in_array($this->sContentTransferEncoding, array('base64', 'quoted-printable')); } public function GetHtmlAndPlainParts() : array @@ -367,7 +359,7 @@ class BodyStructure implements \JsonSerializable $sCharset = ''; // \MailSo\Base\Enumerations\Charset::UTF_8 ? $sContentID = ''; $sDescription = ''; - $sMailEncodingName = ''; + $sContentTransferEncoding = ''; $iSize = 0; $iExtraItemPos = 0; // list index of items which have no well-established position (such as 0, 1, 5, etc). @@ -463,10 +455,10 @@ class BodyStructure implements \JsonSerializable if (!\is_string($aBodyStructure[5])) { return null; } - $sMailEncodingName = $aBodyStructure[5]; + $sContentTransferEncoding = $aBodyStructure[5]; } - $iSize = \is_numeric($aBodyStructure[6]) ? (int) $aBodyStructure[6] : -1; + $iSize = \is_numeric($aBodyStructure[6]) ? (int) $aBodyStructure[6] : 0; if (!\strlen($sPartID) || '.' === $sPartID[\strlen($sPartID) - 1]) { // This is the only sub-part of the message (otherwise, it would be @@ -519,7 +511,7 @@ class BodyStructure implements \JsonSerializable $oStructure->sCharset = $sCharset; $oStructure->sContentID = \trim($sContentID); $oStructure->sDescription = $sDescription; - $oStructure->sMailEncodingName = \strtolower($sMailEncodingName); + $oStructure->sContentTransferEncoding = \strtolower($sContentTransferEncoding); $oStructure->sDisposition = \strtolower($sDisposition); $oStructure->sFileName = \MailSo\Base\Utils::Utf8Clear($sFileName); $oStructure->iSize = $iSize; diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Mail/Message.php b/snappymail/v/0.0.0/app/libraries/MailSo/Mail/Message.php index ed848213a..9c234fd0d 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Mail/Message.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Mail/Message.php @@ -397,7 +397,7 @@ class Message implements \JsonSerializable } if (\is_string($sText) && \strlen($sText)) { - $sText = Utils::DecodeEncodingValue($sText, $oPart->MailEncodingName()); + $sText = Utils::DecodeEncodingValue($sText, $oPart->ContentTransferEncoding()); $sText = Utils::ConvertEncoding($sText, Utils::NormalizeCharset($oPart->Charset() ?: $sCharset, true), \MailSo\Base\Enumerations\Charset::UTF_8 diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Mime/Part.php b/snappymail/v/0.0.0/app/libraries/MailSo/Mime/Part.php index 655012df2..79b8e07ea 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Mime/Part.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Mime/Part.php @@ -60,7 +60,7 @@ class Part Enumerations\Header::CONTENT_TYPE, Enumerations\Parameter::FORMAT))); - if ($bResult && \in_array($this->MailEncodingName(), array('base64', 'quoted-printable'))) { + if ($bResult && \in_array($this->ContentTransferEncoding(), array('base64', 'quoted-printable'))) { $bResult = false; }