Plugin Directory

Changeset 1653904


Ignore:
Timestamp:
05/09/2017 10:47:30 PM (9 years ago)
Author:
Cimmo
Message:

Updated Swift Mailer to 5.4.8

Location:
cimy-swift-smtp/trunk
Files:
82 edited

Legend:

Unmodified
Added
Removed
  • cimy-swift-smtp/trunk/README_OFFICIAL.txt

    r1331083 r1653904  
    6262
    6363CHANGELOG:
     64v2.6.3 - 10/05/2017
     65- Updated Swift Mailer to 5.4.8
     66
    6467v2.6.2 - 19/01/2016
    6568- Updated Swift Mailer to 5.4.1
  • cimy-swift-smtp/trunk/Swift/CHANGES

    r1331083 r1653904  
    11Changelog
    22=========
     3
     45.4.8 (2017-05-01)
     5------------------
     6
     7 * fixed encoding inheritance in addPart()
     8 * fixed sorting MIME children when their types are equal
     9
     105.4.7 (2017-04-20)
     11------------------
     12
     13 * fixed NTLMAuthenticator clobbering bcmath scale
     14
     155.4.6 (2017-02-13)
     16------------------
     17
     18 * removed exceptions thrown in destructors as they lead to fatal errors
     19 * switched to use sha256 by default in DKIM as per the RFC
     20 * fixed an 'Undefined variable: pipes' PHP notice
     21 * fixed long To headers when using the mail transport
     22 * fixed NTLMAuthenticator when no domain is passed with the username
     23 * prevented fatal error during unserialization of a message
     24 * fixed a PHP warning when sending a message that has a length of a multiple of 8192
     25
     265.4.5 (2016-12-29)
     27------------------
     28
     29 * SECURITY FIX:  fixed CVE-2016-10074 by disallowing potentially unsafe shell characters
     30
     31   Prior to 5.4.5, the mail transport (Swift_Transport_MailTransport) was vulnerable to passing
     32   arbitrary shell arguments if the "From", "ReturnPath" or "Sender" header came
     33   from a non-trusted source, potentially allowing Remote Code Execution
     34 * deprecated the mail transport
     35
     365.4.4 (2016-11-23)
     37------------------
     38
     39 * reverted escaping command-line args to mail (PHP mail() function already does it)
     40
     415.4.3 (2016-07-08)
     42------------------
     43
     44 * fixed SimpleHeaderSet::has()/get() when the 0 index is removed
     45 * removed the need to have mcrypt installed
     46 * fixed broken MIME header encoding with quotes/colons and non-ascii chars
     47 * allowed mail transport send for messages without To header
     48 * fixed PHP 7 support
     49
     505.4.2 (2016-05-01)
     51------------------
     52
     53 * fixed support for IPv6 sockets
     54 * added auto-retry when sending messages from the memory spool
     55 * fixed consecutive read calls in Swift_ByteStream_FileByteStream
     56 * added support for iso-8859-15 encoding
     57 * fixed PHP mail extra params on missing reversePath
     58 * added methods to set custom stream context options
     59 * fixed charset changes in QpContentEncoderProxy
     60 * added return-path header to the ignoredHeaders list of DKIMSigner
     61 * fixed crlf for subject using mail
     62 * fixed add soft line break only when necessary
     63 * fixed escaping command-line args to mail
    364
    4655.4.1 (2015-06-06)
  • cimy-swift-smtp/trunk/Swift/LICENSE

    r730543 r1653904  
    1 Copyright (c) 2013 Fabien Potencier
     1Copyright (c) 2013-2016 Fabien Potencier
    22
    33Permission is hereby granted, free of charge, to any person obtaining a copy
  • cimy-swift-smtp/trunk/Swift/README

    r730543 r1653904  
    77Homepage:      http://swiftmailer.org
    88Documentation: http://swiftmailer.org/docs
    9 Mailing List:  http://groups.google.com/group/swiftmailer
    109Bugs:          https://github.com/swiftmailer/swiftmailer/issues
    1110Repository:    https://github.com/swiftmailer/swiftmailer
  • cimy-swift-smtp/trunk/Swift/VERSION

    r1331083 r1653904  
    1 Swift-5.4.1
     1Swift-5.4.8
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift.php

    r1331083 r1653904  
    4848        }
    4949
    50         $path = dirname(__FILE__).'/'.str_replace('_', '/', $class).'.php';
     50        $path = __DIR__.'/'.str_replace('_', '/', $class).'.php';
    5151
    5252        if (!file_exists($path)) {
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/ByteStream/AbstractFilterableInputStream.php

    r1331083 r1653904  
    2323    /**
    2424     * StreamFilters.
     25     *
     26     * @var Swift_StreamFilter[]
    2527     */
    2628    private $_filters = array();
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/ByteStream/ArrayByteStream.php

    r1331083 r1653904  
    8383        // Don't use array slice
    8484        $end = $length + $this->_offset;
    85         $end = $this->_arraySize < $end
    86             ? $this->_arraySize
    87             : $end;
     85        $end = $this->_arraySize < $end ? $this->_arraySize : $end;
    8886        $ret = '';
    8987        for (; $this->_offset < $end; ++$this->_offset) {
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/ByteStream/FileByteStream.php

    r1331083 r1653904  
    140140    {
    141141        if (!isset($this->_reader)) {
    142             if (!$this->_reader = fopen($this->_path, 'rb')) {
     142            $pointer = @fopen($this->_path, 'rb');
     143            if (!$pointer) {
    143144                throw new Swift_IoException(
    144145                    'Unable to open file for reading ['.$this->_path.']'
    145146                );
    146147            }
     148            $this->_reader = $pointer;
    147149            if ($this->_offset != 0) {
    148150                $this->_getReadStreamSeekableStatus();
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/CharacterReader.php

    r1331083 r1653904  
    4949     * A value of -1 means this cannot possibly be a valid character.
    5050     *
    51      * @param integer[] $bytes
    52      * @param int       $size
     51     * @param int[] $bytes
     52     * @param int   $size
    5353     *
    5454     * @return int
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/CharacterReader/GenericFixedWidthReader.php

    r1331083 r1653904  
    4949        // % and / are CPU intensive, so, maybe find a better way
    5050        $ignored = $strlen % $this->_width;
    51         $ignoredChars = substr($string, -$ignored);
     51        $ignoredChars = $ignored ? substr($string, -$ignored) : '';
    5252        $currentMap = $this->_width;
    5353
     
    8383        $needed = $this->_width - $size;
    8484
    85         return ($needed > -1) ? $needed : -1;
     85        return $needed > -1 ? $needed : -1;
    8686    }
    8787
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/CharacterReader/UsAsciiReader.php

    r1331083 r1653904  
    6868        if (1 == count($bytes) && $byte >= 0x00 && $byte <= 0x7F) {
    6969            return 0;
    70         } else {
    71             return -1;
    7270        }
     71
     72        return -1;
    7373    }
    7474
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/CharacterReader/Utf8Reader.php

    r1331083 r1653904  
    2020    private static $length_map = array(
    2121        // N=0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,
    22         1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x0N
    23         1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x1N
    24         1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x2N
    25         1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x3N
    26         1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x4N
    27         1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x5N
    28         1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x6N
    29         1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x7N
    30         0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0x8N
    31         0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0x9N
    32         0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0xAN
    33         0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0xBN
    34         2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, // 0xCN
    35         2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, // 0xDN
    36         3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, // 0xEN
    37         4,4,4,4,4,4,4,4,5,5,5,5,6,6,0,0,  // 0xFN
     22        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x0N
     23        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x1N
     24        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x2N
     25        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x3N
     26        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x4N
     27        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x5N
     28        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x6N
     29        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x7N
     30        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x8N
     31        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x9N
     32        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0xAN
     33        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0xBN
     34        2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xCN
     35        2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xDN
     36        3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 0xEN
     37        4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 0, 0,  // 0xFN
    3838    );
    3939
     
    162162        $needed = self::$length_map[$bytes[0]] - $size;
    163163
    164         return ($needed > -1)
    165             ? $needed
    166             : -1
    167             ;
     164        return $needed > -1 ? $needed : -1;
    168165    }
    169166
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/CharacterStream/ArrayCharacterStream.php

    r1331083 r1653904  
    156156     * @param int $length
    157157     *
    158      * @return integer[]
     158     * @return int[]
    159159     */
    160160    public function readBytes($length)
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/CharacterStream/NgCharacterStream.php

    r1331083 r1653904  
    166166        }
    167167        $ret = false;
    168         $length = ($this->_currentPos + $length > $this->_charCount)
    169           ? $this->_charCount - $this->_currentPos
    170           : $length;
     168        $length = $this->_currentPos + $length > $this->_charCount ? $this->_charCount - $this->_currentPos : $length;
    171169        switch ($this->_mapType) {
    172170            case Swift_CharacterReader::MAP_TYPE_FIXED_LEN:
     
    179177
    180178            case Swift_CharacterReader::MAP_TYPE_INVALID:
    181                 $end = $this->_currentPos + $length;
    182                 $end = $end > $this->_charCount
    183                     ? $this->_charCount
    184                     : $end;
    185179                $ret = '';
    186180                for (; $this->_currentPos < $length; ++$this->_currentPos) {
     
    195189            case Swift_CharacterReader::MAP_TYPE_POSITIONS:
    196190                $end = $this->_currentPos + $length;
    197                 $end = $end > $this->_charCount
    198                     ? $this->_charCount
    199                     : $end;
     191                $end = $end > $this->_charCount ? $this->_charCount : $end;
    200192                $ret = '';
    201193                $start = 0;
     
    224216     * @param int $length
    225217     *
    226      * @return integer[]
     218     * @return int[]
    227219     */
    228220    public function readBytes($length)
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/DependencyContainer.php

    r1331083 r1653904  
    4949     * Returns a singleton of the DependencyContainer.
    5050     *
    51      * @return Swift_DependencyContainer
     51     * @return self
    5252     */
    5353    public static function getInstance()
     
    144144     * @param string $itemName
    145145     *
    146      * @return Swift_DependencyContainer
     146     * @return $this
    147147     */
    148148    public function register($itemName)
     
    161161     * @param mixed $value
    162162     *
    163      * @return Swift_DependencyContainer
     163     * @return $this
    164164     */
    165165    public function asValue($value)
     
    177177     * @param string $lookup
    178178     *
    179      * @return Swift_DependencyContainer
     179     * @return $this
    180180     */
    181181    public function asAliasOf($lookup)
     
    199199     * @param string $className
    200200     *
    201      * @return Swift_DependencyContainer
     201     * @return $this
    202202     */
    203203    public function asNewInstanceOf($className)
     
    217217     * @param string $className
    218218     *
    219      * @return Swift_DependencyContainer
     219     * @return $this
    220220     */
    221221    public function asSharedInstanceOf($className)
     
    237237     * @param array $lookups
    238238     *
    239      * @return Swift_DependencyContainer
     239     * @return $this
    240240     */
    241241    public function withDependencies(array $lookups)
     
    258258     * @param mixed $value
    259259     *
    260      * @return Swift_DependencyContainer
     260     * @return $this
    261261     */
    262262    public function addConstructorValue($value)
     
    279279     * @param string $lookup
    280280     *
    281      * @return Swift_DependencyContainer
     281     * @return $this
    282282     */
    283283    public function addConstructorLookup($lookup)
     
    312312                $this->createDependenciesFor($itemName)
    313313                );
    314         } else {
    315             return $reflector->newInstance();
    316         }
     314        }
     315
     316        return $reflector->newInstance();
    317317    }
    318318
     
    367367
    368368            return $collection;
    369         } else {
    370             return $this->lookup($item);
    371         }
     369        }
     370
     371        return $this->lookup($item);
    372372    }
    373373}
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Encoder/QpEncoder.php

    r1331083 r1653904  
    199199
    200200            $enc = $this->_encodeByteSequence($bytes, $size);
    201             if ($currentLine && $lineLen + $size >= $thisLineLength) {
     201
     202            $i = strpos($enc, '=0D=0A');
     203            $newLineLength = $lineLen + ($i === false ? $size : $i);
     204
     205            if ($currentLine && $newLineLength >= $thisLineLength) {
    202206                $lines[$lNo] = '';
    203207                $currentLine = &$lines[$lNo++];
     
    205209                $lineLen = 0;
    206210            }
    207             $lineLen += $size;
     211
    208212            $currentLine .= $enc;
     213
     214            if ($i === false) {
     215                $lineLen += $size;
     216            } else {
     217                // 6 is the length of '=0D=0A'.
     218                $lineLen = $size - strrpos($enc, '=0D=0A') - 6;
     219            }
    209220        }
    210221
     
    225236     * Encode the given byte array into a verbatim QP form.
    226237     *
    227      * @param integer[] $bytes
    228      * @param int       $size
     238     * @param int[] $bytes
     239     * @param int   $size
    229240     *
    230241     * @return string
     
    252263     * @param int $size number of bytes to read
    253264     *
    254      * @return integer[]
     265     * @return int[]
    255266     */
    256267    protected function _nextSequence($size = 4)
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Encoding.php

    r1331083 r1653904  
    5656    }
    5757
    58     // -- Private Static Methods
    59 
    6058    private static function _lookup($key)
    6159    {
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Events/CommandEvent.php

    r1331083 r1653904  
    2626     * An array of codes which a successful response will contain.
    2727     *
    28      * @var integer[]
     28     * @var int[]
    2929     */
    3030    private $_successCodes = array();
     
    5757     * Get the numeric response codes which indicate success for this command.
    5858     *
    59      * @return integer[]
     59     * @return int[]
    6060     */
    6161    public function getSuccessCodes()
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/FailoverTransport.php

    r1331083 r1653904  
    3737     * @param Swift_Transport[] $transports
    3838     *
    39      * @return Swift_FailoverTransport
     39     * @return self
    4040     */
    4141    public static function newInstance($transports = array())
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/FileSpool.php

    r1331083 r1653904  
    4040        if (!file_exists($this->_path)) {
    4141            if (!mkdir($this->_path, 0777, true)) {
    42                 throw new Swift_IoException('Unable to create Path ['.$this->_path.']');
     42                throw new Swift_IoException(sprintf('Unable to create path "%s".', $this->_path));
    4343            }
    4444        }
     
    109109        }
    110110
    111         throw new Swift_IoException('Unable to create a file for enqueuing Message');
     111        throw new Swift_IoException(sprintf('Unable to create a file for enqueuing Message in "%s".', $this->_path));
    112112    }
    113113
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Image.php

    r1331083 r1653904  
    3737     * @param string                        $contentType
    3838     *
    39      * @return Swift_Image
     39     * @return self
    4040     */
    4141    public static function newInstance($data = null, $filename = null, $contentType = null)
     
    4949     * @param string $path
    5050     *
    51      * @return Swift_Image
     51     * @return self
    5252     */
    5353    public static function fromPath($path)
    5454    {
    55         $image = self::newInstance()->setFile(
    56             new Swift_ByteStream_FileByteStream($path)
    57             );
    58 
    59         return $image;
     55        return self::newInstance()->setFile(new Swift_ByteStream_FileByteStream($path));
    6056    }
    6157}
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/KeyCache/DiskKeyCache.php

    r1331083 r1653904  
    290290    {
    291291        if (!isset($this->_keys[$nsKey][$itemKey])) {
    292             $openMode = $this->hasKey($nsKey, $itemKey)
    293                 ? 'r+b'
    294                 : 'w+b'
    295                 ;
     292            $openMode = $this->hasKey($nsKey, $itemKey) ? 'r+b' : 'w+b';
    296293            $fp = fopen($this->_path.'/'.$nsKey.'/'.$itemKey, $openMode);
    297294            $this->_keys[$nsKey][$itemKey] = $fp;
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/LoadBalancedTransport.php

    r1331083 r1653904  
    3737     * @param array $transports
    3838     *
    39      * @return Swift_LoadBalancedTransport
     39     * @return self
    4040     */
    4141    public static function newInstance($transports = array())
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/MailTransport.php

    r1331083 r1653904  
    1313 *
    1414 * @author Chris Corbyn
     15 *
     16 * @deprecated since 5.4.5 (to be removed in 6.0)
    1517 */
    1618class Swift_MailTransport extends Swift_Transport_MailTransport
     
    3739     * @param string $extraParams To be passed to mail()
    3840     *
    39      * @return Swift_MailTransport
     41     * @return self
    4042     */
    4143    public static function newInstance($extraParams = '-f%s')
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Mailer.php

    r1331083 r1653904  
    3434     * @param Swift_Transport $transport
    3535     *
    36      * @return Swift_Mailer
     36     * @return self
    3737     */
    3838    public static function newInstance(Swift_Transport $transport)
     
    7070     * @param array              $failedRecipients An array of failures by-reference
    7171     *
    72      * @return int
     72     * @return int The number of successful recipients. Can be 0 which indicates failure
    7373     */
    7474    public function send(Swift_Mime_Message $message, &$failedRecipients = null)
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/MemorySpool.php

    r1331083 r1653904  
    1717{
    1818    protected $messages = array();
     19    private $flushRetries = 3;
    1920
    2021    /**
     
    4041    public function stop()
    4142    {
     43    }
     44
     45    /**
     46     * @param int $retries
     47     */
     48    public function setFlushRetries($retries)
     49    {
     50        $this->flushRetries = $retries;
    4251    }
    4352
     
    7685
    7786        $count = 0;
    78         while ($message = array_pop($this->messages)) {
    79             $count += $transport->send($message, $failedRecipients);
     87        $retries = $this->flushRetries;
     88        while ($retries--) {
     89            try {
     90                while ($message = array_pop($this->messages)) {
     91                    $count += $transport->send($message, $failedRecipients);
     92                }
     93            } catch (Swift_TransportException $exception) {
     94                if ($retries) {
     95                    // re-queue the message at the end of the queue to give a chance
     96                    // to the other messages to be sent, in case the failure was due to
     97                    // this message and not just the transport failing
     98                    array_unshift($this->messages, $message);
     99
     100                    // wait half a second before we try again
     101                    usleep(500000);
     102                } else {
     103                    throw $exception;
     104                }
     105            }
    80106        }
    81107
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Message.php

    r1331083 r1653904  
    6969     * @param string $charset
    7070     *
    71      * @return Swift_Message
     71     * @return $this
    7272     */
    7373    public static function newInstance($subject = null, $body = null, $contentType = null, $charset = null)
     
    8383     * @param string                        $charset
    8484     *
    85      * @return Swift_Mime_SimpleMessage
     85     * @return $this
    8686     */
    8787    public function addPart($body, $contentType = null, $charset = null)
    8888    {
    89         return $this->attach(Swift_MimePart::newInstance(
    90             $body, $contentType, $charset
    91             ));
    92     }
    93 
    94     /**
    95      * Attach a new signature handler to the message.
     89        return $this->attach(Swift_MimePart::newInstance($body, $contentType, $charset)->setEncoder($this->getEncoder()));
     90    }
     91
     92    /**
     93     * Detach a signature handler from a message.
    9694     *
    9795     * @param Swift_Signer $signer
    9896     *
    99      * @return Swift_Message
     97     * @return $this
    10098     */
    10199    public function attachSigner(Swift_Signer $signer)
     
    115113     * @param Swift_Signer $signer
    116114     *
    117      * @return Swift_Message
     115     * @return $this
    118116     */
    119117    public function detachSigner(Swift_Signer $signer)
     
    282280        parent::__clone();
    283281        foreach ($this->bodySigners as $key => $bodySigner) {
    284             $this->bodySigners[$key] = clone($bodySigner);
     282            $this->bodySigners[$key] = clone $bodySigner;
    285283        }
    286284
    287285        foreach ($this->headerSigners as $key => $headerSigner) {
    288             $this->headerSigners[$key] = clone($headerSigner);
     286            $this->headerSigners[$key] = clone $headerSigner;
    289287        }
    290288    }
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Mime/Attachment.php

    r1331083 r1653904  
    6565     * @param string $disposition
    6666     *
    67      * @return Swift_Mime_Attachment
     67     * @return $this
    6868     */
    6969    public function setDisposition($disposition)
    7070    {
    7171        if (!$this->_setHeaderFieldModel('Content-Disposition', $disposition)) {
    72             $this->getHeaders()->addParameterizedHeader(
    73                 'Content-Disposition', $disposition
    74                 );
     72            $this->getHeaders()->addParameterizedHeader('Content-Disposition', $disposition);
    7573        }
    7674
     
    9391     * @param string $filename
    9492     *
    95      * @return Swift_Mime_Attachment
     93     * @return $this
    9694     */
    9795    public function setFilename($filename)
     
    118116     * @param int $size
    119117     *
    120      * @return Swift_Mime_Attachment
     118     * @return $this
    121119     */
    122120    public function setSize($size)
     
    133131     * @param string           $contentType optional
    134132     *
    135      * @return Swift_Mime_Attachment
     133     * @return $this
    136134     */
    137135    public function setFile(Swift_FileStream $file, $contentType = null)
     
    140138        $this->setBody($file, $contentType);
    141139        if (!isset($contentType)) {
    142             $extension = strtolower(substr(
    143                 $file->getPath(), strrpos($file->getPath(), '.') + 1
    144                 ));
     140            $extension = strtolower(substr($file->getPath(), strrpos($file->getPath(), '.') + 1));
    145141
    146142            if (array_key_exists($extension, $this->_mimeTypes)) {
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php

    r1331083 r1653904  
    9696
    9797            $enc = $this->_encodeByteSequence($bytes, $size);
    98             if ($currentLine && $lineLen + $size >= $thisLineLength) {
     98
     99            $i = strpos($enc, '=0D=0A');
     100            $newLineLength = $lineLen + ($i === false ? $size : $i);
     101
     102            if ($currentLine && $newLineLength >= $thisLineLength) {
    99103                $is->write($prepend.$this->_standardize($currentLine));
    100104                $currentLine = '';
     
    103107                $lineLen = 0;
    104108            }
    105             $lineLen += $size;
     109
    106110            $currentLine .= $enc;
     111
     112            if ($i === false) {
     113                $lineLen += $size;
     114            } else {
     115                // 6 is the length of '=0D=0A'.
     116                $lineLen = $size - strrpos($enc, '=0D=0A') - 6;
     117            }
    107118        }
    108119        if (strlen($currentLine)) {
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoderProxy.php

    r1331083 r1653904  
    6262    {
    6363        $this->charset = $charset;
     64        $this->safeEncoder->charsetChanged($charset);
    6465    }
    6566
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Mime/Grammar.php

    r994020 r1653904  
    130130        if (array_key_exists($name, self::$_grammar)) {
    131131            return self::$_grammar[$name];
    132         } else {
    133             throw new Swift_RfcComplianceException(
    134                 "No such grammar '".$name."' defined."
    135                 );
    136132        }
     133
     134        throw new Swift_RfcComplianceException(
     135            "No such grammar '".$name."' defined."
     136        );
    137137    }
    138138
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Mime/HeaderSet.php

    r1331083 r1653904  
    139139     * Create a new instance of this HeaderSet.
    140140     *
    141      * @return Swift_Mime_HeaderSet
     141     * @return self
    142142     */
    143143    public function newInstance();
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Mime/Headers/AbstractHeader.php

    r1331083 r1653904  
    219219        return $this->toString();
    220220    }
    221 
    222     // -- Points of extension
    223221
    224222    /**
     
    450448    protected function toTokens($string = null)
    451449    {
    452         if (is_null($string)) {
     450        if (null === $string) {
    453451            $string = $this->getFieldBody();
    454452        }
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Mime/Headers/DateHeader.php

    r1331083 r1653904  
    9696    public function setTimestamp($timestamp)
    9797    {
    98         if (!is_null($timestamp)) {
     98        if (null !== $timestamp) {
    9999            $timestamp = (int) $timestamp;
    100100        }
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Mime/Headers/MailboxHeader.php

    r1331083 r1653904  
    232232    {
    233233        // Compute the string value of the header only if needed
    234         if (is_null($this->getCachedValue())) {
     234        if (null === $this->getCachedValue()) {
    235235            $this->setCachedValue($this->createMailboxListString($this->_mailboxes));
    236236        }
     
    238238        return $this->getCachedValue();
    239239    }
    240 
    241     // -- Points of extension
    242240
    243241    /**
     
    278276    protected function createDisplayNameString($displayName, $shorten = false)
    279277    {
    280         return $this->createPhrase($this, $displayName,
    281             $this->getCharset(), $this->getEncoder(), $shorten
    282             );
     278        return $this->createPhrase($this, $displayName, $this->getCharset(), $this->getEncoder(), $shorten);
    283279    }
    284280
     
    300296     * Redefine the encoding requirements for mailboxes.
    301297     *
    302      * Commas and semicolons are used to separate
    303      * multiple addresses, and should therefore be encoded
     298     * All "specials" must be encoded as the full header value will not be quoted
     299     *
     300     * @see RFC 2822 3.2.1
    304301     *
    305302     * @param string $token
     
    309306    protected function tokenNeedsEncoding($token)
    310307    {
    311         return preg_match('/[,;]/', $token) || parent::tokenNeedsEncoding($token);
     308        return preg_match('/[()<>\[\]:;@\,."]/', $token) || parent::tokenNeedsEncoding($token);
    312309    }
    313310
     
    325322        foreach ($mailboxes as $email => $name) {
    326323            $mailboxStr = $email;
    327             if (!is_null($name)) {
     324            if (null !== $name) {
    328325                $nameStr = $this->createDisplayNameString($name, empty($strings));
    329326                $mailboxStr = $nameStr.' <'.$mailboxStr.'>';
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Mime/Headers/OpenDKIMHeader.php

    r1331083 r1653904  
    3131
    3232    /**
    33      * Creates a new SimpleHeader with $name.
    34      *
    35      * @param string                   $name
    36      * @param Swift_Mime_HeaderEncoder $encoder
    37      * @param Swift_Mime_Grammar       $grammar
     33     * @param string $name
    3834     */
    3935    public function __construct($name)
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Mime/Headers/ParameterizedHeader.php

    r1331083 r1653904  
    9999        $params = $this->getParameters();
    100100
    101         return array_key_exists($parameter, $params)
    102             ? $params[$parameter]
    103             : null;
     101        return array_key_exists($parameter, $params) ? $params[$parameter] : null;
    104102    }
    105103
     
    134132        $body = parent::getFieldBody();
    135133        foreach ($this->_params as $name => $value) {
    136             if (!is_null($value)) {
     134            if (null !== $value) {
    137135                // Add the parameter
    138136                $body .= '; '.$this->_createParameter($name, $value);
     
    159157        // Try creating any parameters
    160158        foreach ($this->_params as $name => $value) {
    161             if (!is_null($value)) {
     159            if (null !== $value) {
    162160                // Add the semi-colon separator
    163161                $tokens[count($tokens) - 1] .= ';';
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Mime/Headers/PathHeader.php

    r1331083 r1653904  
    8181    public function setAddress($address)
    8282    {
    83         if (is_null($address)) {
     83        if (null === $address) {
    8484            $this->_address = null;
    8585        } elseif ('' == $address) {
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Mime/MimePart.php

    r1331083 r1653904  
    4141        parent::__construct($headers, $encoder, $cache, $grammar);
    4242        $this->setContentType('text/plain');
    43         if (!is_null($charset)) {
     43        if (null !== $charset) {
    4444            $this->setCharset($charset);
    4545        }
     
    5454     * @param string $charset     optional
    5555     *
    56      * @return Swift_Mime_MimePart
     56     * @return $this
    5757     */
    5858    public function setBody($body, $contentType = null, $charset = null)
     
    8383     * @param string $charset
    8484     *
    85      * @return Swift_Mime_MimePart
     85     * @return $this
    8686     */
    8787    public function setCharset($charset)
     
    112112     * @param string $format
    113113     *
    114      * @return Swift_Mime_MimePart
     114     * @return $this
    115115     */
    116116    public function setFormat($format)
     
    129129    public function getDelSp()
    130130    {
    131         return ($this->_getHeaderParameter('Content-Type', 'delsp') == 'yes')
    132             ? true
    133             : false;
     131        return 'yes' == $this->_getHeaderParameter('Content-Type', 'delsp') ? true : false;
    134132    }
    135133
     
    139137     * @param bool $delsp
    140138     *
    141      * @return Swift_Mime_MimePart
     139     * @return $this
    142140     */
    143141    public function setDelSp($delsp = true)
     
    197195    {
    198196        $charset = strtolower($this->getCharset());
    199         if (!in_array($charset, array('utf-8', 'iso-8859-1', ''))) {
     197        if (!in_array($charset, array('utf-8', 'iso-8859-1', 'iso-8859-15', ''))) {
    200198            // mb_convert_encoding must be the first one to check, since iconv cannot convert some words.
    201199            if (function_exists('mb_convert_encoding')) {
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Mime/SimpleHeaderFactory.php

    r1331083 r1653904  
    113113        $params = array())
    114114    {
    115         $header = new Swift_Mime_Headers_ParameterizedHeader($name,
    116             $this->_encoder, (strtolower($name) == 'content-disposition')
    117                 ? $this->_paramEncoder
    118                 : null,
    119                 $this->_grammar
    120             );
     115        $header = new Swift_Mime_Headers_ParameterizedHeader($name, $this->_encoder, strtolower($name) == 'content-disposition' ? $this->_paramEncoder : null, $this->_grammar);
    121116        if (isset($value)) {
    122117            $header->setFieldBodyModel($value);
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Mime/SimpleHeaderSet.php

    r1331083 r1653904  
    141141        $lowerName = strtolower($name);
    142142
    143         return array_key_exists($lowerName, $this->_headers) && array_key_exists($index, $this->_headers[$lowerName]);
     143        if (!array_key_exists($lowerName, $this->_headers)) {
     144            return false;
     145        }
     146
     147        if (func_num_args() < 2) {
     148            // index was not specified, so we only need to check that there is at least one header value set
     149            return (bool) count($this->_headers[$lowerName]);
     150        }
     151
     152        return array_key_exists($index, $this->_headers[$lowerName]);
    144153    }
    145154
     
    174183    public function get($name, $index = 0)
    175184    {
    176         if ($this->has($name, $index)) {
    177             $lowerName = strtolower($name);
    178 
    179             return $this->_headers[$lowerName][$index];
     185        $name = strtolower($name);
     186
     187        if (func_num_args() < 2) {
     188            if ($this->has($name)) {
     189                $values = array_values($this->_headers[$name]);
     190
     191                return array_shift($values);
     192            }
     193        } else {
     194            if ($this->has($name, $index)) {
     195                return $this->_headers[$name][$index];
     196            }
    180197        }
    181198    }
     
    250267     * Create a new instance of this HeaderSet.
    251268     *
    252      * @return Swift_Mime_HeaderSet
     269     * @return self
    253270     */
    254271    public function newInstance()
     
    350367        $lowerA = strtolower($a);
    351368        $lowerB = strtolower($b);
    352         $aPos = array_key_exists($lowerA, $this->_order)
    353             ? $this->_order[$lowerA]
    354             : -1;
    355         $bPos = array_key_exists($lowerB, $this->_order)
    356             ? $this->_order[$lowerB]
    357             : -1;
     369        $aPos = array_key_exists($lowerA, $this->_order) ? $this->_order[$lowerA] : -1;
     370        $bPos = array_key_exists($lowerB, $this->_order) ? $this->_order[$lowerB] : -1;
     371
     372        if (-1 === $aPos && -1 === $bPos) {
     373            // just be sure to be determinist here
     374            return $a > $b ? -1 : 1;
     375        }
    358376
    359377        if ($aPos == -1) {
     
    363381        }
    364382
    365         return ($aPos < $bPos) ? -1 : 1;
     383        return $aPos < $bPos ? -1 : 1;
    366384    }
    367385
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Mime/SimpleMessage.php

    r1331083 r1653904  
    1616class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime_Message
    1717{
     18    const PRIORITY_HIGHEST = 1;
     19    const PRIORITY_HIGH = 2;
     20    const PRIORITY_NORMAL = 3;
     21    const PRIORITY_LOW = 4;
     22    const PRIORITY_LOWEST = 5;
     23
    1824    /**
    1925     * Create a new SimpleMessage with $headers, $encoder and $cache.
     
    6874     * @param string $subject
    6975     *
    70      * @return Swift_Mime_SimpleMessage
     76     * @return $this
    7177     */
    7278    public function setSubject($subject)
     
    94100     * @param int $date
    95101     *
    96      * @return Swift_Mime_SimpleMessage
     102     * @return $this
    97103     */
    98104    public function setDate($date)
     
    120126     * @param string $address
    121127     *
    122      * @return Swift_Mime_SimpleMessage
     128     * @return $this
    123129     */
    124130    public function setReturnPath($address)
     
    149155     * @param string $name    optional
    150156     *
    151      * @return Swift_Mime_SimpleMessage
     157     * @return $this
    152158     */
    153159    public function setSender($address, $name = null)
     
    182188     * @param string $name    optional
    183189     *
    184      * @return Swift_Mime_SimpleMessage
     190     * @return $this
    185191     */
    186192    public function addFrom($address, $name = null)
     
    203209     * @param string       $name      optional
    204210     *
    205      * @return Swift_Mime_SimpleMessage
     211     * @return $this
    206212     */
    207213    public function setFrom($addresses, $name = null)
     
    236242     * @param string $name    optional
    237243     *
    238      * @return Swift_Mime_SimpleMessage
     244     * @return $this
    239245     */
    240246    public function addReplyTo($address, $name = null)
     
    254260     * associated with the address.
    255261     *
    256      * @param string $addresses
     262     * @param mixed $addresses
    257263     * @param string $name      optional
    258264     *
    259      * @return Swift_Mime_SimpleMessage
     265     * @return $this
    260266     */
    261267    public function setReplyTo($addresses, $name = null)
     
    290296     * @param string $name    optional
    291297     *
    292      * @return Swift_Mime_SimpleMessage
     298     * @return $this
    293299     */
    294300    public function addTo($address, $name = null)
     
    312318     * @param string $name      optional
    313319     *
    314      * @return Swift_Mime_SimpleMessage
     320     * @return $this
    315321     */
    316322    public function setTo($addresses, $name = null)
     
    345351     * @param string $name    optional
    346352     *
    347      * @return Swift_Mime_SimpleMessage
     353     * @return $this
    348354     */
    349355    public function addCc($address, $name = null)
     
    364370     * @param string $name      optional
    365371     *
    366      * @return Swift_Mime_SimpleMessage
     372     * @return $this
    367373     */
    368374    public function setCc($addresses, $name = null)
     
    397403     * @param string $name    optional
    398404     *
    399      * @return Swift_Mime_SimpleMessage
     405     * @return $this
    400406     */
    401407    public function addBcc($address, $name = null)
     
    416422     * @param string $name      optional
    417423     *
    418      * @return Swift_Mime_SimpleMessage
     424     * @return $this
    419425     */
    420426    public function setBcc($addresses, $name = null)
     
    448454     * @param int $priority
    449455     *
    450      * @return Swift_Mime_SimpleMessage
     456     * @return $this
    451457     */
    452458    public function setPriority($priority)
    453459    {
    454460        $priorityMap = array(
    455             1 => 'Highest',
    456             2 => 'High',
    457             3 => 'Normal',
    458             4 => 'Low',
    459             5 => 'Lowest',
     461            self::PRIORITY_HIGHEST => 'Highest',
     462            self::PRIORITY_HIGH => 'High',
     463            self::PRIORITY_NORMAL => 'Normal',
     464            self::PRIORITY_LOW => 'Low',
     465            self::PRIORITY_LOWEST => 'Lowest',
    460466            );
    461467        $pMapKeys = array_keys($priorityMap);
     
    496502     * @param array $addresses
    497503     *
    498      * @return Swift_Mime_SimpleMessage
     504     * @return $this
    499505     */
    500506    public function setReadReceiptTo($addresses)
     
    523529     * @param Swift_Mime_MimeEntity $entity
    524530     *
    525      * @return Swift_Mime_SimpleMessage
     531     * @return $this
    526532     */
    527533    public function attach(Swift_Mime_MimeEntity $entity)
     
    537543     * @param Swift_Mime_MimeEntity $entity
    538544     *
    539      * @return Swift_Mime_SimpleMessage
     545     * @return $this
    540546     */
    541547    public function detach(Swift_Mime_MimeEntity $entity)
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Mime/SimpleMimeEntity.php

    r1331083 r1653904  
    162162     * @param string $type
    163163     *
    164      * @return Swift_Mime_SimpleMimeEntity
     164     * @return $this
    165165     */
    166166    public function setContentType($type)
     
    193193     * @param string $id
    194194     *
    195      * @return Swift_Mime_SimpleMimeEntity
     195     * @return $this
    196196     */
    197197    public function setId($id)
     
    224224     * @param string $description
    225225     *
    226      * @return Swift_Mime_SimpleMimeEntity
     226     * @return $this
    227227     */
    228228    public function setDescription($description)
     
    252252     * @param int $length
    253253     *
    254      * @return Swift_Mime_SimpleMimeEntity
     254     * @return $this
    255255     */
    256256    public function setMaxLineLength($length)
     
    277277     * @param int                     $compoundLevel For internal use only
    278278     *
    279      * @return Swift_Mime_SimpleMimeEntity
     279     * @return $this
    280280     */
    281281    public function setChildren(array $children, $compoundLevel = null)
     
    283283        // TODO: Try to refactor this logic
    284284
    285         $compoundLevel = isset($compoundLevel)
    286             ? $compoundLevel
    287             : $this->_getCompoundLevel($children)
    288             ;
    289 
     285        $compoundLevel = isset($compoundLevel) ? $compoundLevel : $this->_getCompoundLevel($children);
    290286        $immediateChildren = array();
    291287        $grandchildren = array();
     
    312308        }
    313309
    314         if (!empty($immediateChildren)) {
     310        if ($immediateChildren) {
    315311            $lowestLevel = $this->_getNeededChildLevel($immediateChildren[0], $compoundLevel);
    316312
     
    318314            // immediate children
    319315            foreach ($this->_compositeRanges as $mediaType => $range) {
    320                 if ($lowestLevel > $range[0]
    321                     && $lowestLevel <= $range[1]) {
     316                if ($lowestLevel > $range[0] && $lowestLevel <= $range[1]) {
    322317                    $newContentType = $mediaType;
     318
    323319                    break;
    324320                }
     
    350346    public function getBody()
    351347    {
    352         return ($this->_body instanceof Swift_OutputByteStream)
    353             ? $this->_readStream($this->_body)
    354             : $this->_body;
     348        return $this->_body instanceof Swift_OutputByteStream ? $this->_readStream($this->_body) : $this->_body;
    355349    }
    356350
     
    362356     * @param string $contentType optional
    363357     *
    364      * @return Swift_Mime_SimpleMimeEntity
     358     * @return $this
    365359     */
    366360    public function setBody($body, $contentType = null)
     
    393387     * @param Swift_Mime_ContentEncoder $encoder
    394388     *
    395      * @return Swift_Mime_SimpleMimeEntity
     389     * @return $this
    396390     */
    397391    public function setEncoder(Swift_Mime_ContentEncoder $encoder)
     
    429423     * @throws Swift_RfcComplianceException
    430424     *
    431      * @return Swift_Mime_SimpleMimeEntity
     425     * @return $this
    432426     */
    433427    public function setBoundary($boundary)
     
    487481                $body = $this->_cache->getString($this->_cacheKey, 'body');
    488482            } else {
    489                 $body = "\r\n".$this->_encoder->encodeString($this->getBody(), 0,
    490                     $this->getMaxLineLength()
    491                     );
    492                 $this->_cache->setString($this->_cacheKey, 'body', $body,
    493                     Swift_KeyCache::MODE_WRITE
    494                     );
     483                $body = "\r\n".$this->_encoder->encodeString($this->getBody(), 0, $this->getMaxLineLength());
     484                $this->_cache->setString($this->_cacheKey, 'body', $body, Swift_KeyCache::MODE_WRITE);
    495485            }
    496486            $string .= $body;
     
    603593
    604594            return true;
    605         } else {
    606             return false;
    607         }
     595        }
     596
     597        return false;
    608598    }
    609599
     
    627617
    628618            return true;
    629         } else {
    630             return false;
    631         }
     619        }
     620
     621        return false;
    632622    }
    633623
     
    717707    private function _assertValidBoundary($boundary)
    718708    {
    719         if (!preg_match(
    720             '/^[a-z0-9\'\(\)\+_\-,\.\/:=\?\ ]{0,69}[a-z0-9\'\(\)\+_\-,\.\/:=\?]$/Di',
    721             $boundary)) {
     709        if (!preg_match('/^[a-z0-9\'\(\)\+_\-,\.\/:=\?\ ]{0,69}[a-z0-9\'\(\)\+_\-,\.\/:=\?]$/Di', $boundary)) {
    722710            throw new Swift_RfcComplianceException('Mime boundary set is not RFC 2046 compliant.');
    723711        }
     
    758746        $lowercaseType = strtolower($child->getContentType());
    759747
    760         if (isset($filter[$realLevel])
    761             && isset($filter[$realLevel][$lowercaseType])) {
     748        if (isset($filter[$realLevel]) && isset($filter[$realLevel][$lowercaseType])) {
    762749            return $filter[$realLevel][$lowercaseType];
    763         } else {
    764             return $realLevel;
    765         }
     750        }
     751
     752        return $realLevel;
    766753    }
    767754
    768755    private function _createChild()
    769756    {
    770         return new self($this->_headers->newInstance(),
    771             $this->_encoder, $this->_cache, $this->_grammar);
     757        return new self($this->_headers->newInstance(), $this->_encoder, $this->_cache, $this->_grammar);
    772758    }
    773759
     
    801787        // Sort in order of preference, if there is one
    802788        if ($shouldSort) {
    803             usort($this->_immediateChildren, array($this, '_childSortAlgorithm'));
    804         }
    805     }
    806 
    807     private function _childSortAlgorithm($a, $b)
    808     {
    809         $typePrefs = array();
    810         $types = array(
    811             strtolower($a->getContentType()),
    812             strtolower($b->getContentType()),
    813             );
    814         foreach ($types as $type) {
    815             $typePrefs[] = (array_key_exists($type, $this->_alternativePartOrder))
    816                 ? $this->_alternativePartOrder[$type]
    817                 : (max($this->_alternativePartOrder) + 1);
    818         }
    819 
    820         return ($typePrefs[0] >= $typePrefs[1]) ? 1 : -1;
    821     }
    822 
    823     // -- Destructor
     789            // Group the messages by order of preference
     790            $sorted = array();
     791            foreach ($this->_immediateChildren as $child) {
     792                $type = $child->getContentType();
     793                $level = array_key_exists($type, $this->_alternativePartOrder) ? $this->_alternativePartOrder[$type] : max($this->_alternativePartOrder) + 1;
     794
     795                if (empty($sorted[$level])) {
     796                    $sorted[$level] = array();
     797                }
     798
     799                $sorted[$level][] = $child;
     800            }
     801
     802            ksort($sorted);
     803
     804            $this->_immediateChildren = array_reduce($sorted, 'array_merge', array());
     805        }
     806    }
    824807
    825808    /**
     
    828811    public function __destruct()
    829812    {
    830         $this->_cache->clearAll($this->_cacheKey);
     813        if ($this->_cache instanceof Swift_KeyCache) {
     814            $this->_cache->clearAll($this->_cacheKey);
     815        }
    831816    }
    832817
     
    840825    private function _assertValidId($id)
    841826    {
    842         if (!preg_match(
    843             '/^'.$this->_grammar->getDefinition('id-left').'@'.
    844             $this->_grammar->getDefinition('id-right').'$/D',
    845             $id
    846             )) {
    847             throw new Swift_RfcComplianceException(
    848                 'Invalid ID given <'.$id.'>'
    849                 );
     827        if (!preg_match('/^'.$this->_grammar->getDefinition('id-left').'@'.$this->_grammar->getDefinition('id-right').'$/D', $id)) {
     828            throw new Swift_RfcComplianceException('Invalid ID given <'.$id.'>');
    850829        }
    851830    }
     
    858837        $this->_headers = clone $this->_headers;
    859838        $this->_encoder = clone $this->_encoder;
    860         $this->_cacheKey = uniqid();
     839        $this->_cacheKey = md5(uniqid(getmypid().mt_rand(), true));
    861840        $children = array();
    862841        foreach ($this->_children as $pos => $child) {
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/MimePart.php

    r1331083 r1653904  
    5151     * @param string $charset
    5252     *
    53      * @return Swift_Mime_MimePart
     53     * @return self
    5454     */
    5555    public static function newInstance($body = null, $contentType = null, $charset = null)
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/NullTransport.php

    r1331083 r1653904  
    1616class Swift_NullTransport extends Swift_Transport_NullTransport
    1717{
    18     /**
    19      * Create a new NullTransport.
    20      */
    2118    public function __construct()
    2219    {
     
    3128     * Create a new NullTransport instance.
    3229     *
    33      * @return Swift_NullTransport
     30     * @return self
    3431     */
    3532    public static function newInstance()
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Plugins/DecoratorPlugin.php

    r1331083 r1653904  
    158158        if ($this->_replacements instanceof Swift_Plugins_Decorator_Replacements) {
    159159            return $this->_replacements->getReplacementsFor($address);
    160         } else {
    161             return isset($this->_replacements[$address])
    162                 ? $this->_replacements[$address]
    163                 : null
    164                 ;
    165         }
     160        }
     161
     162        return isset($this->_replacements[$address]) ? $this->_replacements[$address] : null;
    166163    }
    167164
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Plugins/ImpersonatePlugin.php

    r1331083 r1653904  
    1919     * The sender to impersonate.
    2020     *
    21      * @var String
     21     * @var string
    2222     */
    2323    private $_sender;
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Plugins/MessageLogger.php

    r1331083 r1653904  
    1717{
    1818    /**
    19      * @var array
     19     * @var Swift_Mime_Message[]
    2020     */
    2121    private $messages;
     
    2929     * Get the message list.
    3030     *
    31      * @return array
     31     * @return Swift_Mime_Message[]
    3232     */
    3333    public function getMessages()
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Plugins/PopBeforeSmtpPlugin.php

    r1331083 r1653904  
    6464     * @param string $crypto as "tls" or "ssl"
    6565     *
    66      * @return Swift_Plugins_PopBeforeSmtpPlugin
     66     * @return self
    6767     */
    6868    public static function newInstance($host, $port = 110, $crypto = null)
     
    7676     * @param Swift_Plugins_Pop_Pop3Connection $connection
    7777     *
    78      * @return Swift_Plugins_PopBeforeSmtpPlugin
     78     * @return $this
    7979     */
    8080    public function setConnection(Swift_Plugins_Pop_Pop3Connection $connection)
     
    100100     * @param int $timeout
    101101     *
    102      * @return Swift_Plugins_PopBeforeSmtpPlugin
     102     * @return $this
    103103     */
    104104    public function setTimeout($timeout)
     
    114114     * @param string $username
    115115     *
    116      * @return Swift_Plugins_PopBeforeSmtpPlugin
     116     * @return $this
    117117     */
    118118    public function setUsername($username)
     
    128128     * @param string $password
    129129     *
    130      * @return Swift_Plugins_PopBeforeSmtpPlugin
     130     * @return $this
    131131     */
    132132    public function setPassword($password)
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Plugins/ReporterPlugin.php

    r1331083 r1653904  
    5050        $failures = array_flip($evt->getFailedRecipients());
    5151        foreach ((array) $message->getTo() as $address => $null) {
    52             $this->_reporter->notify(
    53                 $message, $address, (array_key_exists($address, $failures)
    54                 ? Swift_Plugins_Reporter::RESULT_FAIL
    55                 : Swift_Plugins_Reporter::RESULT_PASS)
    56                 );
     52            $this->_reporter->notify($message, $address, array_key_exists($address, $failures) ? Swift_Plugins_Reporter::RESULT_FAIL : Swift_Plugins_Reporter::RESULT_PASS);
    5753        }
    5854        foreach ((array) $message->getCc() as $address => $null) {
    59             $this->_reporter->notify(
    60                 $message, $address, (array_key_exists($address, $failures)
    61                 ? Swift_Plugins_Reporter::RESULT_FAIL
    62                 : Swift_Plugins_Reporter::RESULT_PASS)
    63                 );
     55            $this->_reporter->notify($message, $address, array_key_exists($address, $failures) ? Swift_Plugins_Reporter::RESULT_FAIL : Swift_Plugins_Reporter::RESULT_PASS);
    6456        }
    6557        foreach ((array) $message->getBcc() as $address => $null) {
    66             $this->_reporter->notify(
    67                 $message, $address, (array_key_exists($address, $failures)
    68                 ? Swift_Plugins_Reporter::RESULT_FAIL
    69                 : Swift_Plugins_Reporter::RESULT_PASS)
    70                 );
     58            $this->_reporter->notify($message, $address, array_key_exists($address, $failures) ? Swift_Plugins_Reporter::RESULT_FAIL : Swift_Plugins_Reporter::RESULT_PASS);
    7159        }
    7260    }
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Plugins/ThrottlerPlugin.php

    r1331083 r1653904  
    9999
    100100        switch ($this->_mode) {
    101             case self::BYTES_PER_MINUTE :
     101            case self::BYTES_PER_MINUTE:
    102102                $sleep = $this->_throttleBytesPerMinute($duration);
    103103                break;
    104             case self::MESSAGES_PER_SECOND :
     104            case self::MESSAGES_PER_SECOND:
    105105                $sleep = $this->_throttleMessagesPerSecond($duration);
    106106                break;
    107             case self::MESSAGES_PER_MINUTE :
     107            case self::MESSAGES_PER_MINUTE:
    108108                $sleep = $this->_throttleMessagesPerMinute($duration);
    109109                break;
    110             default :
     110            default:
    111111                $sleep = 0;
    112112                break;
     
    152152        if (isset($this->_timer)) {
    153153            return $this->_timer->getTimestamp();
    154         } else {
    155             return time();
    156         }
     154        }
     155
     156        return time();
    157157    }
    158158
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Preferences.php

    r1331083 r1653904  
    2727     * Gets the instance of Preferences.
    2828     *
    29      * @return Swift_Preferences
     29     * @return self
    3030     */
    3131    public static function getInstance()
     
    4343     * @param string $charset
    4444     *
    45      * @return Swift_Preferences
     45     * @return $this
    4646     */
    4747    public function setCharset($charset)
    4848    {
    49         Swift_DependencyContainer::getInstance()
    50             ->register('properties.charset')->asValue($charset);
     49        Swift_DependencyContainer::getInstance()->register('properties.charset')->asValue($charset);
    5150
    5251        return $this;
     
    5857     * @param string $dir
    5958     *
    60      * @return Swift_Preferences
     59     * @return $this
    6160     */
    6261    public function setTempDir($dir)
    6362    {
    64         Swift_DependencyContainer::getInstance()
    65             ->register('tempdir')->asValue($dir);
     63        Swift_DependencyContainer::getInstance()->register('tempdir')->asValue($dir);
    6664
    6765        return $this;
     
    7371     * @param string $type
    7472     *
    75      * @return Swift_Preferences
     73     * @return $this
    7674     */
    7775    public function setCacheType($type)
    7876    {
    79         Swift_DependencyContainer::getInstance()
    80             ->register('cache')->asAliasOf(sprintf('cache.%s', $type));
     77        Swift_DependencyContainer::getInstance()->register('cache')->asAliasOf(sprintf('cache.%s', $type));
    8178
    8279        return $this;
     
    8885     * @param bool $dotEscape
    8986     *
    90      * @return Swift_Preferences
     87     * @return $this
    9188     */
    9289    public function setQPDotEscape($dotEscape)
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/SendmailTransport.php

    r1331083 r1653904  
    3737     * @param string $command
    3838     *
    39      * @return Swift_SendmailTransport
     39     * @return self
    4040     */
    4141    public static function newInstance($command = '/usr/sbin/sendmail -bs')
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Signers/BodySigner.php

    r1331083 r1653904  
    2121     * @param Swift_Message $message
    2222     *
    23      * @return Swift_Signers_BodySigner
     23     * @return self
    2424     */
    2525    public function signMessage(Swift_Message $message);
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Signers/DKIMSigner.php

    r1331083 r1653904  
    4040     * Hash algorithm used.
    4141     *
    42      * @var string
    43      */
    44     protected $_hashAlgorithm = 'rsa-sha1';
     42     * @see RFC6376 3.3: Signers MUST implement and SHOULD sign using rsa-sha256.
     43     *
     44     * @var string
     45     */
     46    protected $_hashAlgorithm = 'rsa-sha256';
    4547
    4648    /**
     
    6365     * @var array
    6466     */
    65     protected $_ignoredHeaders = array();
     67    protected $_ignoredHeaders = array('return-path' => true);
    6668
    6769    /**
    6870     * Signer identity.
    6971     *
    70      * @var unknown_type
     72     * @var string
    7173     */
    7274    protected $_signerIdentity;
     
    102104    /**
    103105     * When will the signature expires false means not embedded, if sigTimestamp is auto
    104      * Expiration is relative, otherwhise it's absolute.
     106     * Expiration is relative, otherwise it's absolute.
    105107     *
    106108     * @var int
     
    124126
    125127    /**
    126      * If debugHeaders is set store debugDatas here.
     128     * If debugHeaders is set store debugData here.
    127129     *
    128130     * @var string
     
    143145     */
    144146    protected $_dkimHeader;
    145 
    146     /**
    147      * Hash Handler.
    148      *
    149      * @var hash_ressource
    150      */
    151     private $_headerHashHandler;
    152147
    153148    private $_bodyHashHandler;
     
    182177        $this->_signerIdentity = '@'.$domainName;
    183178        $this->_selector = $selector;
     179
     180        // keep fallback hash algorithm sha1 if php version is lower than 5.4.8
     181        if (PHP_VERSION_ID < 50408) {
     182            $this->_hashAlgorithm = 'rsa-sha1';
     183        }
    184184    }
    185185
     
    191191     * @param string $selector
    192192     *
    193      * @return Swift_Signers_DKIMSigner
     193     * @return self
    194194     */
    195195    public static function newInstance($privateKey, $domainName, $selector)
     
    207207        $this->_headerHash = null;
    208208        $this->_signedHeaders = array();
    209         $this->_headerHashHandler = null;
    210209        $this->_bodyHash = null;
    211210        $this->_bodyHashHandler = null;
     
    232231     * @return int
    233232     */
     233    // TODO fix return
    234234    public function write($bytes)
    235235    {
     
    243243     * For any bytes that are currently buffered inside the stream, force them
    244244     * off the buffer.
    245      *
    246      * @throws Swift_IoException
    247245     */
    248246    public function commit()
     
    285283            }
    286284        }
    287 
    288         return;
    289285    }
    290286
     
    301297
    302298    /**
    303      * Set hash_algorithm, must be one of rsa-sha256 | rsa-sha1 defaults to rsa-sha256.
    304      *
    305      * @param string $hash
    306      *
    307      * @return Swift_Signers_DKIMSigner
     299     * Set hash_algorithm, must be one of rsa-sha256 | rsa-sha1.
     300     *
     301     * @param string $hash 'rsa-sha1' or 'rsa-sha256'
     302     *
     303     * @throws Swift_SwiftException
     304     *
     305     * @return $this
    308306     */
    309307    public function setHashAlgorithm($hash)
    310308    {
    311         // Unable to sign with rsa-sha256
    312         if ($hash == 'rsa-sha1') {
    313             $this->_hashAlgorithm = 'rsa-sha1';
    314         } else {
    315             $this->_hashAlgorithm = 'rsa-sha256';
     309        switch ($hash) {
     310            case 'rsa-sha1':
     311                $this->_hashAlgorithm = 'rsa-sha1';
     312                break;
     313            case 'rsa-sha256':
     314                $this->_hashAlgorithm = 'rsa-sha256';
     315                if (!defined('OPENSSL_ALGO_SHA256')) {
     316                    throw new Swift_SwiftException('Unable to set sha256 as it is not supported by OpenSSL.');
     317                }
     318                break;
     319            default:
     320                throw new Swift_SwiftException('Unable to set the hash algorithm, must be one of rsa-sha1 or rsa-sha256 (%s given).', $hash);
    316321        }
    317322
     
    324329     * @param string $canon
    325330     *
    326      * @return Swift_Signers_DKIMSigner
     331     * @return $this
    327332     */
    328333    public function setBodyCanon($canon)
     
    342347     * @param string $canon
    343348     *
    344      * @return Swift_Signers_DKIMSigner
     349     * @return $this
    345350     */
    346351    public function setHeaderCanon($canon)
     
    360365     * @param string $identity
    361366     *
    362      * @return Swift_Signers_DKIMSigner
     367     * @return $this
    363368     */
    364369    public function setSignerIdentity($identity)
     
    374379     * @param mixed $len (bool or int)
    375380     *
    376      * @return Swift_Signers_DKIMSigner
     381     * @return $this
    377382     */
    378383    public function setBodySignedLen($len)
     
    382387            $this->_maxLen = PHP_INT_MAX;
    383388        } elseif ($len === false) {
    384             $this->showLen = false;
     389            $this->_showLen = false;
    385390            $this->_maxLen = PHP_INT_MAX;
    386391        } else {
     
    395400     * Set the signature timestamp.
    396401     *
    397      * @param timestamp $time
    398      *
    399      * @return Swift_Signers_DKIMSigner
     402     * @param int $time A timestamp
     403     *
     404     * @return $this
    400405     */
    401406    public function setSignatureTimestamp($time)
     
    409414     * Set the signature expiration timestamp.
    410415     *
    411      * @param timestamp $time
    412      *
    413      * @return Swift_Signers_DKIMSigner
     416     * @param int $time A timestamp
     417     *
     418     * @return $this
    414419     */
    415420    public function setSignatureExpiration($time)
     
    441446        // Init
    442447        switch ($this->_hashAlgorithm) {
    443             case 'rsa-sha256' :
     448            case 'rsa-sha256':
    444449                $this->_bodyHashHandler = hash_init('sha256');
    445450                break;
    446             case 'rsa-sha1' :
     451            case 'rsa-sha1':
    447452                $this->_bodyHashHandler = hash_init('sha1');
    448453                break;
     
    576581    {
    577582        switch ($this->_headerCanon) {
    578             case 'relaxed' :
     583            case 'relaxed':
    579584                // Prepare Header and cascade
    580585                $exploded = explode(':', $header, 2);
     
    583588                $value = preg_replace("/[ \t][ \t]+/", ' ', $value);
    584589                $header = $name.':'.trim($value).($is_sig ? '' : "\r\n");
    585             case 'simple' :
     590            case 'simple':
    586591                // Nothing to do
    587592        }
     
    589594    }
    590595
     596    /**
     597     * @deprecated This method is currently useless in this class but it must be
     598     *             kept for BC reasons due to its "protected" scope. This method
     599     *             might be overridden by custom client code.
     600     */
    591601    protected function _endOfHeaders()
    592602    {
    593         //$this->_headerHash=hash_final($this->_headerHashHandler, true);
    594603    }
    595604
     
    605614            }
    606615            switch ($string[$i]) {
    607                 case "\r" :
     616                case "\r":
    608617                    $this->_bodyCanonLastChar = "\r";
    609618                    break;
    610                 case "\n" :
     619                case "\n":
    611620                    if ($this->_bodyCanonLastChar == "\r") {
    612621                        if ($method) {
     
    624633                    }
    625634                    break;
    626                 case ' ' :
    627                 case "\t" :
     635                case ' ':
     636                case "\t":
    628637                    if ($method) {
    629638                        $this->_bodyCanonSpace = true;
    630639                        break;
    631640                    }
    632                 default :
     641                default:
    633642                    if ($this->_bodyCanonEmptyCounter > 0) {
    634643                        $canon .= str_repeat("\r\n", $this->_bodyCanonEmptyCounter);
     
    683692    {
    684693        $signature = '';
     694
    685695        switch ($this->_hashAlgorithm) {
    686696            case 'rsa-sha1':
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Signers/DomainKeySigner.php

    r1331083 r1653904  
    132132     * @param string $selector
    133133     *
    134      * @return Swift_Signers_DomainKeySigner
     134     * @return self
    135135     */
    136136    public static function newInstance($privateKey, $domainName, $selector)
     
    142142     * Resets internal states.
    143143     *
    144      * @return Swift_Signers_DomainKeysSigner
     144     * @return $this
    145145     */
    146146    public function reset()
     
    170170     * @throws Swift_IoException
    171171     *
    172      * @return int
    173      * @return Swift_Signers_DomainKeysSigner
     172     * @return $this
    174173     */
    175174    public function write($bytes)
     
    189188     * @throws Swift_IoException
    190189     *
    191      * @return Swift_Signers_DomainKeysSigner
     190     * @return $this
    192191     */
    193192    public function commit()
     
    204203     * @param Swift_InputByteStream $is
    205204     *
    206      * @return Swift_Signers_DomainKeysSigner
     205     * @return $this
    207206     */
    208207    public function bind(Swift_InputByteStream $is)
     
    222221     * @param Swift_InputByteStream $is
    223222     *
    224      * @return Swift_Signers_DomainKeysSigner
     223     * @return $this
    225224     */
    226225    public function unbind(Swift_InputByteStream $is)
     
    231230                unset($this->_bound[$k]);
    232231
    233                 return;
     232                break;
    234233            }
    235234        }
     
    244243     * @throws Swift_IoException
    245244     *
    246      * @return Swift_Signers_DomainKeysSigner
     245     * @return $this
    247246     */
    248247    public function flushBuffers()
     
    258257     * @param string $hash
    259258     *
    260      * @return Swift_Signers_DomainKeysSigner
     259     * @return $this
    261260     */
    262261    public function setHashAlgorithm($hash)
     
    272271     * @param string $canon simple | nofws defaults to simple
    273272     *
    274      * @return Swift_Signers_DomainKeysSigner
     273     * @return $this
    275274     */
    276275    public function setCanon($canon)
     
    290289     * @param string $identity
    291290     *
    292      * @return Swift_Signers_DomainKeySigner
     291     * @return $this
    293292     */
    294293    public function setSignerIdentity($identity)
     
    304303     * @param bool $debug
    305304     *
    306      * @return Swift_Signers_DomainKeySigner
     305     * @return $this
    307306     */
    308307    public function setDebugHeaders($debug)
     
    337336        if ($this->_debugHeaders) {
    338337            return array('DomainKey-Signature', 'X-DebugHash');
    339         } else {
    340             return array('DomainKey-Signature');
    341         }
     338        }
     339
     340        return array('DomainKey-Signature');
    342341    }
    343342
     
    347346     * @param string $header_name
    348347     *
    349      * @return Swift_Signers_DomainKeySigner
     348     * @return $this
    350349     */
    351350    public function ignoreHeader($header_name)
     
    361360     * @param Swift_Mime_HeaderSet $headers
    362361     *
    363      * @return Swift_Signers_DomainKeySigner
     362     * @return $this
    364363     */
    365364    public function setHeaders(Swift_Mime_HeaderSet $headers)
     
    393392     * @param Swift_Mime_HeaderSet $headers
    394393     *
    395      * @return Swift_Signers_DomainKeySigner
     394     * @return $this
    396395     */
    397396    public function addSignature(Swift_Mime_HeaderSet $headers)
     
    414413    {
    415414        switch ($this->_canon) {
    416             case 'nofws' :
     415            case 'nofws':
    417416                // Prepare Header and cascade
    418417                $exploded = explode(':', $header, 2);
     
    421420                $value = preg_replace("/[ \t][ \t]+/", ' ', $value);
    422421                $header = $name.':'.trim($value)."\r\n";
    423             case 'simple' :
     422            case 'simple':
    424423                // Nothing to do
    425424        }
     
    443442            }
    444443            switch ($string[$i]) {
    445                 case "\r" :
     444                case "\r":
    446445                    $this->_bodyCanonLastChar = "\r";
    447446                    break;
    448                 case "\n" :
     447                case "\n":
    449448                    if ($this->_bodyCanonLastChar == "\r") {
    450449                        if ($nofws) {
     
    462461                    }
    463462                    break;
    464                 case ' ' :
    465                 case "\t" :
     463                case ' ':
     464                case "\t":
    466465                case "\x09": //HTAB
    467466                    if ($nofws) {
     
    469468                        break;
    470469                    }
    471                 default :
     470                default:
    472471                    if ($this->_bodyCanonEmptyCounter > 0) {
    473472                        $canon .= str_repeat("\r\n", $this->_bodyCanonEmptyCounter);
     
    499498        // Init
    500499        switch ($this->_hashAlgorithm) {
    501             case 'rsa-sha1' :
     500            case 'rsa-sha1':
    502501                $this->_hashHandler = hash_init('sha1');
    503502                break;
    504503        }
    505         $this->_canonLine = '';
     504        $this->_bodyCanonLine = '';
    506505    }
    507506
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Signers/HeaderSigner.php

    r1331083 r1653904  
    2121     * @param string $header_name
    2222     *
    23      * @return Swift_Signers_HeaderSigner
     23     * @return self
    2424     */
    2525    public function ignoreHeader($header_name);
     
    2828     * Prepare the Signer to get a new Body.
    2929     *
    30      * @return Swift_Signers_HeaderSigner
     30     * @return self
    3131     */
    3232    public function startBody();
     
    3535     * Give the signal that the body has finished streaming.
    3636     *
    37      * @return Swift_Signers_HeaderSigner
     37     * @return self
    3838     */
    3939    public function endBody();
     
    4444     * @param Swift_Mime_SimpleHeaderSet $headers
    4545     *
    46      * @return Swift_Signers_HeaderSigner
     46     * @return self
    4747     */
    4848    public function setHeaders(Swift_Mime_HeaderSet $headers);
     
    5353     * @param Swift_Mime_HeaderSet $headers
    5454     *
    55      * @return Swift_Signers_HeaderSigner
     55     * @return self
    5656     */
    5757    public function addSignature(Swift_Mime_HeaderSet $headers);
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Signers/OpenDKIMSigner.php

    r1331083 r1653904  
    3030    public function __construct($privateKey, $domainName, $selector)
    3131    {
    32         if (extension_loaded('opendkim')) {
    33             $this->_peclLoaded = true;
    34         } else {
     32        if (!extension_loaded('opendkim')) {
    3533            throw new Swift_SwiftException('php-opendkim extension not found');
    3634        }
     35
     36        $this->_peclLoaded = true;
     37
    3738        parent::__construct($privateKey, $domainName, $selector);
    3839    }
     
    6263            $bodyLen = -1;
    6364        }
    64         $hash = ($this->_hashAlgorithm == 'rsa-sha1') ? OpenDKIMSign::ALG_RSASHA1 : OpenDKIMSign::ALG_RSASHA256;
    65         $bodyCanon = ($this->_bodyCanon == 'simple') ? OpenDKIMSign::CANON_SIMPLE : OpenDKIMSign::CANON_RELAXED;
    66         $headerCanon = ($this->_headerCanon == 'simple') ? OpenDKIMSign::CANON_SIMPLE : OpenDKIMSign::CANON_RELAXED;
     65        $hash = $this->_hashAlgorithm == 'rsa-sha1' ? OpenDKIMSign::ALG_RSASHA1 : OpenDKIMSign::ALG_RSASHA256;
     66        $bodyCanon = $this->_bodyCanon == 'simple' ? OpenDKIMSign::CANON_SIMPLE : OpenDKIMSign::CANON_RELAXED;
     67        $headerCanon = $this->_headerCanon == 'simple' ? OpenDKIMSign::CANON_SIMPLE : OpenDKIMSign::CANON_RELAXED;
    6768        $this->_dkimHandler = new OpenDKIMSign($this->_privateKey, $this->_selector, $this->_domainName, $headerCanon, $bodyCanon, $hash, $bodyLen);
    6869        // Hardcode signature Margin for now
     
    131132     * Set the signature timestamp.
    132133     *
    133      * @param timestamp $time
     134     * @param int $time
    134135     *
    135      * @return Swift_Signers_DKIMSigner
     136     * @return $this
    136137     */
    137138    public function setSignatureTimestamp($time)
     
    145146     * Set the signature expiration timestamp.
    146147     *
    147      * @param timestamp $time
     148     * @param int $time
    148149     *
    149      * @return Swift_Signers_DKIMSigner
     150     * @return $this
    150151     */
    151152    public function setSignatureExpiration($time)
     
    161162     * @param bool $debug
    162163     *
    163      * @return Swift_Signers_DKIMSigner
     164     * @return $this
    164165     */
    165166    public function setDebugHeaders($debug)
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Signers/SMimeSigner.php

    r1331083 r1653904  
    4242     * Constructor.
    4343     *
    44      * @param string $certificate
    45      * @param string $privateKey
    46      * @param string $encryptCertificate
     44     * @param string|null $signCertificate
     45     * @param string|null $signPrivateKey
     46     * @param string|null $encryptCertificate
    4747     */
    4848    public function __construct($signCertificate = null, $signPrivateKey = null, $encryptCertificate = null)
     
    7575     * @param string $privateKey
    7676     *
    77      * @return Swift_Signers_SMimeSigner
     77     * @return self
    7878     */
    7979    public static function newInstance($certificate = null, $privateKey = null)
     
    8585     * Set the certificate location to use for signing.
    8686     *
    87      * @link http://www.php.net/manual/en/openssl.pkcs7.flags.php
     87     * @see http://www.php.net/manual/en/openssl.pkcs7.flags.php
    8888     *
    8989     * @param string       $certificate
     
    9292     * @param string       $extraCerts  A file containing intermediate certificates needed by the signing certificate
    9393     *
    94      * @return Swift_Signers_SMimeSigner
     94     * @return $this
    9595     */
    9696    public function setSignCertificate($certificate, $privateKey = null, $signOptions = PKCS7_DETACHED, $extraCerts = null)
     
    118118     * Set the certificate location to use for encryption.
    119119     *
    120      * @link http://www.php.net/manual/en/openssl.pkcs7.flags.php
    121      * @link http://nl3.php.net/manual/en/openssl.ciphers.php
     120     * @see http://www.php.net/manual/en/openssl.pkcs7.flags.php
     121     * @see http://nl3.php.net/manual/en/openssl.ciphers.php
    122122     *
    123123     * @param string|array $recipientCerts Either an single X.509 certificate, or an assoc array of X.509 certificates.
    124124     * @param int          $cipher
    125125     *
    126      * @return Swift_Signers_SMimeSigner
     126     * @return $this
    127127     */
    128128    public function setEncryptCertificate($recipientCerts, $cipher = null)
     
    168168     * As this goes against the official specs, its recommended to only use 'encryption -> signing' when specifically targeting these 'broken' clients.
    169169     *
    170      * @param string $signThenEncrypt
    171      *
    172      * @return Swift_Signers_SMimeSigner
     170     * @param bool $signThenEncrypt
     171     *
     172     * @return $this
    173173     */
    174174    public function setSignThenEncrypt($signThenEncrypt = true)
     
    190190     * Resets internal states.
    191191     *
    192      * @return Swift_Signers_SMimeSigner
     192     * @return $this
    193193     */
    194194    public function reset()
     
    202202     * @param Swift_Message $message
    203203     *
    204      * @return Swift_Signers_SMimeSigner
     204     * @return $this
    205205     */
    206206    public function signMessage(Swift_Message $message)
     
    401401
    402402            $boundary = trim($contentTypeData['1'], '"');
    403             $boundaryLen = strlen($boundary);
    404403
    405404            // Skip the header and CRLF CRLF
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/SmtpTransport.php

    r1331083 r1653904  
    5050     * @param string $security
    5151     *
    52      * @return Swift_SmtpTransport
     52     * @return self
    5353     */
    5454    public static function newInstance($host = 'localhost', $port = 25, $security = null)
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/SpoolTransport.php

    r1331083 r1653904  
    3939     * @param Swift_Spool $spool
    4040     *
    41      * @return Swift_SpoolTransport
     41     * @return self
    4242     */
    4343    public static function newInstance(Swift_Spool $spool)
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/StreamFilters/ByteArrayReplacementFilter.php

    r1331083 r1653904  
    125125        $newBuffer = array();
    126126        $buf_size = count($buffer);
     127        $last_size = 0;
    127128        for ($i = 0; $i < $buf_size; ++$i) {
    128129            $search_pos = $this->_tree;
     
    131132            for ($j = 0; $j <= $this->_treeMaxLen; ++$j) {
    132133                // We have a new byte for a search pattern
    133                 if (isset($buffer [$p = $i + $j]) && isset($search_pos[$buffer[$p]])) {
     134                if (isset($buffer[$p = $i + $j]) && isset($search_pos[$buffer[$p]])) {
    134135                    $search_pos = $search_pos[$buffer[$p]];
    135136                    // We have a complete pattern, save, in case we don't find a better match later
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/StreamFilters/StringReplacementFilter.php

    r1331083 r1653904  
    4343    public function shouldBuffer($buffer)
    4444    {
     45        if ('' === $buffer) {
     46            return false;
     47        }
     48
    4549        $endOfBuffer = substr($buffer, -1);
    4650        foreach ((array) $this->_search as $needle) {
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Transport/AbstractSmtpTransport.php

    r1331083 r1653904  
    5858     * @param string $domain
    5959     *
    60      * @return Swift_Transport_AbstractSmtpTransport
     60     * @return $this
    6161     */
    6262    public function setLocalDomain($domain)
     
    397397                $line = $this->_buffer->readLine($seq);
    398398                $response .= $line;
    399             } while (null !== $line && false !== $line && ' ' != $line{3});
     399            } while (null !== $line && false !== $line && ' ' != $line[3]);
    400400        } catch (Swift_TransportException $e) {
    401401            $this->_throwException($e);
     
    418418            try {
    419419                $this->_doRcptToCommand($forwardPath);
    420                 $sent++;
     420                ++$sent;
    421421            } catch (Swift_TransportException $e) {
    422422                $failedRecipients[] = $forwardPath;
     
    462462    private function _lookupHostname()
    463463    {
    464         if (!empty($_SERVER['SERVER_NAME'])
    465             && $this->_isFqdn($_SERVER['SERVER_NAME'])) {
     464        if (!empty($_SERVER['SERVER_NAME']) && $this->_isFqdn($_SERVER['SERVER_NAME'])) {
    466465            $this->_domain = $_SERVER['SERVER_NAME'];
    467466        } elseif (!empty($_SERVER['SERVER_ADDR'])) {
    468             $this->_domain = sprintf('[%s]', $_SERVER['SERVER_ADDR']);
     467            // Set the address literal tag (See RFC 5321, section: 4.1.3)
     468            if (false === strpos($_SERVER['SERVER_ADDR'], ':')) {
     469                $prefix = ''; // IPv4 addresses are not tagged.
     470            } else {
     471                $prefix = 'IPv6:'; // Adding prefix in case of IPv6.
     472            }
     473
     474            $this->_domain = sprintf('[%s%s]', $prefix, $_SERVER['SERVER_ADDR']);
    469475        }
    470476    }
     
    476482        if (false !== $dotPos = strpos($hostname, '.')) {
    477483            return ($dotPos > 0) && ($dotPos != strlen($hostname) - 1);
    478         } else {
    479             return false;
    480         }
     484        }
     485
     486        return false;
    481487    }
    482488
     
    486492    public function __destruct()
    487493    {
    488         $this->stop();
     494        try {
     495            $this->stop();
     496        } catch (Exception $e) {
     497        }
    489498    }
    490499}
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php

    r1331083 r1653904  
    4242    public function authenticate(Swift_Transport_SmtpAgent $agent, $username, $password)
    4343    {
    44         if (!function_exists('mcrypt_module_open')) {
    45             throw new LogicException('The mcrypt functions need to be enabled to use the NTLM authenticator.');
    46         }
    47 
    48         if (!function_exists('openssl_random_pseudo_bytes')) {
     44        if (!function_exists('openssl_random_pseudo_bytes') || !function_exists('openssl_encrypt')) {
    4945            throw new LogicException('The OpenSSL extension must be enabled to use the NTLM authenticator.');
    5046        }
    5147
    5248        if (!function_exists('bcmul')) {
    53             throw new LogicException('The BCMatch functions must be enabled to use the NTLM authenticator.');
     49            throw new LogicException('The BCMath functions must be enabled to use the NTLM authenticator.');
    5450        }
    5551
     
    301297        }
    302298
    303         list($user, $domain) = explode('@', $name);
    304 
    305         return array($domain, $user);
     299        if (false !== strpos($name, '@')) {
     300            list($user, $domain) = explode('@', $name);
     301
     302            return array($domain, $user);
     303        }
     304
     305        // no domain passed
     306        return array('', $name);
    306307    }
    307308
     
    366367    {
    367368        // Get our timestamp (tricky!)
    368         bcscale(0);
    369 
    370369        $time = number_format($time, 0, '.', ''); // save microtime to string
    371         $time = bcadd($time, '11644473600000'); // add epoch time
    372         $time = bcmul($time, 10000); // tenths of a microsecond.
     370        $time = bcadd($time, '11644473600000', 0); // add epoch time
     371        $time = bcmul($time, 10000, 0); // tenths of a microsecond.
    373372
    374373        $binary = $this->si2bin($time, 64); // create 64 bit binary string
    375374        $timestamp = '';
    376         for ($i = 0; $i < 8; $i++) {
     375        for ($i = 0; $i < 8; ++$i) {
    377376            $timestamp .= chr(bindec(substr($binary, -(($i + 1) * 8), 8)));
    378377        }
     
    438437        $material = array(bin2hex($key[0]));
    439438        $len = strlen($key);
    440         for ($i = 1; $i < $len; $i++) {
     439        for ($i = 1; $i < $len; ++$i) {
    441440            list($high, $low) = str_split(bin2hex($key[$i]));
    442441            $v = $this->castToByte(ord($key[$i - 1]) << (7 + 1 - $i) | $this->uRShift(hexdec(dechex(hexdec($high) & 0xf).dechex(hexdec($low) & 0xf)), $i));
     
    464463
    465464    /** HELPER FUNCTIONS */
     465
    466466    /**
    467467     * Create our security buffer depending on length and offset.
     
    566566
    567567    /** ENCRYPTION ALGORITHMS */
     568
    568569    /**
    569570     * DES Encryption.
    570571     *
    571      * @param string $value
     572     * @param string $value An 8-byte string
    572573     * @param string $key
    573574     *
     
    576577    protected function desEncrypt($value, $key)
    577578    {
    578         $cipher = mcrypt_module_open(MCRYPT_DES, '', 'ecb', '');
    579         mcrypt_generic_init($cipher, $key, mcrypt_create_iv(mcrypt_enc_get_iv_size($cipher), MCRYPT_DEV_RANDOM));
    580 
    581         return mcrypt_generic($cipher, $value);
     579        // 1 == OPENSSL_RAW_DATA - but constant is only available as of PHP 5.4.
     580        return substr(openssl_encrypt($value, 'DES-ECB', $key, 1), 0, 8);
    582581    }
    583582
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Transport/Esmtp/AuthHandler.php

    r1331083 r1653904  
    173173                if (in_array(strtolower($authenticator->getAuthKeyword()),
    174174                    array_map('strtolower', $this->_esmtpParams))) {
    175                     $count++;
     175                    ++$count;
    176176                    if ($authenticator->authenticate($agent, $this->_username, $this->_password)) {
    177177                        return;
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Transport/EsmtpTransport.php

    r1331083 r1653904  
    4343        'tls' => false,
    4444        'type' => Swift_Transport_IoBuffer::TYPE_SOCKET,
     45        'stream_context_options' => array(),
    4546        );
    4647
     
    6364     * @param string $host
    6465     *
    65      * @return Swift_Transport_EsmtpTransport
     66     * @return $this
    6667     */
    6768    public function setHost($host)
     
    8788     * @param int $port
    8889     *
    89      * @return Swift_Transport_EsmtpTransport
     90     * @return $this
    9091     */
    9192    public function setPort($port)
     
    111112     * @param int $timeout seconds
    112113     *
    113      * @return Swift_Transport_EsmtpTransport
     114     * @return $this
    114115     */
    115116    public function setTimeout($timeout)
     
    136137     * @param string $encryption
    137138     *
    138      * @return Swift_Transport_EsmtpTransport
     139     * @return $this
    139140     */
    140141    public function setEncryption($encryption)
    141142    {
     143        $encryption = strtolower($encryption);
    142144        if ('tls' == $encryption) {
    143145            $this->_params['protocol'] = 'tcp';
     
    162164
    163165    /**
     166     * Sets the stream context options.
     167     *
     168     * @param array $options
     169     *
     170     * @return $this
     171     */
     172    public function setStreamOptions($options)
     173    {
     174        $this->_params['stream_context_options'] = $options;
     175
     176        return $this;
     177    }
     178
     179    /**
     180     * Returns the stream context options.
     181     *
     182     * @return array
     183     */
     184    public function getStreamOptions()
     185    {
     186        return $this->_params['stream_context_options'];
     187    }
     188
     189    /**
    164190     * Sets the source IP.
    165191     *
    166192     * @param string $source
    167193     *
    168      * @return Swift_Transport_EsmtpTransport
     194     * @return $this
    169195     */
    170196    public function setSourceIp($source)
     
    190216     * @param Swift_Transport_EsmtpHandler[] $handlers
    191217     *
    192      * @return Swift_Transport_EsmtpTransport
     218     * @return $this
    193219     */
    194220    public function setExtensionHandlers(array $handlers)
     
    198224            $assoc[$handler->getHandledKeyword()] = $handler;
    199225        }
    200         uasort($assoc, array($this, '_sortHandlers'));
     226
     227        @uasort($assoc, array($this, '_sortHandlers'));
    201228        $this->_handlers = $assoc;
    202229        $this->_setHandlerParams();
     
    244271    }
    245272
    246     // -- Mixin invocation code
    247 
    248273    /** Mixin handling method for ESMTP handlers */
    249274    public function __call($method, $args)
     
    255280                $return = call_user_func_array(array($handler, $method), $args);
    256281                // Allow fluid method calls
    257                 if (is_null($return) && substr($method, 0, 3) == 'set') {
     282                if (null === $return && substr($method, 0, 3) == 'set') {
    258283                    return $this;
    259284                } else {
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Transport/FailoverTransport.php

    r1331083 r1653904  
    2323    private $_currentTransport;
    2424
    25     /**
    26      * Creates a new FailoverTransport.
    27      */
     25    // needed as __construct is called from elsewhere explicitly
    2826    public function __construct()
    2927    {
     
    4644        $maxTransports = count($this->_transports);
    4745        $sent = 0;
     46        $this->_lastUsedTransport = null;
    4847
    4948        for ($i = 0; $i < $maxTransports
     
    5453                }
    5554
    56                 return $transport->send($message, $failedRecipients);
     55                if ($sent = $transport->send($message, $failedRecipients)) {
     56                    $this->_lastUsedTransport = $transport;
     57
     58                    return $sent;
     59                }
    5760            } catch (Swift_TransportException $e) {
    5861                $this->_killCurrentTransport();
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Transport/LoadBalancedTransport.php

    r1331083 r1653904  
    3131
    3232    /**
    33      * Creates a new LoadBalancedTransport.
     33     * The Transport used in the last successful send operation.
     34     *
     35     * @var Swift_Transport
    3436     */
     37    protected $_lastUsedTransport = null;
     38
     39    // needed as __construct is called from elsewhere explicitly
    3540    public function __construct()
    3641    {
     
    5661    {
    5762        return array_merge($this->_transports, $this->_deadTransports);
     63    }
     64
     65    /**
     66     * Get the Transport used in the last successful send operation.
     67     *
     68     * @return Swift_Transport
     69     */
     70    public function getLastUsedTransport()
     71    {
     72        return $this->_lastUsedTransport;
    5873    }
    5974
     
    101116        $maxTransports = count($this->_transports);
    102117        $sent = 0;
     118        $this->_lastUsedTransport = null;
    103119
    104120        for ($i = 0; $i < $maxTransports
     
    109125                }
    110126                if ($sent = $transport->send($message, $failedRecipients)) {
     127                    $this->_lastUsedTransport = $transport;
    111128                    break;
    112129                }
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Transport/MailTransport.php

    r1331083 r1653904  
    2121 *
    2222 * @author Chris Corbyn
     23 *
     24 * @deprecated since 5.4.5 (to be removed in 6.0)
    2325 */
    2426class Swift_Transport_MailTransport implements Swift_Transport
     
    4143    public function __construct(Swift_Transport_MailInvoker $invoker, Swift_Events_EventDispatcher $eventDispatcher)
    4244    {
     45        @trigger_error(sprintf('The %s class is deprecated since version 5.4.5 and will be removed in 6.0. Use the Sendmail or SMTP transport instead.', __CLASS__), E_USER_DEPRECATED);
     46
    4347        $this->_invoker = $invoker;
    4448        $this->_eventDispatcher = $eventDispatcher;
     
    7478     * @param string $params
    7579     *
    76      * @return Swift_Transport_MailTransport
     80     * @return $this
    7781     */
    7882    public function setExtraParams($params)
     
    126130        $subjectHeader = $message->getHeaders()->get('Subject');
    127131
    128         if (!$toHeader) {
     132        if (0 === $count) {
    129133            $this->_throwException(new Swift_TransportException('Cannot send message without a recipient'));
    130134        }
    131         $to = $toHeader->getFieldBody();
     135        $to = $toHeader ? $toHeader->getFieldBody() : '';
    132136        $subject = $subjectHeader ? $subjectHeader->getFieldBody() : '';
    133137
     
    140144        $messageStr = $message->toString();
    141145
    142         $message->getHeaders()->set($toHeader);
     146        if ($toHeader) {
     147            $message->getHeaders()->set($toHeader);
     148        }
    143149        $message->getHeaders()->set($subjectHeader);
    144150
     
    157163            // Non-windows (not using SMTP)
    158164            $headers = str_replace("\r\n", PHP_EOL, $headers);
     165            $subject = str_replace("\r\n", PHP_EOL, $subject);
    159166            $body = str_replace("\r\n", PHP_EOL, $body);
     167            $to = str_replace("\r\n", PHP_EOL, $to);
    160168        } else {
    161169            // Windows, using SMTP
    162170            $headers = str_replace("\r\n.", "\r\n..", $headers);
     171            $subject = str_replace("\r\n.", "\r\n..", $subject);
    163172            $body = str_replace("\r\n.", "\r\n..", $body);
    164         }
    165 
    166         if ($this->_invoker->mail($to, $subject, $body, $headers,
    167             sprintf($this->_extraParams, $reversePath))) {
     173            $to = str_replace("\r\n.", "\r\n..", $to);
     174        }
     175
     176        if ($this->_invoker->mail($to, $subject, $body, $headers, $this->_formatExtraParams($this->_extraParams, $reversePath))) {
    168177            if ($evt) {
    169178                $evt->setResult(Swift_Events_SendEvent::RESULT_SUCCESS);
     
    235244        return $path;
    236245    }
     246
     247    /**
     248     * Fix CVE-2016-10074 by disallowing potentially unsafe shell characters.
     249     *
     250     * Note that escapeshellarg and escapeshellcmd are inadequate for our purposes, especially on Windows.
     251     *
     252     * @param string $string The string to be validated
     253     *
     254     * @return bool
     255     */
     256    private function _isShellSafe($string)
     257    {
     258        // Future-proof
     259        if (escapeshellcmd($string) !== $string || !in_array(escapeshellarg($string), array("'$string'", "\"$string\""))) {
     260            return false;
     261        }
     262
     263        $length = strlen($string);
     264        for ($i = 0; $i < $length; ++$i) {
     265            $c = $string[$i];
     266            // All other characters have a special meaning in at least one common shell, including = and +.
     267            // Full stop (.) has a special meaning in cmd.exe, but its impact should be negligible here.
     268            // Note that this does permit non-Latin alphanumeric characters based on the current locale.
     269            if (!ctype_alnum($c) && strpos('@_-.', $c) === false) {
     270                return false;
     271            }
     272        }
     273
     274        return true;
     275    }
     276
     277    /**
     278     * Return php mail extra params to use for invoker->mail.
     279     *
     280     * @param $extraParams
     281     * @param $reversePath
     282     *
     283     * @return string|null
     284     */
     285    private function _formatExtraParams($extraParams, $reversePath)
     286    {
     287        if (false !== strpos($extraParams, '-f%s')) {
     288            if (empty($reversePath) || false === $this->_isShellSafe($reversePath)) {
     289                $extraParams = str_replace('-f%s', '', $extraParams);
     290            } else {
     291                $extraParams = sprintf($extraParams, $reversePath);
     292            }
     293        }
     294
     295        return !empty($extraParams) ? $extraParams : null;
     296    }
    237297}
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Transport/SendmailTransport.php

    r1331083 r1653904  
    6565     * @param string $command
    6666     *
    67      * @return Swift_Transport_SendmailTransport
     67     * @return $this
    6868     */
    6969    public function setCommand($command)
     
    103103        $command = $this->getCommand();
    104104        $buffer = $this->getBuffer();
     105        $count = 0;
    105106
    106107        if (false !== strpos($command, ' -t')) {
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Transport/SimpleMailInvoker.php

    r994020 r1653904  
    3333        if (!ini_get('safe_mode')) {
    3434            return @mail($to, $subject, $body, $headers, $extraParams);
    35         } else {
    36             return @mail($to, $subject, $body, $headers);
    3735        }
     36
     37        return @mail($to, $subject, $body, $headers);
    3838    }
    3939}
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Transport/SpoolTransport.php

    r1331083 r1653904  
    3636     * @param Swift_Spool $spool
    3737     *
    38      * @return Swift_Transport_SpoolTransport
     38     * @return $this
    3939     */
    4040    public function setSpool(Swift_Spool $spool)
  • cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Transport/StreamBuffer.php

    r1331083 r1653904  
    8585                        stream_set_blocking($this->_stream, 1);
    8686                    }
    87 
    8887            }
    8988        }
     
    261260            $options['socket']['bindto'] = $this->_params['sourceIp'].':0';
    262261        }
    263         $this->_stream = @stream_socket_client($host.':'.$this->_params['port'], $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT, stream_context_create($options));
     262        if (isset($this->_params['stream_context_options'])) {
     263            $options = array_merge($options, $this->_params['stream_context_options']);
     264        }
     265        $streamContext = stream_context_create($options);
     266        $this->_stream = @stream_socket_client($host.':'.$this->_params['port'], $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT, $streamContext);
    264267        if (false === $this->_stream) {
    265268            throw new Swift_TransportException(
     
    289292            2 => array('pipe', 'w'),
    290293            );
     294        $pipes = array();
    291295        $this->_stream = proc_open($command, $descriptorSpec, $pipes);
    292296        stream_set_blocking($pipes[2], 0);
  • cimy-swift-smtp/trunk/Swift/lib/dependency_maps/mime_deps.php

    r994020 r1653904  
    11<?php
    22
    3 require dirname(__FILE__).'/../mime_types.php';
     3require __DIR__.'/../mime_types.php';
    44
    55Swift_DependencyContainer::getInstance()
     
    118118    // see https://github.com/php/php-src/commit/18bb426587d62f93c54c40bf8535eb8416603629
    119119    ->register('mime.qpcontentencoder')
    120     ->asAliasOf(version_compare(phpversion(), '5.4.7', '>=') ? 'mime.qpcontentencoderproxy' : 'mime.safeqpcontentencoder')
     120    ->asAliasOf(PHP_VERSION_ID >= 50407 ? 'mime.qpcontentencoderproxy' : 'mime.safeqpcontentencoder')
    121121;
    122122
  • cimy-swift-smtp/trunk/Swift/lib/preferences.php

    r994020 r1653904  
    2121// this should only be done when Swiftmailer won't use the native QP content encoder
    2222// see mime_deps.php
    23 if (version_compare(phpversion(), '5.4.7', '<')) {
     23if (PHP_VERSION_ID < 50407) {
    2424    $preferences->setQPDotEscape(false);
    2525}
  • cimy-swift-smtp/trunk/Swift/lib/swift_init.php

    r994020 r1653904  
    2020
    2121// Load in dependency maps
    22 require dirname(__FILE__).'/dependency_maps/cache_deps.php';
    23 require dirname(__FILE__).'/dependency_maps/mime_deps.php';
    24 require dirname(__FILE__).'/dependency_maps/message_deps.php';
    25 require dirname(__FILE__).'/dependency_maps/transport_deps.php';
     22require __DIR__.'/dependency_maps/cache_deps.php';
     23require __DIR__.'/dependency_maps/mime_deps.php';
     24require __DIR__.'/dependency_maps/message_deps.php';
     25require __DIR__.'/dependency_maps/transport_deps.php';
    2626
    2727// Load in global library preferences
    28 require dirname(__FILE__).'/preferences.php';
     28require __DIR__.'/preferences.php';
  • cimy-swift-smtp/trunk/Swift/lib/swift_required.php

    r994020 r1653904  
    1818
    1919// Load Swift utility class
    20 require dirname(__FILE__).'/classes/Swift.php';
     20require __DIR__.'/classes/Swift.php';
    2121
    2222if (!function_exists('_swiftmailer_init')) {
    2323    function _swiftmailer_init()
    2424    {
    25         require dirname(__FILE__).'/swift_init.php';
     25        require __DIR__.'/swift_init.php';
    2626    }
    2727}
  • cimy-swift-smtp/trunk/Swift/lib/swift_required_pear.php

    r994020 r1653904  
    1818
    1919// Load Swift utility class
    20 require dirname(__FILE__).'/Swift.php';
     20require __DIR__.'/Swift.php';
    2121
    2222if (!function_exists('_swiftmailer_init')) {
    2323    function _swiftmailer_init()
    2424    {
    25         require dirname(__FILE__).'/swift_init.php';
     25        require __DIR__.'/swift_init.php';
    2626    }
    2727}
  • cimy-swift-smtp/trunk/cimy_swift_smtp.php

    r1331085 r1653904  
    55Description: Send email via SMTP (Compatible with GMAIL)
    66Author: Marco Cimmino
    7 Version: 2.6.2
     7Version: 2.6.3
    88Author URI: mailto:cimmino.marco@gmail.com
    99
    10 Copyright (c) 2007-2016 Marco Cimmino
     10Copyright (c) 2007-2017 Marco Cimmino
    1111
    1212Uses Swift Mailer engine - http://swiftmailer.org/
  • cimy-swift-smtp/trunk/readme.txt

    r1331085 r1653904  
    55Tags: cimy, email, smtp, gmail, swift, admin
    66Requires at least: 3.0
    7 Tested up to: 4.4
    8 Stable tag: 2.6.2
     7Tested up to: 4.7
     8Stable tag: 2.6.3
    99
    1010Send email via SMTP (Compatible with GMAIL)
Note: See TracChangeset for help on using the changeset viewer.