update swift mailer

This commit is contained in:
shreesh arora
2021-03-08 15:52:15 +05:30
parent 82b30db256
commit 651477096a
195 changed files with 1887 additions and 2105 deletions

287
tools/swift/CHANGES Normal file
View File

@@ -0,0 +1,287 @@
Changelog
=========
5.4.12 (2018-07-31)
-------------------
* fixed typo
5.4.11 (2018-07-31)
-------------------
* fixed startTLS support for PHP 5.6-
5.4.10 (2018-07-27)
-------------------
* fixed startTLS only allowed tls1.0, now allowed: tls1.0, tls1.1, tls1.2
5.4.9 (2018-01-23)
------------------
* no changes, last version of the 5.x series
5.4.8 (2017-05-01)
------------------
* fixed encoding inheritance in addPart()
* fixed sorting MIME children when their types are equal
5.4.7 (2017-04-20)
------------------
* fixed NTLMAuthenticator clobbering bcmath scale
5.4.6 (2017-02-13)
------------------
* removed exceptions thrown in destructors as they lead to fatal errors
* switched to use sha256 by default in DKIM as per the RFC
* fixed an 'Undefined variable: pipes' PHP notice
* fixed long To headers when using the mail transport
* fixed NTLMAuthenticator when no domain is passed with the username
* prevented fatal error during unserialization of a message
* fixed a PHP warning when sending a message that has a length of a multiple of 8192
5.4.5 (2016-12-29)
------------------
* SECURITY FIX: fixed CVE-2016-10074 by disallowing potentially unsafe shell characters
Prior to 5.4.5, the mail transport (Swift_Transport_MailTransport) was vulnerable to passing
arbitrary shell arguments if the "From", "ReturnPath" or "Sender" header came
from a non-trusted source, potentially allowing Remote Code Execution
* deprecated the mail transport
5.4.4 (2016-11-23)
------------------
* reverted escaping command-line args to mail (PHP mail() function already does it)
5.4.3 (2016-07-08)
------------------
* fixed SimpleHeaderSet::has()/get() when the 0 index is removed
* removed the need to have mcrypt installed
* fixed broken MIME header encoding with quotes/colons and non-ascii chars
* allowed mail transport send for messages without To header
* fixed PHP 7 support
5.4.2 (2016-05-01)
------------------
* fixed support for IPv6 sockets
* added auto-retry when sending messages from the memory spool
* fixed consecutive read calls in Swift_ByteStream_FileByteStream
* added support for iso-8859-15 encoding
* fixed PHP mail extra params on missing reversePath
* added methods to set custom stream context options
* fixed charset changes in QpContentEncoderProxy
* added return-path header to the ignoredHeaders list of DKIMSigner
* fixed crlf for subject using mail
* fixed add soft line break only when necessary
* fixed escaping command-line args to mail
5.4.1 (2015-06-06)
------------------
* made Swiftmailer exceptions confirm to PHP base exception constructor signature
* fixed MAIL FROM & RCPT TO headers to be RFC compliant
5.4.0 (2015-03-14)
------------------
* added the possibility to add extra certs to PKCS#7 signature
* fix base64 encoding with streams
* added a new RESULT_SPOOLED status for SpoolTransport
* fixed getBody() on attachments when called more than once
* removed dots from generated filenames in filespool
5.3.1 (2014-12-05)
------------------
* fixed cloning of messages with attachments
5.3.0 (2014-10-04)
------------------
* fixed cloning when using signers
* reverted removal of Swift_Encoding
* drop support for PHP 5.2.x
5.2.2 (2014-09-20)
------------------
* fixed Japanese support
* fixed the memory spool when the message changes when in the pool
* added support for cloning messages
* fixed PHP warning in the redirect plugin
* changed the way to and cc-ed email are sent to only use one transaction
5.2.1 (2014-06-13)
------------------
* SECURITY FIX: fixed CLI escaping when using sendmail as a transport
Prior to 5.2.1, the sendmail transport (Swift_Transport_SendmailTransport)
was vulnerable to an arbitrary shell execution if the "From" header came
from a non-trusted source and no "Return-Path" is configured.
* fixed parameter in DKIMSigner
* fixed compatibility with PHP < 5.4
5.2.0 (2014-05-08)
------------------
* fixed Swift_ByteStream_FileByteStream::read() to match to the specification
* fixed from-charset and to-charset arguments in mbstring_convert_encoding() usages
* fixed infinite loop in StreamBuffer
* fixed NullTransport to return the number of ignored emails instead of 0
* Use phpunit and mockery for unit testing (realityking)
5.1.0 (2014-03-18)
------------------
* fixed data writing to stream when sending large messages
* added support for libopendkim (https://github.com/xdecock/php-opendkim)
* merged SignedMessage and Message
* added Gmail XOAuth2 authentication
* updated the list of known mime types
* added NTLM authentication
5.0.3 (2013-12-03)
------------------
* fixed double-dot bug
* fixed DKIM signer
5.0.2 (2013-08-30)
------------------
* handled correct exception type while reading IoBuffer output
5.0.1 (2013-06-17)
------------------
* changed the spool to only start the transport when a mail has to be sent
* fixed compatibility with PHP 5.2
* fixed LICENSE file
5.0.0 (2013-04-30)
------------------
* changed the license from LGPL to MIT
4.3.1 (2013-04-11)
------------------
* removed usage of the native QP encoder when the charset is not UTF-8
* fixed usage of uniqid to avoid collisions
* made a performance improvement when tokenizing large headers
* fixed usage of the PHP native QP encoder on PHP 5.4.7+
4.3.0 (2013-01-08)
------------------
* made the temporary directory configurable via the TMPDIR env variable
* added S/MIME signer and encryption support
4.2.2 (2012-10-25)
------------------
* added the possibility to throttle messages per second in ThrottlerPlugin (mostly for Amazon SES)
* switched mime.qpcontentencoder to automatically use the PHP native encoder on PHP 5.4.7+
* allowed specifying a whitelist with regular expressions in RedirectingPlugin
4.2.1 (2012-07-13)
------------------
* changed the coding standards to PSR-1/2
* fixed issue with autoloading
* added NativeQpContentEncoder to enhance performance (for PHP 5.3+)
4.2.0 (2012-06-29)
------------------
* added documentation about how to use the Japanese support introduced in 4.1.8
* added a way to override the default configuration in a lazy way
* changed the PEAR init script to lazy-load the initialization
* fixed a bug when calling Swift_Preferences before anything else (regression introduced in 4.1.8)
4.1.8 (2012-06-17)
------------------
* added Japanese iso-2022-jp support
* changed the init script to lazy-load the initialization
* fixed docblocks (@id) which caused some problems with libraries parsing the dobclocks
* fixed Swift_Mime_Headers_IdentificationHeader::setId() when passed an array of ids
* fixed encoding of email addresses in headers
* added replacements setter to the Decorator plugin
4.1.7 (2012-04-26)
------------------
* fixed QpEncoder safeMapShareId property
4.1.6 (2012-03-23)
------------------
* reduced the size of serialized Messages
4.1.5 (2012-01-04)
------------------
* enforced Swift_Spool::queueMessage() to return a Boolean
* made an optimization to the memory spool: start the transport only when required
* prevented stream_socket_client() from generating an error and throw a Swift_TransportException instead
* fixed a PHP warning when calling to mail() when safe_mode is off
* many doc tweaks
4.1.4 (2011-12-16)
------------------
* added a memory spool (Swift_MemorySpool)
* fixed too many opened files when sending emails with attachments
4.1.3 (2011-10-27)
------------------
* added STARTTLS support
* added missing @return tags on fluent methods
* added a MessageLogger plugin that logs all sent messages
* added composer.json
4.1.2 (2011-09-13)
------------------
* fixed wrong detection of magic_quotes_runtime
* fixed fatal errors when no To or Subject header has been set
* fixed charset on parameter header continuations
* added documentation about how to install Swiftmailer from the PEAR channel
* fixed various typos and markup problem in the documentation
* fixed warning when cache directory does not exist
* fixed "slashes are escaped" bug
* changed require_once() to require() in autoload
4.1.1 (2011-07-04)
------------------
* added missing file in PEAR package
4.1.0 (2011-06-30)
------------------
* documentation has been converted to ReST
4.1.0 RC1 (2011-06-17)
----------------------
New features:
* changed the Decorator Plugin to allow replacements in all headers
* added Swift_Mime_Grammar and Swift_Validate to validate an email address
* modified the autoloader to lazy-initialize Swiftmailer
* removed Swift_Mailer::batchSend()
* added NullTransport
* added new plugins: RedirectingPlugin and ImpersonatePlugin
* added a way to send messages asynchronously (Spool)

15
tools/swift/README Normal file
View File

@@ -0,0 +1,15 @@
Swift Mailer
------------
Swift Mailer is a component based mailing solution for PHP 5.
It is released under the MIT license.
Homepage: https://swiftmailer.symfony.com/
Documentation: https://swiftmailer.symfony.com/docs/introduction.html
Bugs: https://github.com/swiftmailer/swiftmailer/issues
Repository: https://github.com/swiftmailer/swiftmailer
Swift Mailer is highly object-oriented by design and lends itself
to use in complex web application with a great deal of flexibility.
For full details on usage, see the documentation.

1
tools/swift/VERSION Normal file
View File

@@ -0,0 +1 @@
Swift-5.4.12

View File

@@ -16,12 +16,12 @@
*/
abstract class Swift
{
public static $initialized = false;
public static $inits = array();
/** Swift Mailer Version number generated during dist release process */
const VERSION = '@SWIFT_VERSION_NUMBER@';
public static $initialized = false;
public static $inits = array();
/**
* Registers an initializer callable that will be called the first time
* a SwiftMailer class is autoloaded.
@@ -47,7 +47,7 @@ abstract class Swift
return;
}
$path = dirname(__FILE__).'/'.str_replace('_', '/', $class).'.php';
$path = __DIR__.'/'.str_replace('_', '/', $class).'.php';
if (!file_exists($path)) {
return;

View File

@@ -11,7 +11,7 @@
/**
* Attachment class for attaching files to a {@link Swift_Mime_Message}.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_Attachment extends Swift_Mime_Attachment
{

View File

@@ -11,7 +11,7 @@
/**
* Provides the base functionality for an InputStream supporting filters.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
abstract class Swift_ByteStream_AbstractFilterableInputStream implements Swift_InputByteStream, Swift_Filterable
{
@@ -22,6 +22,8 @@ abstract class Swift_ByteStream_AbstractFilterableInputStream implements Swift_I
/**
* StreamFilters.
*
* @var Swift_StreamFilter[]
*/
private $_filters = array();
@@ -75,9 +77,9 @@ abstract class Swift_ByteStream_AbstractFilterableInputStream implements Swift_I
*
* @param string $bytes
*
* @return int
*
* @throws Swift_IoException
*
* @return int
*/
public function write($bytes)
{

View File

@@ -11,7 +11,7 @@
/**
* Allows reading and writing of bytes to and from an array.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_ByteStream_ArrayByteStream implements Swift_InputByteStream, Swift_OutputByteStream
{
@@ -23,7 +23,7 @@ class Swift_ByteStream_ArrayByteStream implements Swift_InputByteStream, Swift_O
private $_array = array();
/**
* The size of the stack
* The size of the stack.
*
* @var int
*/
@@ -70,7 +70,7 @@ class Swift_ByteStream_ArrayByteStream implements Swift_InputByteStream, Swift_O
* remaining bytes are given instead. If no bytes are remaining at all, boolean
* false is returned.
*
* @param int $length
* @param int $length
*
* @return string
*/
@@ -82,9 +82,7 @@ class Swift_ByteStream_ArrayByteStream implements Swift_InputByteStream, Swift_O
// Don't use array slice
$end = $length + $this->_offset;
$end = $this->_arraySize<$end
? $this->_arraySize
: $end;
$end = $this->_arraySize < $end ? $this->_arraySize : $end;
$ret = '';
for (; $this->_offset < $end; ++$this->_offset) {
$ret .= $this->_array[$this->_offset];
@@ -152,7 +150,7 @@ class Swift_ByteStream_ArrayByteStream implements Swift_InputByteStream, Swift_O
/**
* Move the internal read pointer to $byteOffset in the stream.
*
* @param int $byteOffset
* @param int $byteOffset
*
* @return bool
*/

View File

@@ -11,7 +11,7 @@
/**
* Allows reading and writing of bytes to and from a file.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_ByteStream_FileByteStream extends Swift_ByteStream_AbstractFilterableInputStream implements Swift_FileStream
{
@@ -39,8 +39,8 @@ class Swift_ByteStream_FileByteStream extends Swift_ByteStream_AbstractFilterabl
/**
* Create a new FileByteStream for $path.
*
* @param string $path
* @param bool $writable if true
* @param string $path
* @param bool $writable if true
*/
public function __construct($path, $writable = false)
{
@@ -73,11 +73,11 @@ class Swift_ByteStream_FileByteStream extends Swift_ByteStream_AbstractFilterabl
* remaining bytes are given instead. If no bytes are remaining at all, boolean
* false is returned.
*
* @param int $length
*
* @return string|bool
* @param int $length
*
* @throws Swift_IoException
*
* @return string|bool
*/
public function read($length)
{
@@ -111,7 +111,7 @@ class Swift_ByteStream_FileByteStream extends Swift_ByteStream_AbstractFilterabl
/**
* Move the internal read pointer to $byteOffset in the stream.
*
* @param int $byteOffset
* @param int $byteOffset
*
* @return bool
*/
@@ -139,11 +139,13 @@ class Swift_ByteStream_FileByteStream extends Swift_ByteStream_AbstractFilterabl
private function _getReadHandle()
{
if (!isset($this->_reader)) {
if (!$this->_reader = fopen($this->_path, 'rb')) {
$pointer = @fopen($this->_path, 'rb');
if (!$pointer) {
throw new Swift_IoException(
'Unable to open file for reading ['.$this->_path.']'
);
}
$this->_reader = $pointer;
if ($this->_offset != 0) {
$this->_getReadStreamSeekableStatus();
$this->_seekReadStreamToPosition($this->_offset);
@@ -191,8 +193,8 @@ class Swift_ByteStream_FileByteStream extends Swift_ByteStream_AbstractFilterabl
}
if ($this->_seekable === false) {
$currentPos = ftell($this->_reader);
if ($currentPos<$offset) {
$toDiscard = $offset-$currentPos;
if ($currentPos < $offset) {
$toDiscard = $offset - $currentPos;
fread($this->_reader, $toDiscard);
return;

View File

@@ -9,7 +9,7 @@
*/
/**
* @author Romain-Geissler
* @author Romain-Geissler
*/
class Swift_ByteStream_TemporaryFileByteStream extends Swift_ByteStream_FileByteStream
{

View File

@@ -1,35 +0,0 @@
<?php
/*
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2017 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -11,8 +11,8 @@
/**
* Analyzes characters for a specific character set.
*
* @author Chris Corbyn
* @author Xavier De Cock <xdecock@gmail.com>
* @author Chris Corbyn
* @author Xavier De Cock <xdecock@gmail.com>
*/
interface Swift_CharacterReader
{
@@ -21,12 +21,12 @@ interface Swift_CharacterReader
const MAP_TYPE_POSITIONS = 0x03;
/**
* Returns the complete character map
* Returns the complete character map.
*
* @param string $string
* @param int $startOffset
* @param array $currentMap
* @param mixed $ignoredChars
* @param string $string
* @param int $startOffset
* @param array $currentMap
* @param mixed $ignoredChars
*
* @return int
*/
@@ -48,8 +48,8 @@ interface Swift_CharacterReader
* A value of zero means this is already a valid character.
* A value of -1 means this cannot possibly be a valid character.
*
* @param integer[] $bytes
* @param int $size
* @param int[] $bytes
* @param int $size
*
* @return int
*/

View File

@@ -11,8 +11,8 @@
/**
* Provides fixed-width byte sizes for reading fixed-width character sets.
*
* @author Chris Corbyn
* @author Xavier De Cock <xdecock@gmail.com>
* @author Chris Corbyn
* @author Xavier De Cock <xdecock@gmail.com>
*/
class Swift_CharacterReader_GenericFixedWidthReader implements Swift_CharacterReader
{
@@ -26,7 +26,7 @@ class Swift_CharacterReader_GenericFixedWidthReader implements Swift_CharacterRe
/**
* Creates a new GenericFixedWidthReader using $width bytes per character.
*
* @param int $width
* @param int $width
*/
public function __construct($width)
{
@@ -36,10 +36,10 @@ class Swift_CharacterReader_GenericFixedWidthReader implements Swift_CharacterRe
/**
* Returns the complete character map.
*
* @param string $string
* @param int $startOffset
* @param array $currentMap
* @param mixed $ignoredChars
* @param string $string
* @param int $startOffset
* @param array $currentMap
* @param mixed $ignoredChars
*
* @return int
*/
@@ -48,7 +48,7 @@ class Swift_CharacterReader_GenericFixedWidthReader implements Swift_CharacterRe
$strlen = strlen($string);
// % and / are CPU intensive, so, maybe find a better way
$ignored = $strlen % $this->_width;
$ignoredChars = substr($string, - $ignored);
$ignoredChars = $ignored ? substr($string, -$ignored) : '';
$currentMap = $this->_width;
return ($strlen - $ignored) / $this->_width;
@@ -73,8 +73,8 @@ class Swift_CharacterReader_GenericFixedWidthReader implements Swift_CharacterRe
* A value of zero means this is already a valid character.
* A value of -1 means this cannot possibly be a valid character.
*
* @param string $bytes
* @param int $size
* @param string $bytes
* @param int $size
*
* @return int
*/
@@ -82,7 +82,7 @@ class Swift_CharacterReader_GenericFixedWidthReader implements Swift_CharacterRe
{
$needed = $this->_width - $size;
return ($needed > -1) ? $needed : -1;
return $needed > -1 ? $needed : -1;
}
/**

View File

@@ -11,17 +11,17 @@
/**
* Analyzes US-ASCII characters.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_CharacterReader_UsAsciiReader implements Swift_CharacterReader
{
/**
* Returns the complete character map.
*
* @param string $string
* @param int $startOffset
* @param array $currentMap
* @param string $ignoredChars
* @param string $string
* @param int $startOffset
* @param array $currentMap
* @param string $ignoredChars
*
* @return int
*/
@@ -30,9 +30,9 @@ class Swift_CharacterReader_UsAsciiReader implements Swift_CharacterReader
$strlen = strlen($string);
$ignoredChars = '';
for ($i = 0; $i < $strlen; ++$i) {
if ($string[$i]>"\x07F") {
if ($string[$i] > "\x07F") {
// Invalid char
$currentMap[$i+$startOffset] = $string[$i];
$currentMap[$i + $startOffset] = $string[$i];
}
}
@@ -40,9 +40,9 @@ class Swift_CharacterReader_UsAsciiReader implements Swift_CharacterReader
}
/**
* Returns mapType
* Returns mapType.
*
* @return int mapType
* @return int mapType
*/
public function getMapType()
{
@@ -57,8 +57,8 @@ class Swift_CharacterReader_UsAsciiReader implements Swift_CharacterReader
* A value of zero means this is already a valid character.
* A value of -1 means this cannot possibly be a valid character.
*
* @param string $bytes
* @param int $size
* @param string $bytes
* @param int $size
*
* @return int
*/
@@ -67,9 +67,9 @@ class Swift_CharacterReader_UsAsciiReader implements Swift_CharacterReader
$byte = reset($bytes);
if (1 == count($bytes) && $byte >= 0x00 && $byte <= 0x7F) {
return 0;
} else {
return -1;
}
return -1;
}
/**

View File

@@ -11,30 +11,30 @@
/**
* Analyzes UTF-8 characters.
*
* @author Chris Corbyn
* @author Xavier De Cock <xdecock@gmail.com>
* @author Chris Corbyn
* @author Xavier De Cock <xdecock@gmail.com>
*/
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,
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
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x3N
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x4N
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x5N
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x6N
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x7N
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0x8N
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0x9N
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0xAN
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0xBN
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
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
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x3N
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x4N
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x5N
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x6N
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x7N
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x8N
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x9N
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0xAN
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0xBN
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
);
private static $s_length_map = array(
@@ -75,16 +75,16 @@ class Swift_CharacterReader_Utf8Reader implements Swift_CharacterReader
/**
* Returns the complete character map.
*
* @param string $string
* @param int $startOffset
* @param array $currentMap
* @param mixed $ignoredChars
* @param string $string
* @param int $startOffset
* @param array $currentMap
* @param mixed $ignoredChars
*
* @return int
*/
public function getCharPositions($string, $startOffset, &$currentMap, &$ignoredChars)
{
if (!isset($currentMap['i']) || ! isset($currentMap['p'])) {
if (!isset($currentMap['i']) || !isset($currentMap['p'])) {
$currentMap['p'] = $currentMap['i'] = array();
}
@@ -134,7 +134,7 @@ class Swift_CharacterReader_Utf8Reader implements Swift_CharacterReader
/**
* Returns mapType.
*
* @return int mapType
* @return int mapType
*/
public function getMapType()
{
@@ -149,22 +149,19 @@ class Swift_CharacterReader_Utf8Reader implements Swift_CharacterReader
* A value of zero means this is already a valid character.
* A value of -1 means this cannot possibly be a valid character.
*
* @param string $bytes
* @param int $size
* @param string $bytes
* @param int $size
*
* @return int
*/
public function validateByteSequence($bytes, $size)
{
if ($size<1) {
if ($size < 1) {
return -1;
}
$needed = self::$length_map[$bytes[0]] - $size;
return ($needed > -1)
? $needed
: -1
;
return $needed > -1 ? $needed : -1;
}
/**

View File

@@ -1,35 +0,0 @@
<?php
/*
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2017 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -11,7 +11,7 @@
/**
* A factory for creating CharacterReaders.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
interface Swift_CharacterReaderFactory
{

View File

@@ -11,7 +11,7 @@
/**
* Standard factory for creating CharacterReaders.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_CharacterReaderFactory_SimpleCharacterReaderFactory implements Swift_CharacterReaderFactory
{

View File

@@ -1,35 +0,0 @@
<?php
/*
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2017 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -15,7 +15,7 @@
* Classes implementing this interface may use a subsystem which requires less
* memory than working with large strings of data.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
interface Swift_CharacterStream
{
@@ -52,7 +52,7 @@ interface Swift_CharacterStream
* Read $length characters from the stream and move the internal pointer
* $length further into the stream.
*
* @param int $length
* @param int $length
*
* @return string
*/
@@ -62,7 +62,7 @@ interface Swift_CharacterStream
* Read $length characters from the stream and return a 1-dimensional array
* containing there octet values.
*
* @param int $length
* @param int $length
*
* @return int[]
*/
@@ -78,7 +78,7 @@ interface Swift_CharacterStream
/**
* Move the internal pointer to $charOffset in the stream.
*
* @param int $charOffset
* @param int $charOffset
*/
public function setPointer($charOffset);

View File

@@ -11,7 +11,7 @@
/**
* A CharacterStream implementation which stores characters in an internal array.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStream
{
@@ -121,7 +121,7 @@ class Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStrea
* Read $length characters from the stream and move the internal pointer
* $length further into the stream.
*
* @param int $length
* @param int $length
*
* @return string
*/
@@ -153,9 +153,9 @@ class Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStrea
* Read $length characters from the stream and return a 1-dimensional array
* containing there octet values.
*
* @param int $length
* @param int $length
*
* @return integer[]
* @return int[]
*/
public function readBytes($length)
{
@@ -244,7 +244,7 @@ class Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStrea
/**
* Move the internal pointer to $charOffset in the stream.
*
* @param int $charOffset
* @param int $charOffset
*/
public function setPointer($charOffset)
{

View File

@@ -11,9 +11,8 @@
/**
* A CharacterStream implementation which stores characters in an internal array.
*
* @author Xavier De Cock <xdecock@gmail.com>
* @author Xavier De Cock <xdecock@gmail.com>
*/
class Swift_CharacterStream_NgCharacterStream implements Swift_CharacterStream
{
/**
@@ -45,7 +44,7 @@ class Swift_CharacterStream_NgCharacterStream implements Swift_CharacterStream
private $_datas = '';
/**
* Number of bytes in the stream
* Number of bytes in the stream.
*
* @var int
*/
@@ -156,7 +155,7 @@ class Swift_CharacterStream_NgCharacterStream implements Swift_CharacterStream
/**
* @see Swift_CharacterStream::read()
*
* @param int $length
* @param int $length
*
* @return string
*/
@@ -166,12 +165,10 @@ class Swift_CharacterStream_NgCharacterStream implements Swift_CharacterStream
return false;
}
$ret = false;
$length = ($this->_currentPos+$length > $this->_charCount)
? $this->_charCount - $this->_currentPos
: $length;
$length = $this->_currentPos + $length > $this->_charCount ? $this->_charCount - $this->_currentPos : $length;
switch ($this->_mapType) {
case Swift_CharacterReader::MAP_TYPE_FIXED_LEN:
$len = $length*$this->_map;
$len = $length * $this->_map;
$ret = substr($this->_datas,
$this->_currentPos * $this->_map,
$len);
@@ -179,13 +176,9 @@ class Swift_CharacterStream_NgCharacterStream implements Swift_CharacterStream
break;
case Swift_CharacterReader::MAP_TYPE_INVALID:
$end = $this->_currentPos + $length;
$end = $end > $this->_charCount
? $this->_charCount
: $end;
$ret = '';
for (; $this->_currentPos < $length; ++$this->_currentPos) {
if (isset ($this->_map[$this->_currentPos])) {
if (isset($this->_map[$this->_currentPos])) {
$ret .= '?';
} else {
$ret .= $this->_datas[$this->_currentPos];
@@ -195,13 +188,11 @@ class Swift_CharacterStream_NgCharacterStream implements Swift_CharacterStream
case Swift_CharacterReader::MAP_TYPE_POSITIONS:
$end = $this->_currentPos + $length;
$end = $end > $this->_charCount
? $this->_charCount
: $end;
$end = $end > $this->_charCount ? $this->_charCount : $end;
$ret = '';
$start = 0;
if ($this->_currentPos>0) {
$start = $this->_map['p'][$this->_currentPos-1];
if ($this->_currentPos > 0) {
$start = $this->_map['p'][$this->_currentPos - 1];
}
$to = $start;
for (; $this->_currentPos < $end; ++$this->_currentPos) {
@@ -222,9 +213,9 @@ class Swift_CharacterStream_NgCharacterStream implements Swift_CharacterStream
/**
* @see Swift_CharacterStream::readBytes()
*
* @param int $length
* @param int $length
*
* @return integer[]
* @return int[]
*/
public function readBytes($length)
{
@@ -241,11 +232,11 @@ class Swift_CharacterStream_NgCharacterStream implements Swift_CharacterStream
/**
* @see Swift_CharacterStream::setPointer()
*
* @param int $charOffset
* @param int $charOffset
*/
public function setPointer($charOffset)
{
if ($this->_charCount<$charOffset) {
if ($this->_charCount < $charOffset) {
$charOffset = $this->_charCount;
}
$this->_currentPos = $charOffset;
@@ -268,7 +259,7 @@ class Swift_CharacterStream_NgCharacterStream implements Swift_CharacterStream
$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);
$this->_datasSize = strlen($this->_datas) - strlen($ignored);
} else {
$this->_datasSize = strlen($this->_datas);
}

View File

@@ -1,35 +0,0 @@
<?php
/*
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2017 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -11,7 +11,7 @@
/**
* Base class for Spools (implements time and message limits).
*
* @author Fabien Potencier
* @author Fabien Potencier
*/
abstract class Swift_ConfigurableSpool implements Swift_Spool
{
@@ -24,7 +24,7 @@ abstract class Swift_ConfigurableSpool implements Swift_Spool
/**
* Sets the maximum number of messages to send per flush.
*
* @param int $limit
* @param int $limit
*/
public function setMessageLimit($limit)
{
@@ -34,7 +34,7 @@ abstract class Swift_ConfigurableSpool implements Swift_Spool
/**
* Gets the maximum number of messages to send per flush.
*
* @return int The limit
* @return int The limit
*/
public function getMessageLimit()
{
@@ -44,7 +44,7 @@ abstract class Swift_ConfigurableSpool implements Swift_Spool
/**
* Sets the time limit (in seconds) per flush.
*
* @param int $limit The limit
* @param int $limit The limit
*/
public function setTimeLimit($limit)
{
@@ -54,7 +54,7 @@ abstract class Swift_ConfigurableSpool implements Swift_Spool
/**
* Gets the time limit (in seconds) per flush.
*
* @return int The limit
* @return int The limit
*/
public function getTimeLimit()
{

View File

@@ -11,7 +11,7 @@
/**
* Dependency Injection container.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_DependencyContainer
{
@@ -48,7 +48,7 @@ class Swift_DependencyContainer
/**
* Returns a singleton of the DependencyContainer.
*
* @return Swift_DependencyContainer
* @return self
*/
public static function getInstance()
{
@@ -91,9 +91,9 @@ class Swift_DependencyContainer
*
* @param string $itemName
*
* @return mixed
*
* @throws Swift_DependencyException If the dependency is not found
*
* @return mixed
*/
public function lookup($itemName)
{
@@ -138,16 +138,17 @@ class Swift_DependencyContainer
* This method returns the current DependencyContainer instance because it
* requires the use of the fluid interface to set the specific details for the
* dependency.
*
* @see asNewInstanceOf(), asSharedInstanceOf(), asValue()
*
* @param string $itemName
*
* @return Swift_DependencyContainer
* @return $this
*/
public function register($itemName)
{
$this->_store[$itemName] = array();
$this->_endPoint = & $this->_store[$itemName];
$this->_endPoint = &$this->_store[$itemName];
return $this;
}
@@ -159,11 +160,11 @@ class Swift_DependencyContainer
*
* @param mixed $value
*
* @return Swift_DependencyContainer
* @return $this
*/
public function asValue($value)
{
$endPoint = & $this->_getEndPoint();
$endPoint = &$this->_getEndPoint();
$endPoint['lookupType'] = self::TYPE_VALUE;
$endPoint['value'] = $value;
@@ -175,11 +176,11 @@ class Swift_DependencyContainer
*
* @param string $lookup
*
* @return Swift_DependencyContainer
* @return $this
*/
public function asAliasOf($lookup)
{
$endPoint = & $this->_getEndPoint();
$endPoint = &$this->_getEndPoint();
$endPoint['lookupType'] = self::TYPE_ALIAS;
$endPoint['ref'] = $lookup;
@@ -197,11 +198,11 @@ class Swift_DependencyContainer
*
* @param string $className
*
* @return Swift_DependencyContainer
* @return $this
*/
public function asNewInstanceOf($className)
{
$endPoint = & $this->_getEndPoint();
$endPoint = &$this->_getEndPoint();
$endPoint['lookupType'] = self::TYPE_INSTANCE;
$endPoint['className'] = $className;
@@ -215,11 +216,11 @@ class Swift_DependencyContainer
*
* @param string $className
*
* @return Swift_DependencyContainer
* @return $this
*/
public function asSharedInstanceOf($className)
{
$endPoint = & $this->_getEndPoint();
$endPoint = &$this->_getEndPoint();
$endPoint['lookupType'] = self::TYPE_SHARED;
$endPoint['className'] = $className;
@@ -235,11 +236,11 @@ class Swift_DependencyContainer
*
* @param array $lookups
*
* @return Swift_DependencyContainer
* @return $this
*/
public function withDependencies(array $lookups)
{
$endPoint = & $this->_getEndPoint();
$endPoint = &$this->_getEndPoint();
$endPoint['args'] = array();
foreach ($lookups as $lookup) {
$this->addConstructorLookup($lookup);
@@ -256,11 +257,11 @@ class Swift_DependencyContainer
*
* @param mixed $value
*
* @return Swift_DependencyContainer
* @return $this
*/
public function addConstructorValue($value)
{
$endPoint = & $this->_getEndPoint();
$endPoint = &$this->_getEndPoint();
if (!isset($endPoint['args'])) {
$endPoint['args'] = array();
}
@@ -277,11 +278,11 @@ class Swift_DependencyContainer
*
* @param string $lookup
*
* @return Swift_DependencyContainer
* @return $this
*/
public function addConstructorLookup($lookup)
{
$endPoint = & $this->_getEndPoint();
$endPoint = &$this->_getEndPoint();
if (!isset($this->_endPoint['args'])) {
$endPoint['args'] = array();
}
@@ -310,9 +311,9 @@ class Swift_DependencyContainer
return $reflector->newInstanceArgs(
$this->createDependenciesFor($itemName)
);
} else {
return $reflector->newInstance();
}
return $reflector->newInstance();
}
/** Create and register a shared instance of $itemName */
@@ -365,8 +366,8 @@ class Swift_DependencyContainer
}
return $collection;
} else {
return $this->lookup($item);
}
return $this->lookup($item);
}
}

View File

@@ -11,7 +11,7 @@
/**
* DependencyException gets thrown when a requested dependency is missing.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_DependencyException extends Swift_SwiftException
{

View File

@@ -11,7 +11,7 @@
/**
* An embedded file, in a multipart message.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_EmbeddedFile extends Swift_Mime_EmbeddedFile
{

View File

@@ -10,6 +10,7 @@
/**
* Interface for all Encoder schemes.
*
* @author Chris Corbyn
*/
interface Swift_Encoder extends Swift_Mime_CharsetObserver
@@ -17,9 +18,9 @@ interface Swift_Encoder extends Swift_Mime_CharsetObserver
/**
* Encode a given string to produce an encoded string.
*
* @param string $string
* @param int $firstLineOffset if first line needs to be shorter
* @param int $maxLineLength - 0 indicates the default length for this encoding
* @param string $string
* @param int $firstLineOffset if first line needs to be shorter
* @param int $maxLineLength - 0 indicates the default length for this encoding
*
* @return string
*/

View File

@@ -11,7 +11,7 @@
/**
* Handles Base 64 Encoding in Swift Mailer.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_Encoder_Base64Encoder implements Swift_Encoder
{
@@ -22,9 +22,9 @@ class Swift_Encoder_Base64Encoder implements Swift_Encoder
* If the first line needs to be shorter, indicate the difference with
* $firstLineOffset.
*
* @param string $string to encode
* @param int $firstLineOffset
* @param int $maxLineLength optional, 0 indicates the default of 76 bytes
* @param string $string to encode
* @param int $firstLineOffset
* @param int $maxLineLength optional, 0 indicates the default of 76 bytes
*
* @return string
*/

View File

@@ -13,7 +13,7 @@
*
* Possibly the most accurate RFC 2045 QP implementation found in PHP.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_Encoder_QpEncoder implements Swift_Encoder
{
@@ -37,26 +37,26 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
* @var string[]
*/
protected static $_qpMap = array(
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',
15 => '=0F', 16 => '=10', 17 => '=11', 18 => '=12', 19 => '=13',
20 => '=14', 21 => '=15', 22 => '=16', 23 => '=17', 24 => '=18',
25 => '=19', 26 => '=1A', 27 => '=1B', 28 => '=1C', 29 => '=1D',
30 => '=1E', 31 => '=1F', 32 => '=20', 33 => '=21', 34 => '=22',
35 => '=23', 36 => '=24', 37 => '=25', 38 => '=26', 39 => '=27',
40 => '=28', 41 => '=29', 42 => '=2A', 43 => '=2B', 44 => '=2C',
45 => '=2D', 46 => '=2E', 47 => '=2F', 48 => '=30', 49 => '=31',
50 => '=32', 51 => '=33', 52 => '=34', 53 => '=35', 54 => '=36',
55 => '=37', 56 => '=38', 57 => '=39', 58 => '=3A', 59 => '=3B',
60 => '=3C', 61 => '=3D', 62 => '=3E', 63 => '=3F', 64 => '=40',
65 => '=41', 66 => '=42', 67 => '=43', 68 => '=44', 69 => '=45',
70 => '=46', 71 => '=47', 72 => '=48', 73 => '=49', 74 => '=4A',
75 => '=4B', 76 => '=4C', 77 => '=4D', 78 => '=4E', 79 => '=4F',
80 => '=50', 81 => '=51', 82 => '=52', 83 => '=53', 84 => '=54',
85 => '=55', 86 => '=56', 87 => '=57', 88 => '=58', 89 => '=59',
90 => '=5A', 91 => '=5B', 92 => '=5C', 93 => '=5D', 94 => '=5E',
95 => '=5F', 96 => '=60', 97 => '=61', 98 => '=62', 99 => '=63',
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',
15 => '=0F', 16 => '=10', 17 => '=11', 18 => '=12', 19 => '=13',
20 => '=14', 21 => '=15', 22 => '=16', 23 => '=17', 24 => '=18',
25 => '=19', 26 => '=1A', 27 => '=1B', 28 => '=1C', 29 => '=1D',
30 => '=1E', 31 => '=1F', 32 => '=20', 33 => '=21', 34 => '=22',
35 => '=23', 36 => '=24', 37 => '=25', 38 => '=26', 39 => '=27',
40 => '=28', 41 => '=29', 42 => '=2A', 43 => '=2B', 44 => '=2C',
45 => '=2D', 46 => '=2E', 47 => '=2F', 48 => '=30', 49 => '=31',
50 => '=32', 51 => '=33', 52 => '=34', 53 => '=35', 54 => '=36',
55 => '=37', 56 => '=38', 57 => '=39', 58 => '=3A', 59 => '=3B',
60 => '=3C', 61 => '=3D', 62 => '=3E', 63 => '=3F', 64 => '=40',
65 => '=41', 66 => '=42', 67 => '=43', 68 => '=44', 69 => '=45',
70 => '=46', 71 => '=47', 72 => '=48', 73 => '=49', 74 => '=4A',
75 => '=4B', 76 => '=4C', 77 => '=4D', 78 => '=4E', 79 => '=4F',
80 => '=50', 81 => '=51', 82 => '=52', 83 => '=53', 84 => '=54',
85 => '=55', 86 => '=56', 87 => '=57', 88 => '=58', 89 => '=59',
90 => '=5A', 91 => '=5B', 92 => '=5C', 93 => '=5D', 94 => '=5E',
95 => '=5F', 96 => '=60', 97 => '=61', 98 => '=62', 99 => '=63',
100 => '=64', 101 => '=65', 102 => '=66', 103 => '=67', 104 => '=68',
105 => '=69', 106 => '=6A', 107 => '=6B', 108 => '=6C', 109 => '=6D',
110 => '=6E', 111 => '=6F', 112 => '=70', 113 => '=71', 114 => '=72',
@@ -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
*/
@@ -170,7 +170,7 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
$lines = array();
$lNo = 0;
$lines[$lNo] = '';
$currentLine = & $lines[$lNo++];
$currentLine = &$lines[$lNo++];
$size = $lineLen = 0;
$this->_charStream->flushContents();
@@ -198,14 +198,25 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
}
$enc = $this->_encodeByteSequence($bytes, $size);
if ($currentLine && $lineLen+$size >= $thisLineLength) {
$i = strpos($enc, '=0D=0A');
$newLineLength = $lineLen + ($i === false ? $size : $i);
if ($currentLine && $newLineLength >= $thisLineLength) {
$lines[$lNo] = '';
$currentLine = & $lines[$lNo++];
$currentLine = &$lines[$lNo++];
$thisLineLength = $maxLineLength;
$lineLen = 0;
}
$lineLen += $size;
$currentLine .= $enc;
if ($i === false) {
$lineLen += $size;
} else {
// 6 is the length of '=0D=0A'.
$lineLen = $size - strrpos($enc, '=0D=0A') - 6;
}
}
return $this->_standardize(implode("=\r\n", $lines));
@@ -224,8 +235,8 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
/**
* Encode the given byte array into a verbatim QP form.
*
* @param integer[] $bytes
* @param int $size
* @param int[] $bytes
* @param int $size
*
* @return string
*/
@@ -249,9 +260,9 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
/**
* Get the next sequence of bytes to read from the char stream.
*
* @param int $size number of bytes to read
* @param int $size number of bytes to read
*
* @return integer[]
* @return int[]
*/
protected function _nextSequence($size = 4)
{
@@ -267,7 +278,7 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
*/
protected function _standardize($string)
{
$string = str_replace(array("\t=0D=0A", " =0D=0A", "=0D=0A"),
$string = str_replace(array("\t=0D=0A", ' =0D=0A', '=0D=0A'),
array("=09\r\n", "=20\r\n", "\r\n"), $string
);
switch ($end = ord(substr($string, -1))) {
@@ -280,8 +291,8 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
}
/**
* Make a deep copy of object
*/
* Make a deep copy of object.
*/
public function __clone()
{
$this->_charStream = clone $this->_charStream;

View File

@@ -11,7 +11,7 @@
/**
* Handles RFC 2231 specified Encoding in Swift Mailer.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_Encoder_Rfc2231Encoder implements Swift_Encoder
{
@@ -36,9 +36,9 @@ class Swift_Encoder_Rfc2231Encoder implements Swift_Encoder
* Takes an unencoded string and produces a string encoded according to
* RFC 2231 from it.
*
* @param string $string
* @param int $firstLineOffset
* @param int $maxLineLength optional, 0 indicates the default of 75 bytes
* @param string $string
* @param int $firstLineOffset
* @param int $maxLineLength optional, 0 indicates the default of 75 bytes
*
* @return string
*/
@@ -47,7 +47,7 @@ class Swift_Encoder_Rfc2231Encoder implements Swift_Encoder
$lines = array();
$lineCount = 0;
$lines[] = '';
$currentLine = & $lines[$lineCount++];
$currentLine = &$lines[$lineCount++];
if (0 >= $maxLineLength) {
$maxLineLength = 75;
@@ -63,7 +63,7 @@ class Swift_Encoder_Rfc2231Encoder implements Swift_Encoder
if (0 != strlen($currentLine)
&& strlen($currentLine.$encodedChar) > $thisLineLength) {
$lines[] = '';
$currentLine = & $lines[$lineCount++];
$currentLine = &$lines[$lineCount++];
$thisLineLength = $maxLineLength;
}
$currentLine .= $encodedChar;
@@ -83,8 +83,8 @@ class Swift_Encoder_Rfc2231Encoder implements Swift_Encoder
}
/**
* Make a deep copy of object
*/
* Make a deep copy of object.
*/
public function __clone()
{
$this->_charStream = clone $this->_charStream;

View File

@@ -1,35 +0,0 @@
<?php
/*
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2017 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -0,0 +1,62 @@
<?php
/*
* This file is part of SwiftMailer.
* (c) 2004-2009 Chris Corbyn
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Provides quick access to each encoding type.
*
* @author Chris Corbyn
*/
class Swift_Encoding
{
/**
* Get the Encoder that provides 7-bit encoding.
*
* @return Swift_Mime_ContentEncoder
*/
public static function get7BitEncoding()
{
return self::_lookup('mime.7bitcontentencoder');
}
/**
* Get the Encoder that provides 8-bit encoding.
*
* @return Swift_Mime_ContentEncoder
*/
public static function get8BitEncoding()
{
return self::_lookup('mime.8bitcontentencoder');
}
/**
* Get the Encoder that provides Quoted-Printable (QP) encoding.
*
* @return Swift_Mime_ContentEncoder
*/
public static function getQpEncoding()
{
return self::_lookup('mime.qpcontentencoder');
}
/**
* Get the Encoder that provides Base64 encoding.
*
* @return Swift_Mime_ContentEncoder
*/
public static function getBase64Encoding()
{
return self::_lookup('mime.base64contentencoder');
}
private static function _lookup($key)
{
return Swift_DependencyContainer::getInstance()->lookup($key);
}
}

View File

@@ -11,7 +11,7 @@
/**
* Generated when a command is sent over an SMTP connection.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_Events_CommandEvent extends Swift_Events_EventObject
{
@@ -25,7 +25,7 @@ class Swift_Events_CommandEvent extends Swift_Events_EventObject
/**
* An array of codes which a successful response will contain.
*
* @var integer[]
* @var int[]
*/
private $_successCodes = array();
@@ -56,7 +56,7 @@ class Swift_Events_CommandEvent extends Swift_Events_EventObject
/**
* Get the numeric response codes which indicate success for this command.
*
* @return integer[]
* @return int[]
*/
public function getSuccessCodes()
{

View File

@@ -11,7 +11,7 @@
/**
* Listens for Transports to send commands to the server.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
interface Swift_Events_CommandListener extends Swift_Events_EventListener
{

View File

@@ -11,7 +11,7 @@
/**
* The minimum interface for an Event.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
interface Swift_Events_Event
{
@@ -25,7 +25,7 @@ interface Swift_Events_Event
/**
* Prevent this Event from bubbling any further up the stack.
*
* @param bool $cancel, optional
* @param bool $cancel, optional
*/
public function cancelBubble($cancel = true);

View File

@@ -11,7 +11,7 @@
/**
* Interface for the EventDispatcher which handles the event dispatching layer.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
interface Swift_Events_EventDispatcher
{

View File

@@ -11,7 +11,7 @@
/**
* An identity interface which all EventListeners must extend.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
interface Swift_Events_EventListener
{

View File

@@ -11,7 +11,7 @@
/**
* A base Event which all Event classes inherit from.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_Events_EventObject implements Swift_Events_Event
{
@@ -44,7 +44,7 @@ class Swift_Events_EventObject implements Swift_Events_Event
/**
* Prevent this Event from bubbling any further up the stack.
*
* @param bool $cancel, optional
* @param bool $cancel, optional
*/
public function cancelBubble($cancel = true)
{

View File

@@ -11,7 +11,7 @@
/**
* Generated when a response is received on a SMTP connection.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_Events_ResponseEvent extends Swift_Events_EventObject
{

View File

@@ -11,7 +11,7 @@
/**
* Listens for responses from a remote SMTP server.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
interface Swift_Events_ResponseListener extends Swift_Events_EventListener
{

View File

@@ -11,13 +11,16 @@
/**
* Generated when a message is being sent.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_Events_SendEvent extends Swift_Events_EventObject
{
/** Sending has yet to occur */
const RESULT_PENDING = 0x0001;
/** Email is spooled, ready to be sent */
const RESULT_SPOOLED = 0x0011;
/** Sending was successful */
const RESULT_SUCCESS = 0x0010;
@@ -104,7 +107,7 @@ class Swift_Events_SendEvent extends Swift_Events_EventObject
/**
* Set the result of sending.
*
* @param int $result
* @param int $result
*/
public function setResult($result)
{

View File

@@ -11,7 +11,7 @@
/**
* Listens for Messages being sent from within the Transport system.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
interface Swift_Events_SendListener extends Swift_Events_EventListener
{

View File

@@ -11,7 +11,7 @@
/**
* The EventDispatcher which handles the event dispatching layer.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_Events_SimpleEventDispatcher implements Swift_Events_EventDispatcher
{

View File

@@ -11,7 +11,7 @@
/**
* Generated when the state of a Transport is changed (i.e. stopped/started).
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_Events_TransportChangeEvent extends Swift_Events_EventObject
{

View File

@@ -11,7 +11,7 @@
/**
* Listens for changes within the Transport system.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
interface Swift_Events_TransportChangeListener extends Swift_Events_EventListener
{

View File

@@ -11,7 +11,7 @@
/**
* Generated when a TransportException is thrown from the Transport system.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_Events_TransportExceptionEvent extends Swift_Events_EventObject
{

View File

@@ -11,7 +11,7 @@
/**
* Listens for Exceptions thrown from within the Transport system.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
interface Swift_Events_TransportExceptionListener extends Swift_Events_EventListener
{

View File

@@ -1,35 +0,0 @@
<?php
/*
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2017 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -11,7 +11,7 @@
/**
* Contains a list of redundant Transports so when one fails, the next is used.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_FailoverTransport extends Swift_Transport_FailoverTransport
{
@@ -36,7 +36,7 @@ class Swift_FailoverTransport extends Swift_Transport_FailoverTransport
*
* @param Swift_Transport[] $transports
*
* @return Swift_FailoverTransport
* @return self
*/
public static function newInstance($transports = array())
{

View File

@@ -11,8 +11,8 @@
/**
* Stores Messages on the filesystem.
*
* @author Fabien Potencier
* @author Xavier De Cock <xdecock@gmail.com>
* @author Fabien Potencier
* @author Xavier De Cock <xdecock@gmail.com>
*/
class Swift_FileSpool extends Swift_ConfigurableSpool
{
@@ -20,7 +20,7 @@ class Swift_FileSpool extends Swift_ConfigurableSpool
private $_path;
/**
* File WriteRetry Limit
* File WriteRetry Limit.
*
* @var int
*/
@@ -39,7 +39,7 @@ class Swift_FileSpool extends Swift_ConfigurableSpool
if (!file_exists($this->_path)) {
if (!mkdir($this->_path, 0777, true)) {
throw new Swift_IoException('Unable to create Path ['.$this->_path.']');
throw new Swift_IoException(sprintf('Unable to create path "%s".', $this->_path));
}
}
}
@@ -73,7 +73,7 @@ class Swift_FileSpool extends Swift_ConfigurableSpool
*
* Default, is ten and allows over 64^20 different fileNames
*
* @param int $limit
* @param int $limit
*/
public function setRetryLimit($limit)
{
@@ -85,9 +85,9 @@ class Swift_FileSpool extends Swift_ConfigurableSpool
*
* @param Swift_Mime_Message $message The message to store
*
* @return bool
*
* @throws Swift_IoException
*
* @return bool
*/
public function queueMessage(Swift_Mime_Message $message)
{
@@ -108,23 +108,23 @@ class Swift_FileSpool extends Swift_ConfigurableSpool
}
}
throw new Swift_IoException('Unable to create a file for enqueuing Message');
throw new Swift_IoException(sprintf('Unable to create a file for enqueuing Message in "%s".', $this->_path));
}
/**
* Execute a recovery if for any reason a process is sending for too long.
*
* @param int $timeout in second Defaults is for very slow smtp responses
* @param int $timeout in second Defaults is for very slow smtp responses
*/
public function recover($timeout = 900)
{
foreach (new DirectoryIterator($this->_path) as $file) {
$file = $file->getRealPath();
if (substr($file, - 16) == '.message.sending') {
if (substr($file, -16) == '.message.sending') {
$lockedtime = filectime($file);
if ((time() - $lockedtime) > $timeout) {
rename($file, substr($file, 0, - 8));
rename($file, substr($file, 0, -8));
}
}
}
@@ -136,7 +136,7 @@ class Swift_FileSpool extends Swift_ConfigurableSpool
* @param Swift_Transport $transport A transport instance
* @param string[] $failedRecipients An array of failures by-reference
*
* @return int The number of sent e-mail's
* @return int The number of sent e-mail's
*/
public function flushQueue(Swift_Transport $transport, &$failedRecipients = null)
{
@@ -189,14 +189,14 @@ class Swift_FileSpool extends Swift_ConfigurableSpool
/**
* Returns a random string needed to generate a fileName for the queue.
*
* @param int $count
* @param int $count
*
* @return string
*/
protected function getRandomString($count)
{
// This string MUST stay FS safe, avoid special chars
$base = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-.";
$base = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-';
$ret = '';
$strlen = strlen($base);
for ($i = 0; $i < $count; ++$i) {

View File

@@ -11,7 +11,7 @@
/**
* An OutputByteStream which specifically reads from a file.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
interface Swift_FileStream extends Swift_OutputByteStream
{

View File

@@ -11,7 +11,7 @@
/**
* Allows StreamFilters to operate on a stream.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
interface Swift_Filterable
{

View File

@@ -11,7 +11,7 @@
/**
* An image, embedded in a multipart message.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_Image extends Swift_EmbeddedFile
{
@@ -36,7 +36,7 @@ class Swift_Image extends Swift_EmbeddedFile
* @param string $filename
* @param string $contentType
*
* @return Swift_Image
* @return self
*/
public static function newInstance($data = null, $filename = null, $contentType = null)
{
@@ -48,14 +48,10 @@ class Swift_Image extends Swift_EmbeddedFile
*
* @param string $path
*
* @return Swift_Image
* @return self
*/
public static function fromPath($path)
{
$image = self::newInstance()->setFile(
new Swift_ByteStream_FileByteStream($path)
);
return $image;
return self::newInstance()->setFile(new Swift_ByteStream_FileByteStream($path));
}
}

View File

@@ -14,7 +14,7 @@
* Classes implementing this interface may use a subsystem which requires less
* memory than working with large strings of data.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
interface Swift_InputByteStream
{
@@ -30,9 +30,9 @@ interface Swift_InputByteStream
*
* @param string $bytes
*
* @return int
*
* @throws Swift_IoException
*
* @return int
*/
public function write($bytes);

View File

@@ -11,17 +11,19 @@
/**
* I/O Exception class.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_IoException extends Swift_SwiftException
{
/**
* Create a new IoException with $message.
*
* @param string $message
* @param string $message
* @param int $code
* @param Exception $previous
*/
public function __construct($message)
public function __construct($message, $code = 0, Exception $previous = null)
{
parent::__construct($message);
parent::__construct($message, $code, $previous);
}
}

View File

@@ -11,7 +11,7 @@
/**
* Provides a mechanism for storing data using two keys.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
interface Swift_KeyCache
{
@@ -26,10 +26,10 @@ interface Swift_KeyCache
*
* @see MODE_WRITE, MODE_APPEND
*
* @param string $nsKey
* @param string $itemKey
* @param string $string
* @param int $mode
* @param string $nsKey
* @param string $itemKey
* @param string $string
* @param int $mode
*/
public function setString($nsKey, $itemKey, $string, $mode);

View File

@@ -11,7 +11,7 @@
/**
* A basic KeyCache backed by an array.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_KeyCache_ArrayKeyCache implements Swift_KeyCache
{
@@ -45,10 +45,10 @@ class Swift_KeyCache_ArrayKeyCache implements Swift_KeyCache
*
* @see MODE_WRITE, MODE_APPEND
*
* @param string $nsKey
* @param string $itemKey
* @param string $string
* @param int $mode
* @param string $nsKey
* @param string $itemKey
* @param string $string
* @param int $mode
*/
public function setString($nsKey, $itemKey, $string, $mode)
{

View File

@@ -11,7 +11,7 @@
/**
* A KeyCache which streams to and from disk.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_KeyCache_DiskKeyCache implements Swift_KeyCache
{
@@ -74,10 +74,10 @@ class Swift_KeyCache_DiskKeyCache implements Swift_KeyCache
*
* @see MODE_WRITE, MODE_APPEND
*
* @param string $nsKey
* @param string $itemKey
* @param string $string
* @param int $mode
* @param string $nsKey
* @param string $itemKey
* @param string $string
* @param int $mode
*
* @throws Swift_IoException
*/
@@ -167,9 +167,9 @@ class Swift_KeyCache_DiskKeyCache implements Swift_KeyCache
* @param string $nsKey
* @param string $itemKey
*
* @return string
*
* @throws Swift_IoException
*
* @return string
*/
public function getString($nsKey, $itemKey)
{
@@ -280,19 +280,16 @@ class Swift_KeyCache_DiskKeyCache implements Swift_KeyCache
/**
* Get a file handle on the cache item.
*
* @param string $nsKey
* @param string $itemKey
* @param int $position
* @param string $nsKey
* @param string $itemKey
* @param int $position
*
* @return resource
*/
private function _getHandle($nsKey, $itemKey, $position)
{
if (!isset($this->_keys[$nsKey][$itemKey])) {
$openMode = $this->hasKey($nsKey, $itemKey)
? 'r+b'
: 'w+b'
;
$openMode = $this->hasKey($nsKey, $itemKey) ? 'r+b' : 'w+b';
$fp = fopen($this->_path.'/'.$nsKey.'/'.$itemKey, $openMode);
$this->_keys[$nsKey][$itemKey] = $fp;
}

View File

@@ -11,7 +11,7 @@
/**
* Writes data to a KeyCache using a stream.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
interface Swift_KeyCache_KeyCacheInputStream extends Swift_InputByteStream
{

View File

@@ -11,7 +11,7 @@
/**
* A null KeyCache that does not cache at all.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_KeyCache_NullKeyCache implements Swift_KeyCache
{
@@ -20,10 +20,10 @@ class Swift_KeyCache_NullKeyCache implements Swift_KeyCache
*
* @see MODE_WRITE, MODE_APPEND
*
* @param string $nsKey
* @param string $itemKey
* @param string $string
* @param int $mode
* @param string $nsKey
* @param string $itemKey
* @param string $string
* @param int $mode
*/
public function setString($nsKey, $itemKey, $string, $mode)
{

View File

@@ -11,7 +11,7 @@
/**
* Writes data to a KeyCache using a stream.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_KeyCache_SimpleKeyCacheInputStream implements Swift_KeyCache_KeyCacheInputStream
{

View File

@@ -1,35 +0,0 @@
<?php
/*
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2017 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -11,7 +11,7 @@
/**
* Redundantly and rotationally uses several Transport implementations when sending.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_LoadBalancedTransport extends Swift_Transport_LoadBalancedTransport
{
@@ -36,7 +36,7 @@ class Swift_LoadBalancedTransport extends Swift_Transport_LoadBalancedTransport
*
* @param array $transports
*
* @return Swift_LoadBalancedTransport
* @return self
*/
public static function newInstance($transports = array())
{

View File

@@ -11,7 +11,9 @@
/**
* Sends Messages using the mail() function.
*
* @author Chris Corbyn
* @author Chris Corbyn
*
* @deprecated since 5.4.5 (to be removed in 6.0)
*/
class Swift_MailTransport extends Swift_Transport_MailTransport
{
@@ -36,7 +38,7 @@ class Swift_MailTransport extends Swift_Transport_MailTransport
*
* @param string $extraParams To be passed to mail()
*
* @return Swift_MailTransport
* @return self
*/
public static function newInstance($extraParams = '-f%s')
{

View File

@@ -11,7 +11,7 @@
/**
* Swift Mailer class.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_Mailer
{
@@ -33,7 +33,7 @@ class Swift_Mailer
*
* @param Swift_Transport $transport
*
* @return Swift_Mailer
* @return self
*/
public static function newInstance(Swift_Transport $transport)
{
@@ -69,7 +69,7 @@ class Swift_Mailer
* @param Swift_Mime_Message $message
* @param array $failedRecipients An array of failures by-reference
*
* @return int
* @return int The number of successful recipients. Can be 0 which indicates failure
*/
public function send(Swift_Mime_Message $message, &$failedRecipients = null)
{

View File

@@ -11,7 +11,7 @@
/**
* Wraps a standard PHP array in an iterator.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_Mailer_ArrayRecipientIterator implements Swift_Mailer_RecipientIterator
{
@@ -44,7 +44,7 @@ class Swift_Mailer_ArrayRecipientIterator implements Swift_Mailer_RecipientItera
/**
* Returns an array where the keys are the addresses of recipients and the
* values are the names. e.g. ('foo@bar' => 'Foo') or ('foo@bar' => NULL)
* values are the names. e.g. ('foo@bar' => 'Foo') or ('foo@bar' => NULL).
*
* @return array
*/

View File

@@ -11,7 +11,7 @@
/**
* Provides an abstract way of specifying recipients for batch sending.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
interface Swift_Mailer_RecipientIterator
{
@@ -24,7 +24,7 @@ interface Swift_Mailer_RecipientIterator
/**
* Returns an array where the keys are the addresses of recipients and the
* values are the names. e.g. ('foo@bar' => 'Foo') or ('foo@bar' => NULL)
* values are the names. e.g. ('foo@bar' => 'Foo') or ('foo@bar' => NULL).
*
* @return array
*/

View File

@@ -1,35 +0,0 @@
<?php
/*
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2017 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -11,11 +11,12 @@
/**
* Stores Messages in memory.
*
* @author Fabien Potencier
* @author Fabien Potencier
*/
class Swift_MemorySpool implements Swift_Spool
{
protected $messages = array();
private $flushRetries = 3;
/**
* Tests if this Transport mechanism has started.
@@ -41,12 +42,20 @@ class Swift_MemorySpool implements Swift_Spool
{
}
/**
* @param int $retries
*/
public function setFlushRetries($retries)
{
$this->flushRetries = $retries;
}
/**
* Stores a message in the queue.
*
* @param Swift_Mime_Message $message The message to store
*
* @return bool Whether the operation has succeeded
* @return bool Whether the operation has succeeded
*/
public function queueMessage(Swift_Mime_Message $message)
{
@@ -62,7 +71,7 @@ class Swift_MemorySpool implements Swift_Spool
* @param Swift_Transport $transport A transport instance
* @param string[] $failedRecipients An array of failures by-reference
*
* @return int The number of sent emails
* @return int The number of sent emails
*/
public function flushQueue(Swift_Transport $transport, &$failedRecipients = null)
{
@@ -75,8 +84,25 @@ class Swift_MemorySpool implements Swift_Spool
}
$count = 0;
while ($message = array_pop($this->messages)) {
$count += $transport->send($message, $failedRecipients);
$retries = $this->flushRetries;
while ($retries--) {
try {
while ($message = array_pop($this->messages)) {
$count += $transport->send($message, $failedRecipients);
}
} catch (Swift_TransportException $exception) {
if ($retries) {
// re-queue the message at the end of the queue to give a chance
// to the other messages to be sent, in case the failure was due to
// this message and not just the transport failing
array_unshift($this->messages, $message);
// wait half a second before we try again
usleep(500000);
} else {
throw $exception;
}
}
}
return $count;

View File

@@ -11,7 +11,7 @@
/**
* The Message class for building emails.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_Message extends Swift_Mime_SimpleMessage
{
@@ -68,7 +68,7 @@ class Swift_Message extends Swift_Mime_SimpleMessage
* @param string $contentType
* @param string $charset
*
* @return Swift_Message
* @return $this
*/
public static function newInstance($subject = null, $body = null, $contentType = null, $charset = null)
{
@@ -82,20 +82,19 @@ class Swift_Message extends Swift_Mime_SimpleMessage
* @param string $contentType
* @param string $charset
*
* @return Swift_Mime_SimpleMessage
* @return $this
*/
public function addPart($body, $contentType = null, $charset = null)
{
return $this->attach(Swift_MimePart::newInstance(
$body, $contentType, $charset
));
return $this->attach(Swift_MimePart::newInstance($body, $contentType, $charset)->setEncoder($this->getEncoder()));
}
/**
* Attach a new signature handler to the message.
* Detach a signature handler from a message.
*
* @param Swift_Signer $signer
* @return Swift_Message
*
* @return $this
*/
public function attachSigner(Swift_Signer $signer)
{
@@ -112,7 +111,8 @@ class Swift_Message extends Swift_Mime_SimpleMessage
* Attach a new signature handler to the message.
*
* @param Swift_Signer $signer
* @return Swift_Message
*
* @return $this
*/
public function detachSigner(Swift_Signer $signer)
{
@@ -187,7 +187,7 @@ class Swift_Message extends Swift_Mime_SimpleMessage
}
/**
* loops through signers and apply the signatures
* loops through signers and apply the signatures.
*/
protected function doSign()
{
@@ -213,7 +213,7 @@ class Swift_Message extends Swift_Mime_SimpleMessage
}
/**
* save the message before any signature is applied
* save the message before any signature is applied.
*/
protected function saveMessage()
{
@@ -227,7 +227,8 @@ class Swift_Message extends Swift_Mime_SimpleMessage
}
/**
* save the original headers
* save the original headers.
*
* @param array $altered
*/
protected function saveHeaders(array $altered)
@@ -242,7 +243,7 @@ class Swift_Message extends Swift_Mime_SimpleMessage
}
/**
* Remove or restore altered headers
* Remove or restore altered headers.
*/
protected function restoreHeaders()
{
@@ -258,7 +259,7 @@ class Swift_Message extends Swift_Mime_SimpleMessage
}
/**
* Restore message body
* Restore message body.
*/
protected function restoreMessage()
{
@@ -268,4 +269,21 @@ class Swift_Message extends Swift_Mime_SimpleMessage
$this->restoreHeaders();
$this->savedMessage = array();
}
/**
* Clone Message Signers.
*
* @see Swift_Mime_SimpleMimeEntity::__clone()
*/
public function __clone()
{
parent::__clone();
foreach ($this->bodySigners as $key => $bodySigner) {
$this->bodySigners[$key] = clone $bodySigner;
}
foreach ($this->headerSigners as $key => $headerSigner) {
$this->headerSigners[$key] = clone $headerSigner;
}
}
}

View File

@@ -11,7 +11,7 @@
/**
* An attachment, in a multipart message.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_Mime_Attachment extends Swift_Mime_SimpleMimeEntity
{
@@ -64,14 +64,12 @@ class Swift_Mime_Attachment extends Swift_Mime_SimpleMimeEntity
*
* @param string $disposition
*
* @return Swift_Mime_Attachment
* @return $this
*/
public function setDisposition($disposition)
{
if (!$this->_setHeaderFieldModel('Content-Disposition', $disposition)) {
$this->getHeaders()->addParameterizedHeader(
'Content-Disposition', $disposition
);
$this->getHeaders()->addParameterizedHeader('Content-Disposition', $disposition);
}
return $this;
@@ -92,7 +90,7 @@ class Swift_Mime_Attachment extends Swift_Mime_SimpleMimeEntity
*
* @param string $filename
*
* @return Swift_Mime_Attachment
* @return $this
*/
public function setFilename($filename)
{
@@ -115,9 +113,9 @@ class Swift_Mime_Attachment extends Swift_Mime_SimpleMimeEntity
/**
* Set the file size of this attachment.
*
* @param int $size
* @param int $size
*
* @return Swift_Mime_Attachment
* @return $this
*/
public function setSize($size)
{
@@ -132,16 +130,14 @@ class Swift_Mime_Attachment extends Swift_Mime_SimpleMimeEntity
* @param Swift_FileStream $file
* @param string $contentType optional
*
* @return Swift_Mime_Attachment
* @return $this
*/
public function setFile(Swift_FileStream $file, $contentType = null)
{
$this->setFilename(basename($file->getPath()));
$this->setBody($file, $contentType);
if (!isset($contentType)) {
$extension = strtolower(substr(
$file->getPath(), strrpos($file->getPath(), '.') + 1
));
$extension = strtolower(substr($file->getPath(), strrpos($file->getPath(), '.') + 1));
if (array_key_exists($extension, $this->_mimeTypes)) {
$this->setContentType($this->_mimeTypes[$extension]);

View File

@@ -11,7 +11,7 @@
/**
* Observes changes in an Mime entity's character set.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
interface Swift_Mime_CharsetObserver
{

View File

@@ -11,7 +11,7 @@
/**
* Interface for all Transfer Encoding schemes.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
interface Swift_Mime_ContentEncoder extends Swift_Encoder
{

View File

@@ -11,7 +11,7 @@
/**
* Handles Base 64 Transfer Encoding in Swift Mailer.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_Mime_ContentEncoder_Base64ContentEncoder extends Swift_Encoder_Base64Encoder implements Swift_Mime_ContentEncoder
{
@@ -30,9 +30,42 @@ class Swift_Mime_ContentEncoder_Base64ContentEncoder extends Swift_Encoder_Base6
}
$remainder = 0;
$base64ReadBufferRemainderBytes = null;
while (false !== $bytes = $os->read(8190)) {
$encoded = base64_encode($bytes);
// To reduce memory usage, the output buffer is streamed to the input buffer like so:
// Output Stream => base64encode => wrap line length => Input Stream
// HOWEVER it's important to note that base64_encode() should only be passed whole triplets of data (except for the final chunk of data)
// otherwise it will assume the input data has *ended* and it will incorrectly pad/terminate the base64 data mid-stream.
// We use $base64ReadBufferRemainderBytes to carry over 1-2 "remainder" bytes from the each chunk from OutputStream and pre-pend those onto the
// chunk of bytes read in the next iteration.
// When the OutputStream is empty, we must flush any remainder bytes.
while (true) {
$readBytes = $os->read(8192);
$atEOF = ($readBytes === false);
if ($atEOF) {
$streamTheseBytes = $base64ReadBufferRemainderBytes;
} else {
$streamTheseBytes = $base64ReadBufferRemainderBytes.$readBytes;
}
$base64ReadBufferRemainderBytes = null;
$bytesLength = strlen($streamTheseBytes);
if ($bytesLength === 0) { // no data left to encode
break;
}
// if we're not on the last block of the ouput stream, make sure $streamTheseBytes ends with a complete triplet of data
// and carry over remainder 1-2 bytes to the next loop iteration
if (!$atEOF) {
$excessBytes = $bytesLength % 3;
if ($excessBytes !== 0) {
$base64ReadBufferRemainderBytes = substr($streamTheseBytes, -$excessBytes);
$streamTheseBytes = substr($streamTheseBytes, 0, $bytesLength - $excessBytes);
}
}
$encoded = base64_encode($streamTheseBytes);
$encodedTransformed = '';
$thisMaxLineLength = $maxLineLength - $remainder - $firstLineOffset;
@@ -51,6 +84,10 @@ class Swift_Mime_ContentEncoder_Base64ContentEncoder extends Swift_Encoder_Base6
}
$is->write($encodedTransformed);
if ($atEOF) {
break;
}
}
}

View File

@@ -11,7 +11,7 @@
/**
* Handles Quoted Printable (QP) Transfer Encoding in Swift Mailer using the PHP core function.
*
* @author Lars Strojny
* @author Lars Strojny
*/
class Swift_Mime_ContentEncoder_NativeQpContentEncoder implements Swift_Mime_ContentEncoder
{
@@ -77,13 +77,13 @@ class Swift_Mime_ContentEncoder_NativeQpContentEncoder implements Swift_Mime_Con
/**
* Encode a given string to produce an encoded string.
*
* @param string $string
* @param int $firstLineOffset if first line needs to be shorter
* @param int $maxLineLength 0 indicates the default length for this encoding
*
* @return string
* @param string $string
* @param int $firstLineOffset if first line needs to be shorter
* @param int $maxLineLength 0 indicates the default length for this encoding
*
* @throws RuntimeException
*
* @return string
*/
public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0)
{
@@ -107,7 +107,7 @@ class Swift_Mime_ContentEncoder_NativeQpContentEncoder implements Swift_Mime_Con
// transform CR or LF to CRLF
$string = preg_replace('~=0D(?!=0A)|(?<!=0D)=0A~', '=0D=0A', $string);
// transform =0D=0A to CRLF
$string = str_replace(array("\t=0D=0A", " =0D=0A", "=0D=0A"), array("=09\r\n", "=20\r\n", "\r\n"), $string);
$string = str_replace(array("\t=0D=0A", ' =0D=0A', '=0D=0A'), array("=09\r\n", "=20\r\n", "\r\n"), $string);
switch ($end = ord(substr($string, -1))) {
case 0x09:

View File

@@ -11,7 +11,7 @@
/**
* Handles binary/7/8-bit Transfer Encoding in Swift Mailer.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_Mime_ContentEncoder_PlainContentEncoder implements Swift_Mime_ContentEncoder
{
@@ -32,8 +32,8 @@ 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 string $name
* @param bool $canonical If canonicalization transformation should be done.
*/
public function __construct($name, $canonical = false)
{
@@ -44,9 +44,9 @@ class Swift_Mime_ContentEncoder_PlainContentEncoder implements Swift_Mime_Conten
/**
* Encode a given string to produce an encoded string.
*
* @param string $string
* @param int $firstLineOffset ignored
* @param int $maxLineLength - 0 means no wrapping will occur
* @param string $string
* @param int $firstLineOffset ignored
* @param int $maxLineLength - 0 means no wrapping will occur
*
* @return string
*/
@@ -107,9 +107,9 @@ class Swift_Mime_ContentEncoder_PlainContentEncoder implements Swift_Mime_Conten
/**
* A safer (but weaker) wordwrap for unicode.
*
* @param string $string
* @param int $length
* @param string $le
* @param string $string
* @param int $length
* @param string $le
*
* @return string
*/
@@ -126,7 +126,7 @@ class Swift_Mime_ContentEncoder_PlainContentEncoder implements Swift_Mime_Conten
foreach ($originalLines as $originalLine) {
$lines[] = '';
$currentLine = & $lines[$lineCount++];
$currentLine = &$lines[$lineCount++];
//$chunks = preg_split('/(?<=[\ \t,\.!\?\-&\+\/])/', $originalLine);
$chunks = preg_split('/(?<=\s)/', $originalLine);
@@ -135,7 +135,7 @@ class Swift_Mime_ContentEncoder_PlainContentEncoder implements Swift_Mime_Conten
if (0 != strlen($currentLine)
&& strlen($currentLine.$chunk) > $length) {
$lines[] = '';
$currentLine = & $lines[$lineCount++];
$currentLine = &$lines[$lineCount++];
}
$currentLine .= $chunk;
}

View File

@@ -11,7 +11,7 @@
/**
* Handles Quoted Printable (QP) Transfer Encoding in Swift Mailer.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_Mime_ContentEncoder_QpContentEncoder extends Swift_Encoder_QpEncoder implements Swift_Mime_ContentEncoder
{
@@ -95,15 +95,26 @@ class Swift_Mime_ContentEncoder_QpContentEncoder extends Swift_Encoder_QpEncoder
}
$enc = $this->_encodeByteSequence($bytes, $size);
if ($currentLine && $lineLen+$size >= $thisLineLength) {
$i = strpos($enc, '=0D=0A');
$newLineLength = $lineLen + ($i === false ? $size : $i);
if ($currentLine && $newLineLength >= $thisLineLength) {
$is->write($prepend.$this->_standardize($currentLine));
$currentLine = '';
$prepend = "=\r\n";
$thisLineLength = $maxLineLength;
$lineLen = 0;
}
$lineLen += $size;
$currentLine .= $enc;
if ($i === false) {
$lineLen += $size;
} else {
// 6 is the length of '=0D=0A'.
$lineLen = $size - strrpos($enc, '=0D=0A') - 6;
}
}
if (strlen($currentLine)) {
$is->write($prepend.$this->_standardize($currentLine));

View File

@@ -13,7 +13,7 @@
*
* Switches on the best QP encoder implementation for current charset.
*
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
*/
class Swift_Mime_ContentEncoder_QpContentEncoderProxy implements Swift_Mime_ContentEncoder
{
@@ -47,7 +47,7 @@ class Swift_Mime_ContentEncoder_QpContentEncoderProxy implements Swift_Mime_Cont
}
/**
* Make a deep copy of object
* Make a deep copy of object.
*/
public function __clone()
{
@@ -61,6 +61,7 @@ class Swift_Mime_ContentEncoder_QpContentEncoderProxy implements Swift_Mime_Cont
public function charsetChanged($charset)
{
$this->charset = $charset;
$this->safeEncoder->charsetChanged($charset);
}
/**

View File

@@ -12,16 +12,17 @@
* Handles raw Transfer Encoding in Swift Mailer.
*
*
* @author Sebastiaan Stok <s.stok@rollerscapes.net>
* @author Sebastiaan Stok <s.stok@rollerscapes.net>
*/
class Swift_Mime_ContentEncoder_RawContentEncoder implements Swift_Mime_ContentEncoder
{
/**
* Encode a given string to produce an encoded string.
*
* @param string $string
* @param int $firstLineOffset ignored
* @param int $maxLineLength ignored
* @param string $string
* @param int $firstLineOffset ignored
* @param int $maxLineLength ignored
*
* @return string
*/
public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0)

View File

@@ -1,35 +0,0 @@
<?php
/*
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2017 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -11,7 +11,7 @@
/**
* An embedded file, in a multipart message.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_Mime_EmbeddedFile extends Swift_Mime_Attachment
{

View File

@@ -11,7 +11,7 @@
/**
* Observes changes for a Mime entity's ContentEncoder.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
interface Swift_Mime_EncodingObserver
{

View File

@@ -129,11 +129,11 @@ class Swift_Mime_Grammar
{
if (array_key_exists($name, self::$_grammar)) {
return self::$_grammar[$name];
} else {
throw new Swift_RfcComplianceException(
"No such grammar '".$name."' defined."
);
}
throw new Swift_RfcComplianceException(
"No such grammar '".$name."' defined."
);
}
/**

View File

@@ -11,7 +11,7 @@
/**
* A MIME Header.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
interface Swift_Mime_Header
{

View File

@@ -11,7 +11,7 @@
/**
* Interface for all Header Encoding schemes.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
interface Swift_Mime_HeaderEncoder extends Swift_Encoder
{

View File

@@ -11,7 +11,7 @@
/**
* Handles Base64 (B) Header Encoding in Swift Mailer.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_Mime_HeaderEncoder_Base64HeaderEncoder extends Swift_Encoder_Base64Encoder implements Swift_Mime_HeaderEncoder
{
@@ -32,10 +32,10 @@ class Swift_Mime_HeaderEncoder_Base64HeaderEncoder extends Swift_Encoder_Base64E
* If the charset is iso-2022-jp, it uses mb_encode_mimeheader instead of
* default encodeString, otherwise pass to the parent method.
*
* @param string $string string to encode
* @param int $firstLineOffset
* @param int $maxLineLength optional, 0 indicates the default of 76 bytes
* @param string $charset
* @param string $string string to encode
* @param int $firstLineOffset
* @param int $maxLineLength optional, 0 indicates the default of 76 bytes
* @param string $charset
*
* @return string
*/

View File

@@ -11,7 +11,7 @@
/**
* Handles Quoted Printable (Q) Header Encoding in Swift Mailer.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_Mime_HeaderEncoder_QpHeaderEncoder extends Swift_Encoder_QpEncoder implements Swift_Mime_HeaderEncoder
{
@@ -50,9 +50,9 @@ class Swift_Mime_HeaderEncoder_QpHeaderEncoder extends Swift_Encoder_QpEncoder i
/**
* Takes an unencoded string and produces a QP encoded string from it.
*
* @param string $string string to encode
* @param int $firstLineOffset optional
* @param int $maxLineLength optional, 0 indicates the default of 76 chars
* @param string $string string to encode
* @param int $firstLineOffset optional
* @param int $maxLineLength optional, 0 indicates the default of 76 chars
*
* @return string
*/

View File

@@ -1,35 +0,0 @@
<?php
/*
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2017 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -11,7 +11,7 @@
/**
* Creates MIME headers.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
interface Swift_Mime_HeaderFactory extends Swift_Mime_CharsetObserver
{
@@ -28,8 +28,8 @@ interface Swift_Mime_HeaderFactory extends Swift_Mime_CharsetObserver
/**
* Create a new Date header using $timestamp (UNIX time).
*
* @param string $name
* @param int $timestamp
* @param string $name
* @param int $timestamp
*
* @return Swift_Mime_Header
*/

View File

@@ -11,7 +11,7 @@
/**
* A collection of MIME headers.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
interface Swift_Mime_HeaderSet extends Swift_Mime_CharsetObserver
{
@@ -26,8 +26,8 @@ interface Swift_Mime_HeaderSet extends Swift_Mime_CharsetObserver
/**
* Add a new Date header using $timestamp (UNIX time).
*
* @param string $name
* @param int $timestamp
* @param string $name
* @param int $timestamp
*/
public function addDateHeader($name, $timestamp = null);
@@ -69,8 +69,8 @@ interface Swift_Mime_HeaderSet extends Swift_Mime_CharsetObserver
*
* If multiple headers match, the actual one may be specified by $index.
*
* @param string $name
* @param int $index
* @param string $name
* @param int $index
*
* @return bool
*/
@@ -95,8 +95,8 @@ interface Swift_Mime_HeaderSet extends Swift_Mime_CharsetObserver
* If multiple headers match, the actual one may be specified by $index.
* Returns NULL if none present.
*
* @param string $name
* @param int $index
* @param string $name
* @param int $index
*
* @return Swift_Mime_Header
*/
@@ -112,19 +112,19 @@ interface Swift_Mime_HeaderSet extends Swift_Mime_CharsetObserver
public function getAll($name = null);
/**
* Return the name of all Headers
* Return the name of all Headers.
*
* @return array
*/
public function listAll();
/**
/**
* Remove the header with the given $name if it's set.
*
* If multiple headers match, the actual one may be specified by $index.
*
* @param string $name
* @param int $index
* @param string $name
* @param int $index
*/
public function remove($name, $index = 0);
@@ -138,7 +138,7 @@ interface Swift_Mime_HeaderSet extends Swift_Mime_CharsetObserver
/**
* Create a new instance of this HeaderSet.
*
* @return Swift_Mime_HeaderSet
* @return self
*/
public function newInstance();

View File

@@ -11,7 +11,7 @@
/**
* An abstract base MIME Header.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
{
@@ -177,7 +177,7 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
/**
* Set the maximum length of lines in the header (excluding EOL).
*
* @param int $lineLength
* @param int $lineLength
*/
public function setMaxLineLength($lineLength)
{
@@ -198,9 +198,9 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
/**
* Get this Header rendered as a RFC 2822 compliant string.
*
* @return string
*
* @throws Swift_RfcComplianceException
*
* @return string
*/
public function toString()
{
@@ -219,8 +219,6 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
return $this->toString();
}
// -- Points of extension
/**
* Set the name of this Header field.
*
@@ -357,8 +355,8 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
/**
* Get a token as an encoded word for safe insertion into headers.
*
* @param string $token token to encode
* @param int $firstLineOffset optional
* @param string $token token to encode
* @param int $firstLineOffset optional
*
* @return string
*/
@@ -431,7 +429,7 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
/**
* Clear the cached value if $condition is met.
*
* @param bool $condition
* @param bool $condition
*/
protected function clearCachedValueIf($condition)
{
@@ -449,7 +447,7 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
*/
protected function toTokens($string = null)
{
if (is_null($string)) {
if (null === $string) {
$string = $this->getFieldBody();
}
@@ -479,7 +477,7 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
$lineCount = 0;
$headerLines = array();
$headerLines[] = $this->_name.': ';
$currentLine = & $headerLines[$lineCount++];
$currentLine = &$headerLines[$lineCount++];
// Build all tokens back into compliant header
foreach ($tokens as $i => $token) {
@@ -488,7 +486,7 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
($i > 0 && strlen($currentLine.$token) > $this->_lineLength)
&& 0 < strlen($currentLine)) {
$headerLines[] = '';
$currentLine = & $headerLines[$lineCount++];
$currentLine = &$headerLines[$lineCount++];
}
// Append token to the line

View File

@@ -11,7 +11,7 @@
/**
* A Date MIME Header for Swift Mailer.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_Mime_Headers_DateHeader extends Swift_Mime_Headers_AbstractHeader
{
@@ -59,7 +59,7 @@ class Swift_Mime_Headers_DateHeader extends Swift_Mime_Headers_AbstractHeader
*
* This method takes a UNIX timestamp.
*
* @param int $model
* @param int $model
*/
public function setFieldBodyModel($model)
{
@@ -91,11 +91,11 @@ class Swift_Mime_Headers_DateHeader extends Swift_Mime_Headers_AbstractHeader
/**
* Set the UNIX timestamp of the Date in this Header.
*
* @param int $timestamp
* @param int $timestamp
*/
public function setTimestamp($timestamp)
{
if (!is_null($timestamp)) {
if (null !== $timestamp) {
$timestamp = (int) $timestamp;
}
$this->clearCachedValueIf($this->_timestamp != $timestamp);

View File

@@ -11,7 +11,7 @@
/**
* An ID MIME Header for something like Message-ID or Content-ID.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_Mime_Headers_IdentificationHeader extends Swift_Mime_Headers_AbstractHeader
{
@@ -139,9 +139,9 @@ class Swift_Mime_Headers_IdentificationHeader extends Swift_Mime_Headers_Abstrac
*
* @see toString()
*
* @return string
*
* @throws Swift_RfcComplianceException
*
* @return string
*/
public function getFieldBody()
{

View File

@@ -11,7 +11,7 @@
/**
* A Mailbox Address MIME Header for something like From or Sender.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_Mime_Headers_MailboxHeader extends Swift_Mime_Headers_AbstractHeader
{
@@ -68,9 +68,9 @@ class Swift_Mime_Headers_MailboxHeader extends Swift_Mime_Headers_AbstractHeader
*
* This method returns an associative array like {@link getNameAddresses()}
*
* @return array
*
* @throws Swift_RfcComplianceException
*
* @return array
*/
public function getFieldBodyModel()
{
@@ -128,9 +128,9 @@ class Swift_Mime_Headers_MailboxHeader extends Swift_Mime_Headers_AbstractHeader
* @see getNameAddresses()
* @see toString()
*
* @return string[]
*
* @throws Swift_RfcComplianceException
*
* @return string[]
*/
public function getNameAddressStrings()
{
@@ -224,22 +224,20 @@ class Swift_Mime_Headers_MailboxHeader extends Swift_Mime_Headers_AbstractHeader
*
* @see toString()
*
* @return string
*
* @throws Swift_RfcComplianceException
*
* @return string
*/
public function getFieldBody()
{
// Compute the string value of the header only if needed
if (is_null($this->getCachedValue())) {
if (null === $this->getCachedValue()) {
$this->setCachedValue($this->createMailboxListString($this->_mailboxes));
}
return $this->getCachedValue();
}
// -- Points of extension
/**
* Normalizes a user-input list of mailboxes into consistent key=>value pairs.
*
@@ -270,16 +268,14 @@ class Swift_Mime_Headers_MailboxHeader extends Swift_Mime_Headers_AbstractHeader
/**
* Produces a compliant, formatted display-name based on the string given.
*
* @param string $displayName as displayed
* @param bool $shorten the first line to make remove for header name
* @param string $displayName as displayed
* @param bool $shorten the first line to make remove for header name
*
* @return string
*/
protected function createDisplayNameString($displayName, $shorten = false)
{
return $this->createPhrase($this, $displayName,
$this->getCharset(), $this->getEncoder(), $shorten
);
return $this->createPhrase($this, $displayName, $this->getCharset(), $this->getEncoder(), $shorten);
}
/**
@@ -287,9 +283,9 @@ class Swift_Mime_Headers_MailboxHeader extends Swift_Mime_Headers_AbstractHeader
*
* @param string[] $mailboxes
*
* @return string
*
* @throws Swift_RfcComplianceException
*
* @return string
*/
protected function createMailboxListString(array $mailboxes)
{
@@ -299,8 +295,9 @@ class Swift_Mime_Headers_MailboxHeader extends Swift_Mime_Headers_AbstractHeader
/**
* Redefine the encoding requirements for mailboxes.
*
* Commas and semicolons are used to separate
* multiple addresses, and should therefore be encoded
* All "specials" must be encoded as the full header value will not be quoted
*
* @see RFC 2822 3.2.1
*
* @param string $token
*
@@ -308,7 +305,7 @@ class Swift_Mime_Headers_MailboxHeader extends Swift_Mime_Headers_AbstractHeader
*/
protected function tokenNeedsEncoding($token)
{
return preg_match('/[,;]/', $token) || parent::tokenNeedsEncoding($token);
return preg_match('/[()<>\[\]:;@\,."]/', $token) || parent::tokenNeedsEncoding($token);
}
/**
@@ -324,7 +321,7 @@ class Swift_Mime_Headers_MailboxHeader extends Swift_Mime_Headers_AbstractHeader
foreach ($mailboxes as $email => $name) {
$mailboxStr = $email;
if (!is_null($name)) {
if (null !== $name) {
$nameStr = $this->createDisplayNameString($name, empty($strings));
$mailboxStr = $nameStr.' <'.$mailboxStr.'>';
}

View File

@@ -9,9 +9,9 @@
*/
/**
* An OpenDKIM Specific Header using only raw header datas without encoding
* An OpenDKIM Specific Header using only raw header datas without encoding.
*
* @author De Cock Xavier <xdecock@gmail.com>
* @author De Cock Xavier <xdecock@gmail.com>
*/
class Swift_Mime_Headers_OpenDKIMHeader implements Swift_Mime_Header
{
@@ -23,17 +23,14 @@ class Swift_Mime_Headers_OpenDKIMHeader implements Swift_Mime_Header
private $_value;
/**
* The name of this Header
* The name of this Header.
*
* @var string
*/
private $_fieldName;
/**
* Creates a new SimpleHeader with $name.
*
* @param string $name
* @param Swift_Mime_HeaderEncoder $encoder
* @param Swift_Mime_Grammar $grammar
* @param string $name
*/
public function __construct($name)
{
@@ -118,16 +115,17 @@ class Swift_Mime_Headers_OpenDKIMHeader implements Swift_Mime_Header
}
/**
* Set the Header FieldName
* @see Swift_Mime_Header::getFieldName()
*/
* Set the Header FieldName.
*
* @see Swift_Mime_Header::getFieldName()
*/
public function getFieldName()
{
return $this->_fieldName;
}
/**
* Ignored
* Ignored.
*/
public function setCharset($charset)
{

View File

@@ -11,7 +11,7 @@
/**
* An abstract base MIME Header.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_Mime_Headers_ParameterizedHeader extends Swift_Mime_Headers_UnstructuredHeader implements Swift_Mime_ParameterizedHeader
{
@@ -98,9 +98,7 @@ class Swift_Mime_Headers_ParameterizedHeader extends Swift_Mime_Headers_Unstruct
{
$params = $this->getParameters();
return array_key_exists($parameter, $params)
? $params[$parameter]
: null;
return array_key_exists($parameter, $params) ? $params[$parameter] : null;
}
/**
@@ -133,7 +131,7 @@ class Swift_Mime_Headers_ParameterizedHeader extends Swift_Mime_Headers_Unstruct
{
$body = parent::getFieldBody();
foreach ($this->_params as $name => $value) {
if (!is_null($value)) {
if (null !== $value) {
// Add the parameter
$body .= '; '.$this->_createParameter($name, $value);
}
@@ -158,9 +156,9 @@ class Swift_Mime_Headers_ParameterizedHeader extends Swift_Mime_Headers_Unstruct
// Try creating any parameters
foreach ($this->_params as $name => $value) {
if (!is_null($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)
));
@@ -235,9 +233,9 @@ class Swift_Mime_Headers_ParameterizedHeader extends Swift_Mime_Headers_Unstruct
/**
* Returns the parameter value from the "=" and beyond.
*
* @param string $value to append
* @param bool $encoded
* @param bool $firstLine
* @param string $value to append
* @param bool $encoded
* @param bool $firstLine
*
* @return string
*/

View File

@@ -11,7 +11,7 @@
/**
* A Path Header in Swift Mailer, such a Return-Path.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_Mime_Headers_PathHeader extends Swift_Mime_Headers_AbstractHeader
{
@@ -80,7 +80,7 @@ class Swift_Mime_Headers_PathHeader extends Swift_Mime_Headers_AbstractHeader
*/
public function setAddress($address)
{
if (is_null($address)) {
if (null === $address) {
$this->_address = null;
} elseif ('' == $address) {
$this->_address = '';

View File

@@ -11,7 +11,7 @@
/**
* A Simple MIME Header.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
class Swift_Mime_Headers_UnstructuredHeader extends Swift_Mime_Headers_AbstractHeader
{

View File

@@ -1,35 +0,0 @@
<?php
/*
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2017 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -11,7 +11,7 @@
/**
* A Message (RFC 2822) object.
*
* @author Chris Corbyn
* @author Chris Corbyn
*/
interface Swift_Mime_Message extends Swift_Mime_MimeEntity
{
@@ -39,7 +39,7 @@ interface Swift_Mime_Message extends Swift_Mime_MimeEntity
/**
* Set the origination date of the message as a UNIX timestamp.
*
* @param int $date
* @param int $date
*/
public function setDate($date);

Some files were not shown because too many files have changed in this diff Show More