';
foreach ($SkilldetRecords as $sk) {
- if ($sk->rank > $MaxNumberSkill) {
+ if ($sk->rankorder > $MaxNumberSkill) {
continue;
}
@@ -291,7 +291,7 @@ if (($id || $ref) && $action == 'edit') {
// if (!empty($val['help'])) {
// print $form->textwithpicto($langs->trans($val['label']), $langs->trans($val['help']));
// } else {
- print $langs->trans($val['label']).' '.$langs->trans('rank').' '.$sk->rank;
+ print $langs->trans($val['label']).' '.$langs->trans('rank').' '.$sk->rankorder;
// }
print '';
print '';
@@ -696,7 +696,7 @@ if ($action != "create" && $action != "edit") {
break; // Should not happen
}
- if ($obj->rank > $MaxNumberSkill) {
+ if ($obj->rankorder > $MaxNumberSkill) {
continue;
}
diff --git a/htdocs/includes/OAuth/OAuth2/Service/WordPress.php b/htdocs/includes/OAuth/OAuth2/Service/WordPress.php
index 4d6d81e086d..79a13d00e2d 100755
--- a/htdocs/includes/OAuth/OAuth2/Service/WordPress.php
+++ b/htdocs/includes/OAuth/OAuth2/Service/WordPress.php
@@ -11,17 +11,28 @@ use OAuth\Common\Http\Exception\TokenResponseException;
use OAuth\OAuth2\Service\Exception\InvalidAccessTypeException;
use OAuth\Common\Http\Uri\Uri;
+/**
+ * Class For WordPress OAuth
+ */
class WordPress extends AbstractService
{
+ /**
+ * @var string
+ */
protected $accessType = 'online';
- public function __construct(
- CredentialsInterface $credentials,
- ClientInterface $httpClient,
- TokenStorageInterface $storage,
- $scopes = array(),
- UriInterface $baseApiUri = null
- ) {
+ /**
+ * Construct
+ *
+ * @param CredentialsInterface $credentials credentials
+ * @param ClientInterface $httpClient httpClient
+ * @param TokenStorageInterface $storage storage
+ * @param $scopes scope
+ * @param UriInterface|null $baseApiUri baseApiUri
+ * @throws Exception\InvalidScopeException
+ */
+ public function __construct(CredentialsInterface $credentials, ClientInterface $httpClient, TokenStorageInterface $storage, $scopes = array(), UriInterface $baseApiUri = null)
+ {
parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri, true);
if (null === $baseApiUri) {
@@ -41,7 +52,7 @@ class WordPress extends AbstractService
}*/
/**
- * {@inheritdoc}
+ * @return Uri
*/
public function getAuthorizationEndpoint()
{
@@ -49,7 +60,7 @@ class WordPress extends AbstractService
}
/**
- * {@inheritdoc}
+ * @return Uri
*/
public function getAccessTokenEndpoint()
{
@@ -57,7 +68,7 @@ class WordPress extends AbstractService
}
/**
- * {@inheritdoc}
+ * @return int
*/
protected function getAuthorizationMethod()
{
@@ -66,7 +77,9 @@ class WordPress extends AbstractService
}
/**
- * {@inheritdoc}
+ * @param $responseBody responseBody
+ * @return StdOAuth2Token
+ * @throws TokenResponseException
*/
protected function parseAccessTokenResponse($responseBody)
{
diff --git a/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/EmailLexer.php b/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/EmailLexer.php
index 882c968154d..59dcd5876fd 100644
--- a/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/EmailLexer.php
+++ b/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/EmailLexer.php
@@ -13,6 +13,8 @@ class EmailLexer extends AbstractLexer
const S_BACKSLASH = 92;
const S_DOT = 46;
const S_DQUOTE = 34;
+ const S_SQUOTE = 39;
+ const S_BACKTICK = 96;
const S_OPENPARENTHESIS = 49;
const S_CLOSEPARENTHESIS = 261;
const S_OPENBRACKET = 262;
@@ -58,6 +60,8 @@ class EmailLexer extends AbstractLexer
'/' => self::S_SLASH,
',' => self::S_COMMA,
'.' => self::S_DOT,
+ "'" => self::S_SQUOTE,
+ "`" => self::S_BACKTICK,
'"' => self::S_DQUOTE,
'-' => self::S_HYPHEN,
'::' => self::S_DOUBLECOLON,
@@ -73,25 +77,73 @@ class EmailLexer extends AbstractLexer
'\0' => self::C_NUL,
);
+ /**
+ * @var bool
+ */
protected $hasInvalidTokens = false;
- protected $previous;
+ /**
+ * @var array
+ *
+ * @psalm-var array{value:string, type:null|int, position:int}|array
+ */
+ protected $previous = [];
+ /**
+ * The last matched/seen token.
+ *
+ * @var array
+ *
+ * @psalm-var array{value:string, type:null|int, position:int}
+ */
+ public $token;
+
+ /**
+ * The next token in the input.
+ *
+ * @var array|null
+ */
+ public $lookahead;
+
+ /**
+ * @psalm-var array{value:'', type:null, position:0}
+ */
+ private static $nullToken = [
+ 'value' => '',
+ 'type' => null,
+ 'position' => 0,
+ ];
+
+ public function __construct()
+ {
+ $this->previous = $this->token = self::$nullToken;
+ $this->lookahead = null;
+ }
+
+ /**
+ * @return void
+ */
public function reset()
{
$this->hasInvalidTokens = false;
parent::reset();
+ $this->previous = $this->token = self::$nullToken;
}
+ /**
+ * @return bool
+ */
public function hasInvalidTokens()
{
return $this->hasInvalidTokens;
}
/**
- * @param $type
+ * @param int $type
* @throws \UnexpectedValueException
* @return boolean
+ *
+ * @psalm-suppress InvalidScalarArgument
*/
public function find($type)
{
@@ -107,7 +159,7 @@ class EmailLexer extends AbstractLexer
/**
* getPrevious
*
- * @return array token
+ * @return array
*/
public function getPrevious()
{
@@ -122,8 +174,10 @@ class EmailLexer extends AbstractLexer
public function moveNext()
{
$this->previous = $this->token;
+ $hasNext = parent::moveNext();
+ $this->token = $this->token ?: self::$nullToken;
- return parent::moveNext();
+ return $hasNext;
}
/**
@@ -179,6 +233,11 @@ class EmailLexer extends AbstractLexer
return self::GENERIC;
}
+ /**
+ * @param string $value
+ *
+ * @return bool
+ */
protected function isValid($value)
{
if (isset($this->charValue[$value])) {
@@ -189,7 +248,7 @@ class EmailLexer extends AbstractLexer
}
/**
- * @param $value
+ * @param string $value
* @return bool
*/
protected function isNullType($value)
@@ -202,7 +261,7 @@ class EmailLexer extends AbstractLexer
}
/**
- * @param $value
+ * @param string $value
* @return bool
*/
protected function isUTF8Invalid($value)
@@ -214,6 +273,9 @@ class EmailLexer extends AbstractLexer
return false;
}
+ /**
+ * @return string
+ */
protected function getModifiers()
{
return 'iu';
diff --git a/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/EmailParser.php b/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/EmailParser.php
index d0627d82410..6b7bad66927 100644
--- a/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/EmailParser.php
+++ b/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/EmailParser.php
@@ -17,11 +17,33 @@ class EmailParser
{
const EMAIL_MAX_LENGTH = 254;
- protected $warnings;
+ /**
+ * @var array
+ */
+ protected $warnings = [];
+
+ /**
+ * @var string
+ */
protected $domainPart = '';
+
+ /**
+ * @var string
+ */
protected $localPart = '';
+ /**
+ * @var EmailLexer
+ */
protected $lexer;
+
+ /**
+ * @var LocalPart
+ */
protected $localPartParser;
+
+ /**
+ * @var DomainPart
+ */
protected $domainPartParser;
public function __construct(EmailLexer $lexer)
@@ -29,11 +51,10 @@ class EmailParser
$this->lexer = $lexer;
$this->localPartParser = new LocalPart($this->lexer);
$this->domainPartParser = new DomainPart($this->lexer);
- $this->warnings = new \SplObjectStorage();
}
/**
- * @param $str
+ * @param string $str
* @return array
*/
public function parse($str)
@@ -57,6 +78,9 @@ class EmailParser
return array('local' => $this->localPart, 'domain' => $this->domainPart);
}
+ /**
+ * @return Warning\Warning[]
+ */
public function getWarnings()
{
$localPartWarnings = $this->localPartParser->getWarnings();
@@ -68,11 +92,17 @@ class EmailParser
return $this->warnings;
}
+ /**
+ * @return string
+ */
public function getParsedDomainPart()
{
return $this->domainPart;
}
+ /**
+ * @param string $email
+ */
protected function setParts($email)
{
$parts = explode('@', $email);
@@ -80,6 +110,9 @@ class EmailParser
$this->localPart = $parts[0];
}
+ /**
+ * @return bool
+ */
protected function hasAtToken()
{
$this->lexer->moveNext();
diff --git a/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/EmailValidator.php b/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/EmailValidator.php
index 44b4b93c6bb..a30f21dcd30 100644
--- a/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/EmailValidator.php
+++ b/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/EmailValidator.php
@@ -13,12 +13,12 @@ class EmailValidator
private $lexer;
/**
- * @var array
+ * @var Warning\Warning[]
*/
- protected $warnings;
+ protected $warnings = [];
/**
- * @var InvalidEmail
+ * @var InvalidEmail|null
*/
protected $error;
@@ -28,7 +28,7 @@ class EmailValidator
}
/**
- * @param $email
+ * @param string $email
* @param EmailValidation $emailValidation
* @return bool
*/
@@ -58,7 +58,7 @@ class EmailValidator
}
/**
- * @return InvalidEmail
+ * @return InvalidEmail|null
*/
public function getError()
{
diff --git a/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Exception/DomainAcceptsNoMail.php b/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Exception/DomainAcceptsNoMail.php
new file mode 100644
index 00000000000..40a99705ce9
--- /dev/null
+++ b/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Exception/DomainAcceptsNoMail.php
@@ -0,0 +1,9 @@
+lexer->moveNext();
- if ($this->lexer->token['type'] === EmailLexer::S_DOT) {
- throw new DotAtStart();
- }
-
- if ($this->lexer->token['type'] === EmailLexer::S_EMPTY) {
- throw new NoDomainPart();
- }
- if ($this->lexer->token['type'] === EmailLexer::S_HYPHEN) {
- throw new DomainHyphened();
- }
-
- if ($this->lexer->token['type'] === EmailLexer::S_OPENPARENTHESIS) {
- $this->warnings[DeprecatedComment::CODE] = new DeprecatedComment();
- $this->parseDomainComments();
- }
+ $this->performDomainStartChecks();
$domain = $this->doParseDomainPart();
@@ -77,11 +68,50 @@ class DomainPart extends Parser
$this->domainPart = $domain;
}
+ private function performDomainStartChecks()
+ {
+ $this->checkInvalidTokensAfterAT();
+ $this->checkEmptyDomain();
+
+ if ($this->lexer->token['type'] === EmailLexer::S_OPENPARENTHESIS) {
+ $this->warnings[DeprecatedComment::CODE] = new DeprecatedComment();
+ $this->parseDomainComments();
+ }
+ }
+
+ private function checkEmptyDomain()
+ {
+ $thereIsNoDomain = $this->lexer->token['type'] === EmailLexer::S_EMPTY ||
+ ($this->lexer->token['type'] === EmailLexer::S_SP &&
+ !$this->lexer->isNextToken(EmailLexer::GENERIC));
+
+ if ($thereIsNoDomain) {
+ throw new NoDomainPart();
+ }
+ }
+
+ private function checkInvalidTokensAfterAT()
+ {
+ if ($this->lexer->token['type'] === EmailLexer::S_DOT) {
+ throw new DotAtStart();
+ }
+ if ($this->lexer->token['type'] === EmailLexer::S_HYPHEN) {
+ throw new DomainHyphened();
+ }
+ }
+
+ /**
+ * @return string
+ */
public function getDomainPart()
{
return $this->domainPart;
}
+ /**
+ * @param string $addressLiteral
+ * @param int $maxGroups
+ */
public function checkIPV6Tag($addressLiteral, $maxGroups = 8)
{
$prev = $this->lexer->getPrevious();
@@ -125,9 +155,13 @@ class DomainPart extends Parser
}
}
+ /**
+ * @return string
+ */
protected function doParseDomainPart()
{
$domain = '';
+ $label = '';
$openedParenthesis = 0;
do {
$prev = $this->lexer->getPrevious();
@@ -158,7 +192,12 @@ class DomainPart extends Parser
$this->parseDomainLiteral();
}
- $this->checkLabelLength($prev);
+ if ($this->lexer->token['type'] === EmailLexer::S_DOT) {
+ $this->checkLabelLength($label);
+ $label = '';
+ } else {
+ $label .= $this->lexer->token['value'];
+ }
if ($this->isFWS()) {
$this->parseFWS();
@@ -166,12 +205,17 @@ class DomainPart extends Parser
$domain .= $this->lexer->token['value'];
$this->lexer->moveNext();
- } while ($this->lexer->token);
+ if ($this->lexer->token['type'] === EmailLexer::S_SP) {
+ throw new CharNotAllowed();
+ }
+ } while (null !== $this->lexer->token['type']);
+
+ $this->checkLabelLength($label);
return $domain;
}
- private function checkNotAllowedChars($token)
+ private function checkNotAllowedChars(array $token)
{
$notAllowed = [EmailLexer::S_BACKSLASH => true, EmailLexer::S_SLASH=> true];
if (isset($notAllowed[$token['type']])) {
@@ -179,6 +223,9 @@ class DomainPart extends Parser
}
}
+ /**
+ * @return string|false
+ */
protected function parseDomainLiteral()
{
if ($this->lexer->isNextToken(EmailLexer::S_COLON)) {
@@ -195,6 +242,9 @@ class DomainPart extends Parser
return $this->doParseDomainLiteral();
}
+ /**
+ * @return string|false
+ */
protected function doParseDomainLiteral()
{
$IPv6TAG = false;
@@ -262,6 +312,11 @@ class DomainPart extends Parser
return $addressLiteral;
}
+ /**
+ * @param string $addressLiteral
+ *
+ * @return string|false
+ */
protected function checkIPV4Tag($addressLiteral)
{
$matchesIP = array();
@@ -279,16 +334,18 @@ class DomainPart extends Parser
return false;
}
// Convert IPv4 part to IPv6 format for further testing
- $addressLiteral = substr($addressLiteral, 0, $index) . '0:0';
+ $addressLiteral = substr($addressLiteral, 0, (int) $index) . '0:0';
}
return $addressLiteral;
}
- protected function checkDomainPartExceptions($prev)
+ protected function checkDomainPartExceptions(array $prev)
{
$invalidDomainTokens = array(
EmailLexer::S_DQUOTE => true,
+ EmailLexer::S_SQUOTE => true,
+ EmailLexer::S_BACKTICK => true,
EmailLexer::S_SEMICOLON => true,
EmailLexer::S_GREATERTHAN => true,
EmailLexer::S_LOWERTHAN => true,
@@ -320,6 +377,9 @@ class DomainPart extends Parser
}
}
+ /**
+ * @return bool
+ */
protected function hasBrackets()
{
if ($this->lexer->token['type'] !== EmailLexer::S_OPENBRACKET) {
@@ -335,16 +395,31 @@ class DomainPart extends Parser
return true;
}
- protected function checkLabelLength($prev)
+ /**
+ * @param string $label
+ */
+ protected function checkLabelLength($label)
{
- if ($this->lexer->token['type'] === EmailLexer::S_DOT &&
- $prev['type'] === EmailLexer::GENERIC &&
- strlen($prev['value']) > 63
- ) {
+ if ($this->isLabelTooLong($label)) {
$this->warnings[LabelTooLong::CODE] = new LabelTooLong();
}
}
+ /**
+ * @param string $label
+ * @return bool
+ */
+ private function isLabelTooLong($label)
+ {
+ if (preg_match('/[^\x00-\x7F]/', $label)) {
+ idn_to_ascii($label, IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46, $idnaInfo);
+
+ return (bool) ($idnaInfo['errors'] & IDNA_ERROR_LABEL_TOO_LONG);
+ }
+
+ return strlen($label) > self::LABEL_MAX_LENGTH;
+ }
+
protected function parseDomainComments()
{
$this->isUnclosedComment();
diff --git a/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Parser/LocalPart.php b/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Parser/LocalPart.php
index 8ab16ab4a1f..3c21f34ac07 100644
--- a/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Parser/LocalPart.php
+++ b/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Parser/LocalPart.php
@@ -5,7 +5,6 @@ namespace Egulias\EmailValidator\Parser;
use Egulias\EmailValidator\Exception\DotAtEnd;
use Egulias\EmailValidator\Exception\DotAtStart;
use Egulias\EmailValidator\EmailLexer;
-use Egulias\EmailValidator\EmailValidator;
use Egulias\EmailValidator\Exception\ExpectingAT;
use Egulias\EmailValidator\Exception\ExpectingATEXT;
use Egulias\EmailValidator\Exception\UnclosedQuotedString;
@@ -20,9 +19,10 @@ class LocalPart extends Parser
$parseDQuote = true;
$closingQuote = false;
$openedParenthesis = 0;
+ $totalLength = 0;
- while ($this->lexer->token['type'] !== EmailLexer::S_AT && $this->lexer->token) {
- if ($this->lexer->token['type'] === EmailLexer::S_DOT && !$this->lexer->getPrevious()) {
+ while ($this->lexer->token['type'] !== EmailLexer::S_AT && null !== $this->lexer->token['type']) {
+ if ($this->lexer->token['type'] === EmailLexer::S_DOT && null === $this->lexer->getPrevious()['type']) {
throw new DotAtStart();
}
@@ -35,12 +35,13 @@ class LocalPart extends Parser
$this->parseComments();
$openedParenthesis += $this->getOpenedParenthesis();
}
+
if ($this->lexer->token['type'] === EmailLexer::S_CLOSEPARENTHESIS) {
if ($openedParenthesis === 0) {
throw new UnopenedComment();
- } else {
- $openedParenthesis--;
}
+
+ $openedParenthesis--;
}
$this->checkConsecutiveDots();
@@ -58,15 +59,18 @@ class LocalPart extends Parser
$this->parseFWS();
}
+ $totalLength += strlen($this->lexer->token['value']);
$this->lexer->moveNext();
}
- $prev = $this->lexer->getPrevious();
- if (strlen($prev['value']) > LocalTooLong::LOCAL_PART_LENGTH) {
+ if ($totalLength > LocalTooLong::LOCAL_PART_LENGTH) {
$this->warnings[LocalTooLong::CODE] = new LocalTooLong();
}
}
+ /**
+ * @return bool
+ */
protected function parseDoubleQuote()
{
$parseAgain = true;
@@ -86,7 +90,7 @@ class LocalPart extends Parser
$this->lexer->moveNext();
- while ($this->lexer->token['type'] !== EmailLexer::S_DQUOTE && $this->lexer->token) {
+ while ($this->lexer->token['type'] !== EmailLexer::S_DQUOTE && null !== $this->lexer->token['type']) {
$parseAgain = false;
if (isset($special[$this->lexer->token['type']]) && $setSpecialsWarning) {
$this->warnings[CFWSWithFWS::CODE] = new CFWSWithFWS();
@@ -118,7 +122,10 @@ class LocalPart extends Parser
return $parseAgain;
}
- protected function isInvalidToken($token, $closingQuote)
+ /**
+ * @param bool $closingQuote
+ */
+ protected function isInvalidToken(array $token, $closingQuote)
{
$forbidden = array(
EmailLexer::S_COMMA,
diff --git a/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Parser/Parser.php b/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Parser/Parser.php
index e5042e1a859..ccdc93889a2 100644
--- a/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Parser/Parser.php
+++ b/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Parser/Parser.php
@@ -8,7 +8,7 @@ use Egulias\EmailValidator\Exception\ConsecutiveDot;
use Egulias\EmailValidator\Exception\CRLFAtTheEnd;
use Egulias\EmailValidator\Exception\CRLFX2;
use Egulias\EmailValidator\Exception\CRNoLF;
-use Egulias\EmailValidator\Exception\ExpectedQPair;
+use Egulias\EmailValidator\Exception\ExpectingQPair;
use Egulias\EmailValidator\Exception\ExpectingATEXT;
use Egulias\EmailValidator\Exception\ExpectingCTEXT;
use Egulias\EmailValidator\Exception\UnclosedComment;
@@ -21,8 +21,19 @@ use Egulias\EmailValidator\Warning\QuotedString;
abstract class Parser
{
+ /**
+ * @var array
+ */
protected $warnings = [];
+
+ /**
+ * @var EmailLexer
+ */
protected $lexer;
+
+ /**
+ * @var int
+ */
protected $openedParenthesis = 0;
public function __construct(EmailLexer $lexer)
@@ -30,11 +41,17 @@ abstract class Parser
$this->lexer = $lexer;
}
+ /**
+ * @return \Egulias\EmailValidator\Warning\Warning[]
+ */
public function getWarnings()
{
return $this->warnings;
}
+ /**
+ * @param string $str
+ */
abstract public function parse($str);
/** @return int */
@@ -50,7 +67,7 @@ abstract class Parser
{
if (!($this->lexer->token['type'] === EmailLexer::INVALID
|| $this->lexer->token['type'] === EmailLexer::C_DEL)) {
- throw new ExpectedQPair();
+ throw new ExpectingQPair();
}
$this->warnings[QuotedPart::CODE] =
@@ -80,6 +97,9 @@ abstract class Parser
}
}
+ /**
+ * @return bool
+ */
protected function isUnclosedComment()
{
try {
@@ -122,6 +142,9 @@ abstract class Parser
}
}
+ /**
+ * @return bool
+ */
protected function isFWS()
{
if ($this->escaped()) {
@@ -140,11 +163,14 @@ abstract class Parser
return false;
}
+ /**
+ * @return bool
+ */
protected function escaped()
{
$previous = $this->lexer->getPrevious();
- if ($previous['type'] === EmailLexer::S_BACKSLASH
+ if ($previous && $previous['type'] === EmailLexer::S_BACKSLASH
&&
$this->lexer->token['type'] !== EmailLexer::GENERIC
) {
@@ -154,6 +180,9 @@ abstract class Parser
return false;
}
+ /**
+ * @return bool
+ */
protected function warnEscaping()
{
if ($this->lexer->token['type'] !== EmailLexer::S_BACKSLASH) {
@@ -174,6 +203,11 @@ abstract class Parser
}
+ /**
+ * @param bool $hasClosingQuote
+ *
+ * @return bool
+ */
protected function checkDQUOTE($hasClosingQuote)
{
if ($this->lexer->token['type'] !== EmailLexer::S_DQUOTE) {
diff --git a/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Validation/DNSCheckValidation.php b/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Validation/DNSCheckValidation.php
index ecca1dd976a..491082a590f 100644
--- a/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Validation/DNSCheckValidation.php
+++ b/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Validation/DNSCheckValidation.php
@@ -4,6 +4,8 @@ namespace Egulias\EmailValidator\Validation;
use Egulias\EmailValidator\EmailLexer;
use Egulias\EmailValidator\Exception\InvalidEmail;
+use Egulias\EmailValidator\Exception\LocalOrReservedDomain;
+use Egulias\EmailValidator\Exception\DomainAcceptsNoMail;
use Egulias\EmailValidator\Warning\NoDNSMXRecord;
use Egulias\EmailValidator\Exception\NoDNSRecord;
@@ -15,10 +17,23 @@ class DNSCheckValidation implements EmailValidation
private $warnings = [];
/**
- * @var InvalidEmail
+ * @var InvalidEmail|null
*/
private $error;
+ /**
+ * @var array
+ */
+ private $mxRecords = [];
+
+
+ public function __construct()
+ {
+ if (!function_exists('idn_to_ascii')) {
+ throw new \LogicException(sprintf('The %s class requires the Intl extension.', __CLASS__));
+ }
+ }
+
public function isValid($email, EmailLexer $emailLexer)
{
// use the input to check DNS if we cannot extract something similar to a domain
@@ -29,7 +44,40 @@ class DNSCheckValidation implements EmailValidation
$host = substr($email, $lastAtPos + 1);
}
- return $this->checkDNS($host);
+ // Get the domain parts
+ $hostParts = explode('.', $host);
+
+ // Reserved Top Level DNS Names (https://tools.ietf.org/html/rfc2606#section-2),
+ // mDNS and private DNS Namespaces (https://tools.ietf.org/html/rfc6762#appendix-G)
+ $reservedTopLevelDnsNames = [
+ // Reserved Top Level DNS Names
+ 'test',
+ 'example',
+ 'invalid',
+ 'localhost',
+
+ // mDNS
+ 'local',
+
+ // Private DNS Namespaces
+ 'intranet',
+ 'internal',
+ 'private',
+ 'corp',
+ 'home',
+ 'lan',
+ ];
+
+ $isLocalDomain = count($hostParts) <= 1;
+ $isReservedTopLevel = in_array($hostParts[(count($hostParts) - 1)], $reservedTopLevelDnsNames, true);
+
+ // Exclude reserved top level DNS names
+ if ($isLocalDomain || $isReservedTopLevel) {
+ $this->error = new LocalOrReservedDomain();
+ return false;
+ }
+
+ return $this->checkDns($host);
}
public function getError()
@@ -42,20 +90,77 @@ class DNSCheckValidation implements EmailValidation
return $this->warnings;
}
- protected function checkDNS($host)
+ /**
+ * @param string $host
+ *
+ * @return bool
+ */
+ protected function checkDns($host)
{
- $host = rtrim($host, '.') . '.';
+ $variant = INTL_IDNA_VARIANT_UTS46;
- $Aresult = true;
- $MXresult = checkdnsrr($host, 'MX');
+ $host = rtrim(idn_to_ascii($host, IDNA_DEFAULT, $variant), '.') . '.';
- if (!$MXresult) {
- $this->warnings[NoDNSMXRecord::CODE] = new NoDNSMXRecord();
- $Aresult = checkdnsrr($host, 'A') || checkdnsrr($host, 'AAAA');
- if (!$Aresult) {
- $this->error = new NoDNSRecord();
+ return $this->validateDnsRecords($host);
+ }
+
+
+ /**
+ * Validate the DNS records for given host.
+ *
+ * @param string $host A set of DNS records in the format returned by dns_get_record.
+ *
+ * @return bool True on success.
+ */
+ private function validateDnsRecords($host)
+ {
+ // Get all MX, A and AAAA DNS records for host
+ // Using @ as workaround to fix https://bugs.php.net/bug.php?id=73149
+ $dnsRecords = @dns_get_record($host, DNS_MX + DNS_A + DNS_AAAA);
+
+
+ // No MX, A or AAAA DNS records
+ if (empty($dnsRecords)) {
+ $this->error = new NoDNSRecord();
+ return false;
+ }
+
+ // For each DNS record
+ foreach ($dnsRecords as $dnsRecord) {
+ if (!$this->validateMXRecord($dnsRecord)) {
+ return false;
}
}
- return $MXresult || $Aresult;
+
+ // No MX records (fallback to A or AAAA records)
+ if (empty($this->mxRecords)) {
+ $this->warnings[NoDNSMXRecord::CODE] = new NoDNSMXRecord();
+ }
+
+ return true;
+ }
+
+ /**
+ * Validate an MX record
+ *
+ * @param array $dnsRecord Given DNS record.
+ *
+ * @return bool True if valid.
+ */
+ private function validateMxRecord($dnsRecord)
+ {
+ if ($dnsRecord['type'] !== 'MX') {
+ return true;
+ }
+
+ // "Null MX" record indicates the domain accepts no mail (https://tools.ietf.org/html/rfc7505)
+ if (empty($dnsRecord['target']) || $dnsRecord['target'] === '.') {
+ $this->error = new DomainAcceptsNoMail();
+ return false;
+ }
+
+ $this->mxRecords[] = $dnsRecord;
+
+ return true;
}
}
diff --git a/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Validation/Exception/EmptyValidationList.php b/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Validation/Exception/EmptyValidationList.php
index 775ad16fb51..ee7c41aa033 100644
--- a/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Validation/Exception/EmptyValidationList.php
+++ b/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Validation/Exception/EmptyValidationList.php
@@ -6,6 +6,9 @@ use Exception;
class EmptyValidationList extends \InvalidArgumentException
{
+ /**
+ * @param int $code
+ */
public function __construct($code = 0, Exception $previous = null)
{
parent::__construct("Empty validation list is not allowed", $code, $previous);
diff --git a/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Validation/MultipleErrors.php b/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Validation/MultipleErrors.php
index d5e87d8ce06..3be59732664 100644
--- a/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Validation/MultipleErrors.php
+++ b/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Validation/MultipleErrors.php
@@ -9,16 +9,22 @@ class MultipleErrors extends InvalidEmail
const CODE = 999;
const REASON = "Accumulated errors for multiple validations";
/**
- * @var array
+ * @var InvalidEmail[]
*/
private $errors = [];
+ /**
+ * @param InvalidEmail[] $errors
+ */
public function __construct(array $errors)
{
$this->errors = $errors;
parent::__construct();
}
+ /**
+ * @return InvalidEmail[]
+ */
public function getErrors()
{
return $this->errors;
diff --git a/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Validation/MultipleValidationWithAnd.php b/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Validation/MultipleValidationWithAnd.php
index 43fa42a64b7..feb224023da 100644
--- a/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Validation/MultipleValidationWithAnd.php
+++ b/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Validation/MultipleValidationWithAnd.php
@@ -30,12 +30,12 @@ class MultipleValidationWithAnd implements EmailValidation
private $warnings = [];
/**
- * @var MultipleErrors
+ * @var MultipleErrors|null
*/
private $error;
/**
- * @var bool
+ * @var int
*/
private $mode;
@@ -62,7 +62,8 @@ class MultipleValidationWithAnd implements EmailValidation
$errors = [];
foreach ($this->validations as $validation) {
$emailLexer->reset();
- $result = $result && $validation->isValid($email, $emailLexer);
+ $validationResult = $validation->isValid($email, $emailLexer);
+ $result = $result && $validationResult;
$this->warnings = array_merge($this->warnings, $validation->getWarnings());
$errors = $this->addNewError($validation->getError(), $errors);
@@ -78,6 +79,12 @@ class MultipleValidationWithAnd implements EmailValidation
return $result;
}
+ /**
+ * @param \Egulias\EmailValidator\Exception\InvalidEmail|null $possibleError
+ * @param \Egulias\EmailValidator\Exception\InvalidEmail[] $errors
+ *
+ * @return \Egulias\EmailValidator\Exception\InvalidEmail[]
+ */
private function addNewError($possibleError, array $errors)
{
if (null !== $possibleError) {
@@ -87,13 +94,20 @@ class MultipleValidationWithAnd implements EmailValidation
return $errors;
}
+ /**
+ * @param bool $result
+ *
+ * @return bool
+ */
private function shouldStop($result)
{
return !$result && $this->mode === self::STOP_ON_ERROR;
}
/**
- * {@inheritdoc}
+ * Returns the validation errors.
+ *
+ * @return MultipleErrors|null
*/
public function getError()
{
diff --git a/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Validation/NoRFCWarningsValidation.php b/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Validation/NoRFCWarningsValidation.php
index f3656b35a52..6b31e5440ec 100644
--- a/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Validation/NoRFCWarningsValidation.php
+++ b/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Validation/NoRFCWarningsValidation.php
@@ -9,7 +9,7 @@ use Egulias\EmailValidator\Validation\Error\RFCWarnings;
class NoRFCWarningsValidation extends RFCValidation
{
/**
- * @var InvalidEmail
+ * @var InvalidEmail|null
*/
private $error;
@@ -22,8 +22,7 @@ class NoRFCWarningsValidation extends RFCValidation
return false;
}
- $ret = $this->getWarnings();
- if (empty($ret)) {
+ if (empty($this->getWarnings())) {
return true;
}
diff --git a/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Validation/RFCValidation.php b/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Validation/RFCValidation.php
index c4ffe35034b..8781e0b62d1 100644
--- a/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Validation/RFCValidation.php
+++ b/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Validation/RFCValidation.php
@@ -9,7 +9,7 @@ use Egulias\EmailValidator\Exception\InvalidEmail;
class RFCValidation implements EmailValidation
{
/**
- * @var EmailParser
+ * @var EmailParser|null
*/
private $parser;
@@ -19,7 +19,7 @@ class RFCValidation implements EmailValidation
private $warnings = [];
/**
- * @var InvalidEmail
+ * @var InvalidEmail|null
*/
private $error;
diff --git a/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Validation/SpoofCheckValidation.php b/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Validation/SpoofCheckValidation.php
index 4721f0d8c98..e10bfabd92f 100644
--- a/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Validation/SpoofCheckValidation.php
+++ b/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Validation/SpoofCheckValidation.php
@@ -10,7 +10,7 @@ use \Spoofchecker;
class SpoofCheckValidation implements EmailValidation
{
/**
- * @var InvalidEmail
+ * @var InvalidEmail|null
*/
private $error;
@@ -21,6 +21,9 @@ class SpoofCheckValidation implements EmailValidation
}
}
+ /**
+ * @psalm-suppress InvalidArgument
+ */
public function isValid($email, EmailLexer $emailLexer)
{
$checker = new Spoofchecker();
@@ -33,6 +36,9 @@ class SpoofCheckValidation implements EmailValidation
return $this->error === null;
}
+ /**
+ * @return InvalidEmail|null
+ */
public function getError()
{
return $this->error;
diff --git a/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Warning/QuotedPart.php b/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Warning/QuotedPart.php
index 7be9e6a3f25..36a4265a515 100644
--- a/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Warning/QuotedPart.php
+++ b/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Warning/QuotedPart.php
@@ -6,6 +6,10 @@ class QuotedPart extends Warning
{
const CODE = 36;
+ /**
+ * @param scalar $prevToken
+ * @param scalar $postToken
+ */
public function __construct($prevToken, $postToken)
{
$this->message = "Deprecated Quoted String found between $prevToken and $postToken";
diff --git a/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Warning/QuotedString.php b/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Warning/QuotedString.php
index e9d56e1e032..817e4e84b07 100644
--- a/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Warning/QuotedString.php
+++ b/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Warning/QuotedString.php
@@ -6,6 +6,10 @@ class QuotedString extends Warning
{
const CODE = 11;
+ /**
+ * @param scalar $prevToken
+ * @param scalar $postToken
+ */
public function __construct($prevToken, $postToken)
{
$this->message = "Quoted String found between $prevToken and $postToken";
diff --git a/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Warning/Warning.php b/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Warning/Warning.php
index ec6a365ffb7..a2ee7b0de1e 100644
--- a/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Warning/Warning.php
+++ b/htdocs/includes/swiftmailer/egulias/email-validator/EmailValidator/Warning/Warning.php
@@ -5,19 +5,36 @@ namespace Egulias\EmailValidator\Warning;
abstract class Warning
{
const CODE = 0;
- protected $message;
- protected $rfcNumber;
+ /**
+ * @var string
+ */
+ protected $message = '';
+
+ /**
+ * @var int
+ */
+ protected $rfcNumber = 0;
+
+ /**
+ * @return string
+ */
public function message()
{
return $this->message;
}
+ /**
+ * @return int
+ */
public function code()
{
- return self::CODE;
+ return static::CODE;
}
+ /**
+ * @return int
+ */
public function RFCNumber()
{
return $this->rfcNumber;
diff --git a/htdocs/includes/swiftmailer/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php b/htdocs/includes/swiftmailer/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php
index 399a55230b0..dd3ea768e3b 100644
--- a/htdocs/includes/swiftmailer/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php
+++ b/htdocs/includes/swiftmailer/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php
@@ -258,6 +258,11 @@ abstract class AbstractLexer
$flags = PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_OFFSET_CAPTURE;
$matches = preg_split($regex, $input, -1, $flags);
+ if (false === $matches) {
+ // Work around https://bugs.php.net/78122
+ $matches = array(array($input, 0));
+ }
+
foreach ($matches as $match) {
// Must remain before 'value' assignment since it can change content
$type = $this->getType($match[0]);
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift.php b/htdocs/includes/swiftmailer/lib/classes/Swift.php
index e89703eaebb..51b19c9cb4e 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift.php
@@ -11,15 +11,14 @@
/**
* General utility class in Swift Mailer, not to be instantiated.
*
- *
* @author Chris Corbyn
*/
abstract class Swift
{
- const VERSION = '6.0.2';
+ const VERSION = '6.3.0';
public static $initialized = false;
- public static $inits = array();
+ public static $inits = [];
/**
* Registers an initializer callable that will be called the first time
@@ -57,7 +56,7 @@ abstract class Swift
if (self::$inits && !self::$initialized) {
self::$initialized = true;
foreach (self::$inits as $init) {
- call_user_func($init);
+ \call_user_func($init);
}
}
}
@@ -74,6 +73,6 @@ abstract class Swift
if (null !== $callable) {
self::$inits[] = $callable;
}
- spl_autoload_register(array('Swift', 'autoload'));
+ spl_autoload_register(['Swift', 'autoload']);
}
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/AddressEncoder.php b/htdocs/includes/swiftmailer/lib/classes/Swift/AddressEncoder.php
new file mode 100644
index 00000000000..a1704ffb40a
--- /dev/null
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/AddressEncoder.php
@@ -0,0 +1,25 @@
+address = $address;
+ }
+
+ public function getAddress(): string
+ {
+ return $this->address;
+ }
+}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Attachment.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Attachment.php
index 1fb232c9fe6..7a1420f7986 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Attachment.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Attachment.php
@@ -26,17 +26,14 @@ class Swift_Attachment extends Swift_Mime_Attachment
*/
public function __construct($data = null, $filename = null, $contentType = null)
{
- call_user_func_array(
- array($this, 'Swift_Mime_Attachment::__construct'),
+ \call_user_func_array(
+ [$this, 'Swift_Mime_Attachment::__construct'],
Swift_DependencyContainer::getInstance()
->createDependenciesFor('mime.attachment')
);
- $this->setBody($data);
+ $this->setBody($data, $contentType);
$this->setFilename($filename);
- if ($contentType) {
- $this->setContentType($contentType);
- }
}
/**
@@ -45,7 +42,7 @@ class Swift_Attachment extends Swift_Mime_Attachment
* @param string $path
* @param string $contentType optional
*
- * @return Swift_Mime_Attachment
+ * @return self
*/
public static function fromPath($path, $contentType = null)
{
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/ByteStream/AbstractFilterableInputStream.php b/htdocs/includes/swiftmailer/lib/classes/Swift/ByteStream/AbstractFilterableInputStream.php
index bfd2c79bcbd..3a69c15f1c4 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/ByteStream/AbstractFilterableInputStream.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/ByteStream/AbstractFilterableInputStream.php
@@ -25,7 +25,7 @@ abstract class Swift_ByteStream_AbstractFilterableInputStream implements Swift_I
*
* @var Swift_StreamFilter[]
*/
- private $filters = array();
+ private $filters = [];
/**
* A buffer for writing.
@@ -37,7 +37,7 @@ abstract class Swift_ByteStream_AbstractFilterableInputStream implements Swift_I
*
* @var Swift_InputByteStream[]
*/
- private $mirrors = array();
+ private $mirrors = [];
/**
* Commit the given bytes to the storage medium immediately.
@@ -54,8 +54,7 @@ abstract class Swift_ByteStream_AbstractFilterableInputStream implements Swift_I
/**
* Add a StreamFilter to this InputByteStream.
*
- * @param Swift_StreamFilter $filter
- * @param string $key
+ * @param string $key
*/
public function addFilter(Swift_StreamFilter $filter, $key)
{
@@ -110,8 +109,6 @@ abstract class Swift_ByteStream_AbstractFilterableInputStream implements Swift_I
*
* The stream acts as an observer, receiving all data that is written.
* All {@link write()} and {@link flushBuffers()} operations will be mirrored.
- *
- * @param Swift_InputByteStream $is
*/
public function bind(Swift_InputByteStream $is)
{
@@ -124,14 +121,12 @@ abstract class Swift_ByteStream_AbstractFilterableInputStream implements Swift_I
* If $is is not bound, no errors will be raised.
* If the stream currently has any buffered data it will be written to $is
* before unbinding occurs.
- *
- * @param Swift_InputByteStream $is
*/
public function unbind(Swift_InputByteStream $is)
{
foreach ($this->mirrors as $k => $stream) {
if ($is === $stream) {
- if ($this->writeBuffer !== '') {
+ if ('' !== $this->writeBuffer) {
$stream->write($this->writeBuffer);
}
unset($this->mirrors[$k]);
@@ -147,7 +142,7 @@ abstract class Swift_ByteStream_AbstractFilterableInputStream implements Swift_I
*/
public function flushBuffers()
{
- if ($this->writeBuffer !== '') {
+ if ('' !== $this->writeBuffer) {
$this->doWrite($this->writeBuffer);
}
$this->flush();
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/ByteStream/ArrayByteStream.php b/htdocs/includes/swiftmailer/lib/classes/Swift/ByteStream/ArrayByteStream.php
index 31b85e0e02a..4f3dcc37745 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/ByteStream/ArrayByteStream.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/ByteStream/ArrayByteStream.php
@@ -20,7 +20,7 @@ class Swift_ByteStream_ArrayByteStream implements Swift_InputByteStream, Swift_O
*
* @var string[]
*/
- private $array = array();
+ private $array = [];
/**
* The size of the stack.
@@ -41,7 +41,7 @@ class Swift_ByteStream_ArrayByteStream implements Swift_InputByteStream, Swift_O
*
* @var Swift_InputByteStream[]
*/
- private $mirrors = array();
+ private $mirrors = [];
/**
* Create a new ArrayByteStream.
@@ -52,13 +52,13 @@ class Swift_ByteStream_ArrayByteStream implements Swift_InputByteStream, Swift_O
*/
public function __construct($stack = null)
{
- if (is_array($stack)) {
+ if (\is_array($stack)) {
$this->array = $stack;
- $this->arraySize = count($stack);
- } elseif (is_string($stack)) {
+ $this->arraySize = \count($stack);
+ } elseif (\is_string($stack)) {
$this->write($stack);
} else {
- $this->array = array();
+ $this->array = [];
}
}
@@ -102,7 +102,7 @@ class Swift_ByteStream_ArrayByteStream implements Swift_InputByteStream, Swift_O
foreach ($to_add as $value) {
$this->array[] = $value;
}
- $this->arraySize = count($this->array);
+ $this->arraySize = \count($this->array);
foreach ($this->mirrors as $stream) {
$stream->write($bytes);
@@ -121,8 +121,6 @@ class Swift_ByteStream_ArrayByteStream implements Swift_InputByteStream, Swift_O
*
* The stream acts as an observer, receiving all data that is written.
* All {@link write()} and {@link flushBuffers()} operations will be mirrored.
- *
- * @param Swift_InputByteStream $is
*/
public function bind(Swift_InputByteStream $is)
{
@@ -135,8 +133,6 @@ class Swift_ByteStream_ArrayByteStream implements Swift_InputByteStream, Swift_O
* If $is is not bound, no errors will be raised.
* If the stream currently has any buffered data it will be written to $is
* before unbinding occurs.
- *
- * @param Swift_InputByteStream $is
*/
public function unbind(Swift_InputByteStream $is)
{
@@ -172,7 +168,7 @@ class Swift_ByteStream_ArrayByteStream implements Swift_InputByteStream, Swift_O
public function flushBuffers()
{
$this->offset = 0;
- $this->array = array();
+ $this->array = [];
$this->arraySize = 0;
foreach ($this->mirrors as $stream) {
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/ByteStream/FileByteStream.php b/htdocs/includes/swiftmailer/lib/classes/Swift/ByteStream/FileByteStream.php
index 61f820e5a14..f6391219e71 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/ByteStream/FileByteStream.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/ByteStream/FileByteStream.php
@@ -81,7 +81,7 @@ class Swift_ByteStream_FileByteStream extends Swift_ByteStream_AbstractFilterabl
// If we read one byte after reaching the end of the file
// feof() will return false and an empty string is returned
- if ($bytes === '' && feof($fp)) {
+ if ((false === $bytes || '' === $bytes) && feof($fp)) {
$this->resetReadHandle();
return false;
@@ -131,7 +131,7 @@ class Swift_ByteStream_FileByteStream extends Swift_ByteStream_AbstractFilterabl
throw new Swift_IoException('Unable to open file for reading ['.$this->path.']');
}
$this->reader = $pointer;
- if ($this->offset != 0) {
+ if (0 != $this->offset) {
$this->getReadStreamSeekableStatus();
$this->seekReadStreamToPosition($this->offset);
}
@@ -145,9 +145,7 @@ class Swift_ByteStream_FileByteStream extends Swift_ByteStream_AbstractFilterabl
{
if (!isset($this->writer)) {
if (!$this->writer = fopen($this->path, $this->mode)) {
- throw new Swift_IoException(
- 'Unable to open file for writing ['.$this->path.']'
- );
+ throw new Swift_IoException('Unable to open file for writing ['.$this->path.']');
}
}
@@ -173,10 +171,10 @@ class Swift_ByteStream_FileByteStream extends Swift_ByteStream_AbstractFilterabl
/** Streams in a readOnly stream ensuring copy if needed */
private function seekReadStreamToPosition($offset)
{
- if ($this->seekable === null) {
+ if (null === $this->seekable) {
$this->getReadStreamSeekableStatus();
}
- if ($this->seekable === false) {
+ if (false === $this->seekable) {
$currentPos = ftell($this->reader);
if ($currentPos < $offset) {
$toDiscard = $offset - $currentPos;
@@ -194,7 +192,7 @@ class Swift_ByteStream_FileByteStream extends Swift_ByteStream_AbstractFilterabl
{
if ($tmpFile = fopen('php://temp/maxmemory:4096', 'w+b')) {
/* We have opened a php:// Stream Should work without problem */
- } elseif (function_exists('sys_get_temp_dir') && is_writable(sys_get_temp_dir()) && ($tmpFile = tmpfile())) {
+ } elseif (\function_exists('sys_get_temp_dir') && is_writable(sys_get_temp_dir()) && ($tmpFile = tmpfile())) {
/* We have opened a tmpfile */
} else {
throw new Swift_IoException('Unable to copy the file to make it seekable, sys_temp_dir is not writable, php://memory not available');
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/ByteStream/TemporaryFileByteStream.php b/htdocs/includes/swiftmailer/lib/classes/Swift/ByteStream/TemporaryFileByteStream.php
index 1c9a80c0376..0dc61909d31 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/ByteStream/TemporaryFileByteStream.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/ByteStream/TemporaryFileByteStream.php
@@ -17,7 +17,7 @@ class Swift_ByteStream_TemporaryFileByteStream extends Swift_ByteStream_FileByte
{
$filePath = tempnam(sys_get_temp_dir(), 'FileByteStream');
- if ($filePath === false) {
+ if (false === $filePath) {
throw new Swift_IoException('Failed to retrieve temporary file name.');
}
@@ -26,7 +26,7 @@ class Swift_ByteStream_TemporaryFileByteStream extends Swift_ByteStream_FileByte
public function getContent()
{
- if (($content = file_get_contents($this->getPath())) === false) {
+ if (false === ($content = file_get_contents($this->getPath()))) {
throw new Swift_IoException('Failed to get temporary file content.');
}
@@ -39,4 +39,14 @@ class Swift_ByteStream_TemporaryFileByteStream extends Swift_ByteStream_FileByte
@unlink($this->getPath());
}
}
+
+ public function __sleep()
+ {
+ throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
+ }
+
+ public function __wakeup()
+ {
+ throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
+ }
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterReader/GenericFixedWidthReader.php b/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterReader/GenericFixedWidthReader.php
index b09bb5b6c38..3e055afd9dc 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterReader/GenericFixedWidthReader.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterReader/GenericFixedWidthReader.php
@@ -45,7 +45,7 @@ class Swift_CharacterReader_GenericFixedWidthReader implements Swift_CharacterRe
*/
public function getCharPositions($string, $startOffset, &$currentMap, &$ignoredChars)
{
- $strlen = strlen($string);
+ $strlen = \strlen($string);
// % and / are CPU intensive, so, maybe find a better way
$ignored = $strlen % $this->width;
$ignoredChars = $ignored ? substr($string, -$ignored) : '';
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterReader/UsAsciiReader.php b/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterReader/UsAsciiReader.php
index 67da48f6cb0..ffc05f7166a 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterReader/UsAsciiReader.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterReader/UsAsciiReader.php
@@ -27,7 +27,7 @@ class Swift_CharacterReader_UsAsciiReader implements Swift_CharacterReader
*/
public function getCharPositions($string, $startOffset, &$currentMap, &$ignoredChars)
{
- $strlen = strlen($string);
+ $strlen = \strlen($string);
$ignoredChars = '';
for ($i = 0; $i < $strlen; ++$i) {
if ($string[$i] > "\x07F") {
@@ -65,7 +65,7 @@ class Swift_CharacterReader_UsAsciiReader implements Swift_CharacterReader
public function validateByteSequence($bytes, $size)
{
$byte = reset($bytes);
- if (1 == count($bytes) && $byte >= 0x00 && $byte <= 0x7F) {
+ if (1 == \count($bytes) && $byte >= 0x00 && $byte <= 0x7F) {
return 0;
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterReader/Utf8Reader.php b/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterReader/Utf8Reader.php
index 22746bd8575..da37e0da9ab 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterReader/Utf8Reader.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterReader/Utf8Reader.php
@@ -17,8 +17,8 @@
class Swift_CharacterReader_Utf8Reader implements Swift_CharacterReader
{
/** Pre-computed for optimization */
- private static $length_map = array(
- // N=0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,
+ private static $length_map = [
+ // N=0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x0N
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x1N
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x2N
@@ -34,10 +34,10 @@ class Swift_CharacterReader_Utf8Reader implements Swift_CharacterReader
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xCN
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xDN
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 0xEN
- 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 0, 0, // 0xFN
- );
+ 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 0, 0, // 0xFN
+ ];
- private static $s_length_map = array(
+ private static $s_length_map = [
"\x00" => 1, "\x01" => 1, "\x02" => 1, "\x03" => 1, "\x04" => 1, "\x05" => 1, "\x06" => 1, "\x07" => 1,
"\x08" => 1, "\x09" => 1, "\x0a" => 1, "\x0b" => 1, "\x0c" => 1, "\x0d" => 1, "\x0e" => 1, "\x0f" => 1,
"\x10" => 1, "\x11" => 1, "\x12" => 1, "\x13" => 1, "\x14" => 1, "\x15" => 1, "\x16" => 1, "\x17" => 1,
@@ -70,7 +70,7 @@ class Swift_CharacterReader_Utf8Reader implements Swift_CharacterReader
"\xe8" => 3, "\xe9" => 3, "\xea" => 3, "\xeb" => 3, "\xec" => 3, "\xed" => 3, "\xee" => 3, "\xef" => 3,
"\xf0" => 4, "\xf1" => 4, "\xf2" => 4, "\xf3" => 4, "\xf4" => 4, "\xf5" => 4, "\xf6" => 4, "\xf7" => 4,
"\xf8" => 5, "\xf9" => 5, "\xfa" => 5, "\xfb" => 5, "\xfc" => 6, "\xfd" => 6, "\xfe" => 0, "\xff" => 0,
- );
+ ];
/**
* Returns the complete character map.
@@ -85,22 +85,22 @@ class Swift_CharacterReader_Utf8Reader implements Swift_CharacterReader
public function getCharPositions($string, $startOffset, &$currentMap, &$ignoredChars)
{
if (!isset($currentMap['i']) || !isset($currentMap['p'])) {
- $currentMap['p'] = $currentMap['i'] = array();
+ $currentMap['p'] = $currentMap['i'] = [];
}
- $strlen = strlen($string);
- $charPos = count($currentMap['p']);
+ $strlen = \strlen($string);
+ $charPos = \count($currentMap['p']);
$foundChars = 0;
$invalid = false;
for ($i = 0; $i < $strlen; ++$i) {
$char = $string[$i];
$size = self::$s_length_map[$char];
- if ($size == 0) {
+ if (0 == $size) {
/* char is invalid, we must wait for a resync */
$invalid = true;
continue;
} else {
- if ($invalid == true) {
+ if (true === $invalid) {
/* We mark the chars as invalid and start a new char */
$currentMap['p'][$charPos + $foundChars] = $startOffset + $i;
$currentMap['i'][$charPos + $foundChars] = true;
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterReaderFactory/SimpleCharacterReaderFactory.php b/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterReaderFactory/SimpleCharacterReaderFactory.php
index f3641f46b46..86900894ab1 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterReaderFactory/SimpleCharacterReaderFactory.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterReaderFactory/SimpleCharacterReaderFactory.php
@@ -20,14 +20,14 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactory implements Swift
*
* @var array
*/
- private static $map = array();
+ private static $map = [];
/**
* Factories which have already been loaded.
*
* @var Swift_CharacterReaderFactory[]
*/
- private static $loaded = array();
+ private static $loaded = [];
/**
* Creates a new CharacterReaderFactory.
@@ -44,32 +44,32 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactory implements Swift
public function init()
{
- if (count(self::$map) > 0) {
+ if (\count(self::$map) > 0) {
return;
}
$prefix = 'Swift_CharacterReader_';
- $singleByte = array(
+ $singleByte = [
'class' => $prefix.'GenericFixedWidthReader',
- 'constructor' => array(1),
- );
+ 'constructor' => [1],
+ ];
- $doubleByte = array(
+ $doubleByte = [
'class' => $prefix.'GenericFixedWidthReader',
- 'constructor' => array(2),
- );
+ 'constructor' => [2],
+ ];
- $fourBytes = array(
+ $fourBytes = [
'class' => $prefix.'GenericFixedWidthReader',
- 'constructor' => array(4),
- );
+ 'constructor' => [4],
+ ];
// Utf-8
- self::$map['utf-?8'] = array(
+ self::$map['utf-?8'] = [
'class' => $prefix.'Utf8Reader',
- 'constructor' => array(),
- );
+ 'constructor' => [],
+ ];
//7-8 bit charsets
self::$map['(us-)?ascii'] = $singleByte;
@@ -103,11 +103,11 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactory implements Swift
*/
public function getReaderFor($charset)
{
- $charset = strtolower(trim($charset));
+ $charset = strtolower(trim($charset ?? ''));
foreach (self::$map as $pattern => $spec) {
$re = '/^'.$pattern.'$/D';
if (preg_match($re, $charset)) {
- if (!array_key_exists($pattern, self::$loaded)) {
+ if (!\array_key_exists($pattern, self::$loaded)) {
$reflector = new ReflectionClass($spec['class']);
if ($reflector->getConstructor()) {
$reader = $reflector->newInstanceArgs($spec['constructor']);
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterStream.php b/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterStream.php
index 717924f5d63..c9d8a078ee0 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterStream.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterStream.php
@@ -28,8 +28,6 @@ interface Swift_CharacterStream
/**
* Set the CharacterReaderFactory for multi charset support.
- *
- * @param Swift_CharacterReaderFactory $factory
*/
public function setCharacterReaderFactory(Swift_CharacterReaderFactory $factory);
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterStream/ArrayCharacterStream.php b/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterStream/ArrayCharacterStream.php
index e43bd2ed510..5c2869455b8 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterStream/ArrayCharacterStream.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterStream/ArrayCharacterStream.php
@@ -31,10 +31,10 @@ class Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStrea
private $charset;
/** Array of characters */
- private $array = array();
+ private $array = [];
/** Size of the array of character */
- private $array_size = array();
+ private $array_size = [];
/** The current character offset in the stream */
private $offset = 0;
@@ -65,8 +65,6 @@ class Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStrea
/**
* Set the CharacterReaderFactory for multi charset support.
- *
- * @param Swift_CharacterReaderFactory $factory
*/
public function setCharacterReaderFactory(Swift_CharacterReaderFactory $factory)
{
@@ -87,16 +85,16 @@ class Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStrea
$startLength = $this->charReader->getInitialByteSize();
while (false !== $bytes = $os->read($startLength)) {
- $c = array();
- for ($i = 0, $len = strlen($bytes); $i < $len; ++$i) {
+ $c = [];
+ for ($i = 0, $len = \strlen($bytes); $i < $len; ++$i) {
$c[] = self::$byteMap[$bytes[$i]];
}
- $size = count($c);
+ $size = \count($c);
$need = $this->charReader
->validateByteSequence($c, $size);
if ($need > 0 &&
false !== $bytes = $os->read($need)) {
- for ($i = 0, $len = strlen($bytes); $i < $len; ++$i) {
+ for ($i = 0, $len = \strlen($bytes); $i < $len; ++$i) {
$c[] = self::$byteMap[$bytes[$i]];
}
}
@@ -132,7 +130,7 @@ class Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStrea
}
// Don't use array slice
- $arrays = array();
+ $arrays = [];
$end = $length + $this->offset;
for ($i = $this->offset; $i < $end; ++$i) {
if (!isset($this->array[$i])) {
@@ -162,7 +160,7 @@ class Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStrea
if ($this->offset == $this->array_size) {
return false;
}
- $arrays = array();
+ $arrays = [];
$end = $length + $this->offset;
for ($i = $this->offset; $i < $end; ++$i) {
if (!isset($this->array[$i])) {
@@ -172,7 +170,7 @@ class Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStrea
}
$this->offset += ($i - $this->offset); // Limit function calls
- return call_user_func_array('array_merge', $arrays);
+ return array_merge(...$arrays);
}
/**
@@ -194,19 +192,19 @@ class Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStrea
unset($chars);
fseek($fp, 0, SEEK_SET);
- $buffer = array(0);
+ $buffer = [0];
$buf_pos = 1;
$buf_len = 1;
$has_datas = true;
do {
- $bytes = array();
+ $bytes = [];
// Buffer Filing
if ($buf_len - $buf_pos < $startLength) {
$buf = array_splice($buffer, $buf_pos);
$new = $this->reloadBuffer($fp, 100);
if ($new) {
$buffer = array_merge($buf, $new);
- $buf_len = count($buffer);
+ $buf_len = \count($buffer);
$buf_pos = 0;
} else {
$has_datas = false;
@@ -226,7 +224,7 @@ class Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStrea
if ($new) {
$buffer = array_merge($buffer, $new);
- $buf_len = count($buffer);
+ $buf_len = \count($buffer);
}
}
for ($i = 0; $i < $need && isset($buffer[$buf_pos]); ++$i) {
@@ -262,15 +260,15 @@ class Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStrea
public function flushContents()
{
$this->offset = 0;
- $this->array = array();
+ $this->array = [];
$this->array_size = 0;
}
private function reloadBuffer($fp, $len)
{
- if (!feof($fp) && ($bytes = fread($fp, $len)) !== false) {
- $buf = array();
- for ($i = 0, $len = strlen($bytes); $i < $len; ++$i) {
+ if (!feof($fp) && false !== ($bytes = fread($fp, $len))) {
+ $buf = [];
+ for ($i = 0, $len = \strlen($bytes); $i < $len; ++$i) {
$buf[] = self::$byteMap[$bytes[$i]];
}
@@ -283,9 +281,9 @@ class Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStrea
private static function initializeMaps()
{
if (!isset(self::$charMap)) {
- self::$charMap = array();
+ self::$charMap = [];
for ($byte = 0; $byte < 256; ++$byte) {
- self::$charMap[$byte] = chr($byte);
+ self::$charMap[$byte] = \chr($byte);
}
self::$byteMap = array_flip(self::$charMap);
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterStream/NgCharacterStream.php b/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterStream/NgCharacterStream.php
index 0d62fa68ff3..7578dda9cac 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterStream/NgCharacterStream.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/CharacterStream/NgCharacterStream.php
@@ -81,8 +81,7 @@ class Swift_CharacterStream_NgCharacterStream implements Swift_CharacterStream
/**
* Constructor.
*
- * @param Swift_CharacterReaderFactory $factory
- * @param string $charset
+ * @param string $charset
*/
public function __construct(Swift_CharacterReaderFactory $factory, $charset)
{
@@ -106,8 +105,6 @@ class Swift_CharacterStream_NgCharacterStream implements Swift_CharacterStream
/**
* Set the CharacterReaderFactory for multi charset support.
- *
- * @param Swift_CharacterReaderFactory $factory
*/
public function setCharacterReaderFactory(Swift_CharacterReaderFactory $factory)
{
@@ -128,8 +125,6 @@ class Swift_CharacterStream_NgCharacterStream implements Swift_CharacterStream
/**
* @see Swift_CharacterStream::importByteStream()
- *
- * @param Swift_OutputByteStream $os
*/
public function importByteStream(Swift_OutputByteStream $os)
{
@@ -220,7 +215,7 @@ class Swift_CharacterStream_NgCharacterStream implements Swift_CharacterStream
public function readBytes($length)
{
$read = $this->read($length);
- if ($read !== false) {
+ if (false !== $read) {
$ret = array_map('ord', str_split($read, 1));
return $ret;
@@ -252,16 +247,16 @@ class Swift_CharacterStream_NgCharacterStream implements Swift_CharacterStream
if (!isset($this->charReader)) {
$this->charReader = $this->charReaderFactory->getReaderFor(
$this->charset);
- $this->map = array();
+ $this->map = [];
$this->mapType = $this->charReader->getMapType();
}
$ignored = '';
$this->datas .= $chars;
$this->charCount += $this->charReader->getCharPositions(substr($this->datas, $this->datasSize), $this->datasSize, $this->map, $ignored);
- if ($ignored !== false) {
- $this->datasSize = strlen($this->datas) - strlen($ignored);
+ if (false !== $ignored) {
+ $this->datasSize = \strlen($this->datas) - \strlen($ignored);
} else {
- $this->datasSize = strlen($this->datas);
+ $this->datasSize = \strlen($this->datas);
}
}
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/DependencyContainer.php b/htdocs/includes/swiftmailer/lib/classes/Swift/DependencyContainer.php
index b1bc3306f22..3cc885ec03b 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/DependencyContainer.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/DependencyContainer.php
@@ -16,22 +16,25 @@
class Swift_DependencyContainer
{
/** Constant for literal value types */
- const TYPE_VALUE = 0x0001;
+ const TYPE_VALUE = 0x00001;
/** Constant for new instance types */
- const TYPE_INSTANCE = 0x0010;
+ const TYPE_INSTANCE = 0x00010;
/** Constant for shared instance types */
- const TYPE_SHARED = 0x0100;
+ const TYPE_SHARED = 0x00100;
/** Constant for aliases */
- const TYPE_ALIAS = 0x1000;
+ const TYPE_ALIAS = 0x01000;
+
+ /** Constant for arrays */
+ const TYPE_ARRAY = 0x10000;
/** Singleton instance */
private static $instance = null;
/** The data container */
- private $store = array();
+ private $store = [];
/** The current endpoint in the data container */
private $endPoint;
@@ -80,7 +83,7 @@ class Swift_DependencyContainer
*/
public function has($itemName)
{
- return array_key_exists($itemName, $this->store)
+ return \array_key_exists($itemName, $this->store)
&& isset($this->store[$itemName]['lookupType']);
}
@@ -98,9 +101,7 @@ class Swift_DependencyContainer
public function lookup($itemName)
{
if (!$this->has($itemName)) {
- throw new Swift_DependencyException(
- 'Cannot lookup dependency "'.$itemName.'" since it is not registered.'
- );
+ throw new Swift_DependencyException('Cannot lookup dependency "'.$itemName.'" since it is not registered.');
}
switch ($this->store[$itemName]['lookupType']) {
@@ -112,6 +113,8 @@ class Swift_DependencyContainer
return $this->createNewInstance($itemName);
case self::TYPE_SHARED:
return $this->createSharedInstance($itemName);
+ case self::TYPE_ARRAY:
+ return $this->createDependenciesFor($itemName);
}
}
@@ -124,7 +127,7 @@ class Swift_DependencyContainer
*/
public function createDependenciesFor($itemName)
{
- $args = array();
+ $args = [];
if (isset($this->store[$itemName]['args'])) {
$args = $this->resolveArgs($this->store[$itemName]['args']);
}
@@ -147,7 +150,7 @@ class Swift_DependencyContainer
*/
public function register($itemName)
{
- $this->store[$itemName] = array();
+ $this->store[$itemName] = [];
$this->endPoint = &$this->store[$itemName];
return $this;
@@ -227,6 +230,21 @@ class Swift_DependencyContainer
return $this;
}
+ /**
+ * Specify the previously registered item as array of dependencies.
+ *
+ * {@link register()} must be called before this will work.
+ *
+ * @return $this
+ */
+ public function asArray()
+ {
+ $endPoint = &$this->getEndPoint();
+ $endPoint['lookupType'] = self::TYPE_ARRAY;
+
+ return $this;
+ }
+
/**
* Specify a list of injected dependencies for the previously registered item.
*
@@ -234,14 +252,12 @@ class Swift_DependencyContainer
*
* @see addConstructorValue(), addConstructorLookup()
*
- * @param array $lookups
- *
* @return $this
*/
public function withDependencies(array $lookups)
{
$endPoint = &$this->getEndPoint();
- $endPoint['args'] = array();
+ $endPoint['args'] = [];
foreach ($lookups as $lookup) {
$this->addConstructorLookup($lookup);
}
@@ -263,9 +279,9 @@ class Swift_DependencyContainer
{
$endPoint = &$this->getEndPoint();
if (!isset($endPoint['args'])) {
- $endPoint['args'] = array();
+ $endPoint['args'] = [];
}
- $endPoint['args'][] = array('type' => 'value', 'item' => $value);
+ $endPoint['args'][] = ['type' => 'value', 'item' => $value];
return $this;
}
@@ -284,9 +300,9 @@ class Swift_DependencyContainer
{
$endPoint = &$this->getEndPoint();
if (!isset($this->endPoint['args'])) {
- $endPoint['args'] = array();
+ $endPoint['args'] = [];
}
- $endPoint['args'][] = array('type' => 'lookup', 'item' => $lookup);
+ $endPoint['args'][] = ['type' => 'lookup', 'item' => $lookup];
return $this;
}
@@ -330,9 +346,7 @@ class Swift_DependencyContainer
private function &getEndPoint()
{
if (!isset($this->endPoint)) {
- throw new BadMethodCallException(
- 'Component must first be registered by calling register()'
- );
+ throw new BadMethodCallException('Component must first be registered by calling register()');
}
return $this->endPoint;
@@ -341,7 +355,7 @@ class Swift_DependencyContainer
/** Get an argument list with dependencies resolved */
private function resolveArgs(array $args)
{
- $resolved = array();
+ $resolved = [];
foreach ($args as $argDefinition) {
switch ($argDefinition['type']) {
case 'lookup':
@@ -359,8 +373,8 @@ class Swift_DependencyContainer
/** Resolve a single dependency with an collections */
private function lookupRecursive($item)
{
- if (is_array($item)) {
- $collection = array();
+ if (\is_array($item)) {
+ $collection = [];
foreach ($item as $k => $v) {
$collection[$k] = $this->lookupRecursive($v);
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/EmbeddedFile.php b/htdocs/includes/swiftmailer/lib/classes/Swift/EmbeddedFile.php
index 9755a88e176..30fc68ab03e 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/EmbeddedFile.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/EmbeddedFile.php
@@ -26,8 +26,8 @@ class Swift_EmbeddedFile extends Swift_Mime_EmbeddedFile
*/
public function __construct($data = null, $filename = null, $contentType = null)
{
- call_user_func_array(
- array($this, 'Swift_Mime_EmbeddedFile::__construct'),
+ \call_user_func_array(
+ [$this, 'Swift_Mime_EmbeddedFile::__construct'],
Swift_DependencyContainer::getInstance()
->createDependenciesFor('mime.embeddedfile')
);
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Encoder/Base64Encoder.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Encoder/Base64Encoder.php
index 0e7b2a1b0c8..b1eedaa051b 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Encoder/Base64Encoder.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Encoder/Base64Encoder.php
@@ -34,7 +34,7 @@ class Swift_Encoder_Base64Encoder implements Swift_Encoder
$maxLineLength = 76;
}
- $encodedString = base64_encode($string);
+ $encodedString = base64_encode($string ?? '');
$firstLine = '';
if (0 != $firstLineOffset) {
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Encoder/QpEncoder.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Encoder/QpEncoder.php
index b23b07702ef..f078d6d7c38 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Encoder/QpEncoder.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Encoder/QpEncoder.php
@@ -36,7 +36,7 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
*
* @var string[]
*/
- protected static $qpMap = array(
+ protected static $qpMap = [
0 => '=00', 1 => '=01', 2 => '=02', 3 => '=03', 4 => '=04',
5 => '=05', 6 => '=06', 7 => '=07', 8 => '=08', 9 => '=09',
10 => '=0A', 11 => '=0B', 12 => '=0C', 13 => '=0D', 14 => '=0E',
@@ -89,16 +89,16 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
245 => '=F5', 246 => '=F6', 247 => '=F7', 248 => '=F8', 249 => '=F9',
250 => '=FA', 251 => '=FB', 252 => '=FC', 253 => '=FD', 254 => '=FE',
255 => '=FF',
- );
+ ];
- protected static $safeMapShare = array();
+ protected static $safeMapShare = [];
/**
* A map of non-encoded ascii characters.
*
* @var string[]
*/
- protected $safeMap = array();
+ protected $safeMap = [];
/**
* Creates a new QpEncoder for the given CharacterStream.
@@ -120,7 +120,7 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
public function __sleep()
{
- return array('charStream', 'filter');
+ return ['charStream', 'filter'];
}
public function __wakeup()
@@ -135,14 +135,14 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
protected function getSafeMapShareId()
{
- return get_class($this);
+ return static::class;
}
protected function initSafeMap()
{
foreach (array_merge(
- array(0x09, 0x20), range(0x21, 0x3C), range(0x3E, 0x7E)) as $byte) {
- $this->safeMap[$byte] = chr($byte);
+ [0x09, 0x20], range(0x21, 0x3C), range(0x3E, 0x7E)) as $byte) {
+ $this->safeMap[$byte] = \chr($byte);
}
}
@@ -153,9 +153,9 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
* If the first line needs to be shorter, indicate the difference with
* $firstLineOffset.
*
- * @param string $string to encode
- * @param int $firstLineOffset, optional
- * @param int $maxLineLength, optional 0 indicates the default of 76 chars
+ * @param string $string to encode
+ * @param int $firstLineOffset optional
+ * @param int $maxLineLength optional 0 indicates the default of 76 chars
*
* @return string
*/
@@ -167,7 +167,7 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
$thisLineLength = $maxLineLength - $firstLineOffset;
- $lines = array();
+ $lines = [];
$lNo = 0;
$lines[$lNo] = '';
$currentLine = &$lines[$lNo++];
@@ -200,7 +200,7 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
$enc = $this->encodeByteSequence($bytes, $size);
$i = strpos($enc, '=0D=0A');
- $newLineLength = $lineLen + ($i === false ? $size : $i);
+ $newLineLength = $lineLen + (false === $i ? $size : $i);
if ($currentLine && $newLineLength >= $thisLineLength) {
$lines[$lNo] = '';
@@ -211,7 +211,7 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
$currentLine .= $enc;
- if ($i === false) {
+ if (false === $i) {
$lineLen += $size;
} else {
// 6 is the length of '=0D=0A'.
@@ -278,10 +278,10 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
*/
protected function standardize($string)
{
- $string = str_replace(array("\t=0D=0A", ' =0D=0A', '=0D=0A'),
- array("=09\r\n", "=20\r\n", "\r\n"), $string
+ $string = str_replace(["\t=0D=0A", ' =0D=0A', '=0D=0A'],
+ ["=09\r\n", "=20\r\n", "\r\n"], $string
);
- switch ($end = ord(substr($string, -1))) {
+ switch ($end = \ord(substr($string, -1))) {
case 0x09:
case 0x20:
$string = substr_replace($string, self::$qpMap[$end], -1);
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Encoder/Rfc2231Encoder.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Encoder/Rfc2231Encoder.php
index bebb13494bd..7eac36813e0 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Encoder/Rfc2231Encoder.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Encoder/Rfc2231Encoder.php
@@ -24,8 +24,6 @@ class Swift_Encoder_Rfc2231Encoder implements Swift_Encoder
/**
* Creates a new Rfc2231Encoder using the given character stream instance.
- *
- * @param Swift_CharacterStream
*/
public function __construct(Swift_CharacterStream $charStream)
{
@@ -44,7 +42,7 @@ class Swift_Encoder_Rfc2231Encoder implements Swift_Encoder
*/
public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0)
{
- $lines = array();
+ $lines = [];
$lineCount = 0;
$lines[] = '';
$currentLine = &$lines[$lineCount++];
@@ -60,8 +58,8 @@ class Swift_Encoder_Rfc2231Encoder implements Swift_Encoder
while (false !== $char = $this->charStream->read(4)) {
$encodedChar = rawurlencode($char);
- if (0 != strlen($currentLine)
- && strlen($currentLine.$encodedChar) > $thisLineLength) {
+ if (0 != \strlen($currentLine)
+ && \strlen($currentLine.$encodedChar) > $thisLineLength) {
$lines[] = '';
$currentLine = &$lines[$lineCount++];
$thisLineLength = $maxLineLength;
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Events/CommandEvent.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/CommandEvent.php
index 9834aa95883..18994c184f3 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Events/CommandEvent.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/CommandEvent.php
@@ -27,16 +27,15 @@ class Swift_Events_CommandEvent extends Swift_Events_EventObject
*
* @var int[]
*/
- private $successCodes = array();
+ private $successCodes = [];
/**
* Create a new CommandEvent for $source with $command.
*
- * @param Swift_Transport $source
- * @param string $command
- * @param array $successCodes
+ * @param string $command
+ * @param array $successCodes
*/
- public function __construct(Swift_Transport $source, $command, $successCodes = array())
+ public function __construct(Swift_Transport $source, $command, $successCodes = [])
{
parent::__construct($source);
$this->command = $command;
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Events/CommandListener.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/CommandListener.php
index 7545404e765..b158eab462a 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Events/CommandListener.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/CommandListener.php
@@ -17,8 +17,6 @@ interface Swift_Events_CommandListener extends Swift_Events_EventListener
{
/**
* Invoked immediately following a command being sent.
- *
- * @param Swift_Events_CommandEvent $evt
*/
public function commandSent(Swift_Events_CommandEvent $evt);
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Events/EventDispatcher.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/EventDispatcher.php
index f602608eeb6..df25a124863 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Events/EventDispatcher.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/EventDispatcher.php
@@ -18,9 +18,6 @@ interface Swift_Events_EventDispatcher
/**
* Create a new SendEvent for $source and $message.
*
- * @param Swift_Transport $source
- * @param Swift_Mime_SimpleMessage
- *
* @return Swift_Events_SendEvent
*/
public function createSendEvent(Swift_Transport $source, Swift_Mime_SimpleMessage $message);
@@ -28,20 +25,18 @@ interface Swift_Events_EventDispatcher
/**
* Create a new CommandEvent for $source and $command.
*
- * @param Swift_Transport $source
- * @param string $command That will be executed
- * @param array $successCodes That are needed
+ * @param string $command That will be executed
+ * @param array $successCodes That are needed
*
* @return Swift_Events_CommandEvent
*/
- public function createCommandEvent(Swift_Transport $source, $command, $successCodes = array());
+ public function createCommandEvent(Swift_Transport $source, $command, $successCodes = []);
/**
* Create a new ResponseEvent for $source and $response.
*
- * @param Swift_Transport $source
- * @param string $response
- * @param bool $valid If the response is valid
+ * @param string $response
+ * @param bool $valid If the response is valid
*
* @return Swift_Events_ResponseEvent
*/
@@ -50,8 +45,6 @@ interface Swift_Events_EventDispatcher
/**
* Create a new TransportChangeEvent for $source.
*
- * @param Swift_Transport $source
- *
* @return Swift_Events_TransportChangeEvent
*/
public function createTransportChangeEvent(Swift_Transport $source);
@@ -59,25 +52,19 @@ interface Swift_Events_EventDispatcher
/**
* Create a new TransportExceptionEvent for $source.
*
- * @param Swift_Transport $source
- * @param Swift_TransportException $ex
- *
* @return Swift_Events_TransportExceptionEvent
*/
public function createTransportExceptionEvent(Swift_Transport $source, Swift_TransportException $ex);
/**
* Bind an event listener to this dispatcher.
- *
- * @param Swift_Events_EventListener $listener
*/
public function bindEventListener(Swift_Events_EventListener $listener);
/**
* Dispatch the given Event to all suitable listeners.
*
- * @param Swift_Events_EventObject $evt
- * @param string $target method
+ * @param string $target method
*/
public function dispatchEvent(Swift_Events_EventObject $evt, $target);
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Events/EventObject.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/EventObject.php
index 21e7c8127d6..24a11f44e23 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Events/EventObject.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/EventObject.php
@@ -43,8 +43,6 @@ class Swift_Events_EventObject implements Swift_Events_Event
/**
* Prevent this Event from bubbling any further up the stack.
- *
- * @param bool $cancel, optional
*/
public function cancelBubble($cancel = true)
{
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Events/ResponseEvent.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/ResponseEvent.php
index 5ae6c04b627..ff7c37116ba 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Events/ResponseEvent.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/ResponseEvent.php
@@ -32,9 +32,8 @@ class Swift_Events_ResponseEvent extends Swift_Events_EventObject
/**
* Create a new ResponseEvent for $source and $response.
*
- * @param Swift_Transport $source
- * @param string $response
- * @param bool $valid
+ * @param string $response
+ * @param bool $valid
*/
public function __construct(Swift_Transport $source, $response, $valid = false)
{
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Events/ResponseListener.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/ResponseListener.php
index c40919d210f..85115a33811 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Events/ResponseListener.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/ResponseListener.php
@@ -17,8 +17,6 @@ interface Swift_Events_ResponseListener extends Swift_Events_EventListener
{
/**
* Invoked immediately following a response coming back.
- *
- * @param Swift_Events_ResponseEvent $evt
*/
public function responseReceived(Swift_Events_ResponseEvent $evt);
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Events/SendEvent.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/SendEvent.php
index 5dc8efb1fd6..a435691e0b0 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Events/SendEvent.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/SendEvent.php
@@ -42,7 +42,7 @@ class Swift_Events_SendEvent extends Swift_Events_EventObject
*
* @var string[]
*/
- private $failedRecipients = array();
+ private $failedRecipients = [];
/**
* The overall result as a bitmask from the class constants.
@@ -53,9 +53,6 @@ class Swift_Events_SendEvent extends Swift_Events_EventObject
/**
* Create a new SendEvent for $source and $message.
- *
- * @param Swift_Transport $source
- * @param Swift_Mime_SimpleMessage $message
*/
public function __construct(Swift_Transport $source, Swift_Mime_SimpleMessage $message)
{
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Events/SendListener.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/SendListener.php
index d922e1bfa96..f7bf55ef56c 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Events/SendListener.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/SendListener.php
@@ -17,15 +17,11 @@ interface Swift_Events_SendListener extends Swift_Events_EventListener
{
/**
* Invoked immediately before the Message is sent.
- *
- * @param Swift_Events_SendEvent $evt
*/
public function beforeSendPerformed(Swift_Events_SendEvent $evt);
/**
* Invoked immediately after the Message is sent.
- *
- * @param Swift_Events_SendEvent $evt
*/
public function sendPerformed(Swift_Events_SendEvent $evt);
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Events/SimpleEventDispatcher.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/SimpleEventDispatcher.php
index 815fa4d922b..6557103c99a 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Events/SimpleEventDispatcher.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/SimpleEventDispatcher.php
@@ -16,34 +16,28 @@
class Swift_Events_SimpleEventDispatcher implements Swift_Events_EventDispatcher
{
/** A map of event types to their associated listener types */
- private $eventMap = array();
+ private $eventMap = [];
/** Event listeners bound to this dispatcher */
- private $listeners = array();
-
- /** Listeners queued to have an Event bubbled up the stack to them */
- private $bubbleQueue = array();
+ private $listeners = [];
/**
* Create a new EventDispatcher.
*/
public function __construct()
{
- $this->eventMap = array(
+ $this->eventMap = [
'Swift_Events_CommandEvent' => 'Swift_Events_CommandListener',
'Swift_Events_ResponseEvent' => 'Swift_Events_ResponseListener',
'Swift_Events_SendEvent' => 'Swift_Events_SendListener',
'Swift_Events_TransportChangeEvent' => 'Swift_Events_TransportChangeListener',
'Swift_Events_TransportExceptionEvent' => 'Swift_Events_TransportExceptionListener',
- );
+ ];
}
/**
* Create a new SendEvent for $source and $message.
*
- * @param Swift_Transport $source
- * @param Swift_Mime_SimpleMessage
- *
* @return Swift_Events_SendEvent
*/
public function createSendEvent(Swift_Transport $source, Swift_Mime_SimpleMessage $message)
@@ -54,13 +48,12 @@ class Swift_Events_SimpleEventDispatcher implements Swift_Events_EventDispatcher
/**
* Create a new CommandEvent for $source and $command.
*
- * @param Swift_Transport $source
- * @param string $command That will be executed
- * @param array $successCodes That are needed
+ * @param string $command That will be executed
+ * @param array $successCodes That are needed
*
* @return Swift_Events_CommandEvent
*/
- public function createCommandEvent(Swift_Transport $source, $command, $successCodes = array())
+ public function createCommandEvent(Swift_Transport $source, $command, $successCodes = [])
{
return new Swift_Events_CommandEvent($source, $command, $successCodes);
}
@@ -68,9 +61,8 @@ class Swift_Events_SimpleEventDispatcher implements Swift_Events_EventDispatcher
/**
* Create a new ResponseEvent for $source and $response.
*
- * @param Swift_Transport $source
- * @param string $response
- * @param bool $valid If the response is valid
+ * @param string $response
+ * @param bool $valid If the response is valid
*
* @return Swift_Events_ResponseEvent
*/
@@ -82,8 +74,6 @@ class Swift_Events_SimpleEventDispatcher implements Swift_Events_EventDispatcher
/**
* Create a new TransportChangeEvent for $source.
*
- * @param Swift_Transport $source
- *
* @return Swift_Events_TransportChangeEvent
*/
public function createTransportChangeEvent(Swift_Transport $source)
@@ -94,9 +84,6 @@ class Swift_Events_SimpleEventDispatcher implements Swift_Events_EventDispatcher
/**
* Create a new TransportExceptionEvent for $source.
*
- * @param Swift_Transport $source
- * @param Swift_TransportException $ex
- *
* @return Swift_Events_TransportExceptionEvent
*/
public function createTransportExceptionEvent(Swift_Transport $source, Swift_TransportException $ex)
@@ -106,8 +93,6 @@ class Swift_Events_SimpleEventDispatcher implements Swift_Events_EventDispatcher
/**
* Bind an event listener to this dispatcher.
- *
- * @param Swift_Events_EventListener $listener
*/
public function bindEventListener(Swift_Events_EventListener $listener)
{
@@ -123,34 +108,35 @@ class Swift_Events_SimpleEventDispatcher implements Swift_Events_EventDispatcher
/**
* Dispatch the given Event to all suitable listeners.
*
- * @param Swift_Events_EventObject $evt
- * @param string $target method
+ * @param string $target method
*/
public function dispatchEvent(Swift_Events_EventObject $evt, $target)
{
- $this->prepareBubbleQueue($evt);
- $this->bubble($evt, $target);
+ $bubbleQueue = $this->prepareBubbleQueue($evt);
+ $this->bubble($bubbleQueue, $evt, $target);
}
/** Queue listeners on a stack ready for $evt to be bubbled up it */
private function prepareBubbleQueue(Swift_Events_EventObject $evt)
{
- $this->bubbleQueue = array();
- $evtClass = get_class($evt);
+ $bubbleQueue = [];
+ $evtClass = \get_class($evt);
foreach ($this->listeners as $listener) {
- if (array_key_exists($evtClass, $this->eventMap)
+ if (\array_key_exists($evtClass, $this->eventMap)
&& ($listener instanceof $this->eventMap[$evtClass])) {
- $this->bubbleQueue[] = $listener;
+ $bubbleQueue[] = $listener;
}
}
+
+ return $bubbleQueue;
}
/** Bubble $evt up the stack calling $target() on each listener */
- private function bubble(Swift_Events_EventObject $evt, $target)
+ private function bubble(array &$bubbleQueue, Swift_Events_EventObject $evt, $target)
{
- if (!$evt->bubbleCancelled() && $listener = array_shift($this->bubbleQueue)) {
+ if (!$evt->bubbleCancelled() && $listener = array_shift($bubbleQueue)) {
$listener->$target($evt);
- $this->bubble($evt, $target);
+ $this->bubble($bubbleQueue, $evt, $target);
}
}
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Events/TransportChangeListener.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/TransportChangeListener.php
index 253165de89f..4a7492bc551 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Events/TransportChangeListener.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/TransportChangeListener.php
@@ -17,29 +17,21 @@ interface Swift_Events_TransportChangeListener extends Swift_Events_EventListene
{
/**
* Invoked just before a Transport is started.
- *
- * @param Swift_Events_TransportChangeEvent $evt
*/
public function beforeTransportStarted(Swift_Events_TransportChangeEvent $evt);
/**
* Invoked immediately after the Transport is started.
- *
- * @param Swift_Events_TransportChangeEvent $evt
*/
public function transportStarted(Swift_Events_TransportChangeEvent $evt);
/**
* Invoked just before a Transport is stopped.
- *
- * @param Swift_Events_TransportChangeEvent $evt
*/
public function beforeTransportStopped(Swift_Events_TransportChangeEvent $evt);
/**
* Invoked immediately after the Transport is stopped.
- *
- * @param Swift_Events_TransportChangeEvent $evt
*/
public function transportStopped(Swift_Events_TransportChangeEvent $evt);
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Events/TransportExceptionEvent.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/TransportExceptionEvent.php
index 77534e3e033..df442cc70f6 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Events/TransportExceptionEvent.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/TransportExceptionEvent.php
@@ -24,9 +24,6 @@ class Swift_Events_TransportExceptionEvent extends Swift_Events_EventObject
/**
* Create a new TransportExceptionEvent for $transport.
- *
- * @param Swift_Transport $transport
- * @param Swift_TransportException $ex
*/
public function __construct(Swift_Transport $transport, Swift_TransportException $ex)
{
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Events/TransportExceptionListener.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/TransportExceptionListener.php
index cc3c0993793..ad80eb01d0f 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Events/TransportExceptionListener.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Events/TransportExceptionListener.php
@@ -17,8 +17,6 @@ interface Swift_Events_TransportExceptionListener extends Swift_Events_EventList
{
/**
* Invoked as a TransportException is thrown in the Transport system.
- *
- * @param Swift_Events_TransportExceptionEvent $evt
*/
public function exceptionThrown(Swift_Events_TransportExceptionEvent $evt);
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/FailoverTransport.php b/htdocs/includes/swiftmailer/lib/classes/Swift/FailoverTransport.php
index dc2859f74a0..af0be917903 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/FailoverTransport.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/FailoverTransport.php
@@ -20,10 +20,10 @@ class Swift_FailoverTransport extends Swift_Transport_FailoverTransport
*
* @param Swift_Transport[] $transports
*/
- public function __construct($transports = array())
+ public function __construct($transports = [])
{
- call_user_func_array(
- array($this, 'Swift_Transport_FailoverTransport::__construct'),
+ \call_user_func_array(
+ [$this, 'Swift_Transport_FailoverTransport::__construct'],
Swift_DependencyContainer::getInstance()
->createDependenciesFor('transport.failover')
);
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/FileSpool.php b/htdocs/includes/swiftmailer/lib/classes/Swift/FileSpool.php
index b0b9eb064c5..7af8471c9d7 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/FileSpool.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/FileSpool.php
@@ -121,7 +121,7 @@ class Swift_FileSpool extends Swift_ConfigurableSpool
foreach (new DirectoryIterator($this->path) as $file) {
$file = $file->getRealPath();
- if (substr($file, -16) == '.message.sending') {
+ if ('.message.sending' == substr($file, -16)) {
$lockedtime = filectime($file);
if ((time() - $lockedtime) > $timeout) {
rename($file, substr($file, 0, -8));
@@ -145,7 +145,7 @@ class Swift_FileSpool extends Swift_ConfigurableSpool
/* Start the transport only if there are queued files to send */
if (!$transport->isStarted()) {
foreach ($directoryIterator as $file) {
- if (substr($file->getRealPath(), -8) == '.message') {
+ if ('.message' == substr($file->getRealPath(), -8)) {
$transport->start();
break;
}
@@ -158,7 +158,7 @@ class Swift_FileSpool extends Swift_ConfigurableSpool
foreach ($directoryIterator as $file) {
$file = $file->getRealPath();
- if (substr($file, -8) != '.message') {
+ if ('.message' != substr($file, -8)) {
continue;
}
@@ -198,7 +198,7 @@ class Swift_FileSpool extends Swift_ConfigurableSpool
// This string MUST stay FS safe, avoid special chars
$base = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-';
$ret = '';
- $strlen = strlen($base);
+ $strlen = \strlen($base);
for ($i = 0; $i < $count; ++$i) {
$ret .= $base[random_int(0, $strlen - 1)];
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Filterable.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Filterable.php
index 6b75b52748d..efa1b1def5e 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Filterable.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Filterable.php
@@ -18,8 +18,7 @@ interface Swift_Filterable
/**
* Add a new StreamFilter, referenced by $key.
*
- * @param Swift_StreamFilter $filter
- * @param string $key
+ * @param string $key
*/
public function addFilter(Swift_StreamFilter $filter, $key);
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/InputByteStream.php b/htdocs/includes/swiftmailer/lib/classes/Swift/InputByteStream.php
index 56efc7593ac..379a5a17870 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/InputByteStream.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/InputByteStream.php
@@ -52,7 +52,7 @@ interface Swift_InputByteStream
*
* @param Swift_InputByteStream $is
*/
- public function bind(Swift_InputByteStream $is);
+ public function bind(self $is);
/**
* Remove an already bound stream.
@@ -63,7 +63,7 @@ interface Swift_InputByteStream
*
* @param Swift_InputByteStream $is
*/
- public function unbind(Swift_InputByteStream $is);
+ public function unbind(self $is);
/**
* Flush the contents of the stream (empty it) and set the internal pointer
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/IoException.php b/htdocs/includes/swiftmailer/lib/classes/Swift/IoException.php
index c405f352b50..5452bd416a6 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/IoException.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/IoException.php
@@ -18,9 +18,8 @@ class Swift_IoException extends Swift_SwiftException
/**
* Create a new IoException with $message.
*
- * @param string $message
- * @param int $code
- * @param Exception $previous
+ * @param string $message
+ * @param int $code
*/
public function __construct($message, $code = 0, Exception $previous = null)
{
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/KeyCache.php b/htdocs/includes/swiftmailer/lib/classes/Swift/KeyCache.php
index cd6f786df63..87f6a074212 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/KeyCache.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/KeyCache.php
@@ -38,10 +38,9 @@ interface Swift_KeyCache
*
* @see MODE_WRITE, MODE_APPEND
*
- * @param string $nsKey
- * @param string $itemKey
- * @param Swift_OutputByteStream $os
- * @param int $mode
+ * @param string $nsKey
+ * @param string $itemKey
+ * @param int $mode
*/
public function importFromByteStream($nsKey, $itemKey, Swift_OutputByteStream $os, $mode);
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/KeyCache/ArrayKeyCache.php b/htdocs/includes/swiftmailer/lib/classes/Swift/KeyCache/ArrayKeyCache.php
index cdd08503004..e8fef1c95d4 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/KeyCache/ArrayKeyCache.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/KeyCache/ArrayKeyCache.php
@@ -20,7 +20,7 @@ class Swift_KeyCache_ArrayKeyCache implements Swift_KeyCache
*
* @var array
*/
- private $contents = array();
+ private $contents = [];
/**
* An InputStream for cloning.
@@ -32,8 +32,6 @@ class Swift_KeyCache_ArrayKeyCache implements Swift_KeyCache
/**
* Create a new ArrayKeyCache with the given $stream for cloning to make
* InputByteStreams.
- *
- * @param Swift_KeyCache_KeyCacheInputStream $stream
*/
public function __construct(Swift_KeyCache_KeyCacheInputStream $stream)
{
@@ -64,10 +62,7 @@ class Swift_KeyCache_ArrayKeyCache implements Swift_KeyCache
$this->contents[$nsKey][$itemKey] .= $string;
break;
default:
- throw new Swift_SwiftException(
- 'Invalid mode ['.$mode.'] used to set nsKey='.
- $nsKey.', itemKey='.$itemKey
- );
+ throw new Swift_SwiftException('Invalid mode ['.$mode.'] used to set nsKey='.$nsKey.', itemKey='.$itemKey);
}
}
@@ -76,10 +71,9 @@ class Swift_KeyCache_ArrayKeyCache implements Swift_KeyCache
*
* @see MODE_WRITE, MODE_APPEND
*
- * @param string $nsKey
- * @param string $itemKey
- * @param Swift_OutputByteStream $os
- * @param int $mode
+ * @param string $nsKey
+ * @param string $itemKey
+ * @param int $mode
*/
public function importFromByteStream($nsKey, $itemKey, Swift_OutputByteStream $os, $mode)
{
@@ -87,6 +81,7 @@ class Swift_KeyCache_ArrayKeyCache implements Swift_KeyCache
switch ($mode) {
case self::MODE_WRITE:
$this->clearKey($nsKey, $itemKey);
+ // no break
case self::MODE_APPEND:
if (!$this->hasKey($nsKey, $itemKey)) {
$this->contents[$nsKey][$itemKey] = '';
@@ -96,10 +91,7 @@ class Swift_KeyCache_ArrayKeyCache implements Swift_KeyCache
}
break;
default:
- throw new Swift_SwiftException(
- 'Invalid mode ['.$mode.'] used to set nsKey='.
- $nsKey.', itemKey='.$itemKey
- );
+ throw new Swift_SwiftException('Invalid mode ['.$mode.'] used to set nsKey='.$nsKey.', itemKey='.$itemKey);
}
}
@@ -108,9 +100,8 @@ class Swift_KeyCache_ArrayKeyCache implements Swift_KeyCache
*
* NOTE: The stream will always write in append mode.
*
- * @param string $nsKey
- * @param string $itemKey
- * @param Swift_InputByteStream $writeThrough
+ * @param string $nsKey
+ * @param string $itemKey
*
* @return Swift_InputByteStream
*/
@@ -168,7 +159,7 @@ class Swift_KeyCache_ArrayKeyCache implements Swift_KeyCache
{
$this->prepareCache($nsKey);
- return array_key_exists($itemKey, $this->contents[$nsKey]);
+ return \array_key_exists($itemKey, $this->contents[$nsKey]);
}
/**
@@ -199,8 +190,8 @@ class Swift_KeyCache_ArrayKeyCache implements Swift_KeyCache
*/
private function prepareCache($nsKey)
{
- if (!array_key_exists($nsKey, $this->contents)) {
- $this->contents[$nsKey] = array();
+ if (!\array_key_exists($nsKey, $this->contents)) {
+ $this->contents[$nsKey] = [];
}
}
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/KeyCache/DiskKeyCache.php b/htdocs/includes/swiftmailer/lib/classes/Swift/KeyCache/DiskKeyCache.php
index d6a633a1512..33b6367cb8b 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/KeyCache/DiskKeyCache.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/KeyCache/DiskKeyCache.php
@@ -43,14 +43,13 @@ class Swift_KeyCache_DiskKeyCache implements Swift_KeyCache
*
* @var array
*/
- private $keys = array();
+ private $keys = [];
/**
* Create a new DiskKeyCache with the given $stream for cloning to make
* InputByteStreams, and the given $path to save to.
*
- * @param Swift_KeyCache_KeyCacheInputStream $stream
- * @param string $path to save to
+ * @param string $path to save to
*/
public function __construct(Swift_KeyCache_KeyCacheInputStream $stream, $path)
{
@@ -81,10 +80,7 @@ class Swift_KeyCache_DiskKeyCache implements Swift_KeyCache
$fp = $this->getHandle($nsKey, $itemKey, self::POSITION_END);
break;
default:
- throw new Swift_SwiftException(
- 'Invalid mode ['.$mode.'] used to set nsKey='.
- $nsKey.', itemKey='.$itemKey
- );
+ throw new Swift_SwiftException('Invalid mode ['.$mode.'] used to set nsKey='.$nsKey.', itemKey='.$itemKey);
break;
}
fwrite($fp, $string);
@@ -96,10 +92,9 @@ class Swift_KeyCache_DiskKeyCache implements Swift_KeyCache
*
* @see MODE_WRITE, MODE_APPEND
*
- * @param string $nsKey
- * @param string $itemKey
- * @param Swift_OutputByteStream $os
- * @param int $mode
+ * @param string $nsKey
+ * @param string $itemKey
+ * @param int $mode
*
* @throws Swift_IoException
*/
@@ -114,10 +109,7 @@ class Swift_KeyCache_DiskKeyCache implements Swift_KeyCache
$fp = $this->getHandle($nsKey, $itemKey, self::POSITION_END);
break;
default:
- throw new Swift_SwiftException(
- 'Invalid mode ['.$mode.'] used to set nsKey='.
- $nsKey.', itemKey='.$itemKey
- );
+ throw new Swift_SwiftException('Invalid mode ['.$mode.'] used to set nsKey='.$nsKey.', itemKey='.$itemKey);
break;
}
while (false !== $bytes = $os->read(8192)) {
@@ -131,9 +123,8 @@ class Swift_KeyCache_DiskKeyCache implements Swift_KeyCache
*
* NOTE: The stream will always write in append mode.
*
- * @param string $nsKey
- * @param string $itemKey
- * @param Swift_InputByteStream $writeThrough
+ * @param string $nsKey
+ * @param string $itemKey
*
* @return Swift_InputByteStream
*/
@@ -227,7 +218,7 @@ class Swift_KeyCache_DiskKeyCache implements Swift_KeyCache
*/
public function clearAll($nsKey)
{
- if (array_key_exists($nsKey, $this->keys)) {
+ if (\array_key_exists($nsKey, $this->keys)) {
foreach ($this->keys[$nsKey] as $itemKey => $null) {
$this->clearKey($nsKey, $itemKey);
}
@@ -250,7 +241,7 @@ class Swift_KeyCache_DiskKeyCache implements Swift_KeyCache
if (!mkdir($cacheDir)) {
throw new Swift_IoException('Failed to create cache directory '.$cacheDir);
}
- $this->keys[$nsKey] = array();
+ $this->keys[$nsKey] = [];
}
}
@@ -295,4 +286,9 @@ class Swift_KeyCache_DiskKeyCache implements Swift_KeyCache
$this->clearAll($nsKey);
}
}
+
+ public function __wakeup()
+ {
+ $this->keys = [];
+ }
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/KeyCache/KeyCacheInputStream.php b/htdocs/includes/swiftmailer/lib/classes/Swift/KeyCache/KeyCacheInputStream.php
index af80bdca6bf..be2dbba0c58 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/KeyCache/KeyCacheInputStream.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/KeyCache/KeyCacheInputStream.php
@@ -17,8 +17,6 @@ interface Swift_KeyCache_KeyCacheInputStream extends Swift_InputByteStream
{
/**
* Set the KeyCache to wrap.
- *
- * @param Swift_KeyCache $keyCache
*/
public function setKeyCache(Swift_KeyCache $keyCache);
@@ -38,8 +36,6 @@ interface Swift_KeyCache_KeyCacheInputStream extends Swift_InputByteStream
/**
* Specify a stream to write through for each write().
- *
- * @param Swift_InputByteStream $is
*/
public function setWriteThroughStream(Swift_InputByteStream $is);
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/KeyCache/NullKeyCache.php b/htdocs/includes/swiftmailer/lib/classes/Swift/KeyCache/NullKeyCache.php
index 4efe785648f..957b1b2a000 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/KeyCache/NullKeyCache.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/KeyCache/NullKeyCache.php
@@ -34,10 +34,9 @@ class Swift_KeyCache_NullKeyCache implements Swift_KeyCache
*
* @see MODE_WRITE, MODE_APPEND
*
- * @param string $nsKey
- * @param string $itemKey
- * @param Swift_OutputByteStream $os
- * @param int $mode
+ * @param string $nsKey
+ * @param string $itemKey
+ * @param int $mode
*/
public function importFromByteStream($nsKey, $itemKey, Swift_OutputByteStream $os, $mode)
{
@@ -48,9 +47,8 @@ class Swift_KeyCache_NullKeyCache implements Swift_KeyCache
*
* NOTE: The stream will always write in append mode.
*
- * @param string $nsKey
- * @param string $itemKey
- * @param Swift_InputByteStream $writeThrough
+ * @param string $nsKey
+ * @param string $itemKey
*
* @return Swift_InputByteStream
*/
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/KeyCache/SimpleKeyCacheInputStream.php b/htdocs/includes/swiftmailer/lib/classes/Swift/KeyCache/SimpleKeyCacheInputStream.php
index a74df434c46..03bab481ea3 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/KeyCache/SimpleKeyCacheInputStream.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/KeyCache/SimpleKeyCacheInputStream.php
@@ -29,8 +29,6 @@ class Swift_KeyCache_SimpleKeyCacheInputStream implements Swift_KeyCache_KeyCach
/**
* Set the KeyCache to wrap.
- *
- * @param Swift_KeyCache $keyCache
*/
public function setKeyCache(Swift_KeyCache $keyCache)
{
@@ -39,8 +37,6 @@ class Swift_KeyCache_SimpleKeyCacheInputStream implements Swift_KeyCache_KeyCach
/**
* Specify a stream to write through for each write().
- *
- * @param Swift_InputByteStream $is
*/
public function setWriteThroughStream(Swift_InputByteStream $is)
{
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/LoadBalancedTransport.php b/htdocs/includes/swiftmailer/lib/classes/Swift/LoadBalancedTransport.php
index 03106e55d4e..244b5f60245 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/LoadBalancedTransport.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/LoadBalancedTransport.php
@@ -20,10 +20,10 @@ class Swift_LoadBalancedTransport extends Swift_Transport_LoadBalancedTransport
*
* @param array $transports
*/
- public function __construct($transports = array())
+ public function __construct($transports = [])
{
- call_user_func_array(
- array($this, 'Swift_Transport_LoadBalancedTransport::__construct'),
+ \call_user_func_array(
+ [$this, 'Swift_Transport_LoadBalancedTransport::__construct'],
Swift_DependencyContainer::getInstance()
->createDependenciesFor('transport.loadbalanced')
);
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mailer.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mailer.php
index 3561ec6e68e..57630074cd9 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Mailer.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mailer.php
@@ -20,8 +20,6 @@ class Swift_Mailer
/**
* Create a new Mailer using $transport for delivery.
- *
- * @param Swift_Transport $transport
*/
public function __construct(Swift_Transport $transport)
{
@@ -54,8 +52,7 @@ class Swift_Mailer
* The return value is the number of recipients who were accepted for
* delivery.
*
- * @param Swift_Mime_SimpleMessage $message
- * @param array $failedRecipients An array of failures by-reference
+ * @param array $failedRecipients An array of failures by-reference
*
* @return int The number of successful recipients. Can be 0 which indicates failure
*/
@@ -63,6 +60,7 @@ class Swift_Mailer
{
$failedRecipients = (array) $failedRecipients;
+ // FIXME: to be removed in 7.0 (as transport must now start itself on send)
if (!$this->transport->isStarted()) {
$this->transport->start();
}
@@ -82,8 +80,6 @@ class Swift_Mailer
/**
* Register a plugin using a known unique key (e.g. myPlugin).
- *
- * @param Swift_Events_EventListener $plugin
*/
public function registerPlugin(Swift_Events_EventListener $plugin)
{
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mailer/ArrayRecipientIterator.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mailer/ArrayRecipientIterator.php
index 84dacb5f185..19aa82a9c40 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Mailer/ArrayRecipientIterator.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mailer/ArrayRecipientIterator.php
@@ -20,12 +20,10 @@ class Swift_Mailer_ArrayRecipientIterator implements Swift_Mailer_RecipientItera
*
* @var array
*/
- private $recipients = array();
+ private $recipients = [];
/**
* Create a new ArrayRecipientIterator from $recipients.
- *
- * @param array $recipients
*/
public function __construct(array $recipients)
{
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/MemorySpool.php b/htdocs/includes/swiftmailer/lib/classes/Swift/MemorySpool.php
index 9aa62835b32..e3b0894d87a 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/MemorySpool.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/MemorySpool.php
@@ -15,7 +15,7 @@
*/
class Swift_MemorySpool implements Swift_Spool
{
- protected $messages = array();
+ protected $messages = [];
private $flushRetries = 3;
/**
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Message.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Message.php
index 00f6e160027..5c5834e23d8 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Message.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Message.php
@@ -18,17 +18,17 @@ class Swift_Message extends Swift_Mime_SimpleMessage
/**
* @var Swift_Signers_HeaderSigner[]
*/
- private $headerSigners = array();
+ private $headerSigners = [];
/**
* @var Swift_Signers_BodySigner[]
*/
- private $bodySigners = array();
+ private $bodySigners = [];
/**
* @var array
*/
- private $savedMessage = array();
+ private $savedMessage = [];
/**
* Create a new Message.
@@ -42,8 +42,8 @@ class Swift_Message extends Swift_Mime_SimpleMessage
*/
public function __construct($subject = null, $body = null, $contentType = null, $charset = null)
{
- call_user_func_array(
- array($this, 'Swift_Mime_SimpleMessage::__construct'),
+ \call_user_func_array(
+ [$this, 'Swift_Mime_SimpleMessage::__construct'],
Swift_DependencyContainer::getInstance()
->createDependenciesFor('mime.message')
);
@@ -75,9 +75,7 @@ class Swift_Message extends Swift_Mime_SimpleMessage
}
/**
- * Detach a signature handler from a message.
- *
- * @param Swift_Signer $signer
+ * Attach a new signature handler to the message.
*
* @return $this
*/
@@ -93,9 +91,7 @@ class Swift_Message extends Swift_Mime_SimpleMessage
}
/**
- * Attach a new signature handler to the message.
- *
- * @param Swift_Signer $signer
+ * Detach a signature handler from a message.
*
* @return $this
*/
@@ -122,6 +118,19 @@ class Swift_Message extends Swift_Mime_SimpleMessage
return $this;
}
+ /**
+ * Clear all signature handlers attached to the message.
+ *
+ * @return $this
+ */
+ public function clearSigners()
+ {
+ $this->headerSigners = [];
+ $this->bodySigners = [];
+
+ return $this;
+ }
+
/**
* Get this message as a complete string.
*
@@ -146,8 +155,6 @@ class Swift_Message extends Swift_Mime_SimpleMessage
/**
* Write this message to a {@link Swift_InputByteStream}.
- *
- * @param Swift_InputByteStream $is
*/
public function toByteStream(Swift_InputByteStream $is)
{
@@ -202,24 +209,22 @@ class Swift_Message extends Swift_Mime_SimpleMessage
*/
protected function saveMessage()
{
- $this->savedMessage = array('headers' => array());
+ $this->savedMessage = ['headers' => []];
$this->savedMessage['body'] = $this->getBody();
$this->savedMessage['children'] = $this->getChildren();
- if (count($this->savedMessage['children']) > 0 && $this->getBody() != '') {
- $this->setChildren(array_merge(array($this->becomeMimePart()), $this->savedMessage['children']));
+ if (\count($this->savedMessage['children']) > 0 && '' != $this->getBody()) {
+ $this->setChildren(array_merge([$this->becomeMimePart()], $this->savedMessage['children']));
$this->setBody('');
}
}
/**
* save the original headers.
- *
- * @param array $altered
*/
protected function saveHeaders(array $altered)
{
foreach ($altered as $head) {
- $lc = strtolower($head);
+ $lc = strtolower($head ?? '');
if (!isset($this->savedMessage['headers'][$lc])) {
$this->savedMessage['headers'][$lc] = $this->getHeaders()->getAll($head);
@@ -252,7 +257,7 @@ class Swift_Message extends Swift_Mime_SimpleMessage
$this->setChildren($this->savedMessage['children']);
$this->restoreHeaders();
- $this->savedMessage = array();
+ $this->savedMessage = [];
}
/**
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Attachment.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Attachment.php
index a36ce7237cf..d994373bd78 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Attachment.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Attachment.php
@@ -16,18 +16,14 @@
class Swift_Mime_Attachment extends Swift_Mime_SimpleMimeEntity
{
/** Recognized MIME types */
- private $mimeTypes = array();
+ private $mimeTypes = [];
/**
* Create a new Attachment with $headers, $encoder and $cache.
*
- * @param Swift_Mime_SimpleHeaderSet $headers
- * @param Swift_Mime_ContentEncoder $encoder
- * @param Swift_KeyCache $cache
- * @param Swift_IdGenerator $idGenerator
- * @param array $mimeTypes
+ * @param array $mimeTypes
*/
- public function __construct(Swift_Mime_SimpleHeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_IdGenerator $idGenerator, $mimeTypes = array())
+ public function __construct(Swift_Mime_SimpleHeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_IdGenerator $idGenerator, $mimeTypes = [])
{
parent::__construct($headers, $encoder, $cache, $idGenerator);
$this->setDisposition('attachment');
@@ -127,8 +123,7 @@ class Swift_Mime_Attachment extends Swift_Mime_SimpleMimeEntity
/**
* Set the file that this attachment is for.
*
- * @param Swift_FileStream $file
- * @param string $contentType optional
+ * @param string $contentType optional
*
* @return $this
*/
@@ -139,7 +134,7 @@ class Swift_Mime_Attachment extends Swift_Mime_SimpleMimeEntity
if (!isset($contentType)) {
$extension = strtolower(substr($file->getPath(), strrpos($file->getPath(), '.') + 1));
- if (array_key_exists($extension, $this->mimeTypes)) {
+ if (\array_key_exists($extension, $this->mimeTypes)) {
$this->setContentType($this->mimeTypes[$extension]);
}
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/Base64ContentEncoder.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/Base64ContentEncoder.php
index 8f76d70f358..b7e1e028307 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/Base64ContentEncoder.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/Base64ContentEncoder.php
@@ -18,10 +18,7 @@ class Swift_Mime_ContentEncoder_Base64ContentEncoder extends Swift_Encoder_Base6
/**
* Encode stream $in to stream $out.
*
- * @param Swift_OutputByteStream $os
- * @param Swift_InputByteStream $is
- * @param int $firstLineOffset
- * @param int $maxLineLength, optional, 0 indicates the default of 76 bytes
+ * @param int $firstLineOffset
*/
public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
{
@@ -30,7 +27,7 @@ class Swift_Mime_ContentEncoder_Base64ContentEncoder extends Swift_Encoder_Base6
}
$remainder = 0;
- $base64ReadBufferRemainderBytes = null;
+ $base64ReadBufferRemainderBytes = '';
// To reduce memory usage, the output buffer is streamed to the input buffer like so:
// Output Stream => base64encode => wrap line length => Input Stream
@@ -41,17 +38,17 @@ class Swift_Mime_ContentEncoder_Base64ContentEncoder extends Swift_Encoder_Base6
// When the OutputStream is empty, we must flush any remainder bytes.
while (true) {
$readBytes = $os->read(8192);
- $atEOF = ($readBytes === false);
+ $atEOF = (false === $readBytes);
if ($atEOF) {
$streamTheseBytes = $base64ReadBufferRemainderBytes;
} else {
$streamTheseBytes = $base64ReadBufferRemainderBytes.$readBytes;
}
- $base64ReadBufferRemainderBytes = null;
- $bytesLength = strlen($streamTheseBytes);
+ $base64ReadBufferRemainderBytes = '';
+ $bytesLength = \strlen($streamTheseBytes);
- if ($bytesLength === 0) { // no data left to encode
+ if (0 === $bytesLength) { // no data left to encode
break;
}
@@ -59,7 +56,7 @@ class Swift_Mime_ContentEncoder_Base64ContentEncoder extends Swift_Encoder_Base6
// and carry over remainder 1-2 bytes to the next loop iteration
if (!$atEOF) {
$excessBytes = $bytesLength % 3;
- if ($excessBytes !== 0) {
+ if (0 !== $excessBytes) {
$base64ReadBufferRemainderBytes = substr($streamTheseBytes, -$excessBytes);
$streamTheseBytes = substr($streamTheseBytes, 0, $bytesLength - $excessBytes);
}
@@ -69,7 +66,7 @@ class Swift_Mime_ContentEncoder_Base64ContentEncoder extends Swift_Encoder_Base6
$encodedTransformed = '';
$thisMaxLineLength = $maxLineLength - $remainder - $firstLineOffset;
- while ($thisMaxLineLength < strlen($encoded)) {
+ while ($thisMaxLineLength < \strlen($encoded)) {
$encodedTransformed .= substr($encoded, 0, $thisMaxLineLength)."\r\n";
$firstLineOffset = 0;
$encoded = substr($encoded, $thisMaxLineLength);
@@ -77,7 +74,7 @@ class Swift_Mime_ContentEncoder_Base64ContentEncoder extends Swift_Encoder_Base6
$remainder = 0;
}
- if (0 < $remainingLength = strlen($encoded)) {
+ if (0 < $remainingLength = \strlen($encoded)) {
$remainder += $remainingLength;
$encodedTransformed .= $encoded;
$encoded = null;
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/NativeQpContentEncoder.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/NativeQpContentEncoder.php
index 34de4ef39a4..8dfea605fde 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/NativeQpContentEncoder.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/NativeQpContentEncoder.php
@@ -16,16 +16,16 @@
class Swift_Mime_ContentEncoder_NativeQpContentEncoder implements Swift_Mime_ContentEncoder
{
/**
- * @var null|string
+ * @var string|null
*/
private $charset;
/**
- * @param null|string $charset
+ * @param string|null $charset
*/
public function __construct($charset = null)
{
- $this->charset = $charset ? $charset : 'utf-8';
+ $this->charset = $charset ?: 'utf-8';
}
/**
@@ -50,9 +50,8 @@ class Swift_Mime_ContentEncoder_NativeQpContentEncoder implements Swift_Mime_Con
*/
public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
{
- if ($this->charset !== 'utf-8') {
- throw new RuntimeException(
- sprintf('Charset "%s" not supported. NativeQpContentEncoder only supports "utf-8"', $this->charset));
+ if ('utf-8' !== $this->charset) {
+ throw new RuntimeException(sprintf('Charset "%s" not supported. NativeQpContentEncoder only supports "utf-8"', $this->charset));
}
$string = '';
@@ -87,9 +86,8 @@ class Swift_Mime_ContentEncoder_NativeQpContentEncoder implements Swift_Mime_Con
*/
public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0)
{
- if ($this->charset !== 'utf-8') {
- throw new RuntimeException(
- sprintf('Charset "%s" not supported. NativeQpContentEncoder only supports "utf-8"', $this->charset));
+ if ('utf-8' !== $this->charset) {
+ throw new RuntimeException(sprintf('Charset "%s" not supported. NativeQpContentEncoder only supports "utf-8"', $this->charset));
}
return $this->standardize(quoted_printable_encode($string));
@@ -107,9 +105,9 @@ class Swift_Mime_ContentEncoder_NativeQpContentEncoder implements Swift_Mime_Con
// transform CR or LF to CRLF
$string = preg_replace('~=0D(?!=0A)|(?
+ */
+class Swift_Mime_ContentEncoder_NullContentEncoder implements Swift_Mime_ContentEncoder
+{
+ /**
+ * The name of this encoding scheme (probably 7bit or 8bit).
+ *
+ * @var string
+ */
+ private $name;
+
+ /**
+ * Creates a new NullContentEncoder with $name (probably 7bit or 8bit).
+ *
+ * @param string $name
+ */
+ public function __construct($name)
+ {
+ $this->name = $name;
+ }
+
+ /**
+ * Encode a given string to produce an encoded string.
+ *
+ * @param string $string
+ * @param int $firstLineOffset ignored
+ * @param int $maxLineLength ignored
+ *
+ * @return string
+ */
+ public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0)
+ {
+ return $string;
+ }
+
+ /**
+ * Encode stream $in to stream $out.
+ *
+ * @param int $firstLineOffset ignored
+ * @param int $maxLineLength ignored
+ */
+ public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
+ {
+ while (false !== ($bytes = $os->read(8192))) {
+ $is->write($bytes);
+ }
+ }
+
+ /**
+ * Get the name of this encoding scheme.
+ *
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * Not used.
+ */
+ public function charsetChanged($charset)
+ {
+ }
+}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/PlainContentEncoder.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/PlainContentEncoder.php
index 866b0c7c980..72592fc5894 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/PlainContentEncoder.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/PlainContentEncoder.php
@@ -11,6 +11,10 @@
/**
* Handles binary/7/8-bit Transfer Encoding in Swift Mailer.
*
+ * When sending 8-bit content over SMTP, you should use
+ * Swift_Transport_Esmtp_EightBitMimeHandler to enable the 8BITMIME SMTP
+ * extension.
+ *
* @author Chris Corbyn
*/
class Swift_Mime_ContentEncoder_PlainContentEncoder implements Swift_Mime_ContentEncoder
@@ -33,7 +37,7 @@ class Swift_Mime_ContentEncoder_PlainContentEncoder implements Swift_Mime_Conten
* Creates a new PlainContentEncoder with $name (probably 7bit or 8bit).
*
* @param string $name
- * @param bool $canonical If canonicalization transformation should be done.
+ * @param bool $canonical if canonicalization transformation should be done
*/
public function __construct($name, $canonical = false)
{
@@ -62,10 +66,8 @@ class Swift_Mime_ContentEncoder_PlainContentEncoder implements Swift_Mime_Conten
/**
* Encode stream $in to stream $out.
*
- * @param Swift_OutputByteStream $os
- * @param Swift_InputByteStream $is
- * @param int $firstLineOffset ignored
- * @param int $maxLineLength optional, 0 means no wrapping will occur
+ * @param int $firstLineOffset ignored
+ * @param int $maxLineLength optional, 0 means no wrapping will occur
*/
public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
{
@@ -82,7 +84,7 @@ class Swift_Mime_ContentEncoder_PlainContentEncoder implements Swift_Mime_Conten
$is->write($wrapped);
}
- if (strlen($leftOver)) {
+ if (\strlen($leftOver)) {
$is->write($leftOver);
}
}
@@ -121,7 +123,7 @@ class Swift_Mime_ContentEncoder_PlainContentEncoder implements Swift_Mime_Conten
$originalLines = explode($le, $string);
- $lines = array();
+ $lines = [];
$lineCount = 0;
foreach ($originalLines as $originalLine) {
@@ -132,8 +134,8 @@ class Swift_Mime_ContentEncoder_PlainContentEncoder implements Swift_Mime_Conten
$chunks = preg_split('/(?<=\s)/', $originalLine);
foreach ($chunks as $chunk) {
- if (0 != strlen($currentLine)
- && strlen($currentLine.$chunk) > $length) {
+ if (0 != \strlen($currentLine)
+ && \strlen($currentLine.$chunk) > $length) {
$lines[] = '';
$currentLine = &$lines[$lineCount++];
}
@@ -154,8 +156,8 @@ class Swift_Mime_ContentEncoder_PlainContentEncoder implements Swift_Mime_Conten
private function canonicalize($string)
{
return str_replace(
- array("\r\n", "\r", "\n"),
- array("\n", "\n", "\r\n"),
+ ["\r\n", "\r", "\n"],
+ ["\n", "\n", "\r\n"],
$string
);
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php
index b3577dbe61f..465ffd87850 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php
@@ -32,12 +32,12 @@ class Swift_Mime_ContentEncoder_QpContentEncoder extends Swift_Encoder_QpEncoder
public function __sleep()
{
- return array('charStream', 'filter', 'dotEscape');
+ return ['charStream', 'filter', 'dotEscape'];
}
protected function getSafeMapShareId()
{
- return get_class($this).($this->dotEscape ? '.dotEscape' : '');
+ return static::class.($this->dotEscape ? '.dotEscape' : '');
}
protected function initSafeMap()
@@ -97,7 +97,7 @@ class Swift_Mime_ContentEncoder_QpContentEncoder extends Swift_Encoder_QpEncoder
$enc = $this->encodeByteSequence($bytes, $size);
$i = strpos($enc, '=0D=0A');
- $newLineLength = $lineLen + ($i === false ? $size : $i);
+ $newLineLength = $lineLen + (false === $i ? $size : $i);
if ($currentLine && $newLineLength >= $thisLineLength) {
$is->write($prepend.$this->standardize($currentLine));
@@ -109,14 +109,14 @@ class Swift_Mime_ContentEncoder_QpContentEncoder extends Swift_Encoder_QpEncoder
$currentLine .= $enc;
- if ($i === false) {
+ if (false === $i) {
$lineLen += $size;
} else {
// 6 is the length of '=0D=0A'.
$lineLen = $size - strrpos($enc, '=0D=0A') - 6;
}
}
- if (strlen($currentLine)) {
+ if (\strlen($currentLine)) {
$is->write($prepend.$this->standardize($currentLine));
}
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoderProxy.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoderProxy.php
index 3214e1cf3fd..f3ece43aecd 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoderProxy.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoderProxy.php
@@ -28,16 +28,14 @@ class Swift_Mime_ContentEncoder_QpContentEncoderProxy implements Swift_Mime_Cont
private $nativeEncoder;
/**
- * @var null|string
+ * @var string|null
*/
private $charset;
/**
* Constructor.
*
- * @param Swift_Mime_ContentEncoder_QpContentEncoder $safeEncoder
- * @param Swift_Mime_ContentEncoder_NativeQpContentEncoder $nativeEncoder
- * @param string|null $charset
+ * @param string|null $charset
*/
public function __construct(Swift_Mime_ContentEncoder_QpContentEncoder $safeEncoder, Swift_Mime_ContentEncoder_NativeQpContentEncoder $nativeEncoder, $charset)
{
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/RawContentEncoder.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/RawContentEncoder.php
index 0b8526e38c3..870e7f41a93 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/RawContentEncoder.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/RawContentEncoder.php
@@ -11,6 +11,9 @@
/**
* Handles raw Transfer Encoding in Swift Mailer.
*
+ * When sending 8-bit content over SMTP, you should use
+ * Swift_Transport_Esmtp_EightBitMimeHandler to enable the 8BITMIME SMTP
+ * extension.
*
* @author Sebastiaan Stok
*/
@@ -33,10 +36,8 @@ class Swift_Mime_ContentEncoder_RawContentEncoder implements Swift_Mime_ContentE
/**
* Encode stream $in to stream $out.
*
- * @param Swift_OutputByteStream $in
- * @param Swift_InputByteStream $out
- * @param int $firstLineOffset ignored
- * @param int $maxLineLength ignored
+ * @param int $firstLineOffset ignored
+ * @param int $maxLineLength ignored
*/
public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
{
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/EmbeddedFile.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/EmbeddedFile.php
index 7835a492873..42a51770c76 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/EmbeddedFile.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/EmbeddedFile.php
@@ -18,13 +18,9 @@ class Swift_Mime_EmbeddedFile extends Swift_Mime_Attachment
/**
* Creates a new Attachment with $headers and $encoder.
*
- * @param Swift_Mime_SimpleHeaderSet $headers
- * @param Swift_Mime_ContentEncoder $encoder
- * @param Swift_KeyCache $cache
- * @param Swift_IdGenerator $idGenerator
- * @param array $mimeTypes optional
+ * @param array $mimeTypes optional
*/
- public function __construct(Swift_Mime_SimpleHeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_IdGenerator $idGenerator, $mimeTypes = array())
+ public function __construct(Swift_Mime_SimpleHeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_IdGenerator $idGenerator, $mimeTypes = [])
{
parent::__construct($headers, $encoder, $cache, $idGenerator, $mimeTypes);
$this->setDisposition('inline');
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/EncodingObserver.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/EncodingObserver.php
index cc44a6efb97..1a952ece12c 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/EncodingObserver.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/EncodingObserver.php
@@ -17,8 +17,6 @@ interface Swift_Mime_EncodingObserver
{
/**
* Notify this observer that the observed entity's ContentEncoder has changed.
- *
- * @param Swift_Mime_ContentEncoder $encoder
*/
public function encoderChanged(Swift_Mime_ContentEncoder $encoder);
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Header.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Header.php
index a8ddd272165..ca712f35aa0 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Header.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Header.php
@@ -85,7 +85,7 @@ interface Swift_Mime_Header
public function getFieldBody();
/**
- * Get this Header rendered as a compliant string.
+ * Get this Header rendered as a compliant string, including trailing CRLF.
*
* @return string
*/
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/HeaderEncoder/Base64HeaderEncoder.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/HeaderEncoder/Base64HeaderEncoder.php
index 83a4f2f3b2d..21c8aaabfea 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/HeaderEncoder/Base64HeaderEncoder.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/HeaderEncoder/Base64HeaderEncoder.php
@@ -41,7 +41,7 @@ class Swift_Mime_HeaderEncoder_Base64HeaderEncoder extends Swift_Encoder_Base64E
*/
public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0, $charset = 'utf-8')
{
- if (strtolower($charset) === 'iso-2022-jp') {
+ if ('iso-2022-jp' === strtolower($charset ?? '')) {
$old = mb_internal_encoding();
mb_internal_encoding('utf-8');
$newstring = mb_encode_mimeheader($string, $charset, $this->getName(), "\r\n");
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/HeaderEncoder/QpHeaderEncoder.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/HeaderEncoder/QpHeaderEncoder.php
index 062be7d7967..378c4805057 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/HeaderEncoder/QpHeaderEncoder.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/HeaderEncoder/QpHeaderEncoder.php
@@ -29,9 +29,9 @@ class Swift_Mime_HeaderEncoder_QpHeaderEncoder extends Swift_Encoder_QpEncoder i
{
foreach (array_merge(
range(0x61, 0x7A), range(0x41, 0x5A),
- range(0x30, 0x39), array(0x20, 0x21, 0x2A, 0x2B, 0x2D, 0x2F)
+ range(0x30, 0x39), [0x20, 0x21, 0x2A, 0x2B, 0x2D, 0x2F]
) as $byte) {
- $this->safeMap[$byte] = chr($byte);
+ $this->safeMap[$byte] = \chr($byte);
}
}
@@ -58,7 +58,7 @@ class Swift_Mime_HeaderEncoder_QpHeaderEncoder extends Swift_Encoder_QpEncoder i
*/
public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0)
{
- return str_replace(array(' ', '=20', "=\r\n"), array('_', '_', "\r\n"),
+ return str_replace([' ', '=20', "=\r\n"], ['_', '_', "\r\n"],
parent::encodeString($string, $firstLineOffset, $maxLineLength)
);
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/AbstractHeader.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/AbstractHeader.php
index a569f816189..25740d1155c 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/AbstractHeader.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/AbstractHeader.php
@@ -109,8 +109,6 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
/**
* Set the encoder used for encoding the header.
- *
- * @param Swift_Mime_HeaderEncoder $encoder
*/
public function setEncoder(Swift_Mime_HeaderEncoder $encoder)
{
@@ -196,11 +194,9 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
/**
* Produces a compliant, formatted RFC 2822 'phrase' based on the string given.
*
- * @param Swift_Mime_Header $header
- * @param string $string as displayed
- * @param string $charset of the text
- * @param Swift_Mime_HeaderEncoder $encoder
- * @param bool $shorten the first line to make remove for header name
+ * @param string $string as displayed
+ * @param string $charset of the text
+ * @param bool $shorten the first line to make remove for header name
*
* @return string
*/
@@ -214,13 +210,13 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
// .. but it is just ascii text, try escaping some characters
// and make it a quoted-string
if (preg_match('/^[\x00-\x08\x0B\x0C\x0E-\x7F]*$/D', $phraseStr)) {
- $phraseStr = $this->escapeSpecials($phraseStr, array('"'));
+ $phraseStr = $this->escapeSpecials($phraseStr, ['"']);
$phraseStr = '"'.$phraseStr.'"';
} else {
// ... otherwise it needs encoding
// Determine space remaining on line if first line
if ($shorten) {
- $usedLength = strlen($header->getFieldName().': ');
+ $usedLength = \strlen($header->getFieldName().': ');
} else {
$usedLength = 0;
}
@@ -239,9 +235,9 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
*
* @return string
*/
- private function escapeSpecials($token, $include = array())
+ private function escapeSpecials($token, $include = [])
{
- foreach (array_merge(array('\\'), $include) as $char) {
+ foreach (array_merge(['\\'], $include) as $char) {
$token = str_replace($char, '\\'.$char, $token);
}
@@ -251,9 +247,8 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
/**
* Encode needed word tokens within a string of input.
*
- * @param Swift_Mime_Header $header
- * @param string $input
- * @param string $usedLength optional
+ * @param string $input
+ * @param string $usedLength optional
*
* @return string
*/
@@ -276,7 +271,7 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
}
if (-1 == $usedLength) {
- $usedLength = strlen($header->getFieldName().': ') + strlen($value);
+ $usedLength = \strlen($header->getFieldName().': ') + \strlen($value);
}
$value .= $this->getTokenAsEncodedWord($token, $usedLength);
@@ -310,22 +305,22 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
*/
protected function getEncodableWordTokens($string)
{
- $tokens = array();
+ $tokens = [];
$encodedToken = '';
// Split at all whitespace boundaries
- foreach (preg_split('~(?=[\t ])~', $string) as $token) {
+ foreach (preg_split('~(?=[\t ])~', $string ?? '') as $token) {
if ($this->tokenNeedsEncoding($token)) {
$encodedToken .= $token;
} else {
- if (strlen($encodedToken) > 0) {
+ if (\strlen($encodedToken) > 0) {
$tokens[] = $encodedToken;
$encodedToken = '';
}
$tokens[] = $token;
}
}
- if (strlen($encodedToken)) {
+ if (\strlen($encodedToken)) {
$tokens[] = $encodedToken;
}
@@ -347,7 +342,7 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
if (isset($this->lang)) {
$charsetDecl .= '*'.$this->lang;
}
- $encodingWrapperLength = strlen(
+ $encodingWrapperLength = \strlen(
'=?'.$charsetDecl.'?'.$this->encoder->getName().'??='
);
@@ -359,10 +354,10 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
$encodedTextLines = explode("\r\n",
$this->encoder->encodeString(
$token, $firstLineOffset, 75 - $encodingWrapperLength, $this->charset
- )
+ ) ?? ''
);
- if (strtolower($this->charset) !== 'iso-2022-jp') {
+ if ('iso-2022-jp' !== strtolower($this->charset ?? '')) {
// special encoding for iso-2022-jp using mb_encode_mimeheader
foreach ($encodedTextLines as $lineNum => $line) {
$encodedTextLines[$lineNum] = '=?'.$charsetDecl.
@@ -383,7 +378,7 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
*/
protected function generateTokenLines($token)
{
- return preg_split('~(\r\n)~', $token, -1, PREG_SPLIT_DELIM_CAPTURE);
+ return preg_split('~(\r\n)~', $token ?? '', -1, PREG_SPLIT_DELIM_CAPTURE);
}
/**
@@ -431,10 +426,10 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
$string = $this->getFieldBody();
}
- $tokens = array();
+ $tokens = [];
// Generate atoms; split at all invisible boundaries followed by WSP
- foreach (preg_split('~(?=[ \t])~', $string) as $token) {
+ foreach (preg_split('~(?=[ \t])~', $string ?? '') as $token) {
$newTokens = $this->generateTokenLines($token);
foreach ($newTokens as $newToken) {
$tokens[] = $newToken;
@@ -455,7 +450,7 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
private function tokensToString(array $tokens)
{
$lineCount = 0;
- $headerLines = array();
+ $headerLines = [];
$headerLines[] = $this->name.': ';
$currentLine = &$headerLines[$lineCount++];
@@ -463,8 +458,8 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
foreach ($tokens as $i => $token) {
// Line longer than specified maximum or token was just a new line
if (("\r\n" == $token) ||
- ($i > 0 && strlen($currentLine.$token) > $this->lineLength)
- && 0 < strlen($currentLine)) {
+ ($i > 0 && \strlen($currentLine.$token) > $this->lineLength)
+ && 0 < \strlen($currentLine)) {
$headerLines[] = '';
$currentLine = &$headerLines[$lineCount++];
}
@@ -478,4 +473,14 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
// Implode with FWS (RFC 2822, 2.2.3)
return implode("\r\n", $headerLines)."\r\n";
}
+
+ /**
+ * Make a deep copy of object.
+ */
+ public function __clone()
+ {
+ if ($this->encoder) {
+ $this->encoder = clone $this->encoder;
+ }
+ }
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/DateHeader.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/DateHeader.php
index 6dcc92bfdd6..efe1dad6619 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/DateHeader.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/DateHeader.php
@@ -79,8 +79,6 @@ class Swift_Mime_Headers_DateHeader extends Swift_Mime_Headers_AbstractHeader
* Set the date-time of the Date in this Header.
*
* If a DateTime instance is provided, it is converted to DateTimeImmutable.
- *
- * @param DateTimeInterface $dateTime
*/
public function setDateTime(DateTimeInterface $dateTime)
{
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/IdentificationHeader.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/IdentificationHeader.php
index acf794479b6..4fcdff418a7 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/IdentificationHeader.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/IdentificationHeader.php
@@ -9,6 +9,7 @@
*/
use Egulias\EmailValidator\EmailValidator;
+use Egulias\EmailValidator\Validation\MessageIDValidation;
use Egulias\EmailValidator\Validation\RFCValidation;
/**
@@ -25,7 +26,7 @@ class Swift_Mime_Headers_IdentificationHeader extends Swift_Mime_Headers_Abstrac
*
* @var string[]
*/
- private $ids = array();
+ private $ids = [];
/**
* The strict EmailValidator.
@@ -34,16 +35,18 @@ class Swift_Mime_Headers_IdentificationHeader extends Swift_Mime_Headers_Abstrac
*/
private $emailValidator;
+ private $addressEncoder;
+
/**
* Creates a new IdentificationHeader with the given $name and $id.
*
- * @param string $name
- * @param EmailValidator $emailValidator
+ * @param string $name
*/
- public function __construct($name, EmailValidator $emailValidator)
+ public function __construct($name, EmailValidator $emailValidator, Swift_AddressEncoder $addressEncoder = null)
{
$this->setFieldName($name);
$this->emailValidator = $emailValidator;
+ $this->addressEncoder = $addressEncoder ?? new Swift_AddressEncoder_IdnAddressEncoder();
}
/**
@@ -94,7 +97,7 @@ class Swift_Mime_Headers_IdentificationHeader extends Swift_Mime_Headers_Abstrac
*/
public function setId($id)
{
- $this->setIds(is_array($id) ? $id : array($id));
+ $this->setIds(\is_array($id) ? $id : [$id]);
}
/**
@@ -106,7 +109,7 @@ class Swift_Mime_Headers_IdentificationHeader extends Swift_Mime_Headers_Abstrac
*/
public function getId()
{
- if (count($this->ids) > 0) {
+ if (\count($this->ids) > 0) {
return $this->ids[0];
}
}
@@ -120,7 +123,7 @@ class Swift_Mime_Headers_IdentificationHeader extends Swift_Mime_Headers_Abstrac
*/
public function setIds(array $ids)
{
- $actualIds = array();
+ $actualIds = [];
foreach ($ids as $id) {
$this->assertValidId($id);
@@ -156,10 +159,10 @@ class Swift_Mime_Headers_IdentificationHeader extends Swift_Mime_Headers_Abstrac
public function getFieldBody()
{
if (!$this->getCachedValue()) {
- $angleAddrs = array();
+ $angleAddrs = [];
foreach ($this->ids as $id) {
- $angleAddrs[] = '<'.$id.'>';
+ $angleAddrs[] = '<'.$this->addressEncoder->encodeString($id).'>';
}
$this->setCachedValue(implode(' ', $angleAddrs));
@@ -177,7 +180,9 @@ class Swift_Mime_Headers_IdentificationHeader extends Swift_Mime_Headers_Abstrac
*/
private function assertValidId($id)
{
- if (!$this->emailValidator->isValid($id, new RFCValidation())) {
+ $emailValidation = class_exists(MessageIDValidation::class) ? new MessageIDValidation() : new RFCValidation();
+
+ if (!$this->emailValidator->isValid($id, $emailValidation)) {
throw new Swift_RfcComplianceException('Invalid ID given <'.$id.'>');
}
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php
index 450e0f25b7e..ddd5e8cffb1 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php
@@ -23,7 +23,7 @@ class Swift_Mime_Headers_MailboxHeader extends Swift_Mime_Headers_AbstractHeader
*
* @var string[]
*/
- private $mailboxes = array();
+ private $mailboxes = [];
/**
* The strict EmailValidator.
@@ -32,18 +32,19 @@ class Swift_Mime_Headers_MailboxHeader extends Swift_Mime_Headers_AbstractHeader
*/
private $emailValidator;
+ private $addressEncoder;
+
/**
* Creates a new MailboxHeader with $name.
*
- * @param string $name of Header
- * @param Swift_Mime_HeaderEncoder $encoder
- * @param EmailValidator $emailValidator
+ * @param string $name of Header
*/
- public function __construct($name, Swift_Mime_HeaderEncoder $encoder, EmailValidator $emailValidator)
+ public function __construct($name, Swift_Mime_HeaderEncoder $encoder, EmailValidator $emailValidator, Swift_AddressEncoder $addressEncoder = null)
{
$this->setFieldName($name);
$this->setEncoder($encoder);
$this->emailValidator = $emailValidator;
+ $this->addressEncoder = $addressEncoder ?? new Swift_AddressEncoder_IdnAddressEncoder();
}
/**
@@ -257,10 +258,10 @@ class Swift_Mime_Headers_MailboxHeader extends Swift_Mime_Headers_AbstractHeader
*/
protected function normalizeMailboxes(array $mailboxes)
{
- $actualMailboxes = array();
+ $actualMailboxes = [];
foreach ($mailboxes as $key => $value) {
- if (is_string($key)) {
+ if (\is_string($key)) {
//key is email addr
$address = $key;
$name = $value;
@@ -327,10 +328,10 @@ class Swift_Mime_Headers_MailboxHeader extends Swift_Mime_Headers_AbstractHeader
*/
private function createNameAddressStrings(array $mailboxes)
{
- $strings = array();
+ $strings = [];
foreach ($mailboxes as $email => $name) {
- $mailboxStr = $email;
+ $mailboxStr = $this->addressEncoder->encodeString($email);
if (null !== $name) {
$nameStr = $this->createDisplayNameString($name, empty($strings));
$mailboxStr = $nameStr.' <'.$mailboxStr.'>';
@@ -346,14 +347,12 @@ class Swift_Mime_Headers_MailboxHeader extends Swift_Mime_Headers_AbstractHeader
*
* @param string $address
*
- * @throws Swift_RfcComplianceException If invalid.
+ * @throws Swift_RfcComplianceException if invalid
*/
private function assertValidAddress($address)
{
if (!$this->emailValidator->isValid($address, new RFCValidation())) {
- throw new Swift_RfcComplianceException(
- 'Address in mailbox given ['.$address.'] does not comply with RFC 2822, 3.6.2.'
- );
+ throw new Swift_RfcComplianceException('Address in mailbox given ['.$address.'] does not comply with RFC 2822, 3.6.2.');
}
}
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/OpenDKIMHeader.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/OpenDKIMHeader.php
index 29277994c0a..fafb5bae21f 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/OpenDKIMHeader.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/OpenDKIMHeader.php
@@ -12,6 +12,8 @@
* An OpenDKIM Specific Header using only raw header datas without encoding.
*
* @author De Cock Xavier
+ *
+ * @deprecated since SwiftMailer 6.1.0; use Swift_Signers_DKIMSigner instead.
*/
class Swift_Mime_Headers_OpenDKIMHeader implements Swift_Mime_Header
{
@@ -111,7 +113,7 @@ class Swift_Mime_Headers_OpenDKIMHeader implements Swift_Mime_Header
*/
public function toString()
{
- return $this->fieldName.': '.$this->value;
+ return $this->fieldName.': '.$this->value."\r\n";
}
/**
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/ParameterizedHeader.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/ParameterizedHeader.php
index 228946a5ee9..47c15e6c05f 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/ParameterizedHeader.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/ParameterizedHeader.php
@@ -34,14 +34,12 @@ class Swift_Mime_Headers_ParameterizedHeader extends Swift_Mime_Headers_Unstruct
*
* @var string[]
*/
- private $params = array();
+ private $params = [];
/**
* Creates a new ParameterizedHeader with $name.
*
- * @param string $name
- * @param Swift_Mime_HeaderEncoder $encoder
- * @param Swift_Encoder $paramEncoder, optional
+ * @param string $name
*/
public function __construct($name, Swift_Mime_HeaderEncoder $encoder, Swift_Encoder $paramEncoder = null)
{
@@ -83,7 +81,7 @@ class Swift_Mime_Headers_ParameterizedHeader extends Swift_Mime_Headers_Unstruct
*/
public function setParameter($parameter, $value)
{
- $this->setParameters(array_merge($this->getParameters(), array($parameter => $value)));
+ $this->setParameters(array_merge($this->getParameters(), [$parameter => $value]));
}
/**
@@ -97,7 +95,7 @@ class Swift_Mime_Headers_ParameterizedHeader extends Swift_Mime_Headers_Unstruct
{
$params = $this->getParameters();
- return isset($params[$parameter]) ? $params[$parameter] : null;
+ return $params[$parameter] ?? null;
}
/**
@@ -157,7 +155,7 @@ class Swift_Mime_Headers_ParameterizedHeader extends Swift_Mime_Headers_Unstruct
foreach ($this->params as $name => $value) {
if (null !== $value) {
// Add the semi-colon separator
- $tokens[count($tokens) - 1] .= ';';
+ $tokens[\count($tokens) - 1] .= ';';
$tokens = array_merge($tokens, $this->generateTokenLines(
' '.$this->createParameter($name, $value)
));
@@ -181,7 +179,7 @@ class Swift_Mime_Headers_ParameterizedHeader extends Swift_Mime_Headers_Unstruct
$encoded = false;
// Allow room for parameter name, indices, "=" and DQUOTEs
- $maxValueLength = $this->getMaxLineLength() - strlen($name.'=*N"";') - 1;
+ $maxValueLength = $this->getMaxLineLength() - \strlen($name.'=*N"";') - 1;
$firstLineOffset = 0;
// If it's not already a valid parameter value...
@@ -191,15 +189,15 @@ class Swift_Mime_Headers_ParameterizedHeader extends Swift_Mime_Headers_Unstruct
if (!preg_match('/^[\x00-\x08\x0B\x0C\x0E-\x7F]*$/D', $value)) {
$encoded = true;
// Allow space for the indices, charset and language
- $maxValueLength = $this->getMaxLineLength() - strlen($name.'*N*="";') - 1;
- $firstLineOffset = strlen(
+ $maxValueLength = $this->getMaxLineLength() - \strlen($name.'*N*="";') - 1;
+ $firstLineOffset = \strlen(
$this->getCharset()."'".$this->getLanguage()."'"
);
}
}
// Encode if we need to
- if ($encoded || strlen($value) > $maxValueLength) {
+ if ($encoded || \strlen($value) > $maxValueLength) {
if (isset($this->paramEncoder)) {
$value = $this->paramEncoder->encodeString(
$origValue, $firstLineOffset, $maxValueLength, $this->getCharset()
@@ -211,14 +209,14 @@ class Swift_Mime_Headers_ParameterizedHeader extends Swift_Mime_Headers_Unstruct
}
}
- $valueLines = isset($this->paramEncoder) ? explode("\r\n", $value) : array($value);
+ $valueLines = isset($this->paramEncoder) ? explode("\r\n", $value) : [$value];
// Need to add indices
- if (count($valueLines) > 1) {
- $paramLines = array();
+ if (\count($valueLines) > 1) {
+ $paramLines = [];
foreach ($valueLines as $i => $line) {
$paramLines[] = $name.'*'.$i.
- $this->getEndOfParameterValue($line, true, $i == 0);
+ $this->getEndOfParameterValue($line, true, 0 == $i);
}
return implode(";\r\n ", $paramLines);
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/PathHeader.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/PathHeader.php
index f79e19fd8b3..81b421ee7a8 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/PathHeader.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/PathHeader.php
@@ -32,16 +32,18 @@ class Swift_Mime_Headers_PathHeader extends Swift_Mime_Headers_AbstractHeader
*/
private $emailValidator;
+ private $addressEncoder;
+
/**
* Creates a new PathHeader with the given $name.
*
- * @param string $name
- * @param EmailValidator $emailValidator
+ * @param string $name
*/
- public function __construct($name, EmailValidator $emailValidator)
+ public function __construct($name, EmailValidator $emailValidator, Swift_AddressEncoder $addressEncoder = null)
{
$this->setFieldName($name);
$this->emailValidator = $emailValidator;
+ $this->addressEncoder = $addressEncoder ?? new Swift_AddressEncoder_IdnAddressEncoder();
}
/**
@@ -127,7 +129,8 @@ class Swift_Mime_Headers_PathHeader extends Swift_Mime_Headers_AbstractHeader
{
if (!$this->getCachedValue()) {
if (isset($this->address)) {
- $this->setCachedValue('<'.$this->address.'>');
+ $address = $this->addressEncoder->encodeString($this->address);
+ $this->setCachedValue('<'.$address.'>');
}
}
@@ -144,9 +147,7 @@ class Swift_Mime_Headers_PathHeader extends Swift_Mime_Headers_AbstractHeader
private function assertValidAddress($address)
{
if (!$this->emailValidator->isValid($address, new RFCValidation())) {
- throw new Swift_RfcComplianceException(
- 'Address set in PathHeader does not comply with addr-spec of RFC 2822.'
- );
+ throw new Swift_RfcComplianceException('Address set in PathHeader does not comply with addr-spec of RFC 2822.');
}
}
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/UnstructuredHeader.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/UnstructuredHeader.php
index d9d9f5e25d3..64f160dec7c 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/UnstructuredHeader.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/Headers/UnstructuredHeader.php
@@ -25,8 +25,7 @@ class Swift_Mime_Headers_UnstructuredHeader extends Swift_Mime_Headers_AbstractH
/**
* Creates a new SimpleHeader with $name.
*
- * @param string $name
- * @param Swift_Mime_HeaderEncoder $encoder
+ * @param string $name
*/
public function __construct($name, Swift_Mime_HeaderEncoder $encoder)
{
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/IdGenerator.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/IdGenerator.php
index 8d9452bd0f0..3ce35f27c03 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/IdGenerator.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/IdGenerator.php
@@ -13,6 +13,8 @@
*/
class Swift_Mime_IdGenerator implements Swift_IdGenerator
{
+ private $idRight;
+
/**
* @param string $idRight
*/
@@ -46,8 +48,7 @@ class Swift_Mime_IdGenerator implements Swift_IdGenerator
*/
public function generateId()
{
- $idLeft = md5(getmypid().'.'.time().'.'.uniqid(mt_rand(), true));
-
- return $idLeft.'@'.$this->idRight;
+ // 32 hex values for the left part
+ return bin2hex(random_bytes(16)).'@'.$this->idRight;
}
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/MimePart.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/MimePart.php
index d49449fe5be..d0b2e6586b4 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/MimePart.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/MimePart.php
@@ -30,11 +30,7 @@ class Swift_Mime_MimePart extends Swift_Mime_SimpleMimeEntity
/**
* Create a new MimePart with $headers, $encoder and $cache.
*
- * @param Swift_Mime_SimpleHeaderSet $headers
- * @param Swift_Mime_ContentEncoder $encoder
- * @param Swift_KeyCache $cache
- * @param Swift_IdGenerator $idGenerator
- * @param string $charset
+ * @param string $charset
*/
public function __construct(Swift_Mime_SimpleHeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_IdGenerator $idGenerator, $charset = null)
{
@@ -173,7 +169,7 @@ class Swift_Mime_MimePart extends Swift_Mime_SimpleMimeEntity
protected function fixHeaders()
{
parent::fixHeaders();
- if (count($this->getChildren())) {
+ if (\count($this->getChildren())) {
$this->setHeaderParameter('Content-Type', 'charset', null);
$this->setHeaderParameter('Content-Type', 'format', null);
$this->setHeaderParameter('Content-Type', 'delsp', null);
@@ -193,18 +189,9 @@ class Swift_Mime_MimePart extends Swift_Mime_SimpleMimeEntity
/** Encode charset when charset is not utf-8 */
protected function convertString($string)
{
- $charset = strtolower($this->getCharset());
- if (!in_array($charset, array('utf-8', 'iso-8859-1', 'iso-8859-15', ''))) {
- // mb_convert_encoding must be the first one to check, since iconv cannot convert some words.
- if (function_exists('mb_convert_encoding')) {
- $string = mb_convert_encoding($string, $charset, 'utf-8');
- } elseif (function_exists('iconv')) {
- $string = iconv('utf-8//TRANSLIT//IGNORE', $charset, $string);
- } else {
- throw new Swift_SwiftException('No suitable convert encoding function (use UTF-8 as your charset or install the mbstring or iconv extension).');
- }
-
- return $string;
+ $charset = strtolower($this->getCharset() ?? '');
+ if (!\in_array($charset, ['utf-8', 'iso-8859-1', 'iso-8859-15', ''])) {
+ return mb_convert_encoding($string, $charset, 'utf-8');
}
return $string;
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderFactory.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderFactory.php
index e14c9d6f88e..ab3ce6b1914 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderFactory.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderFactory.php
@@ -23,29 +23,27 @@ class Swift_Mime_SimpleHeaderFactory implements Swift_Mime_CharsetObserver
/** The Encoder used by parameters */
private $paramEncoder;
- /** The Grammar */
- private $grammar;
-
/** Strict EmailValidator */
private $emailValidator;
/** The charset of created Headers */
private $charset;
+ /** Swift_AddressEncoder */
+ private $addressEncoder;
+
/**
* Creates a new SimpleHeaderFactory using $encoder and $paramEncoder.
*
- * @param Swift_Mime_HeaderEncoder $encoder
- * @param Swift_Encoder $paramEncoder
- * @param EmailValidator $emailValidator
- * @param string|null $charset
+ * @param string|null $charset
*/
- public function __construct(Swift_Mime_HeaderEncoder $encoder, Swift_Encoder $paramEncoder, EmailValidator $emailValidator, $charset = null)
+ public function __construct(Swift_Mime_HeaderEncoder $encoder, Swift_Encoder $paramEncoder, EmailValidator $emailValidator, $charset = null, Swift_AddressEncoder $addressEncoder = null)
{
$this->encoder = $encoder;
$this->paramEncoder = $paramEncoder;
$this->emailValidator = $emailValidator;
$this->charset = $charset;
+ $this->addressEncoder = $addressEncoder ?? new Swift_AddressEncoder_IdnAddressEncoder();
}
/**
@@ -58,7 +56,7 @@ class Swift_Mime_SimpleHeaderFactory implements Swift_Mime_CharsetObserver
*/
public function createMailboxHeader($name, $addresses = null)
{
- $header = new Swift_Mime_Headers_MailboxHeader($name, $this->encoder, $this->emailValidator);
+ $header = new Swift_Mime_Headers_MailboxHeader($name, $this->encoder, $this->emailValidator, $this->addressEncoder);
if (isset($addresses)) {
$header->setFieldBodyModel($addresses);
}
@@ -70,8 +68,7 @@ class Swift_Mime_SimpleHeaderFactory implements Swift_Mime_CharsetObserver
/**
* Create a new Date header using $dateTime.
*
- * @param string $name
- * @param DateTimeInterface|null $dateTime
+ * @param string $name
*
* @return Swift_Mime_Header
*/
@@ -114,9 +111,9 @@ class Swift_Mime_SimpleHeaderFactory implements Swift_Mime_CharsetObserver
*
* @return Swift_Mime_Headers_ParameterizedHeader
*/
- public function createParameterizedHeader($name, $value = null, $params = array())
+ public function createParameterizedHeader($name, $value = null, $params = [])
{
- $header = new Swift_Mime_Headers_ParameterizedHeader($name, $this->encoder, (strtolower($name) == 'content-disposition') ? $this->paramEncoder : null);
+ $header = new Swift_Mime_Headers_ParameterizedHeader($name, $this->encoder, ('content-disposition' == strtolower($name ?? '')) ? $this->paramEncoder : null);
if (isset($value)) {
$header->setFieldBodyModel($value);
}
@@ -185,6 +182,7 @@ class Swift_Mime_SimpleHeaderFactory implements Swift_Mime_CharsetObserver
{
$this->encoder = clone $this->encoder;
$this->paramEncoder = clone $this->paramEncoder;
+ $this->addressEncoder = clone $this->addressEncoder;
}
/** Apply the charset to the Header */
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderSet.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderSet.php
index 6f71fcac132..5195bcf48ae 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderSet.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderSet.php
@@ -19,13 +19,13 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_CharsetObserver
private $factory;
/** Collection of set Headers */
- private $headers = array();
+ private $headers = [];
/** Field ordering details */
- private $order = array();
+ private $order = [];
/** List of fields which are required to be displayed */
- private $required = array();
+ private $required = [];
/** The charset used by Headers */
private $charset;
@@ -33,8 +33,7 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_CharsetObserver
/**
* Create a new SimpleHeaderSet with the given $factory.
*
- * @param Swift_Mime_SimpleHeaderFactory $factory
- * @param string $charset
+ * @param string $charset
*/
public function __construct(Swift_Mime_SimpleHeaderFactory $factory, $charset = null)
{
@@ -69,20 +68,17 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_CharsetObserver
*/
public function addMailboxHeader($name, $addresses = null)
{
- $this->storeHeader($name,
- $this->factory->createMailboxHeader($name, $addresses));
+ $this->storeHeader($name, $this->factory->createMailboxHeader($name, $addresses));
}
/**
* Add a new Date header using $dateTime.
*
- * @param string $name
- * @param DateTimeInterface $dateTime
+ * @param string $name
*/
public function addDateHeader($name, DateTimeInterface $dateTime = null)
{
- $this->storeHeader($name,
- $this->factory->createDateHeader($name, $dateTime));
+ $this->storeHeader($name, $this->factory->createDateHeader($name, $dateTime));
}
/**
@@ -93,8 +89,7 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_CharsetObserver
*/
public function addTextHeader($name, $value = null)
{
- $this->storeHeader($name,
- $this->factory->createTextHeader($name, $value));
+ $this->storeHeader($name, $this->factory->createTextHeader($name, $value));
}
/**
@@ -104,7 +99,7 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_CharsetObserver
* @param string $value
* @param array $params
*/
- public function addParameterizedHeader($name, $value = null, $params = array())
+ public function addParameterizedHeader($name, $value = null, $params = [])
{
$this->storeHeader($name, $this->factory->createParameterizedHeader($name, $value, $params));
}
@@ -143,18 +138,18 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_CharsetObserver
*/
public function has($name, $index = 0)
{
- $lowerName = strtolower($name);
+ $lowerName = strtolower($name ?? '');
- if (!array_key_exists($lowerName, $this->headers)) {
+ if (!\array_key_exists($lowerName, $this->headers)) {
return false;
}
- if (func_num_args() < 2) {
+ if (\func_num_args() < 2) {
// index was not specified, so we only need to check that there is at least one header value set
- return (bool) count($this->headers[$lowerName]);
+ return (bool) \count($this->headers[$lowerName]);
}
- return array_key_exists($index, $this->headers[$lowerName]);
+ return \array_key_exists($index, $this->headers[$lowerName]);
}
/**
@@ -166,8 +161,7 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_CharsetObserver
* If $index is specified, the header will be inserted into the set at this
* offset.
*
- * @param Swift_Mime_Header $header
- * @param int $index
+ * @param int $index
*/
public function set(Swift_Mime_Header $header, $index = 0)
{
@@ -183,13 +177,13 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_CharsetObserver
* @param string $name
* @param int $index
*
- * @return Swift_Mime_Header
+ * @return Swift_Mime_Header|null
*/
public function get($name, $index = 0)
{
- $name = strtolower($name);
+ $name = strtolower($name ?? '');
- if (func_num_args() < 2) {
+ if (\func_num_args() < 2) {
if ($this->has($name)) {
$values = array_values($this->headers[$name]);
@@ -212,7 +206,7 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_CharsetObserver
public function getAll($name = null)
{
if (!isset($name)) {
- $headers = array();
+ $headers = [];
foreach ($this->headers as $collection) {
$headers = array_merge($headers, $collection);
}
@@ -220,9 +214,9 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_CharsetObserver
return $headers;
}
- $lowerName = strtolower($name);
- if (!array_key_exists($lowerName, $this->headers)) {
- return array();
+ $lowerName = strtolower($name ?? '');
+ if (!\array_key_exists($lowerName, $this->headers)) {
+ return [];
}
return $this->headers[$lowerName];
@@ -237,7 +231,7 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_CharsetObserver
{
$headers = $this->headers;
if ($this->canSort()) {
- uksort($headers, array($this, 'sortHeaders'));
+ uksort($headers, [$this, 'sortHeaders']);
}
return array_keys($headers);
@@ -253,7 +247,7 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_CharsetObserver
*/
public function remove($name, $index = 0)
{
- $lowerName = strtolower($name);
+ $lowerName = strtolower($name ?? '');
unset($this->headers[$lowerName][$index]);
}
@@ -264,7 +258,7 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_CharsetObserver
*/
public function removeAll($name)
{
- $lowerName = strtolower($name);
+ $lowerName = strtolower($name ?? '');
unset($this->headers[$lowerName]);
}
@@ -272,8 +266,6 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_CharsetObserver
* Define a list of Header names as an array in the correct order.
*
* These Headers will be output in the given order where present.
- *
- * @param array $sequence
*/
public function defineOrdering(array $sequence)
{
@@ -284,8 +276,6 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_CharsetObserver
* Set a list of header names which must always be displayed when set.
*
* Usually headers without a field value won't be output unless set here.
- *
- * @param array $names
*/
public function setAlwaysDisplayed(array $names)
{
@@ -312,11 +302,11 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_CharsetObserver
$string = '';
$headers = $this->headers;
if ($this->canSort()) {
- uksort($headers, array($this, 'sortHeaders'));
+ uksort($headers, [$this, 'sortHeaders']);
}
foreach ($headers as $collection) {
foreach ($collection as $header) {
- if ($this->isDisplayed($header) || $header->getFieldBody() != '') {
+ if ($this->isDisplayed($header) || '' != $header->getFieldBody()) {
$string .= $header->toString();
}
}
@@ -340,38 +330,38 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_CharsetObserver
/** Save a Header to the internal collection */
private function storeHeader($name, Swift_Mime_Header $header, $offset = null)
{
- if (!isset($this->headers[strtolower($name)])) {
- $this->headers[strtolower($name)] = array();
+ if (!isset($this->headers[strtolower($name ?? '')])) {
+ $this->headers[strtolower($name ?? '')] = [];
}
if (!isset($offset)) {
- $this->headers[strtolower($name)][] = $header;
+ $this->headers[strtolower($name ?? '')][] = $header;
} else {
- $this->headers[strtolower($name)][$offset] = $header;
+ $this->headers[strtolower($name ?? '')][$offset] = $header;
}
}
/** Test if the headers can be sorted */
private function canSort()
{
- return count($this->order) > 0;
+ return \count($this->order) > 0;
}
/** uksort() algorithm for Header ordering */
private function sortHeaders($a, $b)
{
- $lowerA = strtolower($a);
- $lowerB = strtolower($b);
- $aPos = array_key_exists($lowerA, $this->order) ? $this->order[$lowerA] : -1;
- $bPos = array_key_exists($lowerB, $this->order) ? $this->order[$lowerB] : -1;
+ $lowerA = strtolower($a ?? '');
+ $lowerB = strtolower($b ?? '');
+ $aPos = \array_key_exists($lowerA, $this->order) ? $this->order[$lowerA] : -1;
+ $bPos = \array_key_exists($lowerB, $this->order) ? $this->order[$lowerB] : -1;
if (-1 === $aPos && -1 === $bPos) {
// just be sure to be determinist here
return $a > $b ? -1 : 1;
}
- if ($aPos == -1) {
+ if (-1 == $aPos) {
return 1;
- } elseif ($bPos == -1) {
+ } elseif (-1 == $bPos) {
return -1;
}
@@ -381,7 +371,7 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_CharsetObserver
/** Test if the given Header is always displayed */
private function isDisplayed(Swift_Mime_Header $header)
{
- return array_key_exists(strtolower($header->getFieldName()), $this->required);
+ return \array_key_exists(strtolower($header->getFieldName() ?? ''), $this->required);
}
/** Notify all Headers of the new charset */
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/SimpleMessage.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/SimpleMessage.php
index f8667954bcf..62da1650a7b 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/SimpleMessage.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/SimpleMessage.php
@@ -24,16 +24,12 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart
/**
* Create a new SimpleMessage with $headers, $encoder and $cache.
*
- * @param Swift_Mime_SimpleHeaderSet $headers
- * @param Swift_Mime_ContentEncoder $encoder
- * @param Swift_KeyCache $cache
- * @param Swift_IdGenerator $idGenerator
- * @param string $charset
+ * @param string $charset
*/
public function __construct(Swift_Mime_SimpleHeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_IdGenerator $idGenerator, $charset = null)
{
parent::__construct($headers, $encoder, $cache, $idGenerator, $charset);
- $this->getHeaders()->defineOrdering(array(
+ $this->getHeaders()->defineOrdering([
'Return-Path',
'Received',
'DKIM-Signature',
@@ -50,8 +46,8 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart
'MIME-Version',
'Content-Type',
'Content-Transfer-Encoding',
- ));
- $this->getHeaders()->setAlwaysDisplayed(array('Date', 'Message-ID', 'From'));
+ ]);
+ $this->getHeaders()->setAlwaysDisplayed(['Date', 'Message-ID', 'From']);
$this->getHeaders()->addTextHeader('MIME-Version', '1.0');
$this->setDate(new DateTimeImmutable());
$this->setId($this->getId());
@@ -97,8 +93,6 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart
/**
* Set the date at which this message was created.
*
- * @param DateTimeInterface $dateTime
- *
* @return $this
*/
public function setDate(DateTimeInterface $dateTime)
@@ -158,8 +152,8 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart
*/
public function setSender($address, $name = null)
{
- if (!is_array($address) && isset($name)) {
- $address = array($address => $name);
+ if (!\is_array($address) && isset($name)) {
+ $address = [$address => $name];
}
if (!$this->setHeaderFieldModel('Sender', (array) $address)) {
@@ -212,8 +206,8 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart
*/
public function setFrom($addresses, $name = null)
{
- if (!is_array($addresses) && isset($name)) {
- $addresses = array($addresses => $name);
+ if (!\is_array($addresses) && isset($name)) {
+ $addresses = [$addresses => $name];
}
if (!$this->setHeaderFieldModel('From', (array) $addresses)) {
@@ -266,8 +260,8 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart
*/
public function setReplyTo($addresses, $name = null)
{
- if (!is_array($addresses) && isset($name)) {
- $addresses = array($addresses => $name);
+ if (!\is_array($addresses) && isset($name)) {
+ $addresses = [$addresses => $name];
}
if (!$this->setHeaderFieldModel('Reply-To', (array) $addresses)) {
@@ -321,8 +315,8 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart
*/
public function setTo($addresses, $name = null)
{
- if (!is_array($addresses) && isset($name)) {
- $addresses = array($addresses => $name);
+ if (!\is_array($addresses) && isset($name)) {
+ $addresses = [$addresses => $name];
}
if (!$this->setHeaderFieldModel('To', (array) $addresses)) {
@@ -373,8 +367,8 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart
*/
public function setCc($addresses, $name = null)
{
- if (!is_array($addresses) && isset($name)) {
- $addresses = array($addresses => $name);
+ if (!\is_array($addresses) && isset($name)) {
+ $addresses = [$addresses => $name];
}
if (!$this->setHeaderFieldModel('Cc', (array) $addresses)) {
@@ -425,8 +419,8 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart
*/
public function setBcc($addresses, $name = null)
{
- if (!is_array($addresses) && isset($name)) {
- $addresses = array($addresses => $name);
+ if (!\is_array($addresses) && isset($name)) {
+ $addresses = [$addresses => $name];
}
if (!$this->setHeaderFieldModel('Bcc', (array) $addresses)) {
@@ -457,13 +451,13 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart
*/
public function setPriority($priority)
{
- $priorityMap = array(
+ $priorityMap = [
self::PRIORITY_HIGHEST => 'Highest',
self::PRIORITY_HIGH => 'High',
self::PRIORITY_NORMAL => 'Normal',
self::PRIORITY_LOW => 'Low',
self::PRIORITY_LOWEST => 'Lowest',
- );
+ ];
$pMapKeys = array_keys($priorityMap);
if ($priority > max($pMapKeys)) {
$priority = max($pMapKeys);
@@ -493,7 +487,7 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart
'%[1-5]'
);
- return isset($priority) ? $priority : 3;
+ return $priority ?? 3;
}
/**
@@ -526,13 +520,11 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart
/**
* Attach a {@link Swift_Mime_SimpleMimeEntity} such as an Attachment or MimePart.
*
- * @param Swift_Mime_SimpleMimeEntity $entity
- *
* @return $this
*/
public function attach(Swift_Mime_SimpleMimeEntity $entity)
{
- $this->setChildren(array_merge($this->getChildren(), array($entity)));
+ $this->setChildren(array_merge($this->getChildren(), [$entity]));
return $this;
}
@@ -540,13 +532,11 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart
/**
* Remove an already attached entity.
*
- * @param Swift_Mime_SimpleMimeEntity $entity
- *
* @return $this
*/
public function detach(Swift_Mime_SimpleMimeEntity $entity)
{
- $newChildren = array();
+ $newChildren = [];
foreach ($this->getChildren() as $child) {
if ($entity !== $child) {
$newChildren[] = $child;
@@ -559,9 +549,8 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart
/**
* Attach a {@link Swift_Mime_SimpleMimeEntity} and return it's CID source.
- * This method should be used when embedding images or other data in a message.
*
- * @param Swift_Mime_SimpleMimeEntity $entity
+ * This method should be used when embedding images or other data in a message.
*
* @return string
*/
@@ -579,8 +568,8 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart
*/
public function toString()
{
- if (count($children = $this->getChildren()) > 0 && $this->getBody() != '') {
- $this->setChildren(array_merge(array($this->becomeMimePart()), $children));
+ if (\count($children = $this->getChildren()) > 0 && '' != $this->getBody()) {
+ $this->setChildren(array_merge([$this->becomeMimePart()], $children));
$string = parent::toString();
$this->setChildren($children);
} else {
@@ -604,13 +593,11 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart
/**
* Write this message to a {@link Swift_InputByteStream}.
- *
- * @param Swift_InputByteStream $is
*/
public function toByteStream(Swift_InputByteStream $is)
{
- if (count($children = $this->getChildren()) > 0 && $this->getBody() != '') {
- $this->setChildren(array_merge(array($this->becomeMimePart()), $children));
+ if (\count($children = $this->getChildren()) > 0 && '' != $this->getBody()) {
+ $this->setChildren(array_merge([$this->becomeMimePart()], $children));
parent::toByteStream($is);
$this->setChildren($children);
} else {
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/SimpleMimeEntity.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/SimpleMimeEntity.php
index 980f1cedc1c..03eaf472dd5 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/SimpleMimeEntity.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Mime/SimpleMimeEntity.php
@@ -43,14 +43,14 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_CharsetObserver, Swift_M
private $boundary;
/** Mime types to be used based on the nesting level */
- private $compositeRanges = array(
- 'multipart/mixed' => array(self::LEVEL_TOP, self::LEVEL_MIXED),
- 'multipart/alternative' => array(self::LEVEL_MIXED, self::LEVEL_ALTERNATIVE),
- 'multipart/related' => array(self::LEVEL_ALTERNATIVE, self::LEVEL_RELATED),
- );
+ private $compositeRanges = [
+ 'multipart/mixed' => [self::LEVEL_TOP, self::LEVEL_MIXED],
+ 'multipart/alternative' => [self::LEVEL_MIXED, self::LEVEL_ALTERNATIVE],
+ 'multipart/related' => [self::LEVEL_ALTERNATIVE, self::LEVEL_RELATED],
+ ];
/** A set of filter rules to define what level an entity should be nested at */
- private $compoundLevelFilters = array();
+ private $compoundLevelFilters = [];
/** The nesting level of this entity */
private $nestingLevel = self::LEVEL_ALTERNATIVE;
@@ -59,20 +59,20 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_CharsetObserver, Swift_M
private $cache;
/** Direct descendants of this entity */
- private $immediateChildren = array();
+ private $immediateChildren = [];
/** All descendants of this entity */
- private $children = array();
+ private $children = [];
/** The maximum line length of the body of this entity */
private $maxLineLength = 78;
/** The order in which alternative mime types should appear */
- private $alternativePartOrder = array(
+ private $alternativePartOrder = [
'text/plain' => 1,
'text/html' => 2,
'multipart/related' => 3,
- );
+ ];
/** The CID of this entity */
private $id;
@@ -84,20 +84,15 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_CharsetObserver, Swift_M
/**
* Create a new SimpleMimeEntity with $headers, $encoder and $cache.
- *
- * @param Swift_Mime_SimpleHeaderSet $headers
- * @param Swift_Mime_ContentEncoder $encoder
- * @param Swift_KeyCache $cache
- * @param Swift_IdGenerator $idGenerator
*/
public function __construct(Swift_Mime_SimpleHeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_IdGenerator $idGenerator)
{
- $this->cacheKey = md5(getmypid().'.'.time().'.'.uniqid(mt_rand(), true));
+ $this->cacheKey = bin2hex(random_bytes(16)); // set 32 hex values
$this->cache = $cache;
$this->headers = $headers;
$this->idGenerator = $idGenerator;
$this->setEncoder($encoder);
- $this->headers->defineOrdering(array('Content-Type', 'Content-Transfer-Encoding'));
+ $this->headers->defineOrdering(['Content-Type', 'Content-Transfer-Encoding']);
// This array specifies that, when the entire MIME document contains
// $compoundLevel, then for each child within $level, if its Content-Type
@@ -112,14 +107,14 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_CharsetObserver, Swift_M
// )
// )
- $this->compoundLevelFilters = array(
- (self::LEVEL_ALTERNATIVE + self::LEVEL_RELATED) => array(
- self::LEVEL_ALTERNATIVE => array(
+ $this->compoundLevelFilters = [
+ (self::LEVEL_ALTERNATIVE + self::LEVEL_RELATED) => [
+ self::LEVEL_ALTERNATIVE => [
'text/plain' => self::LEVEL_ALTERNATIVE,
'text/html' => self::LEVEL_RELATED,
- ),
- ),
- );
+ ],
+ ],
+ ];
$this->id = $this->idGenerator->generateId();
}
@@ -168,6 +163,16 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_CharsetObserver, Swift_M
return $this->getHeaderFieldModel('Content-Type');
}
+ /**
+ * Get the Body Content-type of this entity.
+ *
+ * @return string
+ */
+ public function getBodyContentType()
+ {
+ return $this->userContentType;
+ }
+
/**
* Set the Content-type of this entity.
*
@@ -293,16 +298,16 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_CharsetObserver, Swift_M
public function setChildren(array $children, $compoundLevel = null)
{
// TODO: Try to refactor this logic
- $compoundLevel = isset($compoundLevel) ? $compoundLevel : $this->getCompoundLevel($children);
- $immediateChildren = array();
- $grandchildren = array();
+ $compoundLevel = $compoundLevel ?? $this->getCompoundLevel($children);
+ $immediateChildren = [];
+ $grandchildren = [];
$newContentType = $this->userContentType;
foreach ($children as $child) {
$level = $this->getNeededChildLevel($child, $compoundLevel);
if (empty($immediateChildren)) {
//first iteration
- $immediateChildren = array($child);
+ $immediateChildren = [$child];
} else {
$nextLevel = $this->getNeededChildLevel($immediateChildren[0], $compoundLevel);
if ($nextLevel == $level) {
@@ -311,7 +316,7 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_CharsetObserver, Swift_M
// Re-assign immediateChildren to grandchildren
$grandchildren = array_merge($grandchildren, $immediateChildren);
// Set new children
- $immediateChildren = array($child);
+ $immediateChildren = [$child];
} else {
$grandchildren[] = $child;
}
@@ -375,7 +380,7 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_CharsetObserver, Swift_M
}
$this->body = $body;
- if (isset($contentType)) {
+ if (null !== $contentType) {
$this->setContentType($contentType);
}
@@ -395,8 +400,6 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_CharsetObserver, Swift_M
/**
* Set the encoder used for the body of this entity.
*
- * @param Swift_Mime_ContentEncoder $encoder
- *
* @return $this
*/
public function setEncoder(Swift_Mime_ContentEncoder $encoder)
@@ -420,7 +423,7 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_CharsetObserver, Swift_M
public function getBoundary()
{
if (!isset($this->boundary)) {
- $this->boundary = '_=_swift_'.time().'_'.md5(getmypid().'.'.time().'.'.uniqid(mt_rand(), true)).'_=_';
+ $this->boundary = '_=_swift_'.time().'_'.bin2hex(random_bytes(16)).'_=_';
}
return $this->boundary;
@@ -457,8 +460,6 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_CharsetObserver, Swift_M
/**
* Receive notification that the encoder of this entity or a parent entity
* has changed.
- *
- * @param Swift_Mime_ContentEncoder $encoder
*/
public function encoderChanged(Swift_Mime_ContentEncoder $encoder)
{
@@ -522,8 +523,6 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_CharsetObserver, Swift_M
/**
* Write this entire entity to a {@see Swift_InputByteStream}.
- *
- * @param Swift_InputByteStream
*/
public function toByteStream(Swift_InputByteStream $is)
{
@@ -535,8 +534,6 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_CharsetObserver, Swift_M
/**
* Write this entire entity to a {@link Swift_InputByteStream}.
- *
- * @param Swift_InputByteStream
*/
protected function bodyToByteStream(Swift_InputByteStream $is)
{
@@ -637,7 +634,7 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_CharsetObserver, Swift_M
*/
protected function fixHeaders()
{
- if (count($this->immediateChildren)) {
+ if (\count($this->immediateChildren)) {
$this->setHeaderParameter('Content-Type', 'boundary',
$this->getBoundary()
);
@@ -726,7 +723,7 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_CharsetObserver, Swift_M
private function getNeededChildLevel($child, $compoundLevel)
{
- $filter = array();
+ $filter = [];
foreach ($this->compoundLevelFilters as $bitmask => $rules) {
if (($compoundLevel & $bitmask) === $bitmask) {
$filter = $rules + $filter;
@@ -734,7 +731,7 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_CharsetObserver, Swift_M
}
$realLevel = $child->getNestingLevel();
- $lowercaseType = strtolower($child->getContentType());
+ $lowercaseType = strtolower($child->getContentType() ?? '');
if (isset($filter[$realLevel]) && isset($filter[$realLevel][$lowercaseType])) {
return $filter[$realLevel][$lowercaseType];
@@ -769,7 +766,7 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_CharsetObserver, Swift_M
$shouldSort = false;
foreach ($this->immediateChildren as $child) {
// NOTE: This include alternative parts moved into a related part
- if ($child->getNestingLevel() == self::LEVEL_ALTERNATIVE) {
+ if (self::LEVEL_ALTERNATIVE == $child->getNestingLevel()) {
$shouldSort = true;
break;
}
@@ -778,13 +775,13 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_CharsetObserver, Swift_M
// Sort in order of preference, if there is one
if ($shouldSort) {
// Group the messages by order of preference
- $sorted = array();
+ $sorted = [];
foreach ($this->immediateChildren as $child) {
$type = $child->getContentType();
- $level = array_key_exists($type, $this->alternativePartOrder) ? $this->alternativePartOrder[$type] : max($this->alternativePartOrder) + 1;
+ $level = \array_key_exists($type, $this->alternativePartOrder) ? $this->alternativePartOrder[$type] : max($this->alternativePartOrder) + 1;
if (empty($sorted[$level])) {
- $sorted[$level] = array();
+ $sorted[$level] = [];
}
$sorted[$level][] = $child;
@@ -792,7 +789,7 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_CharsetObserver, Swift_M
ksort($sorted);
- $this->immediateChildren = array_reduce($sorted, 'array_merge', array());
+ $this->immediateChildren = array_reduce($sorted, 'array_merge', []);
}
}
@@ -813,11 +810,17 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_CharsetObserver, Swift_M
{
$this->headers = clone $this->headers;
$this->encoder = clone $this->encoder;
- $this->cacheKey = md5(getmypid().'.'.time().'.'.uniqid(mt_rand(), true));
- $children = array();
+ $this->cacheKey = bin2hex(random_bytes(16)); // set 32 hex values
+ $children = [];
foreach ($this->children as $pos => $child) {
$children[$pos] = clone $child;
}
$this->setChildren($children);
}
+
+ public function __wakeup()
+ {
+ $this->cacheKey = bin2hex(random_bytes(16)); // set 32 hex values
+ $this->cache = new Swift_KeyCache_ArrayKeyCache(new Swift_KeyCache_SimpleKeyCacheInputStream());
+ }
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/MimePart.php b/htdocs/includes/swiftmailer/lib/classes/Swift/MimePart.php
index 8fa0cbebcd2..ea97619ad69 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/MimePart.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/MimePart.php
@@ -26,8 +26,8 @@ class Swift_MimePart extends Swift_Mime_MimePart
*/
public function __construct($body = null, $contentType = null, $charset = null)
{
- call_user_func_array(
- array($this, 'Swift_Mime_MimePart::__construct'),
+ \call_user_func_array(
+ [$this, 'Swift_Mime_MimePart::__construct'],
Swift_DependencyContainer::getInstance()
->createDependenciesFor('mime.part')
);
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/NullTransport.php b/htdocs/includes/swiftmailer/lib/classes/Swift/NullTransport.php
index a580dfbefb6..e44b7af982f 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/NullTransport.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/NullTransport.php
@@ -17,8 +17,8 @@ class Swift_NullTransport extends Swift_Transport_NullTransport
{
public function __construct()
{
- call_user_func_array(
- array($this, 'Swift_Transport_NullTransport::__construct'),
+ \call_user_func_array(
+ [$this, 'Swift_Transport_NullTransport::__construct'],
Swift_DependencyContainer::getInstance()
->createDependenciesFor('transport.null')
);
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/AntiFloodPlugin.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/AntiFloodPlugin.php
index 06b3109e62c..5b1d7deefff 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/AntiFloodPlugin.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/AntiFloodPlugin.php
@@ -99,8 +99,6 @@ class Swift_Plugins_AntiFloodPlugin implements Swift_Events_SendListener, Swift_
/**
* Invoked immediately before the Message is sent.
- *
- * @param Swift_Events_SendEvent $evt
*/
public function beforeSendPerformed(Swift_Events_SendEvent $evt)
{
@@ -108,8 +106,6 @@ class Swift_Plugins_AntiFloodPlugin implements Swift_Events_SendListener, Swift_
/**
* Invoked immediately after the Message is sent.
- *
- * @param Swift_Events_SendEvent $evt
*/
public function sendPerformed(Swift_Events_SendEvent $evt)
{
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/BandwidthMonitorPlugin.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/BandwidthMonitorPlugin.php
index af060a99cc3..36451f44f1f 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/BandwidthMonitorPlugin.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/BandwidthMonitorPlugin.php
@@ -30,7 +30,7 @@ class Swift_Plugins_BandwidthMonitorPlugin implements Swift_Events_SendListener,
private $in = 0;
/** Bound byte streams */
- private $mirrors = array();
+ private $mirrors = [];
/**
* Not used.
@@ -41,8 +41,6 @@ class Swift_Plugins_BandwidthMonitorPlugin implements Swift_Events_SendListener,
/**
* Invoked immediately after the Message is sent.
- *
- * @param Swift_Events_SendEvent $evt
*/
public function sendPerformed(Swift_Events_SendEvent $evt)
{
@@ -52,24 +50,20 @@ class Swift_Plugins_BandwidthMonitorPlugin implements Swift_Events_SendListener,
/**
* Invoked immediately following a command being sent.
- *
- * @param Swift_Events_CommandEvent $evt
*/
public function commandSent(Swift_Events_CommandEvent $evt)
{
$command = $evt->getCommand();
- $this->out += strlen($command);
+ $this->out += \strlen($command);
}
/**
* Invoked immediately following a response coming back.
- *
- * @param Swift_Events_ResponseEvent $evt
*/
public function responseReceived(Swift_Events_ResponseEvent $evt)
{
$response = $evt->getResponse();
- $this->in += strlen($response);
+ $this->in += \strlen($response);
}
/**
@@ -79,7 +73,7 @@ class Swift_Plugins_BandwidthMonitorPlugin implements Swift_Events_SendListener,
*/
public function write($bytes)
{
- $this->out += strlen($bytes);
+ $this->out += \strlen($bytes);
foreach ($this->mirrors as $stream) {
$stream->write($bytes);
}
@@ -97,8 +91,6 @@ class Swift_Plugins_BandwidthMonitorPlugin implements Swift_Events_SendListener,
*
* The stream acts as an observer, receiving all data that is written.
* All {@link write()} and {@link flushBuffers()} operations will be mirrored.
- *
- * @param Swift_InputByteStream $is
*/
public function bind(Swift_InputByteStream $is)
{
@@ -111,8 +103,6 @@ class Swift_Plugins_BandwidthMonitorPlugin implements Swift_Events_SendListener,
* If $is is not bound, no errors will be raised.
* If the stream currently has any buffered data it will be written to $is
* before unbinding occurs.
- *
- * @param Swift_InputByteStream $is
*/
public function unbind(Swift_InputByteStream $is)
{
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/DecoratorPlugin.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/DecoratorPlugin.php
index 745ee879003..93124c9a5f4 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/DecoratorPlugin.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/DecoratorPlugin.php
@@ -23,10 +23,10 @@ class Swift_Plugins_DecoratorPlugin implements Swift_Events_SendListener, Swift_
private $originalBody;
/** The original headers of the message, before replacements */
- private $originalHeaders = array();
+ private $originalHeaders = [];
/** Bodies of children before they are replaced */
- private $originalChildBodies = array();
+ private $originalChildBodies = [];
/** The Message that was last replaced */
private $lastMessage;
@@ -74,8 +74,6 @@ class Swift_Plugins_DecoratorPlugin implements Swift_Events_SendListener, Swift_
/**
* Invoked immediately before the Message is sent.
- *
- * @param Swift_Events_SendEvent $evt
*/
public function beforeSendPerformed(Swift_Events_SendEvent $evt)
{
@@ -98,20 +96,20 @@ class Swift_Plugins_DecoratorPlugin implements Swift_Events_SendListener, Swift_
foreach ($message->getHeaders()->getAll() as $header) {
$body = $header->getFieldBodyModel();
$count = 0;
- if (is_array($body)) {
- $bodyReplaced = array();
+ if (\is_array($body)) {
+ $bodyReplaced = [];
foreach ($body as $key => $value) {
$count1 = 0;
$count2 = 0;
- $key = is_string($key) ? str_replace($search, $replace, $key, $count1) : $key;
- $value = is_string($value) ? str_replace($search, $replace, $value, $count2) : $value;
+ $key = \is_string($key) ? str_replace($search, $replace, $key, $count1) : $key;
+ $value = \is_string($value) ? str_replace($search, $replace, $value, $count2) : $value;
$bodyReplaced[$key] = $value;
if (!$count && ($count1 || $count2)) {
$count = 1;
}
}
- } elseif (is_string($body)) {
+ } elseif (\is_string($body)) {
$bodyReplaced = str_replace($search, $replace, $body, $count);
}
@@ -159,13 +157,11 @@ class Swift_Plugins_DecoratorPlugin implements Swift_Events_SendListener, Swift_
return $this->replacements->getReplacementsFor($address);
}
- return isset($this->replacements[$address]) ? $this->replacements[$address] : null;
+ return $this->replacements[$address] ?? null;
}
/**
* Invoked immediately after the Message is sent.
- *
- * @param Swift_Events_SendEvent $evt
*/
public function sendPerformed(Swift_Events_SendEvent $evt)
{
@@ -182,21 +178,21 @@ class Swift_Plugins_DecoratorPlugin implements Swift_Events_SendListener, Swift_
}
if (!empty($this->originalHeaders)) {
foreach ($message->getHeaders()->getAll() as $header) {
- if (array_key_exists($header->getFieldName(), $this->originalHeaders)) {
+ if (\array_key_exists($header->getFieldName(), $this->originalHeaders)) {
$header->setFieldBodyModel($this->originalHeaders[$header->getFieldName()]);
}
}
- $this->originalHeaders = array();
+ $this->originalHeaders = [];
}
if (!empty($this->originalChildBodies)) {
$children = (array) $message->getChildren();
foreach ($children as $child) {
$id = $child->getId();
- if (array_key_exists($id, $this->originalChildBodies)) {
+ if (\array_key_exists($id, $this->originalChildBodies)) {
$child->setBody($this->originalChildBodies[$id]);
}
}
- $this->originalChildBodies = array();
+ $this->originalChildBodies = [];
}
$this->lastMessage = null;
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/ImpersonatePlugin.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/ImpersonatePlugin.php
index b975d36b858..3f4dbbfa40f 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/ImpersonatePlugin.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/ImpersonatePlugin.php
@@ -34,8 +34,6 @@ class Swift_Plugins_ImpersonatePlugin implements Swift_Events_SendListener
/**
* Invoked immediately before the Message is sent.
- *
- * @param Swift_Events_SendEvent $evt
*/
public function beforeSendPerformed(Swift_Events_SendEvent $evt)
{
@@ -51,8 +49,6 @@ class Swift_Plugins_ImpersonatePlugin implements Swift_Events_SendListener
/**
* Invoked immediately after the Message is sent.
- *
- * @param Swift_Events_SendEvent $evt
*/
public function sendPerformed(Swift_Events_SendEvent $evt)
{
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/LoggerPlugin.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/LoggerPlugin.php
index 7ddf1fd16db..e183749b7ec 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/LoggerPlugin.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/LoggerPlugin.php
@@ -20,8 +20,6 @@ class Swift_Plugins_LoggerPlugin implements Swift_Events_CommandListener, Swift_
/**
* Create a new LoggerPlugin using $logger.
- *
- * @param Swift_Plugins_Logger $logger
*/
public function __construct(Swift_Plugins_Logger $logger)
{
@@ -58,8 +56,6 @@ class Swift_Plugins_LoggerPlugin implements Swift_Events_CommandListener, Swift_
/**
* Invoked immediately following a command being sent.
- *
- * @param Swift_Events_CommandEvent $evt
*/
public function commandSent(Swift_Events_CommandEvent $evt)
{
@@ -69,8 +65,6 @@ class Swift_Plugins_LoggerPlugin implements Swift_Events_CommandListener, Swift_
/**
* Invoked immediately following a response coming back.
- *
- * @param Swift_Events_ResponseEvent $evt
*/
public function responseReceived(Swift_Events_ResponseEvent $evt)
{
@@ -80,52 +74,42 @@ class Swift_Plugins_LoggerPlugin implements Swift_Events_CommandListener, Swift_
/**
* Invoked just before a Transport is started.
- *
- * @param Swift_Events_TransportChangeEvent $evt
*/
public function beforeTransportStarted(Swift_Events_TransportChangeEvent $evt)
{
- $transportName = get_class($evt->getSource());
+ $transportName = \get_class($evt->getSource());
$this->logger->add(sprintf('++ Starting %s', $transportName));
}
/**
* Invoked immediately after the Transport is started.
- *
- * @param Swift_Events_TransportChangeEvent $evt
*/
public function transportStarted(Swift_Events_TransportChangeEvent $evt)
{
- $transportName = get_class($evt->getSource());
+ $transportName = \get_class($evt->getSource());
$this->logger->add(sprintf('++ %s started', $transportName));
}
/**
* Invoked just before a Transport is stopped.
- *
- * @param Swift_Events_TransportChangeEvent $evt
*/
public function beforeTransportStopped(Swift_Events_TransportChangeEvent $evt)
{
- $transportName = get_class($evt->getSource());
+ $transportName = \get_class($evt->getSource());
$this->logger->add(sprintf('++ Stopping %s', $transportName));
}
/**
* Invoked immediately after the Transport is stopped.
- *
- * @param Swift_Events_TransportChangeEvent $evt
*/
public function transportStopped(Swift_Events_TransportChangeEvent $evt)
{
- $transportName = get_class($evt->getSource());
+ $transportName = \get_class($evt->getSource());
$this->logger->add(sprintf('++ %s stopped', $transportName));
}
/**
* Invoked as a TransportException is thrown in the Transport system.
- *
- * @param Swift_Events_TransportExceptionEvent $evt
*/
public function exceptionThrown(Swift_Events_TransportExceptionEvent $evt)
{
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Loggers/ArrayLogger.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Loggers/ArrayLogger.php
index 186b6b41bcd..6f595adaa4d 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Loggers/ArrayLogger.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Loggers/ArrayLogger.php
@@ -20,7 +20,7 @@ class Swift_Plugins_Loggers_ArrayLogger implements Swift_Plugins_Logger
*
* @var array
*/
- private $log = array();
+ private $log = [];
/**
* Max size of the log.
@@ -47,7 +47,7 @@ class Swift_Plugins_Loggers_ArrayLogger implements Swift_Plugins_Logger
public function add($entry)
{
$this->log[] = $entry;
- while (count($this->log) > $this->size) {
+ while (\count($this->log) > $this->size) {
array_shift($this->log);
}
}
@@ -57,7 +57,7 @@ class Swift_Plugins_Loggers_ArrayLogger implements Swift_Plugins_Logger
*/
public function clear()
{
- $this->log = array();
+ $this->log = [];
}
/**
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/MessageLogger.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/MessageLogger.php
index 5ff1d9321c0..39c48ed18f5 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/MessageLogger.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/MessageLogger.php
@@ -16,19 +16,19 @@
class Swift_Plugins_MessageLogger implements Swift_Events_SendListener
{
/**
- * @var Swift_Mime_Message[]
+ * @var Swift_Mime_SimpleMessage[]
*/
private $messages;
public function __construct()
{
- $this->messages = array();
+ $this->messages = [];
}
/**
* Get the message list.
*
- * @return Swift_Mime_Message[]
+ * @return Swift_Mime_SimpleMessage[]
*/
public function getMessages()
{
@@ -42,7 +42,7 @@ class Swift_Plugins_MessageLogger implements Swift_Events_SendListener
*/
public function countMessages()
{
- return count($this->messages);
+ return \count($this->messages);
}
/**
@@ -50,13 +50,11 @@ class Swift_Plugins_MessageLogger implements Swift_Events_SendListener
*/
public function clear()
{
- $this->messages = array();
+ $this->messages = [];
}
/**
* Invoked immediately before the Message is sent.
- *
- * @param Swift_Events_SendEvent $evt
*/
public function beforeSendPerformed(Swift_Events_SendEvent $evt)
{
@@ -65,8 +63,6 @@ class Swift_Plugins_MessageLogger implements Swift_Events_SendListener
/**
* Invoked immediately after the Message is sent.
- *
- * @param Swift_Events_SendEvent $evt
*/
public function sendPerformed(Swift_Events_SendEvent $evt)
{
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/PopBeforeSmtpPlugin.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/PopBeforeSmtpPlugin.php
index c19403aec61..9448594090b 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/PopBeforeSmtpPlugin.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/PopBeforeSmtpPlugin.php
@@ -45,7 +45,8 @@ class Swift_Plugins_PopBeforeSmtpPlugin implements Swift_Events_TransportChangeL
/**
* Create a new PopBeforeSmtpPlugin for $host and $port.
*
- * @param string $host
+ * @param string $host Hostname or IP. Literal IPv6 addresses should be
+ * wrapped in square brackets.
* @param int $port
* @param string $crypto as "tls" or "ssl"
*/
@@ -59,8 +60,6 @@ class Swift_Plugins_PopBeforeSmtpPlugin implements Swift_Events_TransportChangeL
/**
* Set a Pop3Connection to delegate to instead of connecting directly.
*
- * @param Swift_Plugins_Pop_Pop3Connection $connection
- *
* @return $this
*/
public function setConnection(Swift_Plugins_Pop_Pop3Connection $connection)
@@ -72,8 +71,6 @@ class Swift_Plugins_PopBeforeSmtpPlugin implements Swift_Events_TransportChangeL
/**
* Bind this plugin to a specific SMTP transport instance.
- *
- * @param Swift_Transport
*/
public function bindSmtp(Swift_Transport $smtp)
{
@@ -135,16 +132,12 @@ class Swift_Plugins_PopBeforeSmtpPlugin implements Swift_Events_TransportChangeL
if (!isset($this->socket)) {
if (!$socket = fsockopen(
$this->getHostString(), $this->port, $errno, $errstr, $this->timeout)) {
- throw new Swift_Plugins_Pop_Pop3Exception(
- sprintf('Failed to connect to POP3 host [%s]: %s', $this->host, $errstr)
- );
+ throw new Swift_Plugins_Pop_Pop3Exception(sprintf('Failed to connect to POP3 host [%s]: %s', $this->host, $errstr));
}
$this->socket = $socket;
if (false === $greeting = fgets($this->socket)) {
- throw new Swift_Plugins_Pop_Pop3Exception(
- sprintf('Failed to connect to POP3 host [%s]', trim($greeting))
- );
+ throw new Swift_Plugins_Pop_Pop3Exception(sprintf('Failed to connect to POP3 host [%s]', trim($greeting ?? '')));
}
$this->assertOk($greeting);
@@ -167,9 +160,7 @@ class Swift_Plugins_PopBeforeSmtpPlugin implements Swift_Events_TransportChangeL
} else {
$this->command("QUIT\r\n");
if (!fclose($this->socket)) {
- throw new Swift_Plugins_Pop_Pop3Exception(
- sprintf('POP3 host [%s] connection could not be stopped', $this->host)
- );
+ throw new Swift_Plugins_Pop_Pop3Exception(sprintf('POP3 host [%s] connection could not be stopped', $this->host));
}
$this->socket = null;
}
@@ -177,8 +168,6 @@ class Swift_Plugins_PopBeforeSmtpPlugin implements Swift_Events_TransportChangeL
/**
* Invoked just before a Transport is started.
- *
- * @param Swift_Events_TransportChangeEvent $evt
*/
public function beforeTransportStarted(Swift_Events_TransportChangeEvent $evt)
{
@@ -216,15 +205,11 @@ class Swift_Plugins_PopBeforeSmtpPlugin implements Swift_Events_TransportChangeL
private function command($command)
{
if (!fwrite($this->socket, $command)) {
- throw new Swift_Plugins_Pop_Pop3Exception(
- sprintf('Failed to write command [%s] to POP3 host', trim($command))
- );
+ throw new Swift_Plugins_Pop_Pop3Exception(sprintf('Failed to write command [%s] to POP3 host', trim($command ?? '')));
}
if (false === $response = fgets($this->socket)) {
- throw new Swift_Plugins_Pop_Pop3Exception(
- sprintf('Failed to read from POP3 host after command [%s]', trim($command))
- );
+ throw new Swift_Plugins_Pop_Pop3Exception(sprintf('Failed to read from POP3 host after command [%s]', trim($command ?? '')));
}
$this->assertOk($response);
@@ -234,17 +219,15 @@ class Swift_Plugins_PopBeforeSmtpPlugin implements Swift_Events_TransportChangeL
private function assertOk($response)
{
- if (substr($response, 0, 3) != '+OK') {
- throw new Swift_Plugins_Pop_Pop3Exception(
- sprintf('POP3 command failed [%s]', trim($response))
- );
+ if ('+OK' != substr($response, 0, 3)) {
+ throw new Swift_Plugins_Pop_Pop3Exception(sprintf('POP3 command failed [%s]', trim($response ?? '')));
}
}
private function getHostString()
{
$host = $this->host;
- switch (strtolower($this->crypto)) {
+ switch (strtolower($this->crypto ?? '')) {
case 'ssl':
$host = 'ssl://'.$host;
break;
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/RedirectingPlugin.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/RedirectingPlugin.php
index 8d797dd117b..f7373b2424c 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/RedirectingPlugin.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/RedirectingPlugin.php
@@ -27,15 +27,14 @@ class Swift_Plugins_RedirectingPlugin implements Swift_Events_SendListener
*
* @var array
*/
- private $whitelist = array();
+ private $whitelist = [];
/**
* Create a new RedirectingPlugin.
*
* @param mixed $recipient
- * @param array $whitelist
*/
- public function __construct($recipient, array $whitelist = array())
+ public function __construct($recipient, array $whitelist = [])
{
$this->recipient = $recipient;
$this->whitelist = $whitelist;
@@ -63,8 +62,6 @@ class Swift_Plugins_RedirectingPlugin implements Swift_Events_SendListener
/**
* Set a list of regular expressions to whitelist certain recipients.
- *
- * @param array $whitelist
*/
public function setWhitelist(array $whitelist)
{
@@ -83,8 +80,6 @@ class Swift_Plugins_RedirectingPlugin implements Swift_Events_SendListener
/**
* Invoked immediately before the Message is sent.
- *
- * @param Swift_Events_SendEvent $evt
*/
public function beforeSendPerformed(Swift_Events_SendEvent $evt)
{
@@ -113,11 +108,11 @@ class Swift_Plugins_RedirectingPlugin implements Swift_Events_SendListener
// Add each hard coded recipient
$to = $message->getTo();
if (null === $to) {
- $to = array();
+ $to = [];
}
foreach ((array) $this->recipient as $recipient) {
- if (!array_key_exists($recipient, $to)) {
+ if (!\array_key_exists($recipient, $to)) {
$message->addTo($recipient);
}
}
@@ -126,8 +121,7 @@ class Swift_Plugins_RedirectingPlugin implements Swift_Events_SendListener
/**
* Filter header set against a whitelist of regular expressions.
*
- * @param Swift_Mime_SimpleHeaderSet $headerSet
- * @param string $type
+ * @param string $type
*/
private function filterHeaderSet(Swift_Mime_SimpleHeaderSet $headerSet, $type)
{
@@ -139,13 +133,11 @@ class Swift_Plugins_RedirectingPlugin implements Swift_Events_SendListener
/**
* Filtered list of addresses => name pairs.
*
- * @param array $recipients
- *
* @return array
*/
private function filterNameAddresses(array $recipients)
{
- $filtered = array();
+ $filtered = [];
foreach ($recipients as $address => $name) {
if ($this->isWhitelisted($address)) {
@@ -159,13 +151,11 @@ class Swift_Plugins_RedirectingPlugin implements Swift_Events_SendListener
/**
* Matches address against whitelist of regular expressions.
*
- * @param $recipient
- *
* @return bool
*/
protected function isWhitelisted($recipient)
{
- if (in_array($recipient, (array) $this->recipient)) {
+ if (\in_array($recipient, (array) $this->recipient)) {
return true;
}
@@ -180,8 +170,6 @@ class Swift_Plugins_RedirectingPlugin implements Swift_Events_SendListener
/**
* Invoked immediately after the Message is sent.
- *
- * @param Swift_Events_SendEvent $evt
*/
public function sendPerformed(Swift_Events_SendEvent $evt)
{
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Reporter.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Reporter.php
index 3a2b6657c09..b8818339722 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Reporter.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Reporter.php
@@ -24,9 +24,8 @@ interface Swift_Plugins_Reporter
/**
* Notifies this ReportNotifier that $address failed or succeeded.
*
- * @param Swift_Mime_SimpleMessage $message
- * @param string $address
- * @param int $result from {@link RESULT_PASS, RESULT_FAIL}
+ * @param string $address
+ * @param int $result from {@link RESULT_PASS, RESULT_FAIL}
*/
public function notify(Swift_Mime_SimpleMessage $message, $address, $result);
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/ReporterPlugin.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/ReporterPlugin.php
index 5ffca24c61c..c4a016520f6 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/ReporterPlugin.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/ReporterPlugin.php
@@ -24,8 +24,6 @@ class Swift_Plugins_ReporterPlugin implements Swift_Events_SendListener
/**
* Create a new ReporterPlugin using $reporter.
- *
- * @param Swift_Plugins_Reporter $reporter
*/
public function __construct(Swift_Plugins_Reporter $reporter)
{
@@ -41,21 +39,19 @@ class Swift_Plugins_ReporterPlugin implements Swift_Events_SendListener
/**
* Invoked immediately after the Message is sent.
- *
- * @param Swift_Events_SendEvent $evt
*/
public function sendPerformed(Swift_Events_SendEvent $evt)
{
$message = $evt->getMessage();
$failures = array_flip($evt->getFailedRecipients());
foreach ((array) $message->getTo() as $address => $null) {
- $this->reporter->notify($message, $address, (array_key_exists($address, $failures) ? Swift_Plugins_Reporter::RESULT_FAIL : Swift_Plugins_Reporter::RESULT_PASS));
+ $this->reporter->notify($message, $address, (\array_key_exists($address, $failures) ? Swift_Plugins_Reporter::RESULT_FAIL : Swift_Plugins_Reporter::RESULT_PASS));
}
foreach ((array) $message->getCc() as $address => $null) {
- $this->reporter->notify($message, $address, (array_key_exists($address, $failures) ? Swift_Plugins_Reporter::RESULT_FAIL : Swift_Plugins_Reporter::RESULT_PASS));
+ $this->reporter->notify($message, $address, (\array_key_exists($address, $failures) ? Swift_Plugins_Reporter::RESULT_FAIL : Swift_Plugins_Reporter::RESULT_PASS));
}
foreach ((array) $message->getBcc() as $address => $null) {
- $this->reporter->notify($message, $address, (array_key_exists($address, $failures) ? Swift_Plugins_Reporter::RESULT_FAIL : Swift_Plugins_Reporter::RESULT_PASS));
+ $this->reporter->notify($message, $address, (\array_key_exists($address, $failures) ? Swift_Plugins_Reporter::RESULT_FAIL : Swift_Plugins_Reporter::RESULT_PASS));
}
}
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Reporters/HitReporter.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Reporters/HitReporter.php
index 67c117ac7c2..249cffbde7b 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Reporters/HitReporter.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Reporters/HitReporter.php
@@ -20,16 +20,15 @@ class Swift_Plugins_Reporters_HitReporter implements Swift_Plugins_Reporter
*
* @var array
*/
- private $failures = array();
+ private $failures = [];
- private $failures_cache = array();
+ private $failures_cache = [];
/**
* Notifies this ReportNotifier that $address failed or succeeded.
*
- * @param Swift_Mime_SimpleMessage $message
- * @param string $address
- * @param int $result from {@link RESULT_PASS, RESULT_FAIL}
+ * @param string $address
+ * @param int $result from {@link RESULT_PASS, RESULT_FAIL}
*/
public function notify(Swift_Mime_SimpleMessage $message, $address, $result)
{
@@ -54,6 +53,6 @@ class Swift_Plugins_Reporters_HitReporter implements Swift_Plugins_Reporter
*/
public function clear()
{
- $this->failures = $this->failures_cache = array();
+ $this->failures = $this->failures_cache = [];
}
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Reporters/HtmlReporter.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Reporters/HtmlReporter.php
index 525eef570a9..1cfc3f974f8 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Reporters/HtmlReporter.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Reporters/HtmlReporter.php
@@ -18,9 +18,8 @@ class Swift_Plugins_Reporters_HtmlReporter implements Swift_Plugins_Reporter
/**
* Notifies this ReportNotifier that $address failed or succeeded.
*
- * @param Swift_Mime_SimpleMessage $message
- * @param string $address
- * @param int $result from {@see RESULT_PASS, RESULT_FAIL}
+ * @param string $address
+ * @param int $result from {@see RESULT_PASS, RESULT_FAIL}
*/
public function notify(Swift_Mime_SimpleMessage $message, $address, $result)
{
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/ThrottlerPlugin.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/ThrottlerPlugin.php
index 77c2e8db6ec..83d3044927f 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/ThrottlerPlugin.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/ThrottlerPlugin.php
@@ -72,7 +72,7 @@ class Swift_Plugins_ThrottlerPlugin extends Swift_Plugins_BandwidthMonitorPlugin
* Create a new ThrottlerPlugin.
*
* @param int $rate
- * @param int $mode, defaults to {@link BYTES_PER_MINUTE}
+ * @param int $mode defaults to {@link BYTES_PER_MINUTE}
* @param Swift_Plugins_Sleeper $sleeper (only needed in testing)
* @param Swift_Plugins_Timer $timer (only needed in testing)
*/
@@ -86,8 +86,6 @@ class Swift_Plugins_ThrottlerPlugin extends Swift_Plugins_BandwidthMonitorPlugin
/**
* Invoked immediately before the Message is sent.
- *
- * @param Swift_Events_SendEvent $evt
*/
public function beforeSendPerformed(Swift_Events_SendEvent $evt)
{
@@ -119,8 +117,6 @@ class Swift_Plugins_ThrottlerPlugin extends Swift_Plugins_BandwidthMonitorPlugin
/**
* Invoked when a Message is sent.
- *
- * @param Swift_Events_SendEvent $evt
*/
public function sendPerformed(Swift_Events_SendEvent $evt)
{
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Preferences.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Preferences.php
index 79eafde9ad9..16103e11031 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Preferences.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Preferences.php
@@ -92,7 +92,7 @@ class Swift_Preferences
Swift_DependencyContainer::getInstance()
->register('mime.qpcontentencoder')
->asNewInstanceOf('Swift_Mime_ContentEncoder_QpContentEncoder')
- ->withDependencies(array('mime.charstream', 'mime.bytecanonicalizer'))
+ ->withDependencies(['mime.charstream', 'mime.bytecanonicalizer'])
->addConstructorValue($dotEscape);
return $this;
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/SendmailTransport.php b/htdocs/includes/swiftmailer/lib/classes/Swift/SendmailTransport.php
index c129281b347..3c756436cc8 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/SendmailTransport.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/SendmailTransport.php
@@ -22,8 +22,8 @@ class Swift_SendmailTransport extends Swift_Transport_SendmailTransport
*/
public function __construct($command = '/usr/sbin/sendmail -bs')
{
- call_user_func_array(
- array($this, 'Swift_Transport_SendmailTransport::__construct'),
+ \call_user_func_array(
+ [$this, 'Swift_Transport_SendmailTransport::__construct'],
Swift_DependencyContainer::getInstance()
->createDependenciesFor('transport.sendmail')
);
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Signer.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Signer.php
index 2d8176d905c..26c5e285c03 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Signer.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Signer.php
@@ -11,7 +11,6 @@
/**
* Base Class of Signer Infrastructure.
*
- *
* @author Xavier De Cock
*/
interface Swift_Signer
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/BodySigner.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/BodySigner.php
index 8e66e18f4e0..b25c427af83 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/BodySigner.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/BodySigner.php
@@ -18,8 +18,6 @@ interface Swift_Signers_BodySigner extends Swift_Signer
/**
* Change the Swift_Signed_Message to apply the singing.
*
- * @param Swift_Message $message
- *
* @return self
*/
public function signMessage(Swift_Message $message);
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/DKIMSigner.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/DKIMSigner.php
index a88daa19815..ec82dc05663 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/DKIMSigner.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/DKIMSigner.php
@@ -66,7 +66,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
*
* @var array
*/
- protected $ignoredHeaders = array('return-path' => true);
+ protected $ignoredHeaders = ['return-path' => true];
/**
* Signer identity.
@@ -124,14 +124,14 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
*
* @var array
*/
- protected $signedHeaders = array();
+ protected $signedHeaders = [];
/**
* If debugHeaders is set store debugData here.
*
- * @var string
+ * @var string[]
*/
- private $debugHeadersData = '';
+ private $debugHeadersData = [];
/**
* Stores the bodyHash.
@@ -163,7 +163,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
private $bodyCanonLine = '';
- private $bound = array();
+ private $bound = [];
/**
* Constructor.
@@ -190,7 +190,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
public function reset()
{
$this->headerHash = null;
- $this->signedHeaders = array();
+ $this->signedHeaders = [];
$this->bodyHash = null;
$this->bodyHashHandler = null;
$this->bodyCanonIgnoreStart = 2;
@@ -236,10 +236,9 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
/**
* Attach $is to this stream.
+ *
* The stream acts as an observer, receiving all data that is written.
* All {@link write()} and {@link flushBuffers()} operations will be mirrored.
- *
- * @param Swift_InputByteStream $is
*/
public function bind(Swift_InputByteStream $is)
{
@@ -251,11 +250,10 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
/**
* Remove an already bound stream.
+ *
* If $is is not bound, no errors will be raised.
* If the stream currently has any buffered data it will be written to $is
* before unbinding occurs.
- *
- * @param Swift_InputByteStream $is
*/
public function unbind(Swift_InputByteStream $is)
{
@@ -297,7 +295,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
break;
case 'rsa-sha256':
$this->hashAlgorithm = 'rsa-sha256';
- if (!defined('OPENSSL_ALGO_SHA256')) {
+ if (!\defined('OPENSSL_ALGO_SHA256')) {
throw new Swift_SwiftException('Unable to set sha256 as it is not supported by OpenSSL.');
}
break;
@@ -317,7 +315,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
*/
public function setBodyCanon($canon)
{
- if ($canon == 'relaxed') {
+ if ('relaxed' == $canon) {
$this->bodyCanon = 'relaxed';
} else {
$this->bodyCanon = 'simple';
@@ -335,7 +333,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
*/
public function setHeaderCanon($canon)
{
- if ($canon == 'relaxed') {
+ if ('relaxed' == $canon) {
$this->headerCanon = 'relaxed';
} else {
$this->headerCanon = 'simple';
@@ -367,10 +365,10 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
*/
public function setBodySignedLen($len)
{
- if ($len === true) {
+ if (true === $len) {
$this->showLen = true;
$this->maxLen = PHP_INT_MAX;
- } elseif ($len === false) {
+ } elseif (false === $len) {
$this->showLen = false;
$this->maxLen = PHP_INT_MAX;
} else {
@@ -456,9 +454,9 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
public function getAlteredHeaders()
{
if ($this->debugHeaders) {
- return array('DKIM-Signature', 'X-DebugHash');
+ return ['DKIM-Signature', 'X-DebugHash'];
} else {
- return array('DKIM-Signature');
+ return ['DKIM-Signature'];
}
}
@@ -471,7 +469,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
*/
public function ignoreHeader($header_name)
{
- $this->ignoredHeaders[strtolower($header_name)] = true;
+ $this->ignoredHeaders[strtolower($header_name ?? '')] = true;
return $this;
}
@@ -479,8 +477,6 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
/**
* Set the headers to sign.
*
- * @param Swift_Mime_SimpleHeaderSet $headers
- *
* @return Swift_Signers_DKIMSigner
*/
public function setHeaders(Swift_Mime_SimpleHeaderSet $headers)
@@ -490,11 +486,11 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
$listHeaders = $headers->listAll();
foreach ($listHeaders as $hName) {
// Check if we need to ignore Header
- if (!isset($this->ignoredHeaders[strtolower($hName)])) {
+ if (!isset($this->ignoredHeaders[strtolower($hName ?? '')])) {
if ($headers->has($hName)) {
$tmp = $headers->getAll($hName);
foreach ($tmp as $header) {
- if ($header->getFieldBody() != '') {
+ if ('' != $header->getFieldBody()) {
$this->addHeader($header->toString());
$this->signedHeaders[] = $header->getFieldName();
}
@@ -509,32 +505,30 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
/**
* Add the signature to the given Headers.
*
- * @param Swift_Mime_SimpleHeaderSet $headers
- *
* @return Swift_Signers_DKIMSigner
*/
public function addSignature(Swift_Mime_SimpleHeaderSet $headers)
{
// Prepare the DKIM-Signature
- $params = array('v' => '1', 'a' => $this->hashAlgorithm, 'bh' => base64_encode($this->bodyHash), 'd' => $this->domainName, 'h' => implode(': ', $this->signedHeaders), 'i' => $this->signerIdentity, 's' => $this->selector);
- if ($this->bodyCanon != 'simple') {
+ $params = ['v' => '1', 'a' => $this->hashAlgorithm, 'bh' => base64_encode($this->bodyHash ?? ''), 'd' => $this->domainName, 'h' => implode(': ', $this->signedHeaders), 'i' => $this->signerIdentity, 's' => $this->selector];
+ if ('simple' != $this->bodyCanon) {
$params['c'] = $this->headerCanon.'/'.$this->bodyCanon;
- } elseif ($this->headerCanon != 'simple') {
+ } elseif ('simple' != $this->headerCanon) {
$params['c'] = $this->headerCanon;
}
if ($this->showLen) {
$params['l'] = $this->bodyLen;
}
- if ($this->signatureTimestamp === true) {
+ if (true === $this->signatureTimestamp) {
$params['t'] = time();
- if ($this->signatureExpiration !== false) {
+ if (false !== $this->signatureExpiration) {
$params['x'] = $params['t'] + $this->signatureExpiration;
}
} else {
- if ($this->signatureTimestamp !== false) {
+ if (false !== $this->signatureTimestamp) {
$params['t'] = $this->signatureTimestamp;
}
- if ($this->signatureExpiration !== false) {
+ if (false !== $this->signatureExpiration) {
$params['x'] = $this->signatureExpiration;
}
}
@@ -550,11 +544,11 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
// Add the last DKIM-Signature
$tmp = $headers->getAll('DKIM-Signature');
$this->dkimHeader = end($tmp);
- $this->addHeader(trim($this->dkimHeader->toString())."\r\n b=", true);
+ $this->addHeader(trim($this->dkimHeader->toString() ?? '')."\r\n b=", true);
if ($this->debugHeaders) {
- $headers->addTextHeader('X-DebugHash', base64_encode($this->headerHash));
+ $headers->addTextHeader('X-DebugHash', base64_encode($this->headerHash ?? ''));
}
- $this->dkimHeader->setValue($string.' b='.trim(chunk_split(base64_encode($this->getEncryptedHash()), 73, ' ')));
+ $this->dkimHeader->setValue($string.' b='.trim(chunk_split(base64_encode($this->getEncryptedHash() ?? ''), 73, ' ')));
return $this;
}
@@ -571,6 +565,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
$value = str_replace("\r\n", '', $exploded[1]);
$value = preg_replace("/[ \t][ \t]+/", ' ', $value);
$header = $name.':'.trim($value).($is_sig ? '' : "\r\n");
+ // no break
case 'simple':
// Nothing to do
}
@@ -579,9 +574,9 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
protected function canonicalizeBody($string)
{
- $len = strlen($string);
+ $len = \strlen($string);
$canon = '';
- $method = ($this->bodyCanon == 'relaxed');
+ $method = ('relaxed' == $this->bodyCanon);
for ($i = 0; $i < $len; ++$i) {
if ($this->bodyCanonIgnoreStart > 0) {
--$this->bodyCanonIgnoreStart;
@@ -592,11 +587,11 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
$this->bodyCanonLastChar = "\r";
break;
case "\n":
- if ($this->bodyCanonLastChar == "\r") {
+ if ("\r" == $this->bodyCanonLastChar) {
if ($method) {
$this->bodyCanonSpace = false;
}
- if ($this->bodyCanonLine == '') {
+ if ('' == $this->bodyCanonLine) {
++$this->bodyCanonEmptyCounter;
} else {
$this->bodyCanonLine = '';
@@ -613,6 +608,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
$this->bodyCanonSpace = true;
break;
}
+ // no break
default:
if ($this->bodyCanonEmptyCounter > 0) {
$canon .= str_repeat("\r\n", $this->bodyCanonEmptyCounter);
@@ -633,7 +629,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
protected function endOfBody()
{
// Add trailing Line return if last line is non empty
- if (strlen($this->bodyCanonLine) > 0) {
+ if (\strlen($this->bodyCanonLine) > 0) {
$this->addToBodyHash("\r\n");
}
$this->bodyHash = hash_final($this->bodyHashHandler, true);
@@ -641,7 +637,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
private function addToBodyHash($string)
{
- $len = strlen($string);
+ $len = \strlen($string);
if ($len > ($new_len = ($this->maxLen - $this->bodyLen))) {
$string = substr($string, 0, $new_len);
$len = $new_len;
@@ -653,7 +649,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
private function addToHeaderHash($header)
{
if ($this->debugHeaders) {
- $this->debugHeadersData[] = trim($header);
+ $this->debugHeadersData[] = trim($header ?? '');
}
$this->headerCanonData .= $header;
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/DomainKeySigner.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/DomainKeySigner.php
index 40654987f9b..5e2b67b6520 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/DomainKeySigner.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/DomainKeySigner.php
@@ -55,7 +55,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
*
* @var array
*/
- protected $ignoredHeaders = array();
+ protected $ignoredHeaders = [];
/**
* Signer identity.
@@ -77,7 +77,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
*
* @var array
*/
- private $signedHeaders = array();
+ private $signedHeaders = [];
/**
* Stores the signature header.
@@ -93,8 +93,6 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
*/
private $hashHandler;
- private $hash;
-
private $canonData = '';
private $bodyCanonEmptyCounter = 0;
@@ -107,7 +105,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
private $bodyCanonLine = '';
- private $bound = array();
+ private $bound = [];
/**
* Constructor.
@@ -131,7 +129,6 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
*/
public function reset()
{
- $this->hash = null;
$this->hashHandler = null;
$this->bodyCanonIgnoreStart = 2;
$this->bodyCanonEmptyCounter = 0;
@@ -185,11 +182,10 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
/**
* Attach $is to this stream.
+ *
* The stream acts as an observer, receiving all data that is written.
* All {@link write()} and {@link flushBuffers()} operations will be mirrored.
*
- * @param Swift_InputByteStream $is
- *
* @return $this
*/
public function bind(Swift_InputByteStream $is)
@@ -202,12 +198,11 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
/**
* Remove an already bound stream.
+ *
* If $is is not bound, no errors will be raised.
* If the stream currently has any buffered data it will be written to $is
* before unbinding occurs.
*
- * @param Swift_InputByteStream $is
- *
* @return $this
*/
public function unbind(Swift_InputByteStream $is)
@@ -262,7 +257,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
*/
public function setCanon($canon)
{
- if ($canon == 'nofws') {
+ if ('nofws' == $canon) {
$this->canon = 'nofws';
} else {
$this->canon = 'simple';
@@ -322,10 +317,10 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
public function getAlteredHeaders()
{
if ($this->debugHeaders) {
- return array('DomainKey-Signature', 'X-DebugHash');
+ return ['DomainKey-Signature', 'X-DebugHash'];
}
- return array('DomainKey-Signature');
+ return ['DomainKey-Signature'];
}
/**
@@ -337,7 +332,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
*/
public function ignoreHeader($header_name)
{
- $this->ignoredHeaders[strtolower($header_name)] = true;
+ $this->ignoredHeaders[strtolower($header_name ?? '')] = true;
return $this;
}
@@ -345,8 +340,6 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
/**
* Set the headers to sign.
*
- * @param Swift_Mime_SimpleHeaderSet $headers
- *
* @return $this
*/
public function setHeaders(Swift_Mime_SimpleHeaderSet $headers)
@@ -357,11 +350,11 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
$listHeaders = $headers->listAll();
foreach ($listHeaders as $hName) {
// Check if we need to ignore Header
- if (!isset($this->ignoredHeaders[strtolower($hName)])) {
+ if (!isset($this->ignoredHeaders[strtolower($hName ?? '')])) {
if ($headers->has($hName)) {
$tmp = $headers->getAll($hName);
foreach ($tmp as $header) {
- if ($header->getFieldBody() != '') {
+ if ('' != $header->getFieldBody()) {
$this->addHeader($header->toString());
$this->signedHeaders[] = $header->getFieldName();
}
@@ -377,14 +370,12 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
/**
* Add the signature to the given Headers.
*
- * @param Swift_Mime_SimpleHeaderSet $headers
- *
* @return $this
*/
public function addSignature(Swift_Mime_SimpleHeaderSet $headers)
{
// Prepare the DomainKey-Signature Header
- $params = array('a' => $this->hashAlgorithm, 'b' => chunk_split(base64_encode($this->getEncryptedHash()), 73, ' '), 'c' => $this->canon, 'd' => $this->domainName, 'h' => implode(': ', $this->signedHeaders), 'q' => 'dns', 's' => $this->selector);
+ $params = ['a' => $this->hashAlgorithm, 'b' => chunk_split(base64_encode($this->getEncryptedHash() ?? ''), 73, ' '), 'c' => $this->canon, 'd' => $this->domainName, 'h' => implode(': ', $this->signedHeaders), 'q' => 'dns', 's' => $this->selector];
$string = '';
foreach ($params as $k => $v) {
$string .= $k.'='.$v.'; ';
@@ -407,6 +398,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
$value = str_replace("\r\n", '', $exploded[1]);
$value = preg_replace("/[ \t][ \t]+/", ' ', $value);
$header = $name.':'.trim($value)."\r\n";
+ // no break
case 'simple':
// Nothing to do
}
@@ -420,9 +412,9 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
protected function canonicalizeBody($string)
{
- $len = strlen($string);
+ $len = \strlen($string);
$canon = '';
- $nofws = ($this->canon == 'nofws');
+ $nofws = ('nofws' == $this->canon);
for ($i = 0; $i < $len; ++$i) {
if ($this->bodyCanonIgnoreStart > 0) {
--$this->bodyCanonIgnoreStart;
@@ -433,11 +425,11 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
$this->bodyCanonLastChar = "\r";
break;
case "\n":
- if ($this->bodyCanonLastChar == "\r") {
+ if ("\r" == $this->bodyCanonLastChar) {
if ($nofws) {
$this->bodyCanonSpace = false;
}
- if ($this->bodyCanonLine == '') {
+ if ('' == $this->bodyCanonLine) {
++$this->bodyCanonEmptyCounter;
} else {
$this->bodyCanonLine = '';
@@ -455,6 +447,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
$this->bodyCanonSpace = true;
break;
}
+ // no break
default:
if ($this->bodyCanonEmptyCounter > 0) {
$canon .= str_repeat("\r\n", $this->bodyCanonEmptyCounter);
@@ -469,10 +462,9 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
protected function endOfBody()
{
- if (strlen($this->bodyCanonLine) > 0) {
+ if (\strlen($this->bodyCanonLine) > 0) {
$this->addToHash("\r\n");
}
- $this->hash = hash_final($this->hashHandler, true);
}
private function addToHash($string)
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/HeaderSigner.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/HeaderSigner.php
index 6104e34f3f5..6f5c20923dc 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/HeaderSigner.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/HeaderSigner.php
@@ -41,8 +41,6 @@ interface Swift_Signers_HeaderSigner extends Swift_Signer, Swift_InputByteStream
/**
* Give the headers already given.
*
- * @param Swift_Mime_SimpleHeaderSet $headers
- *
* @return self
*/
public function setHeaders(Swift_Mime_SimpleHeaderSet $headers);
@@ -50,8 +48,6 @@ interface Swift_Signers_HeaderSigner extends Swift_Signer, Swift_InputByteStream
/**
* Add the header(s) to the headerSet.
*
- * @param Swift_Mime_SimpleHeaderSet $headers
- *
* @return self
*/
public function addSignature(Swift_Mime_SimpleHeaderSet $headers);
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/OpenDKIMSigner.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/OpenDKIMSigner.php
index deb29f575f2..520bcc15e8b 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/OpenDKIMSigner.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/OpenDKIMSigner.php
@@ -13,6 +13,8 @@
* Takes advantage of pecl extension.
*
* @author Xavier De Cock
+ *
+ * @deprecated since SwiftMailer 6.1.0; use Swift_Signers_DKIMSigner instead.
*/
class Swift_Signers_OpenDKIMSigner extends Swift_Signers_DKIMSigner
{
@@ -29,7 +31,7 @@ class Swift_Signers_OpenDKIMSigner extends Swift_Signers_DKIMSigner
public function __construct($privateKey, $domainName, $selector)
{
- if (!extension_loaded('opendkim')) {
+ if (!\extension_loaded('opendkim')) {
throw new Swift_SwiftException('php-opendkim extension not found');
}
@@ -42,7 +44,7 @@ class Swift_Signers_OpenDKIMSigner extends Swift_Signers_DKIMSigner
{
$header = new Swift_Mime_Headers_OpenDKIMHeader('DKIM-Signature');
$headerVal = $this->dkimHandler->getSignatureHeader();
- if (!$headerVal) {
+ if (false === $headerVal || \is_int($headerVal)) {
throw new Swift_SwiftException('OpenDKIM Error: '.$this->dkimHandler->getError());
}
$header->setValue($headerVal);
@@ -53,14 +55,10 @@ class Swift_Signers_OpenDKIMSigner extends Swift_Signers_DKIMSigner
public function setHeaders(Swift_Mime_SimpleHeaderSet $headers)
{
- $bodyLen = $this->bodyLen;
- if (is_bool($bodyLen)) {
- $bodyLen = -1;
- }
- $hash = $this->hashAlgorithm == 'rsa-sha1' ? OpenDKIMSign::ALG_RSASHA1 : OpenDKIMSign::ALG_RSASHA256;
- $bodyCanon = $this->bodyCanon == 'simple' ? OpenDKIMSign::CANON_SIMPLE : OpenDKIMSign::CANON_RELAXED;
- $headerCanon = $this->headerCanon == 'simple' ? OpenDKIMSign::CANON_SIMPLE : OpenDKIMSign::CANON_RELAXED;
- $this->dkimHandler = new OpenDKIMSign($this->privateKey, $this->selector, $this->domainName, $headerCanon, $bodyCanon, $hash, $bodyLen);
+ $hash = 'rsa-sha1' == $this->hashAlgorithm ? OpenDKIMSign::ALG_RSASHA1 : OpenDKIMSign::ALG_RSASHA256;
+ $bodyCanon = 'simple' == $this->bodyCanon ? OpenDKIMSign::CANON_SIMPLE : OpenDKIMSign::CANON_RELAXED;
+ $headerCanon = 'simple' == $this->headerCanon ? OpenDKIMSign::CANON_SIMPLE : OpenDKIMSign::CANON_RELAXED;
+ $this->dkimHandler = new OpenDKIMSign($this->privateKey, $this->selector, $this->domainName, $headerCanon, $bodyCanon, $hash, -1);
// Hardcode signature Margin for now
$this->dkimHandler->setMargin(78);
@@ -77,11 +75,11 @@ class Swift_Signers_OpenDKIMSigner extends Swift_Signers_DKIMSigner
$listHeaders = $headers->listAll();
foreach ($listHeaders as $hName) {
// Check if we need to ignore Header
- if (!isset($this->ignoredHeaders[strtolower($hName)])) {
+ if (!isset($this->ignoredHeaders[strtolower($hName ?? '')])) {
$tmp = $headers->getAll($hName);
if ($headers->has($hName)) {
foreach ($tmp as $header) {
- if ($header->getFieldBody() != '') {
+ if ('' != $header->getFieldBody()) {
$htosign = $header->toString();
$this->dkimHandler->header($htosign);
$this->signedHeaders[] = $header->getFieldName();
@@ -172,13 +170,13 @@ class Swift_Signers_OpenDKIMSigner extends Swift_Signers_DKIMSigner
if (!$this->peclLoaded) {
return parent::canonicalizeBody($string);
}
- if (false && $this->dropFirstLF === true) {
- if ($string[0] == "\r" && $string[1] == "\n") {
+ if (true === $this->dropFirstLF) {
+ if ("\r" == $string[0] && "\n" == $string[1]) {
$string = substr($string, 2);
}
}
$this->dropFirstLF = false;
- if (strlen($string)) {
+ if (\strlen($string)) {
$this->dkimHandler->body($string);
}
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/SMimeSigner.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/SMimeSigner.php
index e2231151993..3dd3cd05f04 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/SMimeSigner.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Signers/SMimeSigner.php
@@ -11,9 +11,9 @@
/**
* MIME Message Signer used to apply S/MIME Signature/Encryption to a message.
*
- *
* @author Romain-Geissler
* @author Sebastiaan Stok
+ * @author Jan Flora
*/
class Swift_Signers_SMimeSigner implements Swift_Signers_BodySigner
{
@@ -27,6 +27,7 @@ class Swift_Signers_SMimeSigner implements Swift_Signers_BodySigner
protected $encryptOptions;
protected $encryptCipher;
protected $extraCerts = null;
+ protected $wrapFullMessage = false;
/**
* @var Swift_StreamFilters_StringReplacementFilterFactory
@@ -65,7 +66,7 @@ class Swift_Signers_SMimeSigner implements Swift_Signers_BodySigner
/**
* Set the certificate location to use for signing.
*
- * @see http://www.php.net/manual/en/openssl.pkcs7.flags.php
+ * @see https://secure.php.net/manual/en/openssl.pkcs7.flags.php
*
* @param string $certificate
* @param string|array $privateKey If the key needs an passphrase use array('file-location', 'passphrase') instead
@@ -79,7 +80,7 @@ class Swift_Signers_SMimeSigner implements Swift_Signers_BodySigner
$this->signCertificate = 'file://'.str_replace('\\', '/', realpath($certificate));
if (null !== $privateKey) {
- if (is_array($privateKey)) {
+ if (\is_array($privateKey)) {
$this->signPrivateKey = $privateKey;
$this->signPrivateKey[0] = 'file://'.str_replace('\\', '/', realpath($privateKey[0]));
} else {
@@ -88,9 +89,7 @@ class Swift_Signers_SMimeSigner implements Swift_Signers_BodySigner
}
$this->signOptions = $signOptions;
- if (null !== $extraCerts) {
- $this->extraCerts = str_replace('\\', '/', realpath($extraCerts));
- }
+ $this->extraCerts = $extraCerts ? realpath($extraCerts) : null;
return $this;
}
@@ -98,8 +97,8 @@ class Swift_Signers_SMimeSigner implements Swift_Signers_BodySigner
/**
* Set the certificate location to use for encryption.
*
- * @see http://www.php.net/manual/en/openssl.pkcs7.flags.php
- * @see http://nl3.php.net/manual/en/openssl.ciphers.php
+ * @see https://secure.php.net/manual/en/openssl.pkcs7.flags.php
+ * @see https://secure.php.net/manual/en/openssl.ciphers.php
*
* @param string|array $recipientCerts Either an single X.509 certificate, or an assoc array of X.509 certificates.
* @param int $cipher
@@ -108,8 +107,8 @@ class Swift_Signers_SMimeSigner implements Swift_Signers_BodySigner
*/
public function setEncryptCertificate($recipientCerts, $cipher = null)
{
- if (is_array($recipientCerts)) {
- $this->encryptCert = array();
+ if (\is_array($recipientCerts)) {
+ $this->encryptCert = [];
foreach ($recipientCerts as $cert) {
$this->encryptCert[] = 'file://'.str_replace('\\', '/', realpath($cert));
@@ -178,9 +177,27 @@ class Swift_Signers_SMimeSigner implements Swift_Signers_BodySigner
}
/**
- * Change the Swift_Message to apply the signing.
+ * Specify whether to wrap the entire MIME message in the S/MIME message.
*
- * @param Swift_Message $message
+ * According to RFC5751 section 3.1:
+ * In order to protect outer, non-content-related message header fields
+ * (for instance, the "Subject", "To", "From", and "Cc" fields), the
+ * sending client MAY wrap a full MIME message in a message/rfc822
+ * wrapper in order to apply S/MIME security services to these header
+ * fields. It is up to the receiving client to decide how to present
+ * this "inner" header along with the unprotected "outer" header.
+ *
+ * @param bool $wrap
+ *
+ * @return $this
+ */
+ public function setWrapFullMessage($wrap)
+ {
+ $this->wrapFullMessage = $wrap;
+ }
+
+ /**
+ * Change the Swift_Message to apply the signing.
*
* @return $this
*/
@@ -190,17 +207,13 @@ class Swift_Signers_SMimeSigner implements Swift_Signers_BodySigner
return $this;
}
- // Store the message using ByteStream to a file{1}
- // Remove all Children
- // Sign file{1}, parse the new MIME headers and set them on the primary MimeEntity
- // Set the singed-body as the new body (without boundary)
-
- $messageStream = new Swift_ByteStream_TemporaryFileByteStream();
- $this->toSMimeByteStream($messageStream, $message);
- $message->setEncoder(Swift_DependencyContainer::getInstance()->lookup('mime.rawcontentencoder'));
-
- $message->setChildren(array());
- $this->streamToMime($messageStream, $message);
+ if ($this->signThenEncrypt) {
+ $this->smimeSignMessage($message);
+ $this->smimeEncryptMessage($message);
+ } else {
+ $this->smimeEncryptMessage($message);
+ $this->smimeSignMessage($message);
+ }
}
/**
@@ -210,102 +223,303 @@ class Swift_Signers_SMimeSigner implements Swift_Signers_BodySigner
*/
public function getAlteredHeaders()
{
- return array('Content-Type', 'Content-Transfer-Encoding', 'Content-Disposition');
+ return ['Content-Type', 'Content-Transfer-Encoding', 'Content-Disposition'];
}
/**
- * @param Swift_InputByteStream $inputStream
- * @param Swift_Message $mimeEntity
+ * Sign a Swift message.
*/
- protected function toSMimeByteStream(Swift_InputByteStream $inputStream, Swift_Message $message)
+ protected function smimeSignMessage(Swift_Message $message)
{
- $mimeEntity = $this->createMessage($message);
- $messageStream = new Swift_ByteStream_TemporaryFileByteStream();
-
- $mimeEntity->toByteStream($messageStream);
- $messageStream->commit();
-
- if (null !== $this->signCertificate && null !== $this->encryptCert) {
- $temporaryStream = new Swift_ByteStream_TemporaryFileByteStream();
-
- if ($this->signThenEncrypt) {
- $this->messageStreamToSignedByteStream($messageStream, $temporaryStream);
- $this->messageStreamToEncryptedByteStream($temporaryStream, $inputStream);
- } else {
- $this->messageStreamToEncryptedByteStream($messageStream, $temporaryStream);
- $this->messageStreamToSignedByteStream($temporaryStream, $inputStream);
- }
- } elseif ($this->signCertificate !== null) {
- $this->messageStreamToSignedByteStream($messageStream, $inputStream);
- } else {
- $this->messageStreamToEncryptedByteStream($messageStream, $inputStream);
+ // If we don't have a certificate we can't sign the message
+ if (null === $this->signCertificate) {
+ return;
}
- }
- /**
- * @param Swift_Message $message
- *
- * @return Swift_Message
- */
- protected function createMessage(Swift_Message $message)
- {
- $mimeEntity = new Swift_Message('', $message->getBody(), $message->getContentType(), $message->getCharset());
- $mimeEntity->setChildren($message->getChildren());
+ // Work on a clone of the original message
+ $signMessage = clone $message;
+ $signMessage->clearSigners();
- $messageHeaders = $mimeEntity->getHeaders();
- $messageHeaders->remove('Message-ID');
- $messageHeaders->remove('Date');
- $messageHeaders->remove('Subject');
- $messageHeaders->remove('MIME-Version');
- $messageHeaders->remove('To');
- $messageHeaders->remove('From');
+ if ($this->wrapFullMessage) {
+ // The original message essentially becomes the body of the new
+ // wrapped message
+ $signMessage = $this->wrapMimeMessage($signMessage);
+ } else {
+ // Only keep header needed to parse the body correctly
+ $this->clearAllHeaders($signMessage);
+ $this->copyHeaders(
+ $message,
+ $signMessage,
+ [
+ 'Content-Type',
+ 'Content-Transfer-Encoding',
+ 'Content-Disposition',
+ ]
+ );
+ }
- return $mimeEntity;
- }
-
- /**
- * @param Swift_FileStream $outputStream
- * @param Swift_InputByteStream $inputStream
- *
- * @throws Swift_IoException
- */
- protected function messageStreamToSignedByteStream(Swift_FileStream $outputStream, Swift_InputByteStream $inputStream)
- {
+ // Copy the cloned message into a temporary file stream
+ $messageStream = new Swift_ByteStream_TemporaryFileByteStream();
+ $signMessage->toByteStream($messageStream);
+ $messageStream->commit();
$signedMessageStream = new Swift_ByteStream_TemporaryFileByteStream();
- $args = array($outputStream->getPath(), $signedMessageStream->getPath(), $this->signCertificate, $this->signPrivateKey, array(), $this->signOptions);
- if (null !== $this->extraCerts) {
- $args[] = $this->extraCerts;
- }
-
- if (!call_user_func_array('openssl_pkcs7_sign', $args)) {
+ // Sign the message using openssl
+ if (!openssl_pkcs7_sign(
+ $messageStream->getPath(),
+ $signedMessageStream->getPath(),
+ $this->signCertificate,
+ $this->signPrivateKey,
+ [],
+ $this->signOptions,
+ $this->extraCerts
+ )
+ ) {
throw new Swift_IoException(sprintf('Failed to sign S/Mime message. Error: "%s".', openssl_error_string()));
}
- $this->copyFromOpenSSLOutput($signedMessageStream, $inputStream);
+ // Parse the resulting signed message content back into the Swift message
+ // preserving the original headers
+ $this->parseSSLOutput($signedMessageStream, $message);
}
/**
- * @param Swift_FileStream $outputStream
- * @param Swift_InputByteStream $is
- *
- * @throws Swift_IoException
+ * Encrypt a Swift message.
*/
- protected function messageStreamToEncryptedByteStream(Swift_FileStream $outputStream, Swift_InputByteStream $is)
+ protected function smimeEncryptMessage(Swift_Message $message)
{
+ // If we don't have a certificate we can't encrypt the message
+ if (null === $this->encryptCert) {
+ return;
+ }
+
+ // Work on a clone of the original message
+ $encryptMessage = clone $message;
+ $encryptMessage->clearSigners();
+
+ if ($this->wrapFullMessage) {
+ // The original message essentially becomes the body of the new
+ // wrapped message
+ $encryptMessage = $this->wrapMimeMessage($encryptMessage);
+ } else {
+ // Only keep header needed to parse the body correctly
+ $this->clearAllHeaders($encryptMessage);
+ $this->copyHeaders(
+ $message,
+ $encryptMessage,
+ [
+ 'Content-Type',
+ 'Content-Transfer-Encoding',
+ 'Content-Disposition',
+ ]
+ );
+ }
+
+ // Convert the message content (including headers) to a string
+ // and place it in a temporary file
+ $messageStream = new Swift_ByteStream_TemporaryFileByteStream();
+ $encryptMessage->toByteStream($messageStream);
+ $messageStream->commit();
$encryptedMessageStream = new Swift_ByteStream_TemporaryFileByteStream();
- if (!openssl_pkcs7_encrypt($outputStream->getPath(), $encryptedMessageStream->getPath(), $this->encryptCert, array(), 0, $this->encryptCipher)) {
+ // Encrypt the message
+ if (!openssl_pkcs7_encrypt(
+ $messageStream->getPath(),
+ $encryptedMessageStream->getPath(),
+ $this->encryptCert,
+ [],
+ 0,
+ $this->encryptCipher
+ )
+ ) {
throw new Swift_IoException(sprintf('Failed to encrypt S/Mime message. Error: "%s".', openssl_error_string()));
}
- $this->copyFromOpenSSLOutput($encryptedMessageStream, $is);
+ // Parse the resulting signed message content back into the Swift message
+ // preserving the original headers
+ $this->parseSSLOutput($encryptedMessageStream, $message);
}
/**
- * @param Swift_OutputByteStream $fromStream
- * @param Swift_InputByteStream $toStream
+ * Copy named headers from one Swift message to another.
*/
+ protected function copyHeaders(
+ Swift_Message $fromMessage,
+ Swift_Message $toMessage,
+ array $headers = []
+ ) {
+ foreach ($headers as $header) {
+ $this->copyHeader($fromMessage, $toMessage, $header);
+ }
+ }
+
+ /**
+ * Copy a single header from one Swift message to another.
+ *
+ * @param string $headerName
+ */
+ protected function copyHeader(Swift_Message $fromMessage, Swift_Message $toMessage, $headerName)
+ {
+ $header = $fromMessage->getHeaders()->get($headerName);
+ if (!$header) {
+ return;
+ }
+ $headers = $toMessage->getHeaders();
+ switch ($header->getFieldType()) {
+ case Swift_Mime_Header::TYPE_TEXT:
+ $headers->addTextHeader($header->getFieldName(), $header->getValue());
+ break;
+ case Swift_Mime_Header::TYPE_PARAMETERIZED:
+ $headers->addParameterizedHeader(
+ $header->getFieldName(),
+ $header->getValue(),
+ $header->getParameters()
+ );
+ break;
+ }
+ }
+
+ /**
+ * Remove all headers from a Swift message.
+ */
+ protected function clearAllHeaders(Swift_Message $message)
+ {
+ $headers = $message->getHeaders();
+ foreach ($headers->listAll() as $header) {
+ $headers->removeAll($header);
+ }
+ }
+
+ /**
+ * Wraps a Swift_Message in a message/rfc822 MIME part.
+ *
+ * @return Swift_MimePart
+ */
+ protected function wrapMimeMessage(Swift_Message $message)
+ {
+ // Start by copying the original message into a message stream
+ $messageStream = new Swift_ByteStream_TemporaryFileByteStream();
+ $message->toByteStream($messageStream);
+ $messageStream->commit();
+
+ // Create a new MIME part that wraps the original stream
+ $wrappedMessage = new Swift_MimePart($messageStream, 'message/rfc822');
+ $wrappedMessage->setEncoder(new Swift_Mime_ContentEncoder_PlainContentEncoder('7bit'));
+
+ return $wrappedMessage;
+ }
+
+ protected function parseSSLOutput(Swift_InputByteStream $inputStream, Swift_Message $message)
+ {
+ $messageStream = new Swift_ByteStream_TemporaryFileByteStream();
+ $this->copyFromOpenSSLOutput($inputStream, $messageStream);
+
+ $this->streamToMime($messageStream, $message);
+ }
+
+ /**
+ * Merges an OutputByteStream from OpenSSL to a Swift_Message.
+ */
+ protected function streamToMime(Swift_OutputByteStream $fromStream, Swift_Message $message)
+ {
+ // Parse the stream into headers and body
+ list($headers, $messageStream) = $this->parseStream($fromStream);
+
+ // Get the original message headers
+ $messageHeaders = $message->getHeaders();
+
+ // Let the stream determine the headers describing the body content,
+ // since the body of the original message is overwritten by the body
+ // coming from the stream.
+ // These are all content-* headers.
+
+ // Default transfer encoding is 7bit if not set
+ $encoding = '';
+ // Remove all existing transfer encoding headers
+ $messageHeaders->removeAll('Content-Transfer-Encoding');
+ // See whether the stream sets the transfer encoding
+ if (isset($headers['content-transfer-encoding'])) {
+ $encoding = $headers['content-transfer-encoding'];
+ }
+
+ // We use the null content encoder, since the body is already encoded
+ // according to the transfer encoding specified in the stream
+ $message->setEncoder(new Swift_Mime_ContentEncoder_NullContentEncoder($encoding));
+
+ // Set the disposition, if present
+ if (isset($headers['content-disposition'])) {
+ $messageHeaders->addTextHeader('Content-Disposition', $headers['content-disposition']);
+ }
+
+ // Copy over the body from the stream using the content type dictated
+ // by the stream content
+ $message->setChildren([]);
+ $message->setBody($messageStream, $headers['content-type']);
+ }
+
+ /**
+ * This message will parse the headers of a MIME email byte stream
+ * and return an array that contains the headers as an associative
+ * array and the email body as a string.
+ *
+ * @return array
+ */
+ protected function parseStream(Swift_OutputByteStream $emailStream)
+ {
+ $bufferLength = 78;
+ $headerData = '';
+ $headerBodySeparator = "\r\n\r\n";
+
+ $emailStream->setReadPointer(0);
+
+ // Read out the headers section from the stream to a string
+ while (false !== ($buffer = $emailStream->read($bufferLength))) {
+ $headerData .= $buffer;
+
+ $headersPosEnd = strpos($headerData, $headerBodySeparator);
+
+ // Stop reading if we found the end of the headers
+ if (false !== $headersPosEnd) {
+ break;
+ }
+ }
+
+ // Split the header data into lines
+ $headerData = trim(substr($headerData, 0, $headersPosEnd));
+ $headerLines = explode("\r\n", $headerData);
+ unset($headerData);
+
+ $headers = [];
+ $currentHeaderName = '';
+
+ // Transform header lines into an associative array
+ foreach ($headerLines as $headerLine) {
+ // Handle headers that span multiple lines
+ if (false === strpos($headerLine, ':')) {
+ $headers[$currentHeaderName] .= ' '.trim($headerLine ?? '');
+ continue;
+ }
+
+ $header = explode(':', $headerLine, 2);
+ $currentHeaderName = strtolower($header[0] ?? '');
+ $headers[$currentHeaderName] = trim($header[1] ?? '');
+ }
+
+ // Read the entire email body into a byte stream
+ $bodyStream = new Swift_ByteStream_TemporaryFileByteStream();
+
+ // Skip the header and separator and point to the body
+ $emailStream->setReadPointer($headersPosEnd + \strlen($headerBodySeparator));
+
+ while (false !== ($buffer = $emailStream->read($bufferLength))) {
+ $bodyStream->write($buffer);
+ }
+
+ $bodyStream->commit();
+
+ return [$headers, $bodyStream];
+ }
+
protected function copyFromOpenSSLOutput(Swift_OutputByteStream $fromStream, Swift_InputByteStream $toStream)
{
$bufferLength = 4096;
@@ -325,93 +539,4 @@ class Swift_Signers_SMimeSigner implements Swift_Signers_BodySigner
$toStream->commit();
}
-
- /**
- * Merges an OutputByteStream to Swift_Message.
- *
- * @param Swift_OutputByteStream $fromStream
- * @param Swift_Message $message
- */
- protected function streamToMime(Swift_OutputByteStream $fromStream, Swift_Message $message)
- {
- $bufferLength = 78;
- $headerData = '';
-
- $fromStream->setReadPointer(0);
-
- while (($buffer = $fromStream->read($bufferLength)) !== false) {
- $headerData .= $buffer;
-
- if (false !== strpos($buffer, "\r\n\r\n")) {
- break;
- }
- }
-
- $headersPosEnd = strpos($headerData, "\r\n\r\n");
- $headerData = trim($headerData);
- $headerData = substr($headerData, 0, $headersPosEnd);
- $headerLines = explode("\r\n", $headerData);
- unset($headerData);
-
- $headers = array();
- $currentHeaderName = '';
-
- foreach ($headerLines as $headerLine) {
- // Line separated
- if (ctype_space($headerLines[0]) || false === strpos($headerLine, ':')) {
- $headers[$currentHeaderName] .= ' '.trim($headerLine);
- continue;
- }
-
- $header = explode(':', $headerLine, 2);
- $currentHeaderName = strtolower($header[0]);
- $headers[$currentHeaderName] = trim($header[1]);
- }
-
- $messageStream = new Swift_ByteStream_TemporaryFileByteStream();
- $messageStream->addFilter($this->replacementFactory->createFilter("\r\n", "\n"), 'CRLF to LF');
- $messageStream->addFilter($this->replacementFactory->createFilter("\n", "\r\n"), 'LF to CRLF');
-
- $messageHeaders = $message->getHeaders();
-
- // No need to check for 'application/pkcs7-mime', as this is always base64
- if ('multipart/signed;' === substr($headers['content-type'], 0, 17)) {
- if (!preg_match('/boundary=("[^"]+"|(?:[^\s]+|$))/is', $headers['content-type'], $contentTypeData)) {
- throw new Swift_SwiftException('Failed to find Boundary parameter');
- }
-
- $boundary = trim($contentTypeData['1'], '"');
-
- // Skip the header and CRLF CRLF
- $fromStream->setReadPointer($headersPosEnd + 4);
-
- while (false !== ($buffer = $fromStream->read($bufferLength))) {
- $messageStream->write($buffer);
- }
-
- $messageStream->commit();
-
- $messageHeaders->remove('Content-Transfer-Encoding');
- $message->setContentType($headers['content-type']);
- $message->setBoundary($boundary);
- $message->setBody($messageStream);
- } else {
- $fromStream->setReadPointer($headersPosEnd + 4);
-
- if (null === $this->headerFactory) {
- $this->headerFactory = Swift_DependencyContainer::getInstance()->lookup('mime.headerfactory');
- }
-
- $message->setContentType($headers['content-type']);
- $messageHeaders->set($this->headerFactory->createTextHeader('Content-Transfer-Encoding', $headers['content-transfer-encoding']));
- $messageHeaders->set($this->headerFactory->createTextHeader('Content-Disposition', $headers['content-disposition']));
-
- while (false !== ($buffer = $fromStream->read($bufferLength))) {
- $messageStream->write($buffer);
- }
-
- $messageStream->commit();
- $message->setBody($messageStream);
- }
- }
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/SmtpTransport.php b/htdocs/includes/swiftmailer/lib/classes/Swift/SmtpTransport.php
index 011c03ab188..56b62323ad7 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/SmtpTransport.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/SmtpTransport.php
@@ -23,22 +23,23 @@
class Swift_SmtpTransport extends Swift_Transport_EsmtpTransport
{
/**
- * Create a new SmtpTransport, optionally with $host, $port and $security.
- *
* @param string $host
* @param int $port
- * @param string $security
+ * @param string|null $encryption SMTP encryption mode:
+ * - null for plain SMTP (no encryption),
+ * - 'tls' for SMTP with STARTTLS (best effort encryption),
+ * - 'ssl' for SMTPS = SMTP over TLS (always encrypted).
*/
- public function __construct($host = 'localhost', $port = 25, $security = null)
+ public function __construct($host = 'localhost', $port = 25, $encryption = null)
{
- call_user_func_array(
- array($this, 'Swift_Transport_EsmtpTransport::__construct'),
+ \call_user_func_array(
+ [$this, 'Swift_Transport_EsmtpTransport::__construct'],
Swift_DependencyContainer::getInstance()
->createDependenciesFor('transport.smtp')
- );
+ );
$this->setHost($host);
$this->setPort($port);
- $this->setEncryption($security);
+ $this->setEncryption($encryption);
}
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/SpoolTransport.php b/htdocs/includes/swiftmailer/lib/classes/Swift/SpoolTransport.php
index f92567ba021..c08e0fb17d5 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/SpoolTransport.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/SpoolTransport.php
@@ -17,8 +17,6 @@ class Swift_SpoolTransport extends Swift_Transport_SpoolTransport
{
/**
* Create a new SpoolTransport.
- *
- * @param Swift_Spool $spool
*/
public function __construct(Swift_Spool $spool)
{
@@ -27,8 +25,8 @@ class Swift_SpoolTransport extends Swift_Transport_SpoolTransport
$arguments[] = $spool;
- call_user_func_array(
- array($this, 'Swift_Transport_SpoolTransport::__construct'),
+ \call_user_func_array(
+ [$this, 'Swift_Transport_SpoolTransport::__construct'],
$arguments
);
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/StreamFilters/ByteArrayReplacementFilter.php b/htdocs/includes/swiftmailer/lib/classes/Swift/StreamFilters/ByteArrayReplacementFilter.php
index ba1f6d323fc..7e5ddf1b7da 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/StreamFilters/ByteArrayReplacementFilter.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/StreamFilters/ByteArrayReplacementFilter.php
@@ -17,9 +17,6 @@
*/
class Swift_StreamFilters_ByteArrayReplacementFilter implements Swift_StreamFilter
{
- /** The needle(s) to search for */
- private $search;
-
/** The replacement(s) to make */
private $replace;
@@ -27,7 +24,7 @@ class Swift_StreamFilters_ByteArrayReplacementFilter implements Swift_StreamFilt
private $index;
/** The Search Tree */
- private $tree = array();
+ private $tree = [];
/** Gives the size of the largest search */
private $treeMaxLen = 0;
@@ -42,26 +39,25 @@ class Swift_StreamFilters_ByteArrayReplacementFilter implements Swift_StreamFilt
*/
public function __construct($search, $replace)
{
- $this->search = $search;
- $this->index = array();
- $this->tree = array();
- $this->replace = array();
- $this->repSize = array();
+ $this->index = [];
+ $this->tree = [];
+ $this->replace = [];
+ $this->repSize = [];
$tree = null;
$i = null;
$last_size = $size = 0;
foreach ($search as $i => $search_element) {
- if ($tree !== null) {
- $tree[-1] = min(count($replace) - 1, $i - 1);
+ if (null !== $tree) {
+ $tree[-1] = min(\count($replace) - 1, $i - 1);
$tree[-2] = $last_size;
}
$tree = &$this->tree;
- if (is_array($search_element)) {
+ if (\is_array($search_element)) {
foreach ($search_element as $k => $char) {
$this->index[$char] = true;
if (!isset($tree[$char])) {
- $tree[$char] = array();
+ $tree[$char] = [];
}
$tree = &$tree[$char];
}
@@ -70,27 +66,27 @@ class Swift_StreamFilters_ByteArrayReplacementFilter implements Swift_StreamFilt
} else {
$last_size = 1;
if (!isset($tree[$search_element])) {
- $tree[$search_element] = array();
+ $tree[$search_element] = [];
}
$tree = &$tree[$search_element];
$size = max($last_size, $size);
$this->index[$search_element] = true;
}
}
- if ($i !== null) {
- $tree[-1] = min(count($replace) - 1, $i);
+ if (null !== $i) {
+ $tree[-1] = min(\count($replace) - 1, $i);
$tree[-2] = $last_size;
$this->treeMaxLen = $size;
}
foreach ($replace as $rep) {
- if (!is_array($rep)) {
- $rep = array($rep);
+ if (!\is_array($rep)) {
+ $rep = [$rep];
}
$this->replace[] = $rep;
}
- for ($i = count($this->replace) - 1; $i >= 0; --$i) {
+ for ($i = \count($this->replace) - 1; $i >= 0; --$i) {
$this->replace[$i] = $rep = $this->filter($this->replace[$i], $i);
- $this->repSize[$i] = count($rep);
+ $this->repSize[$i] = \count($rep);
}
}
@@ -118,12 +114,12 @@ class Swift_StreamFilters_ByteArrayReplacementFilter implements Swift_StreamFilt
*/
public function filter($buffer, $minReplaces = -1)
{
- if ($this->treeMaxLen == 0) {
+ if (0 == $this->treeMaxLen) {
return $buffer;
}
- $newBuffer = array();
- $buf_size = count($buffer);
+ $newBuffer = [];
+ $buf_size = \count($buffer);
$last_size = 0;
for ($i = 0; $i < $buf_size; ++$i) {
$search_pos = $this->tree;
@@ -141,7 +137,7 @@ class Swift_StreamFilters_ByteArrayReplacementFilter implements Swift_StreamFilt
}
}
// We got a complete pattern
- elseif ($last_found !== PHP_INT_MAX) {
+ elseif (PHP_INT_MAX !== $last_found) {
// Adding replacement datas to output buffer
$rep_size = $this->repSize[$last_found];
for ($j = 0; $j < $rep_size; ++$j) {
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/StreamFilters/StringReplacementFilterFactory.php b/htdocs/includes/swiftmailer/lib/classes/Swift/StreamFilters/StringReplacementFilterFactory.php
index f60f0cf8218..783b8896dd7 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/StreamFilters/StringReplacementFilterFactory.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/StreamFilters/StringReplacementFilterFactory.php
@@ -16,7 +16,7 @@
class Swift_StreamFilters_StringReplacementFilterFactory implements Swift_ReplacementFilterFactory
{
/** Lazy-loaded filters */
- private $filters = array();
+ private $filters = [];
/**
* Create a new StreamFilter to replace $search with $replace in a string.
@@ -30,11 +30,11 @@ class Swift_StreamFilters_StringReplacementFilterFactory implements Swift_Replac
{
if (!isset($this->filters[$search][$replace])) {
if (!isset($this->filters[$search])) {
- $this->filters[$search] = array();
+ $this->filters[$search] = [];
}
if (!isset($this->filters[$search][$replace])) {
- $this->filters[$search][$replace] = array();
+ $this->filters[$search][$replace] = [];
}
$this->filters[$search][$replace] = new Swift_StreamFilters_StringReplacementFilter($search, $replace);
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/SwiftException.php b/htdocs/includes/swiftmailer/lib/classes/Swift/SwiftException.php
index db3d31093ef..15e68b18e79 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/SwiftException.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/SwiftException.php
@@ -18,9 +18,8 @@ class Swift_SwiftException extends Exception
/**
* Create a new SwiftException with $message.
*
- * @param string $message
- * @param int $code
- * @param Exception $previous
+ * @param string $message
+ * @param int $code
*/
public function __construct($message, $code = 0, Exception $previous = null)
{
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport.php
index f6214b7bfc5..bc324e8685a 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport.php
@@ -61,8 +61,9 @@ interface Swift_Transport
* Recipient/sender data will be retrieved from the Message API.
* The return value is the number of recipients who were accepted for delivery.
*
- * @param Swift_Mime_SimpleMessage $message
- * @param string[] $failedRecipients An array of failures by-reference
+ * This is the responsibility of the send method to start the transport if needed.
+ *
+ * @param string[] $failedRecipients An array of failures by-reference
*
* @return int
*/
@@ -70,8 +71,6 @@ interface Swift_Transport
/**
* Register a plugin in the Transport.
- *
- * @param Swift_Events_EventListener $plugin
*/
public function registerPlugin(Swift_Events_EventListener $plugin);
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php
index 34c3323fdba..d2dbd7a66a0 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php
@@ -27,6 +27,14 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
/** The event dispatching layer */
protected $eventDispatcher;
+ protected $addressEncoder;
+
+ /** Whether the PIPELINING SMTP extension is enabled (RFC 2920) */
+ protected $pipelining = null;
+
+ /** The pipelined commands waiting for response */
+ protected $pipeline = [];
+
/** Source Ip */
protected $sourceIp;
@@ -36,14 +44,13 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
/**
* Creates a new EsmtpTransport using the given I/O buffer.
*
- * @param Swift_Transport_IoBuffer $buf
- * @param Swift_Events_EventDispatcher $dispatcher
- * @param string $localDomain
+ * @param string $localDomain
*/
- public function __construct(Swift_Transport_IoBuffer $buf, Swift_Events_EventDispatcher $dispatcher, $localDomain = '127.0.0.1')
+ public function __construct(Swift_Transport_IoBuffer $buf, Swift_Events_EventDispatcher $dispatcher, $localDomain = '127.0.0.1', Swift_AddressEncoder $addressEncoder = null)
{
- $this->eventDispatcher = $dispatcher;
$this->buffer = $buf;
+ $this->eventDispatcher = $dispatcher;
+ $this->addressEncoder = $addressEncoder ?? new Swift_AddressEncoder_IdnAddressEncoder();
$this->setLocalDomain($localDomain);
}
@@ -63,7 +70,7 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
*/
public function setLocalDomain($domain)
{
- if (substr($domain, 0, 1) !== '[') {
+ if ('[' !== substr($domain, 0, 1)) {
if (filter_var($domain, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
$domain = '['.$domain.']';
} elseif (filter_var($domain, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
@@ -109,6 +116,16 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
return $this->sourceIp;
}
+ public function setAddressEncoder(Swift_AddressEncoder $addressEncoder)
+ {
+ $this->addressEncoder = $addressEncoder;
+ }
+
+ public function getAddressEncoder()
+ {
+ return $this->addressEncoder;
+ }
+
/**
* Start the SMTP connection.
*/
@@ -154,13 +171,16 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
* Recipient/sender data will be retrieved from the Message API.
* The return value is the number of recipients who were accepted for delivery.
*
- * @param Swift_Mime_SimpleMessage $message
- * @param string[] $failedRecipients An array of failures by-reference
+ * @param string[] $failedRecipients An array of failures by-reference
*
* @return int
*/
public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null)
{
+ if (!$this->isStarted()) {
+ $this->start();
+ }
+
$sent = 0;
$failedRecipients = (array) $failedRecipients;
@@ -172,31 +192,24 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
}
if (!$reversePath = $this->getReversePath($message)) {
- $this->throwException(new Swift_TransportException(
- 'Cannot send message without a sender address'
- )
- );
+ $this->throwException(new Swift_TransportException('Cannot send message without a sender address'));
}
$to = (array) $message->getTo();
$cc = (array) $message->getCc();
- $tos = array_merge($to, $cc);
$bcc = (array) $message->getBcc();
+ $tos = array_merge($to, $cc, $bcc);
- $message->setBcc(array());
+ $message->setBcc([]);
try {
$sent += $this->sendTo($message, $reversePath, $tos, $failedRecipients);
- $sent += $this->sendBcc($message, $reversePath, $bcc, $failedRecipients);
- } catch (Exception $e) {
+ } finally {
$message->setBcc($bcc);
- throw $e;
}
- $message->setBcc($bcc);
-
if ($evt) {
- if ($sent == count($to) + count($cc) + count($bcc)) {
+ if ($sent == \count($to) + \count($cc) + \count($bcc)) {
$evt->setResult(Swift_Events_SendEvent::RESULT_SUCCESS);
} elseif ($sent > 0) {
$evt->setResult(Swift_Events_SendEvent::RESULT_TENTATIVE);
@@ -226,7 +239,7 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
}
try {
- $this->executeCommand("QUIT\r\n", array(221));
+ $this->executeCommand("QUIT\r\n", [221]);
} catch (Swift_TransportException $e) {
}
@@ -253,7 +266,7 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
$this->start();
}
- $this->executeCommand("NOOP\r\n", array(250));
+ $this->executeCommand("NOOP\r\n", [250]);
} catch (Swift_TransportException $e) {
try {
$this->stop();
@@ -268,8 +281,6 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
/**
* Register a plugin.
- *
- * @param Swift_Events_EventListener $plugin
*/
public function registerPlugin(Swift_Events_EventListener $plugin)
{
@@ -281,7 +292,7 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
*/
public function reset()
{
- $this->executeCommand("RSET\r\n", array(250));
+ $this->executeCommand("RSET\r\n", [250], $failures, true);
}
/**
@@ -299,22 +310,46 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
*
* If no response codes are given, the response will not be validated.
* If codes are given, an exception will be thrown on an invalid response.
+ * If the command is RCPT TO, and the pipeline is non-empty, no exception
+ * will be thrown; instead the failing address is added to $failures.
*
* @param string $command
* @param int[] $codes
* @param string[] $failures An array of failures by-reference
+ * @param bool $pipeline Do not wait for response
+ * @param string $address the address, if command is RCPT TO
*
- * @return string
+ * @return string|null The server response, or null if pipelining is enabled
*/
- public function executeCommand($command, $codes = array(), &$failures = null)
+ public function executeCommand($command, $codes = [], &$failures = null, $pipeline = false, $address = null)
{
$failures = (array) $failures;
$seq = $this->buffer->write($command);
- $response = $this->getFullResponse($seq);
if ($evt = $this->eventDispatcher->createCommandEvent($this, $command, $codes)) {
$this->eventDispatcher->dispatchEvent($evt, 'commandSent');
}
- $this->assertResponseCode($response, $codes);
+
+ $this->pipeline[] = [$command, $seq, $codes, $address];
+
+ if ($pipeline && $this->pipelining) {
+ return null;
+ }
+
+ $response = null;
+
+ while ($this->pipeline) {
+ list($command, $seq, $codes, $address) = array_shift($this->pipeline);
+ $response = $this->getFullResponse($seq);
+ try {
+ $this->assertResponseCode($response, $codes);
+ } catch (Swift_TransportException $e) {
+ if ($this->pipeline && $address) {
+ $failures[] = $address;
+ } else {
+ $this->throwException($e);
+ }
+ }
+ }
return $response;
}
@@ -322,51 +357,53 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
/** Read the opening SMTP greeting */
protected function readGreeting()
{
- $this->assertResponseCode($this->getFullResponse(0), array(220));
+ $this->assertResponseCode($this->getFullResponse(0), [220]);
}
/** Send the HELO welcome */
protected function doHeloCommand()
{
$this->executeCommand(
- sprintf("HELO %s\r\n", $this->domain), array(250)
+ sprintf("HELO %s\r\n", $this->domain), [250]
);
}
/** Send the MAIL FROM command */
protected function doMailFromCommand($address)
{
+ $address = $this->addressEncoder->encodeString($address);
$this->executeCommand(
- sprintf("MAIL FROM:<%s>\r\n", $address), array(250)
+ sprintf("MAIL FROM:<%s>\r\n", $address), [250], $failures, true
);
}
/** Send the RCPT TO command */
protected function doRcptToCommand($address)
{
+ $address = $this->addressEncoder->encodeString($address);
$this->executeCommand(
- sprintf("RCPT TO:<%s>\r\n", $address), array(250, 251, 252)
+ sprintf("RCPT TO:<%s>\r\n", $address), [250, 251, 252], $failures, true, $address
);
}
/** Send the DATA command */
- protected function doDataCommand()
+ protected function doDataCommand(&$failedRecipients)
{
- $this->executeCommand("DATA\r\n", array(354));
+ $this->executeCommand("DATA\r\n", [354], $failedRecipients);
}
/** Stream the contents of the message over the buffer */
protected function streamMessage(Swift_Mime_SimpleMessage $message)
{
- $this->buffer->setWriteTranslations(array("\r\n." => "\r\n.."));
+ $this->buffer->setWriteTranslations(["\r\n." => "\r\n.."]);
try {
$message->toByteStream($this->buffer);
$this->buffer->flushBuffers();
} catch (Swift_TransportException $e) {
$this->throwException($e);
}
- $this->buffer->setWriteTranslations(array());
- $this->executeCommand("\r\n.\r\n", array(250));
+ $this->buffer->setWriteTranslations([]);
+ $this->executeCommand("\r\n.\r\n", [250]);
}
/** Determine the best-use reverse path for this message */
@@ -406,8 +443,12 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
/** Throws an Exception if a response code is incorrect */
protected function assertResponseCode($response, $wanted)
{
+ if (!$response) {
+ $this->throwException(new Swift_TransportException('Expected response code '.implode('/', $wanted).' but got an empty response'));
+ }
+
list($code) = sscanf($response, '%3d');
- $valid = (empty($wanted) || in_array($code, $wanted));
+ $valid = (empty($wanted) || \in_array($code, $wanted));
if ($evt = $this->eventDispatcher->createResponseEvent($this, $response,
$valid)) {
@@ -415,12 +456,7 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
}
if (!$valid) {
- $this->throwException(
- new Swift_TransportException(
- 'Expected response code '.implode('/', $wanted).' but got code '.
- '"'.$code.'", with message "'.$response.'"',
- $code)
- );
+ $this->throwException(new Swift_TransportException('Expected response code '.implode('/', $wanted).' but got code "'.$code.'", with message "'.$response.'"', $code));
}
}
@@ -436,10 +472,7 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
} catch (Swift_TransportException $e) {
$this->throwException($e);
} catch (Swift_IoException $e) {
- $this->throwException(
- new Swift_TransportException(
- $e->getMessage())
- );
+ $this->throwException(new Swift_TransportException($e->getMessage(), 0, $e));
}
return $response;
@@ -456,11 +489,16 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
++$sent;
} catch (Swift_TransportException $e) {
$failedRecipients[] = $forwardPath;
+ } catch (Swift_AddressEncoderException $e) {
+ $failedRecipients[] = $forwardPath;
}
}
- if ($sent != 0) {
- $this->doDataCommand();
+ if (0 != $sent) {
+ $sent += \count($failedRecipients);
+ $this->doDataCommand($failedRecipients);
+ $sent -= \count($failedRecipients);
+
$this->streamMessage($message);
} else {
$this->reset();
@@ -480,20 +518,6 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
$failedRecipients);
}
- /** Send a message to all Bcc: recipients */
- private function sendBcc(Swift_Mime_SimpleMessage $message, $reversePath, array $bcc, array &$failedRecipients)
- {
- $sent = 0;
- foreach ($bcc as $forwardPath => $name) {
- $message->setBcc(array($forwardPath => $name));
- $sent += $this->doMailTransaction(
- $message, $reversePath, array($forwardPath), $failedRecipients
- );
- }
-
- return $sent;
- }
-
/**
* Destructor.
*/
@@ -504,4 +528,14 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
} catch (Exception $e) {
}
}
+
+ public function __sleep()
+ {
+ throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
+ }
+
+ public function __wakeup()
+ {
+ throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
+ }
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/CramMd5Authenticator.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/CramMd5Authenticator.php
index 26c2d745a95..bb3a1615096 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/CramMd5Authenticator.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/CramMd5Authenticator.php
@@ -26,29 +26,23 @@ class Swift_Transport_Esmtp_Auth_CramMd5Authenticator implements Swift_Transport
}
/**
- * Try to authenticate the user with $username and $password.
- *
- * @param Swift_Transport_SmtpAgent $agent
- * @param string $username
- * @param string $password
- *
- * @return bool
+ * {@inheritdoc}
*/
public function authenticate(Swift_Transport_SmtpAgent $agent, $username, $password)
{
try {
- $challenge = $agent->executeCommand("AUTH CRAM-MD5\r\n", array(334));
+ $challenge = $agent->executeCommand("AUTH CRAM-MD5\r\n", [334]);
$challenge = base64_decode(substr($challenge, 4));
$message = base64_encode(
$username.' '.$this->getResponse($password, $challenge)
- );
- $agent->executeCommand(sprintf("%s\r\n", $message), array(235));
+ );
+ $agent->executeCommand(sprintf("%s\r\n", $message), [235]);
return true;
} catch (Swift_TransportException $e) {
- $agent->executeCommand("RSET\r\n", array(250));
+ $agent->executeCommand("RSET\r\n", [250]);
- return false;
+ throw $e;
}
}
@@ -62,16 +56,16 @@ class Swift_Transport_Esmtp_Auth_CramMd5Authenticator implements Swift_Transport
*/
private function getResponse($secret, $challenge)
{
- if (strlen($secret) > 64) {
+ if (\strlen($secret) > 64) {
$secret = pack('H32', md5($secret));
}
- if (strlen($secret) < 64) {
- $secret = str_pad($secret, 64, chr(0));
+ if (\strlen($secret) < 64) {
+ $secret = str_pad($secret, 64, \chr(0));
}
- $k_ipad = substr($secret, 0, 64) ^ str_repeat(chr(0x36), 64);
- $k_opad = substr($secret, 0, 64) ^ str_repeat(chr(0x5C), 64);
+ $k_ipad = substr($secret, 0, 64) ^ str_repeat(\chr(0x36), 64);
+ $k_opad = substr($secret, 0, 64) ^ str_repeat(\chr(0x5C), 64);
$inner = pack('H32', md5($k_ipad.$challenge));
$digest = md5($k_opad.$inner);
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/LoginAuthenticator.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/LoginAuthenticator.php
index 6ab6e3337e2..0b9d81b8ad6 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/LoginAuthenticator.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/LoginAuthenticator.php
@@ -26,26 +26,20 @@ class Swift_Transport_Esmtp_Auth_LoginAuthenticator implements Swift_Transport_E
}
/**
- * Try to authenticate the user with $username and $password.
- *
- * @param Swift_Transport_SmtpAgent $agent
- * @param string $username
- * @param string $password
- *
- * @return bool
+ * {@inheritdoc}
*/
public function authenticate(Swift_Transport_SmtpAgent $agent, $username, $password)
{
try {
- $agent->executeCommand("AUTH LOGIN\r\n", array(334));
- $agent->executeCommand(sprintf("%s\r\n", base64_encode($username)), array(334));
- $agent->executeCommand(sprintf("%s\r\n", base64_encode($password)), array(235));
+ $agent->executeCommand("AUTH LOGIN\r\n", [334]);
+ $agent->executeCommand(sprintf("%s\r\n", base64_encode($username ?? '')), [334]);
+ $agent->executeCommand(sprintf("%s\r\n", base64_encode($password ?? '')), [235]);
return true;
} catch (Swift_TransportException $e) {
- $agent->executeCommand("RSET\r\n", array(250));
+ $agent->executeCommand("RSET\r\n", [250]);
- return false;
+ throw $e;
}
}
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php
index 7b8608d4a1b..41931fdd226 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php
@@ -31,63 +31,57 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
}
/**
- * Try to authenticate the user with $username and $password.
- *
- * @param Swift_Transport_SmtpAgent $agent
- * @param string $username
- * @param string $password
- *
- * @return bool
+ * {@inheritdoc}
*
* @throws \LogicException
*/
public function authenticate(Swift_Transport_SmtpAgent $agent, $username, $password)
{
- if (!function_exists('openssl_encrypt')) {
+ if (!\function_exists('openssl_encrypt')) {
throw new LogicException('The OpenSSL extension must be enabled to use the NTLM authenticator.');
}
- if (!function_exists('bcmul')) {
+ if (!\function_exists('bcmul')) {
throw new LogicException('The BCMath functions must be enabled to use the NTLM authenticator.');
}
try {
// execute AUTH command and filter out the code at the beginning
// AUTH NTLM xxxx
- $response = base64_decode(substr(trim($this->sendMessage1($agent)), 4));
+ $response = base64_decode(substr(trim($this->sendMessage1($agent) ?? ''), 4));
// extra parameters for our unit cases
- $timestamp = func_num_args() > 3 ? func_get_arg(3) : $this->getCorrectTimestamp(bcmul(microtime(true), '1000'));
- $client = func_num_args() > 4 ? func_get_arg(4) : $this->getRandomBytes(8);
+ $timestamp = \func_num_args() > 3 ? func_get_arg(3) : $this->getCorrectTimestamp(bcmul(microtime(true), '1000'));
+ $client = \func_num_args() > 4 ? func_get_arg(4) : random_bytes(8);
// Message 3 response
$this->sendMessage3($response, $username, $password, $timestamp, $client, $agent);
return true;
} catch (Swift_TransportException $e) {
- $agent->executeCommand("RSET\r\n", array(250));
+ $agent->executeCommand("RSET\r\n", [250]);
- return false;
+ throw $e;
}
}
protected function si2bin($si, $bits = 32)
{
$bin = null;
- if ($si >= -pow(2, $bits - 1) && ($si <= pow(2, $bits - 1))) {
+ if ($si >= -2 ** ($bits - 1) && ($si <= 2 ** ($bits - 1))) {
// positive or zero
if ($si >= 0) {
$bin = base_convert($si, 10, 2);
// pad to $bits bit
- $bin_length = strlen($bin);
+ $bin_length = \strlen($bin);
if ($bin_length < $bits) {
$bin = str_repeat('0', $bits - $bin_length).$bin;
}
} else {
// negative
- $si = -$si - pow(2, $bits);
+ $si = -$si - 2 ** $bits;
$bin = base_convert($si, 10, 2);
- $bin_length = strlen($bin);
+ $bin_length = \strlen($bin);
if ($bin_length > $bits) {
$bin = str_repeat('1', $bits - $bin_length).$bin;
}
@@ -100,15 +94,13 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
/**
* Send our auth message and returns the response.
*
- * @param Swift_Transport_SmtpAgent $agent
- *
* @return string SMTP Response
*/
protected function sendMessage1(Swift_Transport_SmtpAgent $agent)
{
$message = $this->createMessage1();
- return $agent->executeCommand(sprintf("AUTH %s %s\r\n", $this->getAuthKeyword(), base64_encode($message)), array(334));
+ return $agent->executeCommand(sprintf("AUTH %s %s\r\n", $this->getAuthKeyword(), base64_encode($message)), [334]);
}
/**
@@ -131,7 +123,7 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
$targetInfoBlock = substr($responseHex, $offset);
list($domainName, $serverName, $DNSDomainName, $DNSServerName, $terminatorByte) = $this->readSubBlock($targetInfoBlock);
- return array(
+ return [
$challenge,
$context,
$targetInfoH,
@@ -142,14 +134,12 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
$DNSServerName,
hex2bin($targetInfoBlock),
$terminatorByte,
- );
+ ];
}
/**
* Read the blob information in from message2.
*
- * @param $block
- *
* @return array
*/
protected function readSubBlock($block)
@@ -157,9 +147,9 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
// remove terminatorByte cause it's always the same
$block = substr($block, 0, -8);
- $length = strlen($block);
+ $length = \strlen($block);
$offset = 0;
- $data = array();
+ $data = [];
while ($offset < $length) {
$blockLength = hexdec(substr(substr($block, $offset, 8), -4)) / 256;
$offset += 8;
@@ -167,7 +157,7 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
$offset += $blockLength * 2;
}
- if (count($data) == 3) {
+ if (3 == \count($data)) {
$data[] = $data[2];
$data[2] = '';
}
@@ -180,13 +170,12 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
/**
* Send our final message with all our data.
*
- * @param string $response Message 1 response (message 2)
- * @param string $username
- * @param string $password
- * @param string $timestamp
- * @param string $client
- * @param Swift_Transport_SmtpAgent $agent
- * @param bool $v2 Use version2 of the protocol
+ * @param string $response Message 1 response (message 2)
+ * @param string $username
+ * @param string $password
+ * @param string $timestamp
+ * @param string $client
+ * @param bool $v2 Use version2 of the protocol
*
* @return string
*/
@@ -210,7 +199,7 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
$message = $this->createMessage3($domain, $username, $workstation, $lmResponse, $ntlmResponse);
- return $agent->executeCommand(sprintf("%s\r\n", base64_encode($message)), array(235));
+ return $agent->executeCommand(sprintf("%s\r\n", base64_encode($message)), [235]);
}
/**
@@ -294,18 +283,18 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
*/
protected function getDomainAndUsername($name)
{
- if (strpos($name, '\\') !== false) {
+ if (false !== strpos($name, '\\')) {
return explode('\\', $name);
}
if (false !== strpos($name, '@')) {
list($user, $domain) = explode('@', $name);
- return array($domain, $user);
+ return [$domain, $user];
}
// no domain passed
- return array('', $name);
+ return ['', $name];
}
/**
@@ -375,7 +364,7 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
$binary = $this->si2bin($time, 64); // create 64 bit binary string
$timestamp = '';
for ($i = 0; $i < 8; ++$i) {
- $timestamp .= chr(bindec(substr($binary, -(($i + 1) * 8), 8)));
+ $timestamp .= \chr(bindec(substr($binary, -(($i + 1) * 8), 8)));
}
return $timestamp;
@@ -396,7 +385,7 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
{
$lmPass = '00'; // by default 00
// if $password > 15 than we can't use this method
- if (strlen($password) <= 15) {
+ if (\strlen($password) <= 15) {
$ntlmHash = $this->md4Encrypt($password);
$ntml2Hash = $this->md5Encrypt($ntlmHash, $this->convertTo16bit(strtoupper($username).$domain));
@@ -436,21 +425,21 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
protected function createDesKey($key)
{
- $material = array(bin2hex($key[0]));
- $len = strlen($key);
+ $material = [bin2hex($key[0])];
+ $len = \strlen($key);
for ($i = 1; $i < $len; ++$i) {
list($high, $low) = str_split(bin2hex($key[$i]));
- $v = $this->castToByte(ord($key[$i - 1]) << (7 + 1 - $i) | $this->uRShift(hexdec(dechex(hexdec($high) & 0xf).dechex(hexdec($low) & 0xf)), $i));
+ $v = $this->castToByte(\ord($key[$i - 1]) << (7 + 1 - $i) | $this->uRShift(hexdec(dechex(hexdec($high) & 0xf).dechex(hexdec($low) & 0xf)), $i));
$material[] = str_pad(substr(dechex($v), -2), 2, '0', STR_PAD_LEFT); // cast to byte
}
- $material[] = str_pad(substr(dechex($this->castToByte(ord($key[6]) << 1)), -2), 2, '0');
+ $material[] = str_pad(substr(dechex($this->castToByte(\ord($key[6]) << 1)), -2), 2, '0');
// odd parity
foreach ($material as $k => $v) {
$b = $this->castToByte(hexdec($v));
- $needsParity = (($this->uRShift($b, 7) ^ $this->uRShift($b, 6) ^ $this->uRShift($b, 5)
+ $needsParity = 0 == (($this->uRShift($b, 7) ^ $this->uRShift($b, 6) ^ $this->uRShift($b, 5)
^ $this->uRShift($b, 4) ^ $this->uRShift($b, 3) ^ $this->uRShift($b, 2)
- ^ $this->uRShift($b, 1)) & 0x01) == 0;
+ ^ $this->uRShift($b, 1)) & 0x01);
list($high, $low) = str_split($v);
if ($needsParity) {
@@ -476,7 +465,7 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
*/
protected function createSecurityBuffer($value, $offset, $is16 = false)
{
- $length = strlen(bin2hex($value));
+ $length = \strlen(bin2hex($value));
$length = $is16 ? $length / 2 : $length;
$length = $this->createByte(str_pad(dechex($length), 2, '0', STR_PAD_LEFT), 2);
@@ -495,7 +484,7 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
$length = floor(hexdec(substr($value, 0, 4)) / 256) * 2;
$offset = floor(hexdec(substr($value, 8, 4)) / 256) * 2;
- return array($length, $offset);
+ return [$length, $offset];
}
/**
@@ -521,7 +510,7 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
*/
protected function uRShift($a, $b)
{
- if ($b == 0) {
+ if (0 == $b) {
return $a;
}
@@ -548,22 +537,6 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
return $byte;
}
- /**
- * Create random bytes.
- *
- * @param $length
- *
- * @return string
- */
- protected function getRandomBytes($length)
- {
- $bytes = openssl_random_pseudo_bytes($length, $strong);
- if (false !== $bytes && true === $strong) {
- return $bytes;
- }
- throw new RuntimeException('OpenSSL did not produce a secure random number.');
- }
-
/** ENCRYPTION ALGORITHMS */
/**
@@ -590,7 +563,7 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
protected function md5Encrypt($key, $msg)
{
$blocksize = 64;
- if (strlen($key) > $blocksize) {
+ if (\strlen($key) > $blocksize) {
$key = pack('H*', md5($key));
}
@@ -608,13 +581,13 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
*
* @return string
*
- * @see http://php.net/manual/en/ref.hash.php
+ * @see https://secure.php.net/manual/en/ref.hash.php
*/
protected function md4Encrypt($input)
{
$input = $this->convertTo16bit($input);
- return function_exists('hash') ? hex2bin(hash('md4', $input)) : mhash(MHASH_MD4, $input);
+ return \function_exists('hash') ? hex2bin(hash('md4', $input)) : mhash(MHASH_MD4, $input);
}
/**
@@ -639,8 +612,8 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
echo substr($message, 0, 16)." NTLMSSP Signature \n";
echo $messageId." Type Indicator \n";
- if ($messageId == '02000000') {
- $map = array(
+ if ('02000000' == $messageId) {
+ $map = [
'Challenge',
'Context',
'Target Information Security Buffer',
@@ -651,14 +624,14 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
'DNS Server Name',
'BLOB',
'Target Information Terminator',
- );
+ ];
$data = $this->parseMessage2(hex2bin($message));
foreach ($map as $key => $value) {
echo bin2hex($data[$key]).' - '.$data[$key].' ||| '.$value." \n";
}
- } elseif ($messageId == '03000000') {
+ } elseif ('03000000' == $messageId) {
$i = 0;
$data[$i++] = substr($message, 24, 16);
list($lmLength, $lmOffset) = $this->readSecurityBuffer($data[$i - 1]);
@@ -683,7 +656,7 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
$data[$i++] = substr($message, $lmOffset, $lmLength);
$data[$i] = substr($message, $ntmlOffset, $ntmlLength);
- $map = array(
+ $map = [
'LM Response Security Buffer',
'NTLM Response Security Buffer',
'Target Name Security Buffer',
@@ -696,7 +669,7 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
'Workstation Name Data',
'LM Response Data',
'NTLM Response Data',
- );
+ ];
foreach ($map as $key => $value) {
echo $data[$key].' - '.hex2bin($data[$key]).' ||| '.$value." \n";
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/PlainAuthenticator.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/PlainAuthenticator.php
index 43219f93445..41d0a50a82b 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/PlainAuthenticator.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/PlainAuthenticator.php
@@ -26,25 +26,19 @@ class Swift_Transport_Esmtp_Auth_PlainAuthenticator implements Swift_Transport_E
}
/**
- * Try to authenticate the user with $username and $password.
- *
- * @param Swift_Transport_SmtpAgent $agent
- * @param string $username
- * @param string $password
- *
- * @return bool
+ * {@inheritdoc}
*/
public function authenticate(Swift_Transport_SmtpAgent $agent, $username, $password)
{
try {
- $message = base64_encode($username.chr(0).$username.chr(0).$password);
- $agent->executeCommand(sprintf("AUTH PLAIN %s\r\n", $message), array(235));
+ $message = base64_encode($username.\chr(0).$username.\chr(0).$password);
+ $agent->executeCommand(sprintf("AUTH PLAIN %s\r\n", $message), [235]);
return true;
} catch (Swift_TransportException $e) {
- $agent->executeCommand("RSET\r\n", array(250));
+ $agent->executeCommand("RSET\r\n", [250]);
- return false;
+ throw $e;
}
}
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/XOAuth2Authenticator.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/XOAuth2Authenticator.php
index d1a4cc3d774..859f22f3d5e 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/XOAuth2Authenticator.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/XOAuth2Authenticator.php
@@ -36,25 +36,19 @@ class Swift_Transport_Esmtp_Auth_XOAuth2Authenticator implements Swift_Transport
}
/**
- * Try to authenticate the user with $email and $token.
- *
- * @param Swift_Transport_SmtpAgent $agent
- * @param string $email
- * @param string $token
- *
- * @return bool
+ * {@inheritdoc}
*/
public function authenticate(Swift_Transport_SmtpAgent $agent, $email, $token)
{
try {
$param = $this->constructXOAuth2Params($email, $token);
- $agent->executeCommand('AUTH XOAUTH2 '.$param."\r\n", array(235));
+ $agent->executeCommand('AUTH XOAUTH2 '.$param."\r\n", [235]);
return true;
} catch (Swift_TransportException $e) {
- $agent->executeCommand("RSET\r\n", array(250));
+ $agent->executeCommand("RSET\r\n", [250]);
- return false;
+ throw $e;
}
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/AuthHandler.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/AuthHandler.php
index 94387f01a2e..53a90a87383 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/AuthHandler.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/AuthHandler.php
@@ -9,7 +9,7 @@
*/
/**
- * An ESMTP handler for AUTH support.
+ * An ESMTP handler for AUTH support (RFC 5248).
*
* @author Chris Corbyn
*/
@@ -20,7 +20,7 @@ class Swift_Transport_Esmtp_AuthHandler implements Swift_Transport_EsmtpHandler
*
* @var Swift_Transport_Esmtp_Authenticator[]
*/
- private $authenticators = array();
+ private $authenticators = [];
/**
* The username for authentication.
@@ -48,7 +48,7 @@ class Swift_Transport_Esmtp_AuthHandler implements Swift_Transport_EsmtpHandler
*
* @var string[]
*/
- private $esmtpParams = array();
+ private $esmtpParams = [];
/**
* Create a new AuthHandler with $authenticators for support.
@@ -143,7 +143,7 @@ class Swift_Transport_Esmtp_AuthHandler implements Swift_Transport_EsmtpHandler
/**
* Get the name of the ESMTP extension this handles.
*
- * @return bool
+ * @return string
*/
public function getHandledKeyword()
{
@@ -169,19 +169,26 @@ class Swift_Transport_Esmtp_AuthHandler implements Swift_Transport_EsmtpHandler
{
if ($this->username) {
$count = 0;
+ $errors = [];
foreach ($this->getAuthenticatorsForAgent() as $authenticator) {
- if (in_array(strtolower($authenticator->getAuthKeyword()),
- array_map('strtolower', $this->esmtpParams))) {
+ if (\in_array(strtolower($authenticator->getAuthKeyword() ?? ''), array_map('strtolower', $this->esmtpParams))) {
++$count;
- if ($authenticator->authenticate($agent, $this->username, $this->password)) {
- return;
+ try {
+ if ($authenticator->authenticate($agent, $this->username, $this->password)) {
+ return;
+ }
+ } catch (Swift_TransportException $e) {
+ // keep the error message, but tries the other authenticators
+ $errors[] = [$authenticator->getAuthKeyword(), $e->getMessage()];
}
}
}
- throw new Swift_TransportException(
- 'Failed to authenticate on SMTP server with username "'.
- $this->username.'" using '.$count.' possible authenticators'
- );
+
+ $message = 'Failed to authenticate on SMTP server with username "'.$this->username.'" using '.$count.' possible authenticators.';
+ foreach ($errors as $error) {
+ $message .= ' Authenticator '.$error[0].' returned '.$error[1].'.';
+ }
+ throw new Swift_TransportException($message);
}
}
@@ -190,7 +197,7 @@ class Swift_Transport_Esmtp_AuthHandler implements Swift_Transport_EsmtpHandler
*/
public function getMailParams()
{
- return array();
+ return [];
}
/**
@@ -198,13 +205,13 @@ class Swift_Transport_Esmtp_AuthHandler implements Swift_Transport_EsmtpHandler
*/
public function getRcptParams()
{
- return array();
+ return [];
}
/**
* Not used.
*/
- public function onCommand(Swift_Transport_SmtpAgent $agent, $command, $codes = array(), &$failedRecipients = null, &$stop = false)
+ public function onCommand(Swift_Transport_SmtpAgent $agent, $command, $codes = [], &$failedRecipients = null, &$stop = false)
{
}
@@ -229,7 +236,7 @@ class Swift_Transport_Esmtp_AuthHandler implements Swift_Transport_EsmtpHandler
*/
public function exposeMixinMethods()
{
- return array('setUsername', 'getUsername', 'setPassword', 'getPassword', 'setAuthMode', 'getAuthMode');
+ return ['setUsername', 'getUsername', 'setPassword', 'getPassword', 'setAuthMode', 'getAuthMode'];
}
/**
@@ -242,19 +249,17 @@ class Swift_Transport_Esmtp_AuthHandler implements Swift_Transport_EsmtpHandler
/**
* Returns the authenticator list for the given agent.
*
- * @param Swift_Transport_SmtpAgent $agent
- *
* @return array
*/
protected function getAuthenticatorsForAgent()
{
- if (!$mode = strtolower($this->auth_mode)) {
+ if (!$mode = strtolower($this->auth_mode ?? '')) {
return $this->authenticators;
}
foreach ($this->authenticators as $authenticator) {
- if (strtolower($authenticator->getAuthKeyword()) == $mode) {
- return array($authenticator);
+ if (strtolower($authenticator->getAuthKeyword() ?? '') == $mode) {
+ return [$authenticator];
}
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Authenticator.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Authenticator.php
index 12a9abf8199..f692a6fe40d 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Authenticator.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/Authenticator.php
@@ -25,11 +25,12 @@ interface Swift_Transport_Esmtp_Authenticator
/**
* Try to authenticate the user with $username and $password.
*
- * @param Swift_Transport_SmtpAgent $agent
- * @param string $username
- * @param string $password
+ * @param string $username
+ * @param string $password
*
- * @return bool
+ * @return bool true if authentication worked (returning false is deprecated, throw a Swift_TransportException instead)
+ *
+ * @throws Swift_TransportException Allows the message to bubble up when authentication was not successful
*/
public function authenticate(Swift_Transport_SmtpAgent $agent, $username, $password);
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/EightBitMimeHandler.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/EightBitMimeHandler.php
new file mode 100644
index 00000000000..63f70866939
--- /dev/null
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/EightBitMimeHandler.php
@@ -0,0 +1,113 @@
+encoding = $encoding;
+ }
+
+ /**
+ * Get the name of the ESMTP extension this handles.
+ *
+ * @return string
+ */
+ public function getHandledKeyword()
+ {
+ return '8BITMIME';
+ }
+
+ /**
+ * Not used.
+ */
+ public function setKeywordParams(array $parameters)
+ {
+ }
+
+ /**
+ * Not used.
+ */
+ public function afterEhlo(Swift_Transport_SmtpAgent $agent)
+ {
+ }
+
+ /**
+ * Get params which are appended to MAIL FROM:<>.
+ *
+ * @return string[]
+ */
+ public function getMailParams()
+ {
+ return ['BODY='.$this->encoding];
+ }
+
+ /**
+ * Not used.
+ */
+ public function getRcptParams()
+ {
+ return [];
+ }
+
+ /**
+ * Not used.
+ */
+ public function onCommand(Swift_Transport_SmtpAgent $agent, $command, $codes = [], &$failedRecipients = null, &$stop = false)
+ {
+ }
+
+ /**
+ * Returns +1, -1 or 0 according to the rules for usort().
+ *
+ * This method is called to ensure extensions can be execute in an appropriate order.
+ *
+ * @param string $esmtpKeyword to compare with
+ *
+ * @return int
+ */
+ public function getPriorityOver($esmtpKeyword)
+ {
+ return 0;
+ }
+
+ /**
+ * Not used.
+ */
+ public function exposeMixinMethods()
+ {
+ return [];
+ }
+
+ /**
+ * Not used.
+ */
+ public function resetState()
+ {
+ }
+}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/SmtpUtf8Handler.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/SmtpUtf8Handler.php
new file mode 100644
index 00000000000..7d0252a01bf
--- /dev/null
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/Esmtp/SmtpUtf8Handler.php
@@ -0,0 +1,107 @@
+.
+ *
+ * @return string[]
+ */
+ public function getMailParams()
+ {
+ return ['SMTPUTF8'];
+ }
+
+ /**
+ * Not used.
+ */
+ public function getRcptParams()
+ {
+ return [];
+ }
+
+ /**
+ * Not used.
+ */
+ public function onCommand(Swift_Transport_SmtpAgent $agent, $command, $codes = [], &$failedRecipients = null, &$stop = false)
+ {
+ }
+
+ /**
+ * Returns +1, -1 or 0 according to the rules for usort().
+ *
+ * This method is called to ensure extensions can be execute in an appropriate order.
+ *
+ * @param string $esmtpKeyword to compare with
+ *
+ * @return int
+ */
+ public function getPriorityOver($esmtpKeyword)
+ {
+ return 0;
+ }
+
+ /**
+ * Not used.
+ */
+ public function exposeMixinMethods()
+ {
+ return [];
+ }
+
+ /**
+ * Not used.
+ */
+ public function resetState()
+ {
+ }
+}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/EsmtpHandler.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/EsmtpHandler.php
index c17ef8feb3b..b8ea36e2fa8 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/EsmtpHandler.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/EsmtpHandler.php
@@ -18,7 +18,7 @@ interface Swift_Transport_EsmtpHandler
/**
* Get the name of the ESMTP extension this handles.
*
- * @return bool
+ * @return string
*/
public function getHandledKeyword();
@@ -59,7 +59,7 @@ interface Swift_Transport_EsmtpHandler
* @param string[] $failedRecipients to collect failures
* @param bool $stop to be set true by-reference if the command is now sent
*/
- public function onCommand(Swift_Transport_SmtpAgent $agent, $command, $codes = array(), &$failedRecipients = null, &$stop = false);
+ public function onCommand(Swift_Transport_SmtpAgent $agent, $command, $codes = [], &$failedRecipients = null, &$stop = false);
/**
* Returns +1, -1 or 0 according to the rules for usort().
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php
index 56d9c748769..36545f51feb 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php
@@ -20,21 +20,21 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
*
* @var Swift_Transport_EsmtpHandler[]
*/
- private $handlers = array();
+ private $handlers = [];
/**
* ESMTP capabilities.
*
* @var string[]
*/
- private $capabilities = array();
+ private $capabilities = [];
/**
* Connection buffer parameters.
*
* @var array
*/
- private $params = array(
+ private $params = [
'protocol' => 'tcp',
'host' => 'localhost',
'port' => 25,
@@ -42,26 +42,26 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
'blocking' => 1,
'tls' => false,
'type' => Swift_Transport_IoBuffer::TYPE_SOCKET,
- 'stream_context_options' => array(),
- );
+ 'stream_context_options' => [],
+ ];
/**
* Creates a new EsmtpTransport using the given I/O buffer.
*
- * @param Swift_Transport_IoBuffer $buf
* @param Swift_Transport_EsmtpHandler[] $extensionHandlers
- * @param Swift_Events_EventDispatcher $dispatcher
* @param string $localDomain
*/
- public function __construct(Swift_Transport_IoBuffer $buf, array $extensionHandlers, Swift_Events_EventDispatcher $dispatcher, $localDomain = '127.0.0.1')
+ public function __construct(Swift_Transport_IoBuffer $buf, array $extensionHandlers, Swift_Events_EventDispatcher $dispatcher, $localDomain = '127.0.0.1', Swift_AddressEncoder $addressEncoder = null)
{
- parent::__construct($buf, $dispatcher, $localDomain);
+ parent::__construct($buf, $dispatcher, $localDomain, $addressEncoder);
$this->setExtensionHandlers($extensionHandlers);
}
/**
* Set the host to connect to.
*
+ * Literal IPv6 addresses should be wrapped in square brackets.
+ *
* @param string $host
*
* @return $this
@@ -141,7 +141,7 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
*/
public function setEncryption($encryption)
{
- $encryption = strtolower($encryption);
+ $encryption = strtolower($encryption ?? '');
if ('tls' == $encryption) {
$this->params['protocol'] = 'tcp';
$this->params['tls'] = true;
@@ -190,6 +190,8 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
/**
* Sets the source IP.
*
+ * IPv6 addresses should be wrapped in square brackets.
+ *
* @param string $source
*
* @return $this
@@ -208,7 +210,36 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
*/
public function getSourceIp()
{
- return isset($this->params['sourceIp']) ? $this->params['sourceIp'] : null;
+ return $this->params['sourceIp'] ?? null;
+ }
+
+ /**
+ * Sets whether SMTP pipelining is enabled.
+ *
+ * By default, support is auto-detected using the PIPELINING SMTP extension.
+ * Use this function to override that in the unlikely event of compatibility
+ * issues.
+ *
+ * @param bool $enabled
+ *
+ * @return $this
+ */
+ public function setPipelining($enabled)
+ {
+ $this->pipelining = $enabled;
+
+ return $this;
+ }
+
+ /**
+ * Returns whether SMTP pipelining is enabled.
+ *
+ * @return bool|null a boolean if pipelining is explicitly enabled or disabled,
+ * or null if support is auto-detected
+ */
+ public function getPipelining()
+ {
+ return $this->pipelining;
}
/**
@@ -220,7 +251,7 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
*/
public function setExtensionHandlers(array $handlers)
{
- $assoc = array();
+ $assoc = [];
foreach ($handlers as $handler) {
$assoc[$handler->getHandledKeyword()] = $handler;
}
@@ -252,10 +283,12 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
* @param string $command
* @param int[] $codes
* @param string[] $failures An array of failures by-reference
+ * @param bool $pipeline Do not wait for response
+ * @param string $address the address, if command is RCPT TO
*
- * @return string
+ * @return string|null The server response, or null if pipelining is enabled
*/
- public function executeCommand($command, $codes = array(), &$failures = null)
+ public function executeCommand($command, $codes = [], &$failures = null, $pipeline = false, $address = null)
{
$failures = (array) $failures;
$stopSignal = false;
@@ -269,19 +302,19 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
}
}
- return parent::executeCommand($command, $codes, $failures);
+ return parent::executeCommand($command, $codes, $failures, $pipeline, $address);
}
/** Mixin handling method for ESMTP handlers */
public function __call($method, $args)
{
foreach ($this->handlers as $handler) {
- if (in_array(strtolower($method),
+ if (\in_array(strtolower($method),
array_map('strtolower', (array) $handler->exposeMixinMethods())
)) {
- $return = call_user_func_array(array($handler, $method), $args);
+ $return = \call_user_func_array([$handler, $method], $args);
// Allow fluid method calls
- if (null === $return && substr($method, 0, 3) == 'set') {
+ if (null === $return && 'set' == substr($method, 0, 3)) {
return $this;
} else {
return $return;
@@ -302,7 +335,7 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
{
try {
$response = $this->executeCommand(
- sprintf("EHLO %s\r\n", $this->domain), array(250)
+ sprintf("EHLO %s\r\n", $this->domain), [250]
);
} catch (Swift_TransportException $e) {
return parent::doHeloCommand();
@@ -310,7 +343,7 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
if ($this->params['tls']) {
try {
- $this->executeCommand("STARTTLS\r\n", array(220));
+ $this->executeCommand("STARTTLS\r\n", [220]);
if (!$this->buffer->startTLS()) {
throw new Swift_TransportException('Unable to connect with TLS encryption');
@@ -318,7 +351,7 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
try {
$response = $this->executeCommand(
- sprintf("EHLO %s\r\n", $this->domain), array(250)
+ sprintf("EHLO %s\r\n", $this->domain), [250]
);
} catch (Swift_TransportException $e) {
return parent::doHeloCommand();
@@ -329,6 +362,10 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
}
$this->capabilities = $this->getCapabilities($response);
+ if (!isset($this->pipelining)) {
+ $this->pipelining = isset($this->capabilities['PIPELINING']);
+ }
+
$this->setHandlerParams();
foreach ($this->getActiveHandlers() as $handler) {
$handler->afterEhlo($this);
@@ -338,43 +375,45 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
/** Overridden to add Extension support */
protected function doMailFromCommand($address)
{
+ $address = $this->addressEncoder->encodeString($address);
$handlers = $this->getActiveHandlers();
- $params = array();
+ $params = [];
foreach ($handlers as $handler) {
$params = array_merge($params, (array) $handler->getMailParams());
}
$paramStr = !empty($params) ? ' '.implode(' ', $params) : '';
$this->executeCommand(
- sprintf("MAIL FROM:<%s>%s\r\n", $address, $paramStr), array(250)
+ sprintf("MAIL FROM:<%s>%s\r\n", $address, $paramStr), [250], $failures, true
);
}
/** Overridden to add Extension support */
protected function doRcptToCommand($address)
{
+ $address = $this->addressEncoder->encodeString($address);
$handlers = $this->getActiveHandlers();
- $params = array();
+ $params = [];
foreach ($handlers as $handler) {
$params = array_merge($params, (array) $handler->getRcptParams());
}
$paramStr = !empty($params) ? ' '.implode(' ', $params) : '';
$this->executeCommand(
- sprintf("RCPT TO:<%s>%s\r\n", $address, $paramStr), array(250, 251, 252)
+ sprintf("RCPT TO:<%s>%s\r\n", $address, $paramStr), [250, 251, 252], $failures, true, $address
);
}
/** Determine ESMTP capabilities by function group */
private function getCapabilities($ehloResponse)
{
- $capabilities = array();
- $ehloResponse = trim($ehloResponse);
+ $capabilities = [];
+ $ehloResponse = trim($ehloResponse ?? '');
$lines = explode("\r\n", $ehloResponse);
array_shift($lines);
foreach ($lines as $line) {
if (preg_match('/^[0-9]{3}[ -]([A-Z0-9-]+)((?:[ =].*)?)$/Di', $line, $matches)) {
$keyword = strtoupper($matches[1]);
$paramStr = strtoupper(ltrim($matches[2], ' ='));
- $params = !empty($paramStr) ? explode(' ', $paramStr) : array();
+ $params = !empty($paramStr) ? explode(' ', $paramStr) : [];
$capabilities[$keyword] = $params;
}
}
@@ -386,7 +425,7 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
private function setHandlerParams()
{
foreach ($this->handlers as $keyword => $handler) {
- if (array_key_exists($keyword, $this->capabilities)) {
+ if (\array_key_exists($keyword, $this->capabilities)) {
$handler->setKeywordParams($this->capabilities[$keyword]);
}
}
@@ -395,9 +434,9 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
/** Get ESMTP handlers which are currently ok to use */
private function getActiveHandlers()
{
- $handlers = array();
+ $handlers = [];
foreach ($this->handlers as $keyword => $handler) {
- if (array_key_exists($keyword, $this->capabilities)) {
+ if (\array_key_exists($keyword, $this->capabilities)) {
$handlers[] = $handler;
}
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/FailoverTransport.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/FailoverTransport.php
index 94151f89fef..1a4b4754f07 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/FailoverTransport.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/FailoverTransport.php
@@ -33,7 +33,7 @@ class Swift_Transport_FailoverTransport extends Swift_Transport_LoadBalancedTran
*/
public function ping()
{
- $maxTransports = count($this->transports);
+ $maxTransports = \count($this->transports);
for ($i = 0; $i < $maxTransports
&& $transport = $this->getNextTransport(); ++$i) {
if ($transport->ping()) {
@@ -43,7 +43,7 @@ class Swift_Transport_FailoverTransport extends Swift_Transport_LoadBalancedTran
}
}
- return count($this->transports) > 0;
+ return \count($this->transports) > 0;
}
/**
@@ -52,14 +52,13 @@ class Swift_Transport_FailoverTransport extends Swift_Transport_LoadBalancedTran
* Recipient/sender data will be retrieved from the Message API.
* The return value is the number of recipients who were accepted for delivery.
*
- * @param Swift_Mime_SimpleMessage $message
- * @param string[] $failedRecipients An array of failures by-reference
+ * @param string[] $failedRecipients An array of failures by-reference
*
* @return int
*/
public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null)
{
- $maxTransports = count($this->transports);
+ $maxTransports = \count($this->transports);
$sent = 0;
$this->lastUsedTransport = null;
@@ -80,10 +79,8 @@ class Swift_Transport_FailoverTransport extends Swift_Transport_LoadBalancedTran
}
}
- if (count($this->transports) == 0) {
- throw new Swift_TransportException(
- 'All Transports in FailoverTransport failed, or no Transports available'
- );
+ if (0 == \count($this->transports)) {
+ throw new Swift_TransportException('All Transports in FailoverTransport failed, or no Transports available');
}
return $sent;
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/IoBuffer.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/IoBuffer.php
index af97adf1f8f..50f1e5e403c 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/IoBuffer.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/IoBuffer.php
@@ -25,8 +25,6 @@ interface Swift_Transport_IoBuffer extends Swift_InputByteStream, Swift_OutputBy
* Perform any initialization needed, using the given $params.
*
* Parameters will vary depending upon the type of IoBuffer used.
- *
- * @param array $params
*/
public function initialize(array $params);
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/LoadBalancedTransport.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/LoadBalancedTransport.php
index dc6a2149bab..0b5ba9d304e 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/LoadBalancedTransport.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/LoadBalancedTransport.php
@@ -20,14 +20,14 @@ class Swift_Transport_LoadBalancedTransport implements Swift_Transport
*
* @var Swift_Transport[]
*/
- private $deadTransports = array();
+ private $deadTransports = [];
/**
* The Transports which are used in rotation.
*
* @var Swift_Transport[]
*/
- protected $transports = array();
+ protected $transports = [];
/**
* The Transport used in the last successful send operation.
@@ -49,7 +49,7 @@ class Swift_Transport_LoadBalancedTransport implements Swift_Transport
public function setTransports(array $transports)
{
$this->transports = $transports;
- $this->deadTransports = array();
+ $this->deadTransports = [];
}
/**
@@ -79,7 +79,7 @@ class Swift_Transport_LoadBalancedTransport implements Swift_Transport
*/
public function isStarted()
{
- return count($this->transports) > 0;
+ return \count($this->transports) > 0;
}
/**
@@ -111,7 +111,7 @@ class Swift_Transport_LoadBalancedTransport implements Swift_Transport
}
}
- return count($this->transports) > 0;
+ return \count($this->transports) > 0;
}
/**
@@ -120,14 +120,13 @@ class Swift_Transport_LoadBalancedTransport implements Swift_Transport
* Recipient/sender data will be retrieved from the Message API.
* The return value is the number of recipients who were accepted for delivery.
*
- * @param Swift_Mime_SimpleMessage $message
- * @param string[] $failedRecipients An array of failures by-reference
+ * @param string[] $failedRecipients An array of failures by-reference
*
* @return int
*/
public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null)
{
- $maxTransports = count($this->transports);
+ $maxTransports = \count($this->transports);
$sent = 0;
$this->lastUsedTransport = null;
@@ -146,10 +145,8 @@ class Swift_Transport_LoadBalancedTransport implements Swift_Transport
}
}
- if (count($this->transports) == 0) {
- throw new Swift_TransportException(
- 'All Transports in LoadBalancedTransport failed, or no Transports available'
- );
+ if (0 == \count($this->transports)) {
+ throw new Swift_TransportException('All Transports in LoadBalancedTransport failed, or no Transports available');
}
return $sent;
@@ -157,8 +154,6 @@ class Swift_Transport_LoadBalancedTransport implements Swift_Transport
/**
* Register a plugin.
- *
- * @param Swift_Events_EventListener $plugin
*/
public function registerPlugin(Swift_Events_EventListener $plugin)
{
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/NullTransport.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/NullTransport.php
index dc38078c3c3..7d910db5a58 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/NullTransport.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/NullTransport.php
@@ -61,8 +61,7 @@ class Swift_Transport_NullTransport implements Swift_Transport
/**
* Sends the given message.
*
- * @param Swift_Mime_SimpleMessage $message
- * @param string[] $failedRecipients An array of failures by-reference
+ * @param string[] $failedRecipients An array of failures by-reference
*
* @return int The number of sent emails
*/
@@ -81,9 +80,9 @@ class Swift_Transport_NullTransport implements Swift_Transport
}
$count = (
- count((array) $message->getTo())
- + count((array) $message->getCc())
- + count((array) $message->getBcc())
+ \count((array) $message->getTo())
+ + \count((array) $message->getCc())
+ + \count((array) $message->getBcc())
);
return $count;
@@ -91,8 +90,6 @@ class Swift_Transport_NullTransport implements Swift_Transport
/**
* Register a plugin.
- *
- * @param Swift_Events_EventListener $plugin
*/
public function registerPlugin(Swift_Events_EventListener $plugin)
{
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/SendmailTransport.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/SendmailTransport.php
index 807538505bf..65a434d1173 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/SendmailTransport.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/SendmailTransport.php
@@ -24,23 +24,21 @@ class Swift_Transport_SendmailTransport extends Swift_Transport_AbstractSmtpTran
*
* @var array
*/
- private $params = array(
+ private $params = [
'timeout' => 30,
'blocking' => 1,
'command' => '/usr/sbin/sendmail -bs',
'type' => Swift_Transport_IoBuffer::TYPE_PROCESS,
- );
+ ];
/**
* Create a new SendmailTransport with $buf for I/O.
*
- * @param Swift_Transport_IoBuffer $buf
- * @param Swift_Events_EventDispatcher $dispatcher
- * @param string $localDomain
+ * @param string $localDomain
*/
- public function __construct(Swift_Transport_IoBuffer $buf, Swift_Events_EventDispatcher $dispatcher, $localDomain = '127.0.0.1')
+ public function __construct(Swift_Transport_IoBuffer $buf, Swift_Events_EventDispatcher $dispatcher, $localDomain = '127.0.0.1', Swift_AddressEncoder $addressEncoder = null)
{
- parent::__construct($buf, $dispatcher, $localDomain);
+ parent::__construct($buf, $dispatcher, $localDomain, $addressEncoder);
}
/**
@@ -93,8 +91,7 @@ class Swift_Transport_SendmailTransport extends Swift_Transport_AbstractSmtpTran
* NOTE: If using 'sendmail -t' you will not be aware of any failures until
* they bounce (i.e. send() will always return 100% success).
*
- * @param Swift_Mime_SimpleMessage $message
- * @param string[] $failedRecipients An array of failures by-reference
+ * @param string[] $failedRecipients An array of failures by-reference
*
* @return int
*/
@@ -114,24 +111,24 @@ class Swift_Transport_SendmailTransport extends Swift_Transport_AbstractSmtpTran
}
if (false === strpos($command, ' -f')) {
- $command .= ' -f'.escapeshellarg($this->getReversePath($message));
+ $command .= ' -f'.escapeshellarg($this->getReversePath($message) ?? '');
}
- $buffer->initialize(array_merge($this->params, array('command' => $command)));
+ $buffer->initialize(array_merge($this->params, ['command' => $command]));
if (false === strpos($command, ' -i') && false === strpos($command, ' -oi')) {
- $buffer->setWriteTranslations(array("\r\n" => "\n", "\n." => "\n.."));
+ $buffer->setWriteTranslations(["\r\n" => "\n", "\n." => "\n.."]);
} else {
- $buffer->setWriteTranslations(array("\r\n" => "\n"));
+ $buffer->setWriteTranslations(["\r\n" => "\n"]);
}
- $count = count((array) $message->getTo())
- + count((array) $message->getCc())
- + count((array) $message->getBcc())
+ $count = \count((array) $message->getTo())
+ + \count((array) $message->getCc())
+ + \count((array) $message->getBcc())
;
$message->toByteStream($buffer);
$buffer->flushBuffers();
- $buffer->setWriteTranslations(array());
+ $buffer->setWriteTranslations([]);
$buffer->terminate();
if ($evt) {
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/SmtpAgent.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/SmtpAgent.php
index 90e913f8edb..e8ce65c2648 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/SmtpAgent.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/SmtpAgent.php
@@ -32,5 +32,5 @@ interface Swift_Transport_SmtpAgent
* @param int[] $codes
* @param string[] $failures An array of failures by-reference
*/
- public function executeCommand($command, $codes = array(), &$failures = null);
+ public function executeCommand($command, $codes = [], &$failures = null);
}
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/SpoolTransport.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/SpoolTransport.php
index 9a1d07115e3..0cb6a5b80a9 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/SpoolTransport.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/SpoolTransport.php
@@ -33,8 +33,6 @@ class Swift_Transport_SpoolTransport implements Swift_Transport
/**
* Sets the spool object.
*
- * @param Swift_Spool $spool
- *
* @return $this
*/
public function setSpool(Swift_Spool $spool)
@@ -89,8 +87,7 @@ class Swift_Transport_SpoolTransport implements Swift_Transport
/**
* Sends the given message.
*
- * @param Swift_Mime_SimpleMessage $message
- * @param string[] $failedRecipients An array of failures by-reference
+ * @param string[] $failedRecipients An array of failures by-reference
*
* @return int The number of sent e-mail's
*/
@@ -115,8 +112,6 @@ class Swift_Transport_SpoolTransport implements Swift_Transport
/**
* Register a plugin.
- *
- * @param Swift_Events_EventListener $plugin
*/
public function registerPlugin(Swift_Events_EventListener $plugin)
{
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php
index bc6ed5a34b4..70782ada044 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php
@@ -25,18 +25,16 @@ class Swift_Transport_StreamBuffer extends Swift_ByteStream_AbstractFilterableIn
private $out;
/** Buffer initialization parameters */
- private $params = array();
+ private $params = [];
/** The ReplacementFilterFactory */
private $replacementFactory;
/** Translations performed on data being streamed into the buffer */
- private $translations = array();
+ private $translations = [];
/**
* Create a new StreamBuffer using $replacementFactory for transformations.
- *
- * @param Swift_ReplacementFilterFactory $replacementFactory
*/
public function __construct(Swift_ReplacementFilterFactory $replacementFactory)
{
@@ -47,8 +45,6 @@ class Swift_Transport_StreamBuffer extends Swift_ByteStream_AbstractFilterableIn
* Perform any initialization needed, using the given $params.
*
* Parameters will vary depending upon the type of IoBuffer used.
- *
- * @param array $params
*/
public function initialize(array $params)
{
@@ -91,7 +87,11 @@ class Swift_Transport_StreamBuffer extends Swift_ByteStream_AbstractFilterableIn
public function startTLS()
{
- return stream_socket_enable_crypto($this->stream, true, STREAM_CRYPTO_METHOD_TLS_CLIENT);
+ // STREAM_CRYPTO_METHOD_TLS_CLIENT only allow tls1.0 connections (some php versions)
+ // To support modern tls we allow explicit tls1.0, tls1.1, tls1.2
+ // Ssl3 and older are not allowed because they are vulnerable
+ // @TODO make tls arguments configurable
+ return stream_socket_enable_crypto($this->stream, true, STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT);
}
/**
@@ -160,14 +160,10 @@ class Swift_Transport_StreamBuffer extends Swift_ByteStream_AbstractFilterableIn
{
if (isset($this->out) && !feof($this->out)) {
$line = fgets($this->out);
- if (strlen($line) == 0) {
+ if (0 == \strlen($line)) {
$metas = stream_get_meta_data($this->out);
if ($metas['timed_out']) {
- throw new Swift_IoException(
- 'Connection to '.
- $this->getReadConnectionDescription().
- ' Timed Out'
- );
+ throw new Swift_IoException('Connection to '.$this->getReadConnectionDescription().' Timed Out');
}
}
@@ -192,14 +188,10 @@ class Swift_Transport_StreamBuffer extends Swift_ByteStream_AbstractFilterableIn
{
if (isset($this->out) && !feof($this->out)) {
$ret = fread($this->out, $length);
- if (strlen($ret) == 0) {
+ if (0 == \strlen($ret)) {
$metas = stream_get_meta_data($this->out);
if ($metas['timed_out']) {
- throw new Swift_IoException(
- 'Connection to '.
- $this->getReadConnectionDescription().
- ' Timed Out'
- );
+ throw new Swift_IoException('Connection to '.$this->getReadConnectionDescription().' Timed Out');
}
}
@@ -224,7 +216,7 @@ class Swift_Transport_StreamBuffer extends Swift_ByteStream_AbstractFilterableIn
protected function doCommit($bytes)
{
if (isset($this->in)) {
- $bytesToWrite = strlen($bytes);
+ $bytesToWrite = \strlen($bytes);
$totalBytesWritten = 0;
while ($totalBytesWritten < $bytesToWrite) {
@@ -255,7 +247,7 @@ class Swift_Transport_StreamBuffer extends Swift_ByteStream_AbstractFilterableIn
if (!empty($this->params['timeout'])) {
$timeout = $this->params['timeout'];
}
- $options = array();
+ $options = [];
if (!empty($this->params['sourceIp'])) {
$options['socket']['bindto'] = $this->params['sourceIp'].':0';
}
@@ -264,13 +256,16 @@ class Swift_Transport_StreamBuffer extends Swift_ByteStream_AbstractFilterableIn
$options = array_merge($options, $this->params['stream_context_options']);
}
$streamContext = stream_context_create($options);
- $this->stream = @stream_socket_client($host.':'.$this->params['port'], $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT, $streamContext);
- if (false === $this->stream) {
- throw new Swift_TransportException(
- 'Connection could not be established with host '.$this->params['host'].
- ' ['.$errstr.' #'.$errno.']'
- );
+
+ set_error_handler(function ($type, $msg) {
+ throw new Swift_TransportException('Connection could not be established with host '.$this->params['host'].' :'.$msg);
+ });
+ try {
+ $this->stream = stream_socket_client($host.':'.$this->params['port'], $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT, $streamContext);
+ } finally {
+ restore_error_handler();
}
+
if (!empty($this->params['blocking'])) {
stream_set_blocking($this->stream, 1);
} else {
@@ -287,18 +282,16 @@ class Swift_Transport_StreamBuffer extends Swift_ByteStream_AbstractFilterableIn
private function establishProcessConnection()
{
$command = $this->params['command'];
- $descriptorSpec = array(
- 0 => array('pipe', 'r'),
- 1 => array('pipe', 'w'),
- 2 => array('pipe', 'w'),
- );
- $pipes = array();
+ $descriptorSpec = [
+ 0 => ['pipe', 'r'],
+ 1 => ['pipe', 'w'],
+ 2 => ['pipe', 'w'],
+ ];
+ $pipes = [];
$this->stream = proc_open($command, $descriptorSpec, $pipes);
stream_set_blocking($pipes[2], 0);
if ($err = stream_get_contents($pipes[2])) {
- throw new Swift_TransportException(
- 'Process could not be started ['.$err.']'
- );
+ throw new Swift_TransportException('Process could not be started ['.$err.']');
}
$this->in = &$pipes[0];
$this->out = &$pipes[1];
diff --git a/htdocs/includes/swiftmailer/lib/classes/Swift/TransportException.php b/htdocs/includes/swiftmailer/lib/classes/Swift/TransportException.php
index 4ae2412e62a..c7417455b3e 100644
--- a/htdocs/includes/swiftmailer/lib/classes/Swift/TransportException.php
+++ b/htdocs/includes/swiftmailer/lib/classes/Swift/TransportException.php
@@ -18,9 +18,8 @@ class Swift_TransportException extends Swift_IoException
/**
* Create a new TransportException with $message.
*
- * @param string $message
- * @param int $code
- * @param Exception $previous
+ * @param string $message
+ * @param int $code
*/
public function __construct($message, $code = 0, Exception $previous = null)
{
diff --git a/htdocs/includes/swiftmailer/lib/dependency_maps/cache_deps.php b/htdocs/includes/swiftmailer/lib/dependency_maps/cache_deps.php
index 6023448e85e..9d94d774014 100644
--- a/htdocs/includes/swiftmailer/lib/dependency_maps/cache_deps.php
+++ b/htdocs/includes/swiftmailer/lib/dependency_maps/cache_deps.php
@@ -12,11 +12,11 @@ Swift_DependencyContainer::getInstance()
->register('cache.array')
->asSharedInstanceOf('Swift_KeyCache_ArrayKeyCache')
- ->withDependencies(array('cache.inputstream'))
+ ->withDependencies(['cache.inputstream'])
->register('cache.disk')
->asSharedInstanceOf('Swift_KeyCache_DiskKeyCache')
- ->withDependencies(array('cache.inputstream', 'tempdir'))
+ ->withDependencies(['cache.inputstream', 'tempdir'])
->register('cache.inputstream')
->asNewInstanceOf('Swift_KeyCache_SimpleKeyCacheInputStream')
diff --git a/htdocs/includes/swiftmailer/lib/dependency_maps/mime_deps.php b/htdocs/includes/swiftmailer/lib/dependency_maps/mime_deps.php
index 4ce9c7cbbc5..307756c89f3 100644
--- a/htdocs/includes/swiftmailer/lib/dependency_maps/mime_deps.php
+++ b/htdocs/includes/swiftmailer/lib/dependency_maps/mime_deps.php
@@ -13,101 +13,105 @@ Swift_DependencyContainer::getInstance()
// As SERVER_NAME can come from the user in certain configurations, check that
// it does not contain forbidden characters (see RFC 952 and RFC 2181). Use
// preg_replace() instead of preg_match() to prevent DoS attacks with long host names.
- ->asValue(!empty($_SERVER['SERVER_NAME']) && preg_replace('/(?:^\[)?[a-zA-Z0-9-:\]_]+\.?/', '', $_SERVER['SERVER_NAME']) === '' ? $_SERVER['SERVER_NAME'] : 'swift.generated')
+ ->asValue(!empty($_SERVER['SERVER_NAME']) && '' === preg_replace('/(?:^\[)?[a-zA-Z0-9-:\]_]+\.?/', '', $_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'swift.generated')
->register('mime.idgenerator')
->asSharedInstanceOf('Swift_Mime_IdGenerator')
- ->withDependencies(array(
+ ->withDependencies([
'mime.idgenerator.idright',
- ))
+ ])
->register('mime.message')
->asNewInstanceOf('Swift_Mime_SimpleMessage')
- ->withDependencies(array(
+ ->withDependencies([
'mime.headerset',
- 'mime.qpcontentencoder',
+ 'mime.textcontentencoder',
'cache',
'mime.idgenerator',
'properties.charset',
- ))
+ ])
->register('mime.part')
->asNewInstanceOf('Swift_Mime_MimePart')
- ->withDependencies(array(
+ ->withDependencies([
'mime.headerset',
- 'mime.qpcontentencoder',
+ 'mime.textcontentencoder',
'cache',
'mime.idgenerator',
'properties.charset',
- ))
+ ])
->register('mime.attachment')
->asNewInstanceOf('Swift_Mime_Attachment')
- ->withDependencies(array(
+ ->withDependencies([
'mime.headerset',
'mime.base64contentencoder',
'cache',
'mime.idgenerator',
- ))
+ ])
->addConstructorValue($swift_mime_types)
->register('mime.embeddedfile')
->asNewInstanceOf('Swift_Mime_EmbeddedFile')
- ->withDependencies(array(
+ ->withDependencies([
'mime.headerset',
'mime.base64contentencoder',
'cache',
'mime.idgenerator',
- ))
+ ])
->addConstructorValue($swift_mime_types)
->register('mime.headerfactory')
->asNewInstanceOf('Swift_Mime_SimpleHeaderFactory')
- ->withDependencies(array(
- 'mime.qpheaderencoder',
- 'mime.rfc2231encoder',
- 'email.validator',
- 'properties.charset',
- ))
+ ->withDependencies([
+ 'mime.qpheaderencoder',
+ 'mime.rfc2231encoder',
+ 'email.validator',
+ 'properties.charset',
+ 'address.idnaddressencoder',
+ ])
->register('mime.headerset')
->asNewInstanceOf('Swift_Mime_SimpleHeaderSet')
- ->withDependencies(array('mime.headerfactory', 'properties.charset'))
+ ->withDependencies(['mime.headerfactory', 'properties.charset'])
->register('mime.qpheaderencoder')
->asNewInstanceOf('Swift_Mime_HeaderEncoder_QpHeaderEncoder')
- ->withDependencies(array('mime.charstream'))
+ ->withDependencies(['mime.charstream'])
->register('mime.base64headerencoder')
->asNewInstanceOf('Swift_Mime_HeaderEncoder_Base64HeaderEncoder')
- ->withDependencies(array('mime.charstream'))
+ ->withDependencies(['mime.charstream'])
->register('mime.charstream')
->asNewInstanceOf('Swift_CharacterStream_NgCharacterStream')
- ->withDependencies(array('mime.characterreaderfactory', 'properties.charset'))
+ ->withDependencies(['mime.characterreaderfactory', 'properties.charset'])
->register('mime.bytecanonicalizer')
->asSharedInstanceOf('Swift_StreamFilters_ByteArrayReplacementFilter')
- ->addConstructorValue(array(array(0x0D, 0x0A), array(0x0D), array(0x0A)))
- ->addConstructorValue(array(array(0x0A), array(0x0A), array(0x0D, 0x0A)))
+ ->addConstructorValue([[0x0D, 0x0A], [0x0D], [0x0A]])
+ ->addConstructorValue([[0x0A], [0x0A], [0x0D, 0x0A]])
->register('mime.characterreaderfactory')
->asSharedInstanceOf('Swift_CharacterReaderFactory_SimpleCharacterReaderFactory')
+ ->register('mime.textcontentencoder')
+ ->asAliasOf('mime.qpcontentencoder')
+
->register('mime.safeqpcontentencoder')
->asNewInstanceOf('Swift_Mime_ContentEncoder_QpContentEncoder')
- ->withDependencies(array('mime.charstream', 'mime.bytecanonicalizer'))
+ ->withDependencies(['mime.charstream', 'mime.bytecanonicalizer'])
->register('mime.rawcontentencoder')
->asNewInstanceOf('Swift_Mime_ContentEncoder_RawContentEncoder')
->register('mime.nativeqpcontentencoder')
- ->withDependencies(array('properties.charset'))
+ ->withDependencies(['properties.charset'])
->asNewInstanceOf('Swift_Mime_ContentEncoder_NativeQpContentEncoder')
->register('mime.qpcontentencoder')
->asNewInstanceOf('Swift_Mime_ContentEncoder_QpContentEncoderProxy')
- ->withDependencies(array('mime.safeqpcontentencoder', 'mime.nativeqpcontentencoder', 'properties.charset'))
+ ->withDependencies(['mime.safeqpcontentencoder', 'mime.nativeqpcontentencoder', 'properties.charset'])
->register('mime.7bitcontentencoder')
->asNewInstanceOf('Swift_Mime_ContentEncoder_PlainContentEncoder')
@@ -124,7 +128,7 @@ Swift_DependencyContainer::getInstance()
->register('mime.rfc2231encoder')
->asNewInstanceOf('Swift_Encoder_Rfc2231Encoder')
- ->withDependencies(array('mime.charstream'))
+ ->withDependencies(['mime.charstream'])
;
unset($swift_mime_types);
diff --git a/htdocs/includes/swiftmailer/lib/dependency_maps/transport_deps.php b/htdocs/includes/swiftmailer/lib/dependency_maps/transport_deps.php
index 15772abb255..34a63c78e51 100644
--- a/htdocs/includes/swiftmailer/lib/dependency_maps/transport_deps.php
+++ b/htdocs/includes/swiftmailer/lib/dependency_maps/transport_deps.php
@@ -5,24 +5,25 @@ Swift_DependencyContainer::getInstance()
// As SERVER_NAME can come from the user in certain configurations, check that
// it does not contain forbidden characters (see RFC 952 and RFC 2181). Use
// preg_replace() instead of preg_match() to prevent DoS attacks with long host names.
- ->asValue(!empty($_SERVER['SERVER_NAME']) && preg_replace('/(?:^\[)?[a-zA-Z0-9-:\]_]+\.?/', '', $_SERVER['SERVER_NAME']) === '' ? trim($_SERVER['SERVER_NAME'], '[]') : '127.0.0.1')
+ ->asValue(!empty($_SERVER['SERVER_NAME']) && '' === preg_replace('/(?:^\[)?[a-zA-Z0-9-:\]_]+\.?/', '', $_SERVER['SERVER_NAME']) ? trim($_SERVER['SERVER_NAME'], '[]') : '127.0.0.1')
->register('transport.smtp')
->asNewInstanceOf('Swift_Transport_EsmtpTransport')
- ->withDependencies(array(
+ ->withDependencies([
'transport.buffer',
- array('transport.authhandler'),
+ 'transport.smtphandlers',
'transport.eventdispatcher',
'transport.localdomain',
- ))
+ 'address.idnaddressencoder',
+ ])
->register('transport.sendmail')
->asNewInstanceOf('Swift_Transport_SendmailTransport')
- ->withDependencies(array(
+ ->withDependencies([
'transport.buffer',
'transport.eventdispatcher',
'transport.localdomain',
- ))
+ ])
->register('transport.loadbalanced')
->asNewInstanceOf('Swift_Transport_LoadBalancedTransport')
@@ -32,27 +33,40 @@ Swift_DependencyContainer::getInstance()
->register('transport.spool')
->asNewInstanceOf('Swift_Transport_SpoolTransport')
- ->withDependencies(array('transport.eventdispatcher'))
+ ->withDependencies(['transport.eventdispatcher'])
->register('transport.null')
->asNewInstanceOf('Swift_Transport_NullTransport')
- ->withDependencies(array('transport.eventdispatcher'))
+ ->withDependencies(['transport.eventdispatcher'])
->register('transport.buffer')
->asNewInstanceOf('Swift_Transport_StreamBuffer')
- ->withDependencies(array('transport.replacementfactory'))
+ ->withDependencies(['transport.replacementfactory'])
+
+ ->register('transport.smtphandlers')
+ ->asArray()
+ ->withDependencies(['transport.authhandler'])
->register('transport.authhandler')
->asNewInstanceOf('Swift_Transport_Esmtp_AuthHandler')
- ->withDependencies(array(
- array(
- 'transport.crammd5auth',
- 'transport.loginauth',
- 'transport.plainauth',
- 'transport.ntlmauth',
- 'transport.xoauth2auth',
- ),
- ))
+ ->withDependencies(['transport.authhandlers'])
+
+ ->register('transport.authhandlers')
+ ->asArray()
+ ->withDependencies([
+ 'transport.crammd5auth',
+ 'transport.loginauth',
+ 'transport.plainauth',
+ 'transport.ntlmauth',
+ 'transport.xoauth2auth',
+ ])
+
+ ->register('transport.smtputf8handler')
+ ->asNewInstanceOf('Swift_Transport_Esmtp_SmtpUtf8Handler')
+
+ ->register('transport.8bitmimehandler')
+ ->asNewInstanceOf('Swift_Transport_Esmtp_EightBitMimeHandler')
+ ->addConstructorValue('8BITMIME')
->register('transport.crammd5auth')
->asNewInstanceOf('Swift_Transport_Esmtp_Auth_CramMd5Authenticator')
@@ -74,4 +88,10 @@ Swift_DependencyContainer::getInstance()
->register('transport.replacementfactory')
->asSharedInstanceOf('Swift_StreamFilters_StringReplacementFilterFactory')
+
+ ->register('address.idnaddressencoder')
+ ->asNewInstanceOf('Swift_AddressEncoder_IdnAddressEncoder')
+
+ ->register('address.utf8addressencoder')
+ ->asNewInstanceOf('Swift_AddressEncoder_Utf8AddressEncoder')
;
diff --git a/htdocs/includes/swiftmailer/lib/mime_types.php b/htdocs/includes/swiftmailer/lib/mime_types.php
index b42c1cc1a3e..72c6fd2afa6 100644
--- a/htdocs/includes/swiftmailer/lib/mime_types.php
+++ b/htdocs/includes/swiftmailer/lib/mime_types.php
@@ -17,7 +17,7 @@
// You may add or take away what you like (lowercase required)
-$swift_mime_types = array(
+$swift_mime_types = [
'3dml' => 'text/vnd.in3d.3dml',
'3ds' => 'image/x-3ds',
'3g2' => 'video/3gpp2',
@@ -1004,4 +1004,4 @@ $swift_mime_types = array(
'zirz' => 'application/vnd.zul',
'zmm' => 'application/vnd.handheld-entertainment+xml',
'123' => 'application/vnd.lotus-1-2-3',
-);
+];
diff --git a/htdocs/includes/swiftmailer/lib/swiftmailer_generate_mimes_config.php b/htdocs/includes/swiftmailer/lib/swiftmailer_generate_mimes_config.php
index 85f2d69f21c..ad8fd2aa0d5 100644
--- a/htdocs/includes/swiftmailer/lib/swiftmailer_generate_mimes_config.php
+++ b/htdocs/includes/swiftmailer/lib/swiftmailer_generate_mimes_config.php
@@ -1,8 +1,8 @@
#!/usr/bin/php
'application/x-php',
'php3' => 'application/x-php',
'php4' => 'application/x-php',
@@ -95,7 +95,7 @@ function generateUpToDateMimeArray()
'xls' => 'application/vnd.ms-excel',
'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'xml' => 'application/xml',
- );
+ ];
// wrap array for generating file
foreach ($valid_mime_types_preset as $extension => $mime_type) {
@@ -103,17 +103,14 @@ function generateUpToDateMimeArray()
$valid_mime_types[$extension] = "'{$extension}' => '{$mime_type}'";
}
- // collect extensions
- $valid_extensions = array();
-
// all extensions from second match
foreach ($matches[2] as $i => $extensions) {
// explode multiple extensions from string
- $extensions = explode(' ', strtolower($extensions));
+ $extensions = explode(' ', strtolower($extensions ?? ''));
// force array for foreach
- if (!is_array($extensions)) {
- $extensions = array($extensions);
+ if (!\is_array($extensions)) {
+ $extensions = [$extensions];
}
foreach ($extensions as $extension) {
@@ -121,10 +118,7 @@ function generateUpToDateMimeArray()
$mime_type = $matches[1][$i];
// check if string length lower than 10
- if (strlen($extension) < 10) {
- // add extension
- $valid_extensions[] = $extension;
-
+ if (\strlen($extension) < 10) {
if (!isset($valid_mime_types[$mime_type])) {
// generate array for mimetype to extension resolver (only first match)
$valid_mime_types[$extension] = "'{$extension}' => '{$mime_type}'";
@@ -145,29 +139,24 @@ function generateUpToDateMimeArray()
// get all matching extensions from match
foreach ((array) $node->glob['pattern'] as $extension) {
// skip none glob extensions
- if (strpos($extension, '.') === false) {
+ if (false === strpos($extension ?? '', '.')) {
continue;
}
// remove get only last part
- $extension = explode('.', strtolower($extension));
+ $extension = explode('.', strtolower($extension ?? ''));
$extension = end($extension);
-
- // maximum length in database column
- if (strlen($extension) <= 9) {
- $valid_extensions[] = $extension;
- }
}
if (isset($node->glob['pattern'][0])) {
// mime type
- $mime_type = strtolower((string) $node['type']);
+ $mime_type = strtolower((string) $node['type'] ?? '');
// get first extension
- $extension = strtolower(trim($node->glob['ddpattern'][0], '*.'));
+ $extension = strtolower(trim($node->glob['ddpattern'][0] ?? '', '*.'));
// skip none glob extensions and check if string length between 1 and 10
- if (strpos($extension, '.') !== false || strlen($extension) < 1 || strlen($extension) > 9) {
+ if (false !== strpos($extension, '.') || \strlen($extension) < 1 || \strlen($extension) > 9) {
continue;
}
@@ -184,7 +173,7 @@ function generateUpToDateMimeArray()
ksort($valid_mime_types);
// combine mime types and extensions array
- $output = "$preamble\$swift_mime_types = array(\n ".implode($valid_mime_types, ",\n ")."\n);";
+ $output = "$preamble\$swift_mime_types = array(\n ".implode(",\n ", $valid_mime_types)."\n);";
// write mime_types.php config file
@file_put_contents('./mime_types.php', $output);
diff --git a/htdocs/install/check.php b/htdocs/install/check.php
index d3c5cba1290..f260be4f9fb 100644
--- a/htdocs/install/check.php
+++ b/htdocs/install/check.php
@@ -420,29 +420,26 @@ if (!file_exists($conffile)) {
if (GETPOST('allowupgrade')) {
$allowupgrade = true;
}
- $migrationscript = array(
- array('from'=>'3.0.0', 'to'=>'3.1.0'),
- array('from'=>'3.1.0', 'to'=>'3.2.0'),
- array('from'=>'3.2.0', 'to'=>'3.3.0'),
- array('from'=>'3.3.0', 'to'=>'3.4.0'),
- array('from'=>'3.4.0', 'to'=>'3.5.0'),
- array('from'=>'3.5.0', 'to'=>'3.6.0'),
- array('from'=>'3.6.0', 'to'=>'3.7.0'),
- array('from'=>'3.7.0', 'to'=>'3.8.0'),
- array('from'=>'3.8.0', 'to'=>'3.9.0'),
- array('from'=>'3.9.0', 'to'=>'4.0.0'),
- array('from'=>'4.0.0', 'to'=>'5.0.0'),
- array('from'=>'5.0.0', 'to'=>'6.0.0'),
- array('from'=>'6.0.0', 'to'=>'7.0.0'),
- array('from'=>'7.0.0', 'to'=>'8.0.0'),
- array('from'=>'8.0.0', 'to'=>'9.0.0'),
- array('from'=>'9.0.0', 'to'=>'10.0.0'),
- array('from'=>'10.0.0', 'to'=>'11.0.0'),
- array('from'=>'11.0.0', 'to'=>'12.0.0'),
- array('from'=>'12.0.0', 'to'=>'13.0.0'),
- array('from'=>'13.0.0', 'to'=>'14.0.0'),
- array('from'=>'14.0.0', 'to'=>'15.0.0'),
- );
+
+ $dir = DOL_DOCUMENT_ROOT."/install/mysql/migration/"; // We use mysql migration scripts whatever is database driver
+ dolibarr_install_syslog("Scan sql files for migration files in ".$dir);
+
+ // Get files list of migration file x.y.z-a.b.c.sql into /install/mysql/migration
+ $migrationscript = array();
+ $handle = opendir($dir);
+ if (is_resource($handle)) {
+ while (($file = readdir($handle)) !== false) {
+ $reg = array();
+ if (preg_match('/^(\d+\.\d+\.\d+)-(\d+\.\d+\.\d+)\.sql$/i', $file, $reg)) {
+ if (!empty($reg[2]) && version_compare(DOL_VERSION, $reg[2])) {
+ $migrationscript[] = array('from' => $reg[1], 'to' => $reg[2]);
+ }
+ }
+ }
+ $migrationscript = dol_sort_array($migrationscript, 'from', 'asc', 1);
+ } else {
+ print ''.$langs->trans("ErrorCanNotReadDir", $dir).'
';
+ }
$count = 0;
foreach ($migrationscript as $migarray) {
diff --git a/htdocs/install/default.css b/htdocs/install/default.css
index 6a0e84ce20a..d18e54c0c1c 100644
--- a/htdocs/install/default.css
+++ b/htdocs/install/default.css
@@ -479,5 +479,3 @@ table.tablesupport {
width: 100%;
}
}
-
-}
diff --git a/htdocs/install/mysql/data/llx_c_action_trigger.sql b/htdocs/install/mysql/data/llx_c_action_trigger.sql
index 258b56f1471..119a4215f56 100644
--- a/htdocs/install/mysql/data/llx_c_action_trigger.sql
+++ b/htdocs/install/mysql/data/llx_c_action_trigger.sql
@@ -9,6 +9,7 @@
-- Copyright (C) 2013 Cedric Gross
-- Copyright (C) 2014 Raphaël Doursenaud
-- Copyright (C) 2015 Bahfir Abbes
+-- Copyright (C) 2022 Anthony Berton
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
@@ -39,6 +40,7 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('COMPANY_SENTBYMAIL','Mails sent from third party card','Executed when you send email from third party card','societe',1);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('COMPANY_DELETE','Third party deleted','Executed when you delete third party','societe',1);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_VALIDATE','Customer proposal validated','Executed when a commercial proposal is validated','propal',2);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_MODIFY','Customer proposal modified','Executed when a customer proposal is modified','propal',2);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_SENTBYMAIL','Commercial proposal sent by mail','Executed when a commercial proposal is sent by mail','propal',3);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_CLOSE_SIGNED','Customer proposal closed signed','Executed when a customer proposal is closed signed','propal',2);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_CLOSE_REFUSED','Customer proposal closed refused','Executed when a customer proposal is closed refused','propal',2);
@@ -46,17 +48,20 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_DELETE','Customer proposal deleted','Executed when a customer proposal is deleted','propal',2);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_VALIDATE','Customer order validate','Executed when a customer order is validated','commande',4);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_CLOSE','Customer order classify delivered','Executed when a customer order is set delivered','commande',5);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_MODIFY','Customer order modified','Executed when a customer order is set modified','commande',5);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_CLASSIFY_BILLED','Customer order classify billed','Executed when a customer order is set to billed','commande',5);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_CANCEL','Customer order canceled','Executed when a customer order is canceled','commande',5);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SENTBYMAIL','Customer order sent by mail','Executed when a customer order is sent by mail ','commande',5);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_DELETE','Customer order deleted','Executed when a customer order is deleted','commande',5);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_VALIDATE','Customer invoice validated','Executed when a customer invoice is approved','facture',6);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_MODIFY','Customer invoice modified','Executed when a customer invoice is modified','facture',7);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_PAYED','Customer invoice payed','Executed when a customer invoice is payed','facture',7);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_CANCEL','Customer invoice canceled','Executed when a customer invoice is conceled','facture',8);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SENTBYMAIL','Customer invoice sent by mail','Executed when a customer invoice is sent by mail','facture',9);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_UNVALIDATE','Customer invoice unvalidated','Executed when a customer invoice status set back to draft','facture',9);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_DELETE','Customer invoice deleted','Executed when a customer invoice is deleted','facture',9);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPOSAL_SUPPLIER_VALIDATE','Price request validated','Executed when a commercial proposal is validated','proposal_supplier',10);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPOSAL_SUPPLIER_MODIFY','Price request modified','Executed when a commercial proposal is modified','proposal_supplier',10);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPOSAL_SUPPLIER_SENTBYMAIL','Price request sent by mail','Executed when a commercial proposal is sent by mail','proposal_supplier',10);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPOSAL_SUPPLIER_CLOSE_SIGNED','Price request closed signed','Executed when a customer proposal is closed signed','proposal_supplier',10);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPOSAL_SUPPLIER_CLOSE_REFUSED','Price request closed refused','Executed when a customer proposal is closed refused','proposal_supplier',10);
@@ -64,6 +69,7 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
--insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_CREATE','Supplier order created','Executed when a supplier order is created','order_supplier',11);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_VALIDATE','Supplier order validated','Executed when a supplier order is validated','order_supplier',12);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_APPROVE','Supplier order request approved','Executed when a supplier order is approved','order_supplier',13);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_MODIFY','Supplier order request modified','Executed when a supplier order is modified','order_supplier',13);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_SUBMIT','Supplier order request submited','Executed when a supplier order is approved','order_supplier',13);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_RECEIVE','Supplier order request received','Executed when a supplier order is received','order_supplier',13);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_REFUSE','Supplier order request refused','Executed when a supplier order is refused','order_supplier',13);
@@ -72,20 +78,24 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_CLASSIFY_BILLED','Supplier order set billed','Executed when a supplier order is set as billed','order_supplier',14);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_DELETE','Supplier order deleted','Executed when a supplier order is deleted','order_supplier',14);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SUPPLIER_VALIDATE','Supplier invoice validated','Executed when a supplier invoice is validated','invoice_supplier',15);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SUPPLIER_MODIFY','Supplier invoice modified','Executed when a supplier invoice is modified','invoice_supplier',15);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SUPPLIER_UNVALIDATE','Supplier invoice unvalidated','Executed when a supplier invoice status is set back to draft','invoice_supplier',15);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SUPPLIER_PAYED','Supplier invoice payed','Executed when a supplier invoice is payed','invoice_supplier',16);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SUPPLIER_SENTBYMAIL','Supplier invoice sent by mail','Executed when a supplier invoice is sent by mail','invoice_supplier',17);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SUPPLIER_CANCELED','Supplier invoice cancelled','Executed when a supplier invoice is cancelled','invoice_supplier',17);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SUPPLIER_DELETE','Supplier invoice deleted','Executed when a supplier invoice is deleted','invoice_supplier',17);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTRACT_VALIDATE','Contract validated','Executed when a contract is validated','contrat',18);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTRACT_MODIFY','Contract modified','Executed when a contract is modified','contrat',18);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTRACT_SENTBYMAIL','Contract sent by mail','Executed when a contract is sent by mail','contrat',18);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTRACT_DELETE','Contract deleted','Executed when a contract is deleted','contrat',18);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('SHIPPING_VALIDATE','Shipping validated','Executed when a shipping is validated','shipping',20);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('SHIPPING_MODIFY','Shipping modified','Executed when a shipping is modified','shipping',20);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('SHIPPING_SENTBYMAIL','Shipping sent by mail','Executed when a shipping is sent by mail','shipping',21);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('SHIPPING_DELETE','Shipping sent is deleted','Executed when a shipping is deleted','shipping',21);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECEPTION_VALIDATE','Reception validated','Executed when a reception is validated','reception',22);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECEPTION_SENTBYMAIL','Reception sent by mail','Executed when a reception is sent by mail','reception',22);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_VALIDATE','Member validated','Executed when a member is validated','member',22);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_MODIFY','Member modified','Executed when a member is modified','member',23);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_SENTBYMAIL','Mails sent from member card','Executed when you send email from member card','member',23);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_SUBSCRIPTION_CREATE','Member subscribtion recorded','Executed when a member subscribtion is deleted','member',24);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_SUBSCRIPTION_MODIFY','Member subscribtion modified','Executed when a member subscribtion is modified','member',24);
@@ -94,21 +104,27 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_DELETE','Member deleted','Executed when a member is deleted','member',26);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_EXCLUDE','Member excluded','Executed when a member is excluded','member',27);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_VALIDATE','Intervention validated','Executed when a intervention is validated','ficheinter',30);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_MODIFY','Intervention modify','Executed when a intervention is modify','ficheinter',30);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_CLASSIFY_BILLED','Intervention set billed','Executed when a intervention is set to billed (when option FICHINTER_CLASSIFY_BILLED is set)','ficheinter',32);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_CLASSIFY_UNBILLED','Intervention set unbilled','Executed when a intervention is set to unbilled (when option FICHINTER_CLASSIFY_BILLED is set)','ficheinter',33);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_REOPEN','Intervention opened','Executed when a intervention is re-opened','ficheinter',34);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_SENTBYMAIL','Intervention sent by mail','Executed when a intervention is sent by mail','ficheinter',35);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_DELETE','Intervention is deleted','Executed when a intervention is deleted','ficheinter',35);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PRODUCT_CREATE','Product or service created','Executed when a product or sevice is created','product',40);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PRODUCT_MODIFY','Product or service modified','Executed when a product or sevice is modified','product',41);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PRODUCT_DELETE','Product or service deleted','Executed when a product or sevice is deleted','product',42);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_CREATE','Expense report created','Executed when an expense report is created','expensereport',201);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_VALIDATE','Expense report validated','Executed when an expense report is validated','expensereport',202);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_MODIFY','Expense report modified','Executed when an expense report is modified','expensereport',202);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_APPROVE','Expense report approved','Executed when an expense report is approved','expensereport',203);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_PAID','Expense report billed','Executed when an expense report is set as billed','expensereport',204);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_DELETE','Expense report deleted','Executed when an expense report is deleted','expensereport',205);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_VALIDATE','Expense report validated','Executed when an expense report is validated','expensereport',211);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_MODIFY','Expense report modified','Executed when an expense report is modified','expensereport',212);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_APPROVE','Expense report approved','Executed when an expense report is approved','expensereport',212);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_CREATE','Project creation','Executed when a project is created','project',140);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_VALIDATE','Project validation','Executed when a project is validated','project',141);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_MODIFY','Project modified','Executed when a project is modified','project',142);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_DELETE','Project deleted','Executed when a project is deleted','project',143);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TICKET_CREATE','Ticket created','Executed when a ticket is created','ticket',161);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TICKET_MODIFY','Ticket modified','Executed when a ticket is modified','ticket',163);
@@ -122,11 +138,7 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('USER_DELETE','User update','Executed when a user is deleted','user',303);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('USER_NEW_PASSWORD','User update','Executed when a user is change password','user',304);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('USER_ENABLEDISABLE','User update','Executed when a user is enable or disable','user',305);
-insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PRODUCT_MODIFY','Product or service modified','Executed when a product or sevice is modified','product',41);
-insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_MODIFY','Member modified','Executed when a member is modified','member',23);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_MODIFY','Intervention modified','Executed when a intervention is modified','ficheinter',19);
-insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_CREATE','Project creation','Executed when a project is created','project',140);
-insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_MODIFY','Project modified','Executed when a project is modified','project',142);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_VALIDATE','BOM validated','Executed when a BOM is validated','bom',650);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_UNVALIDATE','BOM unvalidated','Executed when a BOM is unvalidated','bom',651);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_CLOSE','BOM disabled','Executed when a BOM is disabled','bom',652);
@@ -140,7 +152,6 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_MODIFY','Contact address update','Executed when a contact is updated','contact',51);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_SENTBYMAIL','Mails sent from third party card','Executed when you send email from contact address record','contact',52);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_DELETE','Contact address deleted','Executed when a contact is deleted','contact',53);
-
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTJOBPOSITION_CREATE','Job created','Executed when a job is created','recruitment',7500);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTJOBPOSITION_MODIFY','Job modified','Executed when a job is modified','recruitment',7502);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTJOBPOSITION_SENTBYMAIL','Mails sent from job record','Executed when you send email from job record','recruitment',7504);
diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql
index a9f1a669e52..517771ced4e 100644
--- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql
+++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql
@@ -484,9 +484,9 @@ ALTER TABLE llx_delivery DROP FOREIGN KEY fk_livraison_fk_user_author;
ALTER TABLE llx_delivery DROP FOREIGN KEY fk_livraison_fk_user_valid;
-- add constraint
-ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid);
-ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid);
-ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_user_valid FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid);
+ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid);
+ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid);
+ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_user_valid FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid);
ALTER TABLE llx_deliverydet DROP FOREIGN KEY fk_livraisondet_fk_livraison;
ALTER TABLE llx_deliverydet DROP INDEX idx_livraisondet_fk_expedition;
diff --git a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql
index 50342bc6917..476e63aab68 100644
--- a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql
+++ b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql
@@ -72,11 +72,14 @@ ALTER TABLE llx_salary_extrafields ADD INDEX idx_salary_extrafields (fk_object);
INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailAskConf)', 10, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskConf)__', '__(Hello)__, __(OrganizationEventConfRequestWasReceived)__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailAskBooth)', 20, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskBooth)__', '__(Hello)__, __(OrganizationEventBoothRequestWasReceived)__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
-- TODO Add message for registration only to event __ONLINE_PAYMENT_TEXT_AND_URL__
-INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailSubsBooth)', 30, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailBoothPayment)__', '__(Hello)__, __(OrganizationEventPaymentOfBoothWasReceived)__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
-INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailSubsEvent)', 40, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailRegistrationPayment)__', '__(Hello)__, __(OrganizationEventPaymentOfRegistrationWasReceived)__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
+INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailBoothPayment)', 30, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailBoothPayment)__', '__(Hello)__, __(OrganizationEventPaymentOfBoothWasReceived)__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
+INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailRegistrationPayment)', 40, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailRegistrationPayment)__', '__(Hello)__, __(OrganizationEventPaymentOfRegistrationWasReceived)__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationMassEmailAttendees)', 50, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailAttendees)__', '__(Hello)__, __(OrganizationEventBulkMailToAttendees)__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationMassEmailSpeakers)', 60, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailSpeakers)__', '__(Hello)__, __(OrganizationEventBulkMailToSpeakers)__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
+UPDATE llx_c_email_templates SET label = '(EventOrganizationEmailBoothPayment)' WHERE label = '(EventOrganizationEmailSubsBooth)';
+UPDATE llx_c_email_templates SET label = '(EventOrganizationEmailRegistrationPayment)' WHERE label = '(EventOrganizationEmailSubsEvent)';
+
--Fix bad sign on multicompany column for customer invoice lines
UPDATE llx_facturedet SET multicurrency_subprice = -multicurrency_subprice WHERE ((multicurrency_subprice < 0 and subprice > 0) OR (multicurrency_subprice > 0 and subprice < 0));
@@ -289,7 +292,7 @@ CREATE TABLE llx_hrm_job_user(
date_creation datetime NOT NULL,
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
fk_contrat integer,
- fk_user integer NOT NULL,
+ fk_user integer,
fk_job integer NOT NULL,
date_start date,
date_end date,
diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql
index 42f16f4b4d0..48292523326 100644
--- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql
+++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql
@@ -1,7 +1,7 @@
--
-- Be carefull to requests order.
-- This file must be loaded by calling /install/index.php page
--- when current version is 14.0.0 or higher.
+-- when current version is 15.0.0 or higher.
--
-- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y
-- To restrict request to Pgsql version x.y minimum use -- VPGSQLx.y
@@ -29,6 +29,7 @@
-- To rebuild sequence for postgresql after insert by forcing id autoincrement fields:
-- -- VPGSQL8.2 SELECT dol_util_rebuild_sequences();
+
-- Missing in v15 or lower
ALTER TABLE llx_c_availability MODIFY COLUMN label varchar(128);
@@ -70,3 +71,19 @@ UPDATE llx_rights_def SET perms = 'writeall' WHERE perms = 'writeall_advance' AN
-- v16
+
+ALTER TABLE llx_projet_task_time ADD COLUMN fk_product integer NULL;
+
+INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_MODIFY','Customer proposal modified','Executed when a customer proposal is modified','propal',2);
+INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_MODIFY','Customer order modified','Executed when a customer order is set modified','commande',5);
+INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_MODIFY','Customer invoice modified','Executed when a customer invoice is modified','facture',7);
+INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPOSAL_SUPPLIER_MODIFY','Price request modified','Executed when a commercial proposal is modified','proposal_supplier',10);
+INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_MODIFY','Supplier order request modified','Executed when a supplier order is modified','order_supplier',13);
+INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SUPPLIER_MODIFY','Supplier invoice modified','Executed when a supplier invoice is modified','invoice_supplier',15);
+INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTRACT_MODIFY','Contract modified','Executed when a contract is modified','contrat',18);
+INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('SHIPPING_MODIFY','Shipping modified','Executed when a shipping is modified','shipping',20);
+INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_MODIFY','Intervention modify','Executed when a intervention is modify','ficheinter',30);
+INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('PRODUCT_MODIFY','Product or service modified','Executed when a product or sevice is modified','product',41);
+INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_MODIFY','Expense report modified','Executed when an expense report is modified','expensereport',202);
+INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_MODIFY','Expense report modified','Executed when an expense report is modified','expensereport',212);
+
diff --git a/htdocs/install/mysql/tables/llx_hrm_job_user-hrm.sql b/htdocs/install/mysql/tables/llx_hrm_job_user-hrm.sql
index 33906d1607f..4e10bf64bf8 100644
--- a/htdocs/install/mysql/tables/llx_hrm_job_user-hrm.sql
+++ b/htdocs/install/mysql/tables/llx_hrm_job_user-hrm.sql
@@ -23,7 +23,7 @@ CREATE TABLE llx_hrm_job_user(
date_creation datetime NOT NULL,
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
fk_contrat integer,
- fk_user integer NOT NULL,
+ fk_user integer,
fk_job integer NOT NULL,
date_start datetime,
date_end datetime,
diff --git a/htdocs/install/mysql/tables/llx_projet_task_time.sql b/htdocs/install/mysql/tables/llx_projet_task_time.sql
index 786d8907588..63eadb1177f 100644
--- a/htdocs/install/mysql/tables/llx_projet_task_time.sql
+++ b/htdocs/install/mysql/tables/llx_projet_task_time.sql
@@ -24,6 +24,7 @@ create table llx_projet_task_time
task_datehour datetime, -- day + hour
task_date_withhour integer DEFAULT 0, -- 0 by default, 1 if date was entered with start hour
task_duration double,
+ fk_product integer NULL,
fk_user integer,
thm double(24,8),
invoice_id integer DEFAULT NULL, -- If we need to invoice each line of timespent, we can save invoice id here
diff --git a/htdocs/intracommreport/card.php b/htdocs/intracommreport/card.php
index 4dfc3250014..c769b89f9b8 100644
--- a/htdocs/intracommreport/card.php
+++ b/htdocs/intracommreport/card.php
@@ -13,7 +13,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
+ * along with this program. If not, see .
*/
/**
@@ -21,6 +21,18 @@
* \ingroup Intracomm report
* \brief Page to manage intracomm report export
*/
+
+
+/** Terms
+ *
+ * DEB = Declaration d'Exchanges de Biens (FR) = Declaration of Exchange of Goods (EN)
+ * DES = Déclaration Européenne de Services (FR) = European Declaration of Services (EN)
+ *
+ * INTRACOMM: Douanes françaises (FR) = french customs (EN) - https://www.douane.gouv.fr/professionnels/commerce-international/import-export
+ *
+ */
+
+
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
@@ -29,7 +41,7 @@ require_once DOL_DOCUMENT_ROOT.'/intracommreport/class/intracommreport.class.php
$langs->loadLangs(array("intracommreport"));
$action = GETPOST('action');
-$exporttype = GETPOSTISSET('exporttype') ? GETPOST('exporttype', 'alphanohtml') : 'deb'; // DEB ou DES
+$exporttype = GETPOSTISSET('exporttype') ? GETPOST('exporttype', 'alphanohtml') : 'deb'; // DEB or DES
$year = GETPOSTINT('year');
$month = GETPOSTINT('month');
$label = (string) GETPOST('label', 'alphanohtml');
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index e8a64b3f72b..1bf5233f660 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -343,7 +343,7 @@ StepNb=Step %s
FindPackageFromWebSite=Find a package that provides the features you need (for example on the official web site %s).
DownloadPackageFromWebSite=Download package (for example from the official web site %s).
UnpackPackageInDolibarrRoot=Unpack/unzip the packaged files into your Dolibarr server directory: %s
-UnpackPackageInModulesRoot=To deploy/install an external module, unpack/unzip the packaged files into the server directory dedicated to external modules:%s
+UnpackPackageInModulesRoot=To deploy/install an external module, you must unpack/unzip the archive file into the server directory dedicated to external modules:%s
SetupIsReadyForUse=Module deployment is finished. You must however enable and setup the module in your application by going to the page setup modules: %s .
NotExistsDirect=The alternative root directory is not defined to an existing directory.
InfDirAlt=Since version 3, it is possible to define an alternative root directory. This allows you to store, into a dedicated directory, plug-ins and custom templates. Just create a directory at the root of Dolibarr (eg: custom).
@@ -2216,4 +2216,5 @@ NativeModules=Native modules
NoDeployedModulesFoundWithThisSearchCriteria=No modules found for these search criteria
API_DISABLE_COMPRESSION=Disable compression of API responses
EachTerminalHasItsOwnCounter=Each terminal use its own counter.
-FillAndSaveAccountIdAndSecret=Fill and save account ID and secret first
\ No newline at end of file
+FillAndSaveAccountIdAndSecret=Fill and save account ID and secret first
+PreviousHash=Previous hash
\ No newline at end of file
diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang
index 7f4ca7b074f..6dbc9943586 100644
--- a/htdocs/langs/en_US/errors.lang
+++ b/htdocs/langs/en_US/errors.lang
@@ -27,7 +27,9 @@ ErrorThisContactIsAlreadyDefinedAsThisType=This contact is already defined as co
ErrorCashAccountAcceptsOnlyCashMoney=This bank account is a cash account, so it accepts payments of type cash only.
ErrorFromToAccountsMustDiffers=Source and targets bank accounts must be different.
ErrorBadThirdPartyName=Bad value for third-party name
+ForbiddenBySetupRules=Forbidden by setup rules
ErrorProdIdIsMandatory=The %s is mandatory
+ErrorAccountancyCodeCustomerIsMandatory=The accountancy code of customer %s is mandatory
ErrorBadCustomerCodeSyntax=Bad syntax for customer code
ErrorBadBarCodeSyntax=Bad syntax for barcode. May be you set a bad barcode type or you defined a barcode mask for numbering that does not match value scanned.
ErrorCustomerCodeRequired=Customer code required
@@ -315,6 +317,7 @@ RequireAtLeastXString = Requires at least %s character(s)
RequireXStringMax = Requires %s character(s) max
RequireAtLeastXDigits = Requires at least %s digit(s)
RequireXDigitsMax = Requires %s digit(s) max
+RequireValidNumeric = Requires a numeric value
RequireValidEmail = Email address is not valid
RequireMaxLength = Length must be less than %s chars
RequireMinLength = Length must be more than %s char(s)
diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang
index 88415022bde..bc334fe08cf 100644
--- a/htdocs/langs/en_US/eventorganization.lang
+++ b/htdocs/langs/en_US/eventorganization.lang
@@ -42,12 +42,12 @@ EVENTORGANIZATION_CATEG_THIRDPARTY_CONF = Category to add to third-parties autom
EVENTORGANIZATION_CATEG_THIRDPARTY_BOOTH = Category to add to third-parties automatically created when they suggests a booth
EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_CONF = Template of email to send after receiving a suggestion of a conference.
EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH = Template of email to send after receiving a suggestion of a booth.
-EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH = Template of email to send after a registration to a booth has been paid.
+EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH = Template of email to send after a registration to a booth has been paid.
EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT = Template of email to send after a registration to an event has been paid.
-EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_SPEAKER = Template of email of massaction to attendes
-EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_ATTENDES = Template of email of massaction to speakers
-EVENTORGANIZATION_FILTERATTENDEES_CAT = Filter thirdpartie's select list in attendees creation card/form with category
-EVENTORGANIZATION_FILTERATTENDEES_TYPE = Filter thirdpartie's select list in attendees creation card/form with customer type
+EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_SPEAKER = Template of email to use when sending emails from the massaction "Send emails" to speakers
+EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_ATTENDES = Template of email to use when sending emails from the massaction "Send emails" on attendee list
+EVENTORGANIZATION_FILTERATTENDEES_CAT = In the form to create/add an attendee, restricts the list of thirdparties to thirdparties in the category
+EVENTORGANIZATION_FILTERATTENDEES_TYPE = In the form to create/add an attendee, restricts the list of thirdparties to thirdparties with the nature
#
# Object
@@ -71,6 +71,7 @@ EventOrganizationEmailBoothPayment = Payment of your booth
EventOrganizationEmailRegistrationPayment = Registration for an event
EventOrganizationMassEmailAttendees = Communication to attendees
EventOrganizationMassEmailSpeakers = Communication to speakers
+ToSpeakers=To speakers
#
# Event
@@ -83,14 +84,14 @@ PriceOfRegistration=Price of registration
PriceOfRegistrationHelp=Price to pay to register or participate in the event
PriceOfBooth=Subscription price to stand a booth
PriceOfBoothHelp=Subscription price to stand a booth
-EventOrganizationICSLink=Link ICS for events
+EventOrganizationICSLink=Link ICS for conferences
ConferenceOrBoothInformation=Conference Or Booth informations
Attendees=Attendees
ListOfAttendeesOfEvent=List of attendees of the event project
DownloadICSLink = Download ICS link
-EVENTORGANIZATION_SECUREKEY = Secure Key of the public registration link to a conference
+EVENTORGANIZATION_SECUREKEY = Seed to secure the key for the public registration page to suggest a conference
SERVICE_BOOTH_LOCATION = Service used for the invoice row about a booth location
-SERVICE_CONFERENCE_ATTENDEE_SUBSCRIPTION = Service used for the invoice row about an attendee subscription to a conference
+SERVICE_CONFERENCE_ATTENDEE_SUBSCRIPTION = Service used for the invoice row about an attendee subscription to an event
NbVotes=Number of votes
#
# Status
diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang
index 9d3a83c7a61..77eabd20221 100644
--- a/htdocs/langs/en_US/projects.lang
+++ b/htdocs/langs/en_US/projects.lang
@@ -197,6 +197,7 @@ InputPerMonth=Input per month
InputDetail=Input detail
TimeAlreadyRecorded=This is time spent already recorded for this task/day and user %s
ProjectsWithThisUserAsContact=Projects with this user as contact
+ProjectsWithThisContact=Projects with this contact
TasksWithThisUserAsContact=Tasks assigned to this user
ResourceNotAssignedToProject=Not assigned to project
ResourceNotAssignedToTheTask=Not assigned to the task
@@ -284,4 +285,5 @@ PROJECT_CLASSIFY_CLOSED_WHEN_ALL_TASKS_DONE_help=Note: existing projects with al
SelectLinesOfTimeSpentToInvoice=Select lines of time spent that are unbilled, then bulk action "Generate Invoice" to bill them
ProjectTasksWithoutTimeSpent=Project tasks without time spent
FormForNewLeadDesc=Thanks to fill the following form to contact us. You can also send us an email directly to %s .
+ProjectsHavingThisContact=Projects having this contact
StartDateCannotBeAfterEndDate=End date cannot be before start date
diff --git a/htdocs/langs/fr_FR/projects.lang b/htdocs/langs/fr_FR/projects.lang
index 1b3c6ec7662..ee3736acef0 100644
--- a/htdocs/langs/fr_FR/projects.lang
+++ b/htdocs/langs/fr_FR/projects.lang
@@ -197,6 +197,7 @@ InputPerMonth=Saisie par mois
InputDetail=Saisir le détail
TimeAlreadyRecorded=C'est le temps passé déjà enregistré pour cette tâche/jour et pour l'utilisateur %s
ProjectsWithThisUserAsContact=Projets avec cet utilisateur comme contact
+ProjectsWithThisContact=Projets avec ce contact
TasksWithThisUserAsContact=Tâches assignées à cet utilisateur
ResourceNotAssignedToProject=Non assigné au projet
ResourceNotAssignedToTheTask=Non assigné à la tache
@@ -284,4 +285,5 @@ PROJECT_CLASSIFY_CLOSED_WHEN_ALL_TASKS_DONE_help=Remarque : les projets existant
SelectLinesOfTimeSpentToInvoice=Sélectionnez les lignes de temps passé non facturées, puis l'action groupée "Générer la facture" pour les facturer
ProjectTasksWithoutTimeSpent=Tâches de projet sans temps consommé
FormForNewLeadDesc=Veuillez remplir ce formulaire de contact ou écrivez un e-mail à %s .
+ProjectsHavingThisContact=Projets ayant ce contact associé
StartDateCannotBeAfterEndDate=La date de fin ne peux être avant la date de début
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 4ec8767a801..fd811877295 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -1767,6 +1767,14 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr
}
}
+ //If you want to load custom javascript file from your selected theme directory
+ if (!empty($conf->global->ALLOW_THEME_JS)) {
+ $theme_js = dol_buildpath('/theme/'.$conf->theme.'/'.$conf->theme.'.js', 0);
+ if (file_exists($theme_js)) {
+ print ''."\n";
+ }
+ }
+
if (!empty($head)) {
print $head."\n";
}
diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php
index 5348ea32520..c9eb9043084 100644
--- a/htdocs/modulebuilder/template/admin/setup.php
+++ b/htdocs/modulebuilder/template/admin/setup.php
@@ -71,6 +71,7 @@ if (!$user->admin) {
// Parameters
$action = GETPOST('action', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
+$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
$value = GETPOST('value', 'alpha');
$label = GETPOST('label', 'alpha');
diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php
index 913609ba821..8040c13d606 100644
--- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php
+++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php
@@ -175,7 +175,10 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
if ($nbofiles) {
$texte .= '';
}
diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php
index 9dedb2dd24e..a493508878c 100644
--- a/htdocs/modulebuilder/template/myobject_card.php
+++ b/htdocs/modulebuilder/template/myobject_card.php
@@ -132,7 +132,7 @@ $upload_dir = $conf->mymodule->multidir_output[isset($object->entity) ? $object-
// Security check (enable the most restrictive one)
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
-//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
+//$isdraft = (isset($object->status) && ($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
//if (empty($conf->mymodule->enabled)) accessforbidden();
//if (!$permissiontoread) accessforbidden();
diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php
index 2e7b4186a87..29db4bcb669 100644
--- a/htdocs/mrp/class/mo.class.php
+++ b/htdocs/mrp/class/mo.class.php
@@ -1300,6 +1300,17 @@ class Mo extends CommonObject
{
global $langs, $hookmanager, $conf, $form;
+ $langs->load('stocks');
+ $text_stock_options = $langs->trans("RealStockDesc").' ';
+ $text_stock_options .= $langs->trans("RealStockWillAutomaticallyWhen").' ';
+ $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE) ? '- '.$langs->trans("DeStockOnShipment").' ' : '');
+ $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) ? '- '.$langs->trans("DeStockOnValidateOrder").' ' : '');
+ $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_BILL) ? '- '.$langs->trans("DeStockOnBill").' ' : '');
+ $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) ? '- '.$langs->trans("ReStockOnBill").' ' : '');
+ $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) ? '- '.$langs->trans("ReStockOnValidateOrder").' ' : '');
+ $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) ? '- '.$langs->trans("ReStockOnDispatchOrder").' ' : '');
+ $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE) ? '- '.$langs->trans("StockOnReception").' ' : '');
+
print '';
print ''.$langs->trans('Ref').' ';
print ''.$langs->trans('Qty');
@@ -1309,6 +1320,8 @@ class Mo extends CommonObject
print ' ('.$langs->trans("ForAQuantityToConsumeOf", $this->bom->qty).') ';
}
print ' ';
+ print ''.$form->textwithpicto($langs->trans("PhysicalStock"), $text_stock_options, 1).' ';
+ print ''.$form->textwithpicto($langs->trans("VirtualStock"), $langs->trans("VirtualStockDesc")).' ';
print ''.$langs->trans('QtyFrozen').' ';
print ''.$langs->trans('DisableStockChange').' ';
//print ''.$langs->trans('Efficiency').' ';
@@ -1358,6 +1371,7 @@ class Mo extends CommonObject
if (!empty($line->fk_product)) {
$productstatic = new Product($this->db);
$productstatic->fetch($line->fk_product);
+ $productstatic->load_virtual_stock();
$this->tpl['label'] .= $productstatic->getNomUrl(1);
//$this->tpl['label'].= ' - '.$productstatic->label;
} else {
@@ -1370,6 +1384,9 @@ class Mo extends CommonObject
$this->tpl['qty_bom'] = $this->bom->qty;
}
+ $this->tpl['stock'] = $productstatic->stock_reel;
+ $this->tpl['seuil_stock_alerte'] = $productstatic->seuil_stock_alerte;
+ $this->tpl['virtual_stock'] = $productstatic->stock_theorique;
$this->tpl['qty'] = $line->qty;
$this->tpl['qty_frozen'] = $line->qty_frozen;
$this->tpl['disable_stock_change'] = $line->disable_stock_change;
diff --git a/htdocs/mrp/tpl/originproductline.tpl.php b/htdocs/mrp/tpl/originproductline.tpl.php
index 478c6504979..ba1d7fccd86 100644
--- a/htdocs/mrp/tpl/originproductline.tpl.php
+++ b/htdocs/mrp/tpl/originproductline.tpl.php
@@ -39,6 +39,16 @@ $qtytoconsumeforline = price2num($qtytoconsumeforline, 'MS');
print ' ';
print ''.$this->tpl['label'].' ';
print ''.$this->tpl['qty'].(($this->tpl['efficiency'] > 0 && $this->tpl['efficiency'] < 1) ? ' / '.$form->textwithpicto($this->tpl['efficiency'], $langs->trans("ValueOfMeansLoss")).' = '.$qtytoconsumeforline : '').' ';
+print ''.(empty($this->tpl['stock']) ? 0 : price2num($this->tpl['stock'], 'MS'));
+if ($this->tpl['seuil_stock_alerte'] != '' && ($this->tpl['stock'] < $this->tpl['seuil_stock_alerte'])) {
+ print ' '.img_warning($langs->trans("StockLowerThanLimit", $this->tpl['seuil_stock_alerte']));
+}
+print ' ';
+print ''.((empty($this->tpl['virtual_stock']) ? 0 : price2num($this->tpl['virtual_stock'], 'MS')));
+if ($this->tpl['seuil_stock_alerte'] != '' && ($this->tpl['virtual_stock'] < $this->tpl['seuil_stock_alerte'])) {
+ print ' '.img_warning($langs->trans("StockLowerThanLimit", $this->tpl['seuil_stock_alerte']));
+}
+print ' ';
print ''.($this->tpl['qty_frozen'] ? yn($this->tpl['qty_frozen']) : '').' ';
print ''.($this->tpl['disable_stock_change'] ? yn($this->tpl['disable_stock_change']) : '').' ';
//print ''.$this->tpl['efficiency'].' ';
diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php
index 4f6094e1787..2d7d99a9ab3 100644
--- a/htdocs/product/admin/product.php
+++ b/htdocs/product/admin/product.php
@@ -46,6 +46,8 @@ if (!$user->admin || (empty($conf->product->enabled) && empty($conf->service->en
$action = GETPOST('action', 'aZ09');
$value = GETPOST('value', 'alpha');
+$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
+
$label = GETPOST('label', 'alpha');
$scandir = GETPOST('scan_dir', 'alpha');
$type = 'product';
diff --git a/htdocs/product/dynamic_price/class/price_parser.class.php b/htdocs/product/dynamic_price/class/price_parser.class.php
index 3d28f4b6011..9bd986a3c73 100644
--- a/htdocs/product/dynamic_price/class/price_parser.class.php
+++ b/htdocs/product/dynamic_price/class/price_parser.class.php
@@ -263,13 +263,16 @@ class PriceParser
return -1;
} elseif ($res == 0) {
$supplier_min_price = 0;
+ $supplier_min_price_with_discount = 0;
} else {
$supplier_min_price = $productFournisseur->fourn_unitprice;
+ $supplier_min_price_with_discount = $productFournisseur->fourn_unitprice_with_discount;
}
//Accessible values by expressions
$extra_values = array_merge($extra_values, array(
"supplier_min_price" => $supplier_min_price,
+ "supplier_min_price_with_discount" => $supplier_min_price_with_discount,
));
//Parse the expression and return the price, if not error occurred check if price is higher than min
@@ -329,12 +332,13 @@ class PriceParser
//Values for product expressions
$extra_values = array_merge($extra_values, array(
"supplier_min_price" => 1,
+ "supplier_min_price_with_discount" => 2,
));
//Values for supplier product expressions
$extra_values = array_merge($extra_values, array(
- "supplier_quantity" => 2,
- "supplier_tva_tx" => 3,
+ "supplier_quantity" => 3,
+ "supplier_tva_tx" => 4,
));
return $this->parseExpression($product, $expression, $extra_values);
}
diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php
index 82747fb8360..95c9e2972cb 100644
--- a/htdocs/product/inventory/inventory.php
+++ b/htdocs/product/inventory/inventory.php
@@ -630,7 +630,10 @@ if ($object->id > 0) {
errortab3 = [];
errortab4 = [];
- if(textarray[0] != ""){
+ textarray = textarray.filter(function(value){
+ return value != "";
+ });
+ if(textarray.some((element) => element != "")){
$(".expectedqty").each(function(){
id = this.id;
console.log("Analyze line "+id+" in inventory");
@@ -851,7 +854,7 @@ if ($object->id > 0) {
print ' ';
print ''.$langs->trans("Warehouse").' ';
print ''.$langs->trans("Product").' ';
- if ($conf->productbatch->enabled) {
+ if (!empty($conf->productbatch->enabled)) {
print '';
print $langs->trans("Batch");
print ' ';
@@ -881,7 +884,7 @@ if ($object->id > 0) {
print '';
print $form->select_produits((GETPOSTISSET('fk_product') ? GETPOST('fk_product', 'int') : $object->fk_product), 'fk_product', '', 0, 0, -1, 2, '', 0, null, 0, '1', 0, 'maxwidth300');
print ' ';
- if ($conf->productbatch->enabled) {
+ if (!empty($conf->productbatch->enabled)) {
print '';
print ' ';
print ' ';
@@ -927,6 +930,7 @@ if ($object->id > 0) {
}
// Load real stock we have now
+ $option = '';
if (isset($cacheOfProducts[$obj->fk_product])) {
$product_static = $cacheOfProducts[$obj->fk_product];
} else {
@@ -948,7 +952,7 @@ if ($object->id > 0) {
print $product_static->getNomUrl(1).' - '.$product_static->label;
print '';
- if ($conf->productbatch->enabled) {
+ if (!empty($conf->productbatch->enabled)) {
print '';
print $obj->batch;
print ' ';
@@ -959,7 +963,7 @@ if ($object->id > 0) {
$valuetoshow = $obj->qty_stock;
// For inventory not yet close, we overwrite with the real value in stock now
if ($object->status == $object::STATUS_DRAFT || $object->status == $object::STATUS_VALIDATED) {
- if ($conf->productbatch->enabled && $product_static->hasbatch()) {
+ if (!empty($conf->productbatch->enabled) && $product_static->hasbatch()) {
$valuetoshow = $product_static->stock_warehouse[$obj->fk_warehouse]->detail_batch[$obj->batch]->qty;
} else {
$valuetoshow = $product_static->stock_warehouse[$obj->fk_warehouse]->real;
diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php
index d0b27caf326..87a66279714 100644
--- a/htdocs/projet/class/task.class.php
+++ b/htdocs/projet/class/task.class.php
@@ -800,9 +800,10 @@ class Task extends CommonObject
* @param array $extrafields Show additional column from project or task
* @param int $includebilltime Calculate also the time to bill and billed
* @param array $search_array_options Array of search
+ * @param int $loadextras Fetch all Extrafields on each task
* @return array Array of tasks
*/
- public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0, $extrafields = array(), $includebilltime = 0, $search_array_options = array())
+ public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0, $extrafields = array(), $includebilltime = 0, $search_array_options = array(), $loadextras = 0)
{
global $conf, $hookmanager;
@@ -1022,6 +1023,10 @@ class Task extends CommonObject
}
}
}
+
+ if ($loadextras) {
+ $tasks[$i]->fetch_optionals();
+ }
}
$i++;
diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php
index 6019011956a..b19bc407537 100644
--- a/htdocs/projet/list.php
+++ b/htdocs/projet/list.php
@@ -98,6 +98,7 @@ $search_opp_amount = GETPOST("search_opp_amount", 'alpha');
$search_budget_amount = GETPOST("search_budget_amount", 'alpha');
$search_public = GETPOST("search_public", 'int');
$search_project_user = GETPOST('search_project_user', 'int');
+$search_project_contact = GETPOST('search_project_contact', 'int');
$search_sale = GETPOST('search_sale', 'int');
$search_usage_opportunity = GETPOST('search_usage_opportunity', 'int');
$search_usage_task = GETPOST('search_usage_task', 'int');
@@ -253,6 +254,7 @@ if (empty($reshook)) {
$search_public = "";
$search_sale = "";
$search_project_user = '';
+ $search_project_contact = '';
$search_sday = "";
$search_smonth = "";
$search_syear = "";
@@ -364,13 +366,14 @@ if (empty($user->rights->projet->all->lire)) {
// Get id of types of contacts for projects (This list never contains a lot of elements)
$listofprojectcontacttype = array();
-$sql = "SELECT ctc.rowid, ctc.code FROM ".MAIN_DB_PREFIX."c_type_contact as ctc";
+$listofprojectcontacttypeexternal = array();
+$sql = "SELECT ctc.rowid, ctc.code, ctc.source FROM ".MAIN_DB_PREFIX."c_type_contact as ctc";
$sql .= " WHERE ctc.element = '".$db->escape($object->element)."'";
-$sql .= " AND ctc.source = 'internal'";
$resql = $db->query($sql);
if ($resql) {
while ($obj = $db->fetch_object($resql)) {
- $listofprojectcontacttype[$obj->rowid] = $obj->code;
+ if ($obj->source == 'internal') $listofprojectcontacttype[$obj->rowid] = $obj->code;
+ else $listofprojectcontacttypeexternal[$obj->rowid] = $obj->code;
}
} else {
dol_print_error($db);
@@ -378,6 +381,9 @@ if ($resql) {
if (count($listofprojectcontacttype) == 0) {
$listofprojectcontacttype[0] = '0'; // To avoid sql syntax error if not found
}
+if (count($listofprojectcontacttypeexternal) == 0) {
+ $listofprojectcontacttypeexternal[0] = '0'; // To avoid sql syntax error if not found
+}
$distinct = 'DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is only once.
$sql = "SELECT ".$distinct." p.rowid as id, p.ref, p.title, p.fk_statut as status, p.fk_opp_status, p.public, p.fk_user_creat,";
@@ -418,6 +424,9 @@ if ($search_sale > 0) {
if ($search_project_user > 0) {
$sql .= ", ".MAIN_DB_PREFIX."element_contact as ecp";
}
+if ($search_project_contact > 0) {
+ $sql .= ", ".MAIN_DB_PREFIX."element_contact as ecp_contact";
+}
$sql .= " WHERE p.entity IN (".getEntity('project').')';
if (!empty($conf->categorie->enabled)) {
$sql .= Categorie::getFilterSelectQuery(Categorie::TYPE_PROJECT, "p.rowid", $search_category_array);
@@ -502,6 +511,9 @@ if ($search_sale > 0) {
if ($search_project_user > 0) {
$sql .= " AND ecp.fk_c_type_contact IN (".$db->sanitize(join(',', array_keys($listofprojectcontacttype))).") AND ecp.element_id = p.rowid AND ecp.fk_socpeople = ".((int) $search_project_user);
}
+if ($search_project_contact > 0) {
+ $sql .= " AND ecp_contact.fk_c_type_contact IN (".$db->sanitize(join(',', array_keys($listofprojectcontacttypeexternal))).") AND ecp_contact.element_id = p.rowid AND ecp_contact.fk_socpeople = ".((int) $search_project_contact);
+}
if ($search_opp_amount != '') {
$sql .= natural_search('p.opp_amount', $search_opp_amount, 1);
}
@@ -690,6 +702,9 @@ if ($search_public != '') {
if ($search_project_user != '') {
$param .= '&search_project_user='.urlencode($search_project_user);
}
+if ($search_project_contact != '') {
+ $param .= '&search_project_user='.urlencode($search_project_contact);
+}
if ($search_sale > 0) {
$param .= '&search_sale='.urlencode($search_sale);
}
@@ -809,6 +824,11 @@ if (empty($user->rights->user->user->lire)) {
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_project_user ? $search_project_user : '', 'search_project_user', $tmptitle, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth250');
$moreforfilter .= '';
+$moreforfilter .= '';
+$tmptitle = $langs->trans('ProjectsWithThisContact');
+$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->selectcontacts(0, $search_project_contact ? $search_project_contact : '', 'search_project_contact', $tmptitle);
+$moreforfilter .= '
';
+
// If the user can view thirdparties other than his'
if ($user->rights->societe->client->voir || $socid) {
$langs->load("commercial");
diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php
index dc482c1c60c..64d134a7254 100644
--- a/htdocs/projet/tasks.php
+++ b/htdocs/projet/tasks.php
@@ -850,8 +850,8 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third
$moreforfilter = '';
if (count($tasksarray) > 0) {
$moreforfilter .= '';
- $moreforfilter .= $langs->trans("TasksAssignedTo").': ';
- $moreforfilter .= $form->select_dolusers($tmpuser->id > 0 ? $tmpuser->id : '', 'search_user_id', 1);
+ $moreforfilter .= img_picto('', 'user', 'class="pictofixedwidth"');
+ $moreforfilter .= $form->select_dolusers($tmpuser->id > 0 ? $tmpuser->id : '', 'search_user_id', $langs->trans("TasksAssignedTo"), null, 0, '', '');
$moreforfilter .= '
';
}
if ($moreforfilter) {
diff --git a/htdocs/projet/tasks/note.php b/htdocs/projet/tasks/note.php
index 3d1ec610b48..5f3d74a3c68 100644
--- a/htdocs/projet/tasks/note.php
+++ b/htdocs/projet/tasks/note.php
@@ -47,7 +47,6 @@ if (!$user->rights->projet->lire) {
$hookmanager->initHooks(array('projettasknote'));
-//$result = restrictedArea($user, 'projet', $id, '', 'task'); // TODO ameliorer la verification
$object = new Task($db);
$projectstatic = new Project($db);
@@ -89,6 +88,7 @@ if ($id > 0 || $ref) {
$object->fetch($id, $ref);
}
+//$result = restrictedArea($user, 'projet', $id, '', 'task'); // TODO ameliorer la verification
restrictedArea($user, 'projet', $object->fk_project, 'projet&project');
$permissionnote = ($user->rights->projet->creer || $user->rights->projet->all->creer);
diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php
index bbf33b620c4..bc6ec7d15cf 100644
--- a/htdocs/projet/tasks/time.php
+++ b/htdocs/projet/tasks/time.php
@@ -74,13 +74,6 @@ $search_task_label = GETPOST('search_task_label', 'alpha');
$search_user = GETPOST('search_user', 'int');
$search_valuebilled = GETPOST('search_valuebilled', 'int');
-// Security check
-$socid = 0;
-//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
-if (!$user->rights->projet->lire) {
- accessforbidden();
-}
-
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
@@ -98,6 +91,8 @@ if (!$sortorder) {
$sortorder = 'DESC,DESC,DESC';
}
+$childids = $user->getAllChildIds(1);
+
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
//$object = new TaskTime($db);
$hookmanager->initHooks(array('projecttasktime', 'globalcard'));
@@ -113,11 +108,19 @@ if ($id > 0 || $ref) {
$object->fetch($id, $ref);
}
+
+// Security check
+$socid = 0;
+//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
+if (!$user->rights->projet->lire) {
+ accessforbidden();
+}
+
if ($object->fk_project > 0) {
restrictedArea($user, 'projet', $object->fk_project, 'projet&project');
} else {
restrictedArea($user, 'projet', null, 'projet&project');
- // We check user has permission to see all taks of all users
+ // We check user has permission to see all tasks of all users
if (empty($projectid) && !$user->hasRight('projet', 'all', 'lire')) {
$search_user = $user->id;
}
@@ -246,10 +249,14 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us
$id = GETPOST('taskid', 'int');
$object->fetchTimeSpent(GETPOST('lineid', 'int'));
- // TODO Check that ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids))
- $result = $object->delTimeSpent($user);
+
+ $result = 0;
+ if (in_array($object->timespent_fk_user, $childids) || $user->rights->projet->all->creer) {
+ $result = $object->delTimeSpent($user);
+ }
$object->fetch($id, $ref);
+
$object->timespent_note = GETPOST("timespent_note_line", 'alpha');
$object->timespent_old_duration = GETPOST("old_duration");
$object->timespent_duration = GETPOSTINT("new_durationhour") * 60 * 60; // We store duration in seconds
@@ -261,7 +268,12 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us
$object->timespent_date = dol_mktime(12, 0, 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear"));
}
$object->timespent_fk_user = GETPOST("userid_line", 'int');
- $result = $object->addTimeSpent($user);
+
+ $result = 0;
+ if (in_array($object->timespent_fk_user, $childids) || $user->rights->projet->all->creer) {
+ $result = $object->addTimeSpent($user);
+ }
+
if ($result >= 0) {
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
} else {
@@ -270,7 +282,6 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us
}
} else {
$object->fetch($id, $ref);
- // TODO Check that ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids))
$object->timespent_id = GETPOST("lineid", 'int');
$object->timespent_note = GETPOST("timespent_note_line");
@@ -285,12 +296,16 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us
}
$object->timespent_fk_user = GETPOST("userid_line", 'int');
- $result = $object->updateTimeSpent($user);
- if ($result >= 0) {
- setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
- } else {
- setEventMessages($langs->trans($object->error), null, 'errors');
- $error++;
+ $result = 0;
+ if (in_array($object->timespent_fk_user, $childids) || $user->rights->projet->all->creer) {
+ $result = $object->updateTimeSpent($user);
+
+ if ($result >= 0) {
+ setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
+ } else {
+ setEventMessages($langs->trans($object->error), null, 'errors');
+ $error++;
+ }
}
}
} else {
@@ -298,18 +313,20 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us
}
}
-if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->projet->lire) {
- $object->fetchTimeSpent(GETPOST('lineid', 'int'));
- // TODO Check that ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids))
- $result = $object->delTimeSpent($user);
+if ($action == 'confirm_deleteline' && $confirm == "yes" && $user->rights->projet->lire) {
+ $object->fetchTimeSpent(GETPOST('lineid', 'int')); // load properties like $object->timespent_id
- if ($result < 0) {
- $langs->load("errors");
- setEventMessages($langs->trans($object->error), null, 'errors');
- $error++;
- $action = '';
- } else {
- setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
+ if (in_array($object->timespent_fk_user, $childids) || $user->rights->projet->all->creer) {
+ $result = $object->delTimeSpent($user); // delete line with $object->timespent_id
+
+ if ($result < 0) {
+ $langs->load("errors");
+ setEventMessages($langs->trans($object->error), null, 'errors');
+ $error++;
+ $action = '';
+ } else {
+ setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
+ }
}
}
@@ -888,7 +905,8 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
}
}
- $linktocreatetime = dolGetButtonTitle($langs->trans('AddTimeSpent'), $linktocreatetimeHelpText, 'fa fa-plus-circle', $linktocreatetimeUrl, '', $linktocreatetimeBtnStatus);
+ $paramsbutton = array('morecss'=>'reposition');
+ $linktocreatetime = dolGetButtonTitle($langs->trans('AddTimeSpent'), $linktocreatetimeHelpText, 'fa fa-plus-circle', $linktocreatetimeUrl, '', $linktocreatetimeBtnStatus, $paramsbutton);
}
$massactionbutton = '';
@@ -915,7 +933,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
print dol_get_fiche_head($head, 'task_time', $langs->trans("Task"), -1, 'projecttask', 0, '', 'reposition');
if ($action == 'deleteline') {
- print $form->formconfirm($_SERVER["PHP_SELF"]."?".($object->id > 0 ? "id=".$object->id : 'projectid='.$projectstatic->id).'&lineid='.GETPOST("lineid", 'int').($withproject ? '&withproject=1' : ''), $langs->trans("DeleteATimeSpent"), $langs->trans("ConfirmDeleteATimeSpent"), "confirm_delete", '', '', 1);
+ print $form->formconfirm($_SERVER["PHP_SELF"]."?".($object->id > 0 ? "id=".$object->id : 'projectid='.$projectstatic->id).'&lineid='.GETPOST("lineid", 'int').($withproject ? '&withproject=1' : ''), $langs->trans("DeleteATimeSpent"), $langs->trans("ConfirmDeleteATimeSpent"), "confirm_deleteline", '', '', 1);
}
$param = ($withproject ? '&withproject=1' : '');
@@ -1014,7 +1032,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
if ($projectstatic->id > 0 || $allprojectforuser > 0) {
if ($action == 'deleteline' && !empty($projectidforalltimes)) {
- print $form->formconfirm($_SERVER["PHP_SELF"]."?".($object->id > 0 ? "id=".$object->id : 'projectid='.$projectstatic->id).'&lineid='.GETPOST('lineid', 'int').($withproject ? '&withproject=1' : ''), $langs->trans("DeleteATimeSpent"), $langs->trans("ConfirmDeleteATimeSpent"), "confirm_delete", '', '', 1);
+ print $form->formconfirm($_SERVER["PHP_SELF"]."?".($object->id > 0 ? "id=".$object->id : 'projectid='.$projectstatic->id).'&lineid='.GETPOST('lineid', 'int').($withproject ? '&withproject=1' : ''), $langs->trans("DeleteATimeSpent"), $langs->trans("ConfirmDeleteATimeSpent"), "confirm_deleteline", '', '', 1);
}
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
@@ -1579,8 +1597,6 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
$i = 0;
- $childids = $user->getAllChildIds();
-
$total = 0;
$totalvalue = 0;
$totalarray = array();
@@ -1796,7 +1812,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
print ' ';
print ' ';
} elseif ($user->rights->projet->lire || $user->rights->projet->all->creer) { // Read project and enter time consumed on assigned tasks
- if ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids) || $user->rights->projet->all->creer) {
+ if (in_array($task_time->fk_user, $childids) || $user->rights->projet->all->creer) {
if ($conf->MAIN_FEATURES_LEVEL >= 2) {
print ' ';
print 'fk_task.'&action=splitline&token='.newToken().'&lineid='.$task_time->rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">';
diff --git a/htdocs/recruitment/admin/setup.php b/htdocs/recruitment/admin/setup.php
index b6f03d38b76..6091da86b09 100644
--- a/htdocs/recruitment/admin/setup.php
+++ b/htdocs/recruitment/admin/setup.php
@@ -68,6 +68,7 @@ if (!$user->admin) {
// Parameters
$action = GETPOST('action', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
+$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
$value = GETPOST('value', 'alpha');
$label = GETPOST('label', 'alpha');
diff --git a/htdocs/recruitment/admin/setup_candidatures.php b/htdocs/recruitment/admin/setup_candidatures.php
index 60bd0494ebc..726e24e89b1 100644
--- a/htdocs/recruitment/admin/setup_candidatures.php
+++ b/htdocs/recruitment/admin/setup_candidatures.php
@@ -68,6 +68,7 @@ if (!$user->admin) {
// Parameters
$action = GETPOST('action', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
+$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
$value = GETPOST('value', 'alpha');
$label = GETPOST('label', 'alpha');
diff --git a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php
index 3b9840f9155..e818a0816a9 100644
--- a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php
+++ b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php
@@ -174,7 +174,10 @@ class doc_generic_recruitmentjobposition_odt extends ModelePDFRecruitmentJobPosi
if ($nbofiles) {
$texte .= '';
}
diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php
index 2f272ceca1c..193dfc43cad 100644
--- a/htdocs/societe/admin/societe.php
+++ b/htdocs/societe/admin/societe.php
@@ -34,6 +34,7 @@ $langs->loadLangs(array("admin", "companies", "other"));
$action = GETPOST('action', 'aZ09');
$value = GETPOST('value', 'alpha');
+$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
if (!$user->admin) {
accessforbidden();
@@ -169,6 +170,20 @@ if ($action == 'setdoc') {
}
}
+//Activate Set accountancy code customer invoice mandatory
+if ($action == "setaccountancycodecustomerinvoicemandatory") {
+ $setaccountancycodecustomerinvoicemandatory = GETPOST('value', 'int');
+ $res = dolibarr_set_const($db, "SOCIETE_ACCOUNTANCY_CODE_CUSTOMER_INVOICE_MANDATORY", $setaccountancycodecustomerinvoicemandatory, 'yesno', 0, '', $conf->entity);
+ if (!($res > 0)) {
+ $error++;
+ }
+ if (!$error) {
+ setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
+ } else {
+ setEventMessages($langs->trans("Error"), null, 'errors');
+ }
+}
+
//Activate Set ref in list
if ($action == "setaddrefinlist") {
$setaddrefinlist = GETPOST('value', 'int');
@@ -709,6 +724,23 @@ foreach ($profid as $key => $val) {
$i++;
}
+if ($conf->accounting->enabled) {
+ print '';
+ print ''.$langs->trans('CustomerAccountancyCodeShort')." \n";
+ print ' ';
+
+ if (!empty($conf->global->SOCIETE_ACCOUNTANCY_CODE_CUSTOMER_INVOICE_MANDATORY)) {
+ print '';
+ print img_picto($langs->trans("Activated"), 'switch_on');
+ print ' ';
+ } else {
+ print '';
+ print img_picto($langs->trans("Disabled"), 'switch_off');
+ print ' ';
+ }
+ print " \n";
+}
+
print "
\n";
print '';
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index 7490fca0265..a49bf478763 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -4870,7 +4870,7 @@ class Societe extends CommonObject
{
global $langs;
- require_once DOL_DOCUMENT_ROOT.'/parntership/class/partnership.class.php';
+ require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php';
$this->partnerships[] = array();
diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php
index b779dffcb39..02d25d30797 100644
--- a/htdocs/takepos/invoice.php
+++ b/htdocs/takepos/invoice.php
@@ -537,6 +537,7 @@ if ($action == "addline") {
if (!empty($conf->global->TAKEPOS_GROUP_SAME_PRODUCT)) {
foreach ($invoice->lines as $line) {
if ($line->product_ref == $prod->ref) {
+ if ($line->special_code==4) continue; // If this line is sended to printer create new line
$result = $invoice->updateline($line->id, $line->desc, $line->subprice, $line->qty + 1, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
if ($result < 0) {
dol_htmloutput_errors($invoice->error, $invoice->errors, 1);
diff --git a/htdocs/theme/eldy/dropdown.inc.php b/htdocs/theme/eldy/dropdown.inc.php
index 81734c817b8..5c62a703f67 100644
--- a/htdocs/theme/eldy/dropdown.inc.php
+++ b/htdocs/theme/eldy/dropdown.inc.php
@@ -7,6 +7,11 @@ if (!defined('ISLOADEDBYSTEELSHEET')) {
* Dropdown of user popup
*/
+.bookmark-footer a.top-menu-dropdown-link {
+ white-space: normal;
+ word-break: break-word;
+}
+
button.dropdown-item.global-search-item {
outline: none;
}
@@ -15,6 +20,12 @@ button.dropdown-item.global-search-item {
display: block;
}
+#topmenu-bookmark-dropdown .dropdown-menu {
+ min-width: 300px;
+ max-width: 360px;
+}
+
+
.dropdown-search {
border-color: #eee;
diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php
index a830002d197..deb7cdadf9e 100644
--- a/htdocs/theme/eldy/global.inc.php
+++ b/htdocs/theme/eldy/global.inc.php
@@ -261,7 +261,7 @@ input:invalid, select:invalid, input.--error , select.--error {
div.tabBar textarea:focus {
border: 1px solid #aaa !important;
}
-input:focus:not(.select2-search__field), select:focus, .select2-container--open .select2-selection--single {
+input:focus:not(.button):not(.select2-search__field):not(#top-bookmark-search-input), select:focus, .select2-container--open .select2-selection--single {
/* div.tabBar input:focus, div.tabBar select:focus { */
border-bottom: 1px solid #666 !important;
border-bottom-left-radius: 0 !important;
@@ -985,12 +985,18 @@ span.fa.fa-plus-circle.paddingleft {
padding-: 20px;
}
div.divsearchfield {
- float: ;
+ /* float: ; */
+ display: inline-block;
margin-: 12px;
margin-: 2px;
margin-top: 4px;
margin-bottom: 4px;
- padding-left: 2px;
+ padding-left: 2px;
+}
+.divfilteralone {
+ background-color: rgba(0, 0, 0, 0.08);
+ border-radius: 5px;
+ padding-left: 5px;
}
.divsearchfieldfilter {
text-overflow: clip;
@@ -2808,8 +2814,8 @@ div.login a:hover {
div.login_block_user {
display: inline-block;
vertical-align: middle;
- line-height: px;
- height: px;
+ line-height: px;
+ height: px;
}
div.login_block_other {
display: inline-block;
@@ -3396,6 +3402,7 @@ input.buttonreset {
padding: 8px 15px;
text-decoration: underline;
color: var(--colortextlink);
+ background-color: transparent;
cursor: pointer;
}
.nopaddingleft {
diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php
index a6d9f6d2df9..716ca7eac27 100644
--- a/htdocs/theme/eldy/info-box.inc.php
+++ b/htdocs/theme/eldy/info-box.inc.php
@@ -101,10 +101,11 @@ if (!defined('ISLOADEDBYSTEELSHEET')) {
font-size: 25px;
line-height: 92px;
}
-.opened-dash-board-wrap .info-box-sm .info-box-icon {
- border-radius: 0 0 0 20px;
+.opened-dash-board-wrap .info-box .info-box-icon {
+ font-size: 2em;
}
.opened-dash-board-wrap .info-box-sm .info-box-icon {
+ border-radius: 0 0 0 20px;
line-height: 80px;
}
.info-box-module .info-box-icon {
diff --git a/htdocs/theme/md/dropdown.inc.php b/htdocs/theme/md/dropdown.inc.php
index 1aec654410f..ff7285a2772 100644
--- a/htdocs/theme/md/dropdown.inc.php
+++ b/htdocs/theme/md/dropdown.inc.php
@@ -2,7 +2,6 @@
if (!defined('ISLOADEDBYSTEELSHEET')) {
die('Must be call by steelsheet');
} ?>
-
/*