Changeset 1653904
- Timestamp:
- 05/09/2017 10:47:30 PM (9 years ago)
- Location:
- cimy-swift-smtp/trunk
- Files:
-
- 82 edited
-
README_OFFICIAL.txt (modified) (1 diff)
-
Swift/CHANGES (modified) (1 diff)
-
Swift/LICENSE (modified) (1 diff)
-
Swift/README (modified) (1 diff)
-
Swift/VERSION (modified) (1 diff)
-
Swift/lib/classes/Swift.php (modified) (1 diff)
-
Swift/lib/classes/Swift/ByteStream/AbstractFilterableInputStream.php (modified) (1 diff)
-
Swift/lib/classes/Swift/ByteStream/ArrayByteStream.php (modified) (1 diff)
-
Swift/lib/classes/Swift/ByteStream/FileByteStream.php (modified) (1 diff)
-
Swift/lib/classes/Swift/CharacterReader.php (modified) (1 diff)
-
Swift/lib/classes/Swift/CharacterReader/GenericFixedWidthReader.php (modified) (2 diffs)
-
Swift/lib/classes/Swift/CharacterReader/UsAsciiReader.php (modified) (1 diff)
-
Swift/lib/classes/Swift/CharacterReader/Utf8Reader.php (modified) (2 diffs)
-
Swift/lib/classes/Swift/CharacterStream/ArrayCharacterStream.php (modified) (1 diff)
-
Swift/lib/classes/Swift/CharacterStream/NgCharacterStream.php (modified) (4 diffs)
-
Swift/lib/classes/Swift/DependencyContainer.php (modified) (11 diffs)
-
Swift/lib/classes/Swift/Encoder/QpEncoder.php (modified) (4 diffs)
-
Swift/lib/classes/Swift/Encoding.php (modified) (1 diff)
-
Swift/lib/classes/Swift/Events/CommandEvent.php (modified) (2 diffs)
-
Swift/lib/classes/Swift/FailoverTransport.php (modified) (1 diff)
-
Swift/lib/classes/Swift/FileSpool.php (modified) (2 diffs)
-
Swift/lib/classes/Swift/Image.php (modified) (2 diffs)
-
Swift/lib/classes/Swift/KeyCache/DiskKeyCache.php (modified) (1 diff)
-
Swift/lib/classes/Swift/LoadBalancedTransport.php (modified) (1 diff)
-
Swift/lib/classes/Swift/MailTransport.php (modified) (2 diffs)
-
Swift/lib/classes/Swift/Mailer.php (modified) (2 diffs)
-
Swift/lib/classes/Swift/MemorySpool.php (modified) (3 diffs)
-
Swift/lib/classes/Swift/Message.php (modified) (4 diffs)
-
Swift/lib/classes/Swift/Mime/Attachment.php (modified) (5 diffs)
-
Swift/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php (modified) (2 diffs)
-
Swift/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoderProxy.php (modified) (1 diff)
-
Swift/lib/classes/Swift/Mime/Grammar.php (modified) (1 diff)
-
Swift/lib/classes/Swift/Mime/HeaderSet.php (modified) (1 diff)
-
Swift/lib/classes/Swift/Mime/Headers/AbstractHeader.php (modified) (2 diffs)
-
Swift/lib/classes/Swift/Mime/Headers/DateHeader.php (modified) (1 diff)
-
Swift/lib/classes/Swift/Mime/Headers/MailboxHeader.php (modified) (6 diffs)
-
Swift/lib/classes/Swift/Mime/Headers/OpenDKIMHeader.php (modified) (1 diff)
-
Swift/lib/classes/Swift/Mime/Headers/ParameterizedHeader.php (modified) (3 diffs)
-
Swift/lib/classes/Swift/Mime/Headers/PathHeader.php (modified) (1 diff)
-
Swift/lib/classes/Swift/Mime/MimePart.php (modified) (7 diffs)
-
Swift/lib/classes/Swift/Mime/SimpleHeaderFactory.php (modified) (1 diff)
-
Swift/lib/classes/Swift/Mime/SimpleHeaderSet.php (modified) (5 diffs)
-
Swift/lib/classes/Swift/Mime/SimpleMessage.php (modified) (19 diffs)
-
Swift/lib/classes/Swift/Mime/SimpleMimeEntity.php (modified) (21 diffs)
-
Swift/lib/classes/Swift/MimePart.php (modified) (1 diff)
-
Swift/lib/classes/Swift/NullTransport.php (modified) (2 diffs)
-
Swift/lib/classes/Swift/Plugins/DecoratorPlugin.php (modified) (1 diff)
-
Swift/lib/classes/Swift/Plugins/ImpersonatePlugin.php (modified) (1 diff)
-
Swift/lib/classes/Swift/Plugins/MessageLogger.php (modified) (2 diffs)
-
Swift/lib/classes/Swift/Plugins/PopBeforeSmtpPlugin.php (modified) (5 diffs)
-
Swift/lib/classes/Swift/Plugins/ReporterPlugin.php (modified) (1 diff)
-
Swift/lib/classes/Swift/Plugins/ThrottlerPlugin.php (modified) (2 diffs)
-
Swift/lib/classes/Swift/Preferences.php (modified) (5 diffs)
-
Swift/lib/classes/Swift/SendmailTransport.php (modified) (1 diff)
-
Swift/lib/classes/Swift/Signers/BodySigner.php (modified) (1 diff)
-
Swift/lib/classes/Swift/Signers/DKIMSigner.php (modified) (26 diffs)
-
Swift/lib/classes/Swift/Signers/DomainKeySigner.php (modified) (22 diffs)
-
Swift/lib/classes/Swift/Signers/HeaderSigner.php (modified) (5 diffs)
-
Swift/lib/classes/Swift/Signers/OpenDKIMSigner.php (modified) (5 diffs)
-
Swift/lib/classes/Swift/Signers/SMimeSigner.php (modified) (9 diffs)
-
Swift/lib/classes/Swift/SmtpTransport.php (modified) (1 diff)
-
Swift/lib/classes/Swift/SpoolTransport.php (modified) (1 diff)
-
Swift/lib/classes/Swift/StreamFilters/ByteArrayReplacementFilter.php (modified) (2 diffs)
-
Swift/lib/classes/Swift/StreamFilters/StringReplacementFilter.php (modified) (1 diff)
-
Swift/lib/classes/Swift/Transport/AbstractSmtpTransport.php (modified) (6 diffs)
-
Swift/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php (modified) (7 diffs)
-
Swift/lib/classes/Swift/Transport/Esmtp/AuthHandler.php (modified) (1 diff)
-
Swift/lib/classes/Swift/Transport/EsmtpTransport.php (modified) (10 diffs)
-
Swift/lib/classes/Swift/Transport/FailoverTransport.php (modified) (3 diffs)
-
Swift/lib/classes/Swift/Transport/LoadBalancedTransport.php (modified) (4 diffs)
-
Swift/lib/classes/Swift/Transport/MailTransport.php (modified) (7 diffs)
-
Swift/lib/classes/Swift/Transport/SendmailTransport.php (modified) (2 diffs)
-
Swift/lib/classes/Swift/Transport/SimpleMailInvoker.php (modified) (1 diff)
-
Swift/lib/classes/Swift/Transport/SpoolTransport.php (modified) (1 diff)
-
Swift/lib/classes/Swift/Transport/StreamBuffer.php (modified) (3 diffs)
-
Swift/lib/dependency_maps/mime_deps.php (modified) (2 diffs)
-
Swift/lib/preferences.php (modified) (1 diff)
-
Swift/lib/swift_init.php (modified) (1 diff)
-
Swift/lib/swift_required.php (modified) (1 diff)
-
Swift/lib/swift_required_pear.php (modified) (1 diff)
-
cimy_swift_smtp.php (modified) (1 diff)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
cimy-swift-smtp/trunk/README_OFFICIAL.txt
r1331083 r1653904 62 62 63 63 CHANGELOG: 64 v2.6.3 - 10/05/2017 65 - Updated Swift Mailer to 5.4.8 66 64 67 v2.6.2 - 19/01/2016 65 68 - Updated Swift Mailer to 5.4.1 -
cimy-swift-smtp/trunk/Swift/CHANGES
r1331083 r1653904 1 1 Changelog 2 2 ========= 3 4 5.4.8 (2017-05-01) 5 ------------------ 6 7 * fixed encoding inheritance in addPart() 8 * fixed sorting MIME children when their types are equal 9 10 5.4.7 (2017-04-20) 11 ------------------ 12 13 * fixed NTLMAuthenticator clobbering bcmath scale 14 15 5.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 26 5.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 36 5.4.4 (2016-11-23) 37 ------------------ 38 39 * reverted escaping command-line args to mail (PHP mail() function already does it) 40 41 5.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 50 5.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 3 64 4 65 5.4.1 (2015-06-06) -
cimy-swift-smtp/trunk/Swift/LICENSE
r730543 r1653904 1 Copyright (c) 2013 Fabien Potencier1 Copyright (c) 2013-2016 Fabien Potencier 2 2 3 3 Permission is hereby granted, free of charge, to any person obtaining a copy -
cimy-swift-smtp/trunk/Swift/README
r730543 r1653904 7 7 Homepage: http://swiftmailer.org 8 8 Documentation: http://swiftmailer.org/docs 9 Mailing List: http://groups.google.com/group/swiftmailer10 9 Bugs: https://github.com/swiftmailer/swiftmailer/issues 11 10 Repository: https://github.com/swiftmailer/swiftmailer -
cimy-swift-smtp/trunk/Swift/VERSION
r1331083 r1653904 1 Swift-5.4. 11 Swift-5.4.8 -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift.php
r1331083 r1653904 48 48 } 49 49 50 $path = dirname(__FILE__).'/'.str_replace('_', '/', $class).'.php';50 $path = __DIR__.'/'.str_replace('_', '/', $class).'.php'; 51 51 52 52 if (!file_exists($path)) { -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/ByteStream/AbstractFilterableInputStream.php
r1331083 r1653904 23 23 /** 24 24 * StreamFilters. 25 * 26 * @var Swift_StreamFilter[] 25 27 */ 26 28 private $_filters = array(); -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/ByteStream/ArrayByteStream.php
r1331083 r1653904 83 83 // Don't use array slice 84 84 $end = $length + $this->_offset; 85 $end = $this->_arraySize < $end 86 ? $this->_arraySize 87 : $end; 85 $end = $this->_arraySize < $end ? $this->_arraySize : $end; 88 86 $ret = ''; 89 87 for (; $this->_offset < $end; ++$this->_offset) { -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/ByteStream/FileByteStream.php
r1331083 r1653904 140 140 { 141 141 if (!isset($this->_reader)) { 142 if (!$this->_reader = fopen($this->_path, 'rb')) { 142 $pointer = @fopen($this->_path, 'rb'); 143 if (!$pointer) { 143 144 throw new Swift_IoException( 144 145 'Unable to open file for reading ['.$this->_path.']' 145 146 ); 146 147 } 148 $this->_reader = $pointer; 147 149 if ($this->_offset != 0) { 148 150 $this->_getReadStreamSeekableStatus(); -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/CharacterReader.php
r1331083 r1653904 49 49 * A value of -1 means this cannot possibly be a valid character. 50 50 * 51 * @param int eger[] $bytes52 * @param int $size51 * @param int[] $bytes 52 * @param int $size 53 53 * 54 54 * @return int -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/CharacterReader/GenericFixedWidthReader.php
r1331083 r1653904 49 49 // % and / are CPU intensive, so, maybe find a better way 50 50 $ignored = $strlen % $this->_width; 51 $ignoredChars = substr($string, -$ignored);51 $ignoredChars = $ignored ? substr($string, -$ignored) : ''; 52 52 $currentMap = $this->_width; 53 53 … … 83 83 $needed = $this->_width - $size; 84 84 85 return ($needed > -1)? $needed : -1;85 return $needed > -1 ? $needed : -1; 86 86 } 87 87 -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/CharacterReader/UsAsciiReader.php
r1331083 r1653904 68 68 if (1 == count($bytes) && $byte >= 0x00 && $byte <= 0x7F) { 69 69 return 0; 70 } else {71 return -1;72 70 } 71 72 return -1; 73 73 } 74 74 -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/CharacterReader/Utf8Reader.php
r1331083 r1653904 20 20 private static $length_map = array( 21 21 // 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, // 0x0N23 1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x1N24 1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x2N25 1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x3N26 1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x4N27 1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x5N28 1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x6N29 1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x7N30 0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0x8N31 0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0x9N32 0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0xAN33 0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0xBN34 2, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, // 0xCN35 2, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, // 0xDN36 3, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, // 0xEN37 4, 4,4,4,4,4,4,4,5,5,5,5,6,6,0,0, // 0xFN22 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 38 38 ); 39 39 … … 162 162 $needed = self::$length_map[$bytes[0]] - $size; 163 163 164 return ($needed > -1) 165 ? $needed 166 : -1 167 ; 164 return $needed > -1 ? $needed : -1; 168 165 } 169 166 -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/CharacterStream/ArrayCharacterStream.php
r1331083 r1653904 156 156 * @param int $length 157 157 * 158 * @return int eger[]158 * @return int[] 159 159 */ 160 160 public function readBytes($length) -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/CharacterStream/NgCharacterStream.php
r1331083 r1653904 166 166 } 167 167 $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; 171 169 switch ($this->_mapType) { 172 170 case Swift_CharacterReader::MAP_TYPE_FIXED_LEN: … … 179 177 180 178 case Swift_CharacterReader::MAP_TYPE_INVALID: 181 $end = $this->_currentPos + $length;182 $end = $end > $this->_charCount183 ? $this->_charCount184 : $end;185 179 $ret = ''; 186 180 for (; $this->_currentPos < $length; ++$this->_currentPos) { … … 195 189 case Swift_CharacterReader::MAP_TYPE_POSITIONS: 196 190 $end = $this->_currentPos + $length; 197 $end = $end > $this->_charCount 198 ? $this->_charCount 199 : $end; 191 $end = $end > $this->_charCount ? $this->_charCount : $end; 200 192 $ret = ''; 201 193 $start = 0; … … 224 216 * @param int $length 225 217 * 226 * @return int eger[]218 * @return int[] 227 219 */ 228 220 public function readBytes($length) -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/DependencyContainer.php
r1331083 r1653904 49 49 * Returns a singleton of the DependencyContainer. 50 50 * 51 * @return Swift_DependencyContainer51 * @return self 52 52 */ 53 53 public static function getInstance() … … 144 144 * @param string $itemName 145 145 * 146 * @return Swift_DependencyContainer146 * @return $this 147 147 */ 148 148 public function register($itemName) … … 161 161 * @param mixed $value 162 162 * 163 * @return Swift_DependencyContainer163 * @return $this 164 164 */ 165 165 public function asValue($value) … … 177 177 * @param string $lookup 178 178 * 179 * @return Swift_DependencyContainer179 * @return $this 180 180 */ 181 181 public function asAliasOf($lookup) … … 199 199 * @param string $className 200 200 * 201 * @return Swift_DependencyContainer201 * @return $this 202 202 */ 203 203 public function asNewInstanceOf($className) … … 217 217 * @param string $className 218 218 * 219 * @return Swift_DependencyContainer219 * @return $this 220 220 */ 221 221 public function asSharedInstanceOf($className) … … 237 237 * @param array $lookups 238 238 * 239 * @return Swift_DependencyContainer239 * @return $this 240 240 */ 241 241 public function withDependencies(array $lookups) … … 258 258 * @param mixed $value 259 259 * 260 * @return Swift_DependencyContainer260 * @return $this 261 261 */ 262 262 public function addConstructorValue($value) … … 279 279 * @param string $lookup 280 280 * 281 * @return Swift_DependencyContainer281 * @return $this 282 282 */ 283 283 public function addConstructorLookup($lookup) … … 312 312 $this->createDependenciesFor($itemName) 313 313 ); 314 } else {315 return $reflector->newInstance(); 316 }314 } 315 316 return $reflector->newInstance(); 317 317 } 318 318 … … 367 367 368 368 return $collection; 369 } else {370 return $this->lookup($item); 371 }369 } 370 371 return $this->lookup($item); 372 372 } 373 373 } -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Encoder/QpEncoder.php
r1331083 r1653904 199 199 200 200 $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) { 202 206 $lines[$lNo] = ''; 203 207 $currentLine = &$lines[$lNo++]; … … 205 209 $lineLen = 0; 206 210 } 207 $lineLen += $size; 211 208 212 $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 } 209 220 } 210 221 … … 225 236 * Encode the given byte array into a verbatim QP form. 226 237 * 227 * @param int eger[] $bytes228 * @param int $size238 * @param int[] $bytes 239 * @param int $size 229 240 * 230 241 * @return string … … 252 263 * @param int $size number of bytes to read 253 264 * 254 * @return int eger[]265 * @return int[] 255 266 */ 256 267 protected function _nextSequence($size = 4) -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Encoding.php
r1331083 r1653904 56 56 } 57 57 58 // -- Private Static Methods59 60 58 private static function _lookup($key) 61 59 { -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Events/CommandEvent.php
r1331083 r1653904 26 26 * An array of codes which a successful response will contain. 27 27 * 28 * @var int eger[]28 * @var int[] 29 29 */ 30 30 private $_successCodes = array(); … … 57 57 * Get the numeric response codes which indicate success for this command. 58 58 * 59 * @return int eger[]59 * @return int[] 60 60 */ 61 61 public function getSuccessCodes() -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/FailoverTransport.php
r1331083 r1653904 37 37 * @param Swift_Transport[] $transports 38 38 * 39 * @return Swift_FailoverTransport39 * @return self 40 40 */ 41 41 public static function newInstance($transports = array()) -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/FileSpool.php
r1331083 r1653904 40 40 if (!file_exists($this->_path)) { 41 41 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)); 43 43 } 44 44 } … … 109 109 } 110 110 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)); 112 112 } 113 113 -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Image.php
r1331083 r1653904 37 37 * @param string $contentType 38 38 * 39 * @return Swift_Image39 * @return self 40 40 */ 41 41 public static function newInstance($data = null, $filename = null, $contentType = null) … … 49 49 * @param string $path 50 50 * 51 * @return Swift_Image51 * @return self 52 52 */ 53 53 public static function fromPath($path) 54 54 { 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)); 60 56 } 61 57 } -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/KeyCache/DiskKeyCache.php
r1331083 r1653904 290 290 { 291 291 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'; 296 293 $fp = fopen($this->_path.'/'.$nsKey.'/'.$itemKey, $openMode); 297 294 $this->_keys[$nsKey][$itemKey] = $fp; -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/LoadBalancedTransport.php
r1331083 r1653904 37 37 * @param array $transports 38 38 * 39 * @return Swift_LoadBalancedTransport39 * @return self 40 40 */ 41 41 public static function newInstance($transports = array()) -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/MailTransport.php
r1331083 r1653904 13 13 * 14 14 * @author Chris Corbyn 15 * 16 * @deprecated since 5.4.5 (to be removed in 6.0) 15 17 */ 16 18 class Swift_MailTransport extends Swift_Transport_MailTransport … … 37 39 * @param string $extraParams To be passed to mail() 38 40 * 39 * @return Swift_MailTransport41 * @return self 40 42 */ 41 43 public static function newInstance($extraParams = '-f%s') -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Mailer.php
r1331083 r1653904 34 34 * @param Swift_Transport $transport 35 35 * 36 * @return Swift_Mailer36 * @return self 37 37 */ 38 38 public static function newInstance(Swift_Transport $transport) … … 70 70 * @param array $failedRecipients An array of failures by-reference 71 71 * 72 * @return int 72 * @return int The number of successful recipients. Can be 0 which indicates failure 73 73 */ 74 74 public function send(Swift_Mime_Message $message, &$failedRecipients = null) -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/MemorySpool.php
r1331083 r1653904 17 17 { 18 18 protected $messages = array(); 19 private $flushRetries = 3; 19 20 20 21 /** … … 40 41 public function stop() 41 42 { 43 } 44 45 /** 46 * @param int $retries 47 */ 48 public function setFlushRetries($retries) 49 { 50 $this->flushRetries = $retries; 42 51 } 43 52 … … 76 85 77 86 $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 } 80 106 } 81 107 -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Message.php
r1331083 r1653904 69 69 * @param string $charset 70 70 * 71 * @return Swift_Message71 * @return $this 72 72 */ 73 73 public static function newInstance($subject = null, $body = null, $contentType = null, $charset = null) … … 83 83 * @param string $charset 84 84 * 85 * @return Swift_Mime_SimpleMessage85 * @return $this 86 86 */ 87 87 public function addPart($body, $contentType = null, $charset = null) 88 88 { 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. 96 94 * 97 95 * @param Swift_Signer $signer 98 96 * 99 * @return Swift_Message97 * @return $this 100 98 */ 101 99 public function attachSigner(Swift_Signer $signer) … … 115 113 * @param Swift_Signer $signer 116 114 * 117 * @return Swift_Message115 * @return $this 118 116 */ 119 117 public function detachSigner(Swift_Signer $signer) … … 282 280 parent::__clone(); 283 281 foreach ($this->bodySigners as $key => $bodySigner) { 284 $this->bodySigners[$key] = clone ($bodySigner);282 $this->bodySigners[$key] = clone $bodySigner; 285 283 } 286 284 287 285 foreach ($this->headerSigners as $key => $headerSigner) { 288 $this->headerSigners[$key] = clone ($headerSigner);286 $this->headerSigners[$key] = clone $headerSigner; 289 287 } 290 288 } -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Mime/Attachment.php
r1331083 r1653904 65 65 * @param string $disposition 66 66 * 67 * @return Swift_Mime_Attachment67 * @return $this 68 68 */ 69 69 public function setDisposition($disposition) 70 70 { 71 71 if (!$this->_setHeaderFieldModel('Content-Disposition', $disposition)) { 72 $this->getHeaders()->addParameterizedHeader( 73 'Content-Disposition', $disposition 74 ); 72 $this->getHeaders()->addParameterizedHeader('Content-Disposition', $disposition); 75 73 } 76 74 … … 93 91 * @param string $filename 94 92 * 95 * @return Swift_Mime_Attachment93 * @return $this 96 94 */ 97 95 public function setFilename($filename) … … 118 116 * @param int $size 119 117 * 120 * @return Swift_Mime_Attachment118 * @return $this 121 119 */ 122 120 public function setSize($size) … … 133 131 * @param string $contentType optional 134 132 * 135 * @return Swift_Mime_Attachment133 * @return $this 136 134 */ 137 135 public function setFile(Swift_FileStream $file, $contentType = null) … … 140 138 $this->setBody($file, $contentType); 141 139 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)); 145 141 146 142 if (array_key_exists($extension, $this->_mimeTypes)) { -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php
r1331083 r1653904 96 96 97 97 $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) { 99 103 $is->write($prepend.$this->_standardize($currentLine)); 100 104 $currentLine = ''; … … 103 107 $lineLen = 0; 104 108 } 105 $lineLen += $size; 109 106 110 $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 } 107 118 } 108 119 if (strlen($currentLine)) { -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoderProxy.php
r1331083 r1653904 62 62 { 63 63 $this->charset = $charset; 64 $this->safeEncoder->charsetChanged($charset); 64 65 } 65 66 -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Mime/Grammar.php
r994020 r1653904 130 130 if (array_key_exists($name, self::$_grammar)) { 131 131 return self::$_grammar[$name]; 132 } else {133 throw new Swift_RfcComplianceException(134 "No such grammar '".$name."' defined."135 );136 132 } 133 134 throw new Swift_RfcComplianceException( 135 "No such grammar '".$name."' defined." 136 ); 137 137 } 138 138 -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Mime/HeaderSet.php
r1331083 r1653904 139 139 * Create a new instance of this HeaderSet. 140 140 * 141 * @return Swift_Mime_HeaderSet141 * @return self 142 142 */ 143 143 public function newInstance(); -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Mime/Headers/AbstractHeader.php
r1331083 r1653904 219 219 return $this->toString(); 220 220 } 221 222 // -- Points of extension223 221 224 222 /** … … 450 448 protected function toTokens($string = null) 451 449 { 452 if ( is_null($string)) {450 if (null === $string) { 453 451 $string = $this->getFieldBody(); 454 452 } -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Mime/Headers/DateHeader.php
r1331083 r1653904 96 96 public function setTimestamp($timestamp) 97 97 { 98 if ( !is_null($timestamp)) {98 if (null !== $timestamp) { 99 99 $timestamp = (int) $timestamp; 100 100 } -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Mime/Headers/MailboxHeader.php
r1331083 r1653904 232 232 { 233 233 // Compute the string value of the header only if needed 234 if ( is_null($this->getCachedValue())) {234 if (null === $this->getCachedValue()) { 235 235 $this->setCachedValue($this->createMailboxListString($this->_mailboxes)); 236 236 } … … 238 238 return $this->getCachedValue(); 239 239 } 240 241 // -- Points of extension242 240 243 241 /** … … 278 276 protected function createDisplayNameString($displayName, $shorten = false) 279 277 { 280 return $this->createPhrase($this, $displayName, 281 $this->getCharset(), $this->getEncoder(), $shorten 282 ); 278 return $this->createPhrase($this, $displayName, $this->getCharset(), $this->getEncoder(), $shorten); 283 279 } 284 280 … … 300 296 * Redefine the encoding requirements for mailboxes. 301 297 * 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 304 301 * 305 302 * @param string $token … … 309 306 protected function tokenNeedsEncoding($token) 310 307 { 311 return preg_match('/[ ,;]/', $token) || parent::tokenNeedsEncoding($token);308 return preg_match('/[()<>\[\]:;@\,."]/', $token) || parent::tokenNeedsEncoding($token); 312 309 } 313 310 … … 325 322 foreach ($mailboxes as $email => $name) { 326 323 $mailboxStr = $email; 327 if ( !is_null($name)) {324 if (null !== $name) { 328 325 $nameStr = $this->createDisplayNameString($name, empty($strings)); 329 326 $mailboxStr = $nameStr.' <'.$mailboxStr.'>'; -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Mime/Headers/OpenDKIMHeader.php
r1331083 r1653904 31 31 32 32 /** 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 38 34 */ 39 35 public function __construct($name) -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Mime/Headers/ParameterizedHeader.php
r1331083 r1653904 99 99 $params = $this->getParameters(); 100 100 101 return array_key_exists($parameter, $params) 102 ? $params[$parameter] 103 : null; 101 return array_key_exists($parameter, $params) ? $params[$parameter] : null; 104 102 } 105 103 … … 134 132 $body = parent::getFieldBody(); 135 133 foreach ($this->_params as $name => $value) { 136 if ( !is_null($value)) {134 if (null !== $value) { 137 135 // Add the parameter 138 136 $body .= '; '.$this->_createParameter($name, $value); … … 159 157 // Try creating any parameters 160 158 foreach ($this->_params as $name => $value) { 161 if ( !is_null($value)) {159 if (null !== $value) { 162 160 // Add the semi-colon separator 163 161 $tokens[count($tokens) - 1] .= ';'; -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Mime/Headers/PathHeader.php
r1331083 r1653904 81 81 public function setAddress($address) 82 82 { 83 if ( is_null($address)) {83 if (null === $address) { 84 84 $this->_address = null; 85 85 } elseif ('' == $address) { -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Mime/MimePart.php
r1331083 r1653904 41 41 parent::__construct($headers, $encoder, $cache, $grammar); 42 42 $this->setContentType('text/plain'); 43 if ( !is_null($charset)) {43 if (null !== $charset) { 44 44 $this->setCharset($charset); 45 45 } … … 54 54 * @param string $charset optional 55 55 * 56 * @return Swift_Mime_MimePart56 * @return $this 57 57 */ 58 58 public function setBody($body, $contentType = null, $charset = null) … … 83 83 * @param string $charset 84 84 * 85 * @return Swift_Mime_MimePart85 * @return $this 86 86 */ 87 87 public function setCharset($charset) … … 112 112 * @param string $format 113 113 * 114 * @return Swift_Mime_MimePart114 * @return $this 115 115 */ 116 116 public function setFormat($format) … … 129 129 public function getDelSp() 130 130 { 131 return ($this->_getHeaderParameter('Content-Type', 'delsp') == 'yes') 132 ? true 133 : false; 131 return 'yes' == $this->_getHeaderParameter('Content-Type', 'delsp') ? true : false; 134 132 } 135 133 … … 139 137 * @param bool $delsp 140 138 * 141 * @return Swift_Mime_MimePart139 * @return $this 142 140 */ 143 141 public function setDelSp($delsp = true) … … 197 195 { 198 196 $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', ''))) { 200 198 // mb_convert_encoding must be the first one to check, since iconv cannot convert some words. 201 199 if (function_exists('mb_convert_encoding')) { -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Mime/SimpleHeaderFactory.php
r1331083 r1653904 113 113 $params = array()) 114 114 { 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); 121 116 if (isset($value)) { 122 117 $header->setFieldBodyModel($value); -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Mime/SimpleHeaderSet.php
r1331083 r1653904 141 141 $lowerName = strtolower($name); 142 142 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]); 144 153 } 145 154 … … 174 183 public function get($name, $index = 0) 175 184 { 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 } 180 197 } 181 198 } … … 250 267 * Create a new instance of this HeaderSet. 251 268 * 252 * @return Swift_Mime_HeaderSet269 * @return self 253 270 */ 254 271 public function newInstance() … … 350 367 $lowerA = strtolower($a); 351 368 $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 } 358 376 359 377 if ($aPos == -1) { … … 363 381 } 364 382 365 return ($aPos < $bPos)? -1 : 1;383 return $aPos < $bPos ? -1 : 1; 366 384 } 367 385 -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Mime/SimpleMessage.php
r1331083 r1653904 16 16 class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime_Message 17 17 { 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 18 24 /** 19 25 * Create a new SimpleMessage with $headers, $encoder and $cache. … … 68 74 * @param string $subject 69 75 * 70 * @return Swift_Mime_SimpleMessage76 * @return $this 71 77 */ 72 78 public function setSubject($subject) … … 94 100 * @param int $date 95 101 * 96 * @return Swift_Mime_SimpleMessage102 * @return $this 97 103 */ 98 104 public function setDate($date) … … 120 126 * @param string $address 121 127 * 122 * @return Swift_Mime_SimpleMessage128 * @return $this 123 129 */ 124 130 public function setReturnPath($address) … … 149 155 * @param string $name optional 150 156 * 151 * @return Swift_Mime_SimpleMessage157 * @return $this 152 158 */ 153 159 public function setSender($address, $name = null) … … 182 188 * @param string $name optional 183 189 * 184 * @return Swift_Mime_SimpleMessage190 * @return $this 185 191 */ 186 192 public function addFrom($address, $name = null) … … 203 209 * @param string $name optional 204 210 * 205 * @return Swift_Mime_SimpleMessage211 * @return $this 206 212 */ 207 213 public function setFrom($addresses, $name = null) … … 236 242 * @param string $name optional 237 243 * 238 * @return Swift_Mime_SimpleMessage244 * @return $this 239 245 */ 240 246 public function addReplyTo($address, $name = null) … … 254 260 * associated with the address. 255 261 * 256 * @param string$addresses262 * @param mixed $addresses 257 263 * @param string $name optional 258 264 * 259 * @return Swift_Mime_SimpleMessage265 * @return $this 260 266 */ 261 267 public function setReplyTo($addresses, $name = null) … … 290 296 * @param string $name optional 291 297 * 292 * @return Swift_Mime_SimpleMessage298 * @return $this 293 299 */ 294 300 public function addTo($address, $name = null) … … 312 318 * @param string $name optional 313 319 * 314 * @return Swift_Mime_SimpleMessage320 * @return $this 315 321 */ 316 322 public function setTo($addresses, $name = null) … … 345 351 * @param string $name optional 346 352 * 347 * @return Swift_Mime_SimpleMessage353 * @return $this 348 354 */ 349 355 public function addCc($address, $name = null) … … 364 370 * @param string $name optional 365 371 * 366 * @return Swift_Mime_SimpleMessage372 * @return $this 367 373 */ 368 374 public function setCc($addresses, $name = null) … … 397 403 * @param string $name optional 398 404 * 399 * @return Swift_Mime_SimpleMessage405 * @return $this 400 406 */ 401 407 public function addBcc($address, $name = null) … … 416 422 * @param string $name optional 417 423 * 418 * @return Swift_Mime_SimpleMessage424 * @return $this 419 425 */ 420 426 public function setBcc($addresses, $name = null) … … 448 454 * @param int $priority 449 455 * 450 * @return Swift_Mime_SimpleMessage456 * @return $this 451 457 */ 452 458 public function setPriority($priority) 453 459 { 454 460 $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', 460 466 ); 461 467 $pMapKeys = array_keys($priorityMap); … … 496 502 * @param array $addresses 497 503 * 498 * @return Swift_Mime_SimpleMessage504 * @return $this 499 505 */ 500 506 public function setReadReceiptTo($addresses) … … 523 529 * @param Swift_Mime_MimeEntity $entity 524 530 * 525 * @return Swift_Mime_SimpleMessage531 * @return $this 526 532 */ 527 533 public function attach(Swift_Mime_MimeEntity $entity) … … 537 543 * @param Swift_Mime_MimeEntity $entity 538 544 * 539 * @return Swift_Mime_SimpleMessage545 * @return $this 540 546 */ 541 547 public function detach(Swift_Mime_MimeEntity $entity) -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Mime/SimpleMimeEntity.php
r1331083 r1653904 162 162 * @param string $type 163 163 * 164 * @return Swift_Mime_SimpleMimeEntity164 * @return $this 165 165 */ 166 166 public function setContentType($type) … … 193 193 * @param string $id 194 194 * 195 * @return Swift_Mime_SimpleMimeEntity195 * @return $this 196 196 */ 197 197 public function setId($id) … … 224 224 * @param string $description 225 225 * 226 * @return Swift_Mime_SimpleMimeEntity226 * @return $this 227 227 */ 228 228 public function setDescription($description) … … 252 252 * @param int $length 253 253 * 254 * @return Swift_Mime_SimpleMimeEntity254 * @return $this 255 255 */ 256 256 public function setMaxLineLength($length) … … 277 277 * @param int $compoundLevel For internal use only 278 278 * 279 * @return Swift_Mime_SimpleMimeEntity279 * @return $this 280 280 */ 281 281 public function setChildren(array $children, $compoundLevel = null) … … 283 283 // TODO: Try to refactor this logic 284 284 285 $compoundLevel = isset($compoundLevel) 286 ? $compoundLevel 287 : $this->_getCompoundLevel($children) 288 ; 289 285 $compoundLevel = isset($compoundLevel) ? $compoundLevel : $this->_getCompoundLevel($children); 290 286 $immediateChildren = array(); 291 287 $grandchildren = array(); … … 312 308 } 313 309 314 if ( !empty($immediateChildren)) {310 if ($immediateChildren) { 315 311 $lowestLevel = $this->_getNeededChildLevel($immediateChildren[0], $compoundLevel); 316 312 … … 318 314 // immediate children 319 315 foreach ($this->_compositeRanges as $mediaType => $range) { 320 if ($lowestLevel > $range[0] 321 && $lowestLevel <= $range[1]) { 316 if ($lowestLevel > $range[0] && $lowestLevel <= $range[1]) { 322 317 $newContentType = $mediaType; 318 323 319 break; 324 320 } … … 350 346 public function getBody() 351 347 { 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; 355 349 } 356 350 … … 362 356 * @param string $contentType optional 363 357 * 364 * @return Swift_Mime_SimpleMimeEntity358 * @return $this 365 359 */ 366 360 public function setBody($body, $contentType = null) … … 393 387 * @param Swift_Mime_ContentEncoder $encoder 394 388 * 395 * @return Swift_Mime_SimpleMimeEntity389 * @return $this 396 390 */ 397 391 public function setEncoder(Swift_Mime_ContentEncoder $encoder) … … 429 423 * @throws Swift_RfcComplianceException 430 424 * 431 * @return Swift_Mime_SimpleMimeEntity425 * @return $this 432 426 */ 433 427 public function setBoundary($boundary) … … 487 481 $body = $this->_cache->getString($this->_cacheKey, 'body'); 488 482 } 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); 495 485 } 496 486 $string .= $body; … … 603 593 604 594 return true; 605 } else {606 return false; 607 }595 } 596 597 return false; 608 598 } 609 599 … … 627 617 628 618 return true; 629 } else {630 return false; 631 }619 } 620 621 return false; 632 622 } 633 623 … … 717 707 private function _assertValidBoundary($boundary) 718 708 { 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)) { 722 710 throw new Swift_RfcComplianceException('Mime boundary set is not RFC 2046 compliant.'); 723 711 } … … 758 746 $lowercaseType = strtolower($child->getContentType()); 759 747 760 if (isset($filter[$realLevel]) 761 && isset($filter[$realLevel][$lowercaseType])) { 748 if (isset($filter[$realLevel]) && isset($filter[$realLevel][$lowercaseType])) { 762 749 return $filter[$realLevel][$lowercaseType]; 763 } else {764 return $realLevel; 765 }750 } 751 752 return $realLevel; 766 753 } 767 754 768 755 private function _createChild() 769 756 { 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); 772 758 } 773 759 … … 801 787 // Sort in order of preference, if there is one 802 788 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 } 824 807 825 808 /** … … 828 811 public function __destruct() 829 812 { 830 $this->_cache->clearAll($this->_cacheKey); 813 if ($this->_cache instanceof Swift_KeyCache) { 814 $this->_cache->clearAll($this->_cacheKey); 815 } 831 816 } 832 817 … … 840 825 private function _assertValidId($id) 841 826 { 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.'>'); 850 829 } 851 830 } … … 858 837 $this->_headers = clone $this->_headers; 859 838 $this->_encoder = clone $this->_encoder; 860 $this->_cacheKey = uniqid();839 $this->_cacheKey = md5(uniqid(getmypid().mt_rand(), true)); 861 840 $children = array(); 862 841 foreach ($this->_children as $pos => $child) { -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/MimePart.php
r1331083 r1653904 51 51 * @param string $charset 52 52 * 53 * @return Swift_Mime_MimePart53 * @return self 54 54 */ 55 55 public static function newInstance($body = null, $contentType = null, $charset = null) -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/NullTransport.php
r1331083 r1653904 16 16 class Swift_NullTransport extends Swift_Transport_NullTransport 17 17 { 18 /**19 * Create a new NullTransport.20 */21 18 public function __construct() 22 19 { … … 31 28 * Create a new NullTransport instance. 32 29 * 33 * @return Swift_NullTransport30 * @return self 34 31 */ 35 32 public static function newInstance() -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Plugins/DecoratorPlugin.php
r1331083 r1653904 158 158 if ($this->_replacements instanceof Swift_Plugins_Decorator_Replacements) { 159 159 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; 166 163 } 167 164 -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Plugins/ImpersonatePlugin.php
r1331083 r1653904 19 19 * The sender to impersonate. 20 20 * 21 * @var String21 * @var string 22 22 */ 23 23 private $_sender; -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Plugins/MessageLogger.php
r1331083 r1653904 17 17 { 18 18 /** 19 * @var array19 * @var Swift_Mime_Message[] 20 20 */ 21 21 private $messages; … … 29 29 * Get the message list. 30 30 * 31 * @return array31 * @return Swift_Mime_Message[] 32 32 */ 33 33 public function getMessages() -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Plugins/PopBeforeSmtpPlugin.php
r1331083 r1653904 64 64 * @param string $crypto as "tls" or "ssl" 65 65 * 66 * @return Swift_Plugins_PopBeforeSmtpPlugin66 * @return self 67 67 */ 68 68 public static function newInstance($host, $port = 110, $crypto = null) … … 76 76 * @param Swift_Plugins_Pop_Pop3Connection $connection 77 77 * 78 * @return Swift_Plugins_PopBeforeSmtpPlugin78 * @return $this 79 79 */ 80 80 public function setConnection(Swift_Plugins_Pop_Pop3Connection $connection) … … 100 100 * @param int $timeout 101 101 * 102 * @return Swift_Plugins_PopBeforeSmtpPlugin102 * @return $this 103 103 */ 104 104 public function setTimeout($timeout) … … 114 114 * @param string $username 115 115 * 116 * @return Swift_Plugins_PopBeforeSmtpPlugin116 * @return $this 117 117 */ 118 118 public function setUsername($username) … … 128 128 * @param string $password 129 129 * 130 * @return Swift_Plugins_PopBeforeSmtpPlugin130 * @return $this 131 131 */ 132 132 public function setPassword($password) -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Plugins/ReporterPlugin.php
r1331083 r1653904 50 50 $failures = array_flip($evt->getFailedRecipients()); 51 51 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); 57 53 } 58 54 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); 64 56 } 65 57 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); 71 59 } 72 60 } -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Plugins/ThrottlerPlugin.php
r1331083 r1653904 99 99 100 100 switch ($this->_mode) { 101 case self::BYTES_PER_MINUTE :101 case self::BYTES_PER_MINUTE: 102 102 $sleep = $this->_throttleBytesPerMinute($duration); 103 103 break; 104 case self::MESSAGES_PER_SECOND :104 case self::MESSAGES_PER_SECOND: 105 105 $sleep = $this->_throttleMessagesPerSecond($duration); 106 106 break; 107 case self::MESSAGES_PER_MINUTE :107 case self::MESSAGES_PER_MINUTE: 108 108 $sleep = $this->_throttleMessagesPerMinute($duration); 109 109 break; 110 default :110 default: 111 111 $sleep = 0; 112 112 break; … … 152 152 if (isset($this->_timer)) { 153 153 return $this->_timer->getTimestamp(); 154 } else {155 return time(); 156 }154 } 155 156 return time(); 157 157 } 158 158 -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Preferences.php
r1331083 r1653904 27 27 * Gets the instance of Preferences. 28 28 * 29 * @return Swift_Preferences29 * @return self 30 30 */ 31 31 public static function getInstance() … … 43 43 * @param string $charset 44 44 * 45 * @return Swift_Preferences45 * @return $this 46 46 */ 47 47 public function setCharset($charset) 48 48 { 49 Swift_DependencyContainer::getInstance() 50 ->register('properties.charset')->asValue($charset); 49 Swift_DependencyContainer::getInstance()->register('properties.charset')->asValue($charset); 51 50 52 51 return $this; … … 58 57 * @param string $dir 59 58 * 60 * @return Swift_Preferences59 * @return $this 61 60 */ 62 61 public function setTempDir($dir) 63 62 { 64 Swift_DependencyContainer::getInstance() 65 ->register('tempdir')->asValue($dir); 63 Swift_DependencyContainer::getInstance()->register('tempdir')->asValue($dir); 66 64 67 65 return $this; … … 73 71 * @param string $type 74 72 * 75 * @return Swift_Preferences73 * @return $this 76 74 */ 77 75 public function setCacheType($type) 78 76 { 79 Swift_DependencyContainer::getInstance() 80 ->register('cache')->asAliasOf(sprintf('cache.%s', $type)); 77 Swift_DependencyContainer::getInstance()->register('cache')->asAliasOf(sprintf('cache.%s', $type)); 81 78 82 79 return $this; … … 88 85 * @param bool $dotEscape 89 86 * 90 * @return Swift_Preferences87 * @return $this 91 88 */ 92 89 public function setQPDotEscape($dotEscape) -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/SendmailTransport.php
r1331083 r1653904 37 37 * @param string $command 38 38 * 39 * @return Swift_SendmailTransport39 * @return self 40 40 */ 41 41 public static function newInstance($command = '/usr/sbin/sendmail -bs') -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Signers/BodySigner.php
r1331083 r1653904 21 21 * @param Swift_Message $message 22 22 * 23 * @return Swift_Signers_BodySigner23 * @return self 24 24 */ 25 25 public function signMessage(Swift_Message $message); -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Signers/DKIMSigner.php
r1331083 r1653904 40 40 * Hash algorithm used. 41 41 * 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'; 45 47 46 48 /** … … 63 65 * @var array 64 66 */ 65 protected $_ignoredHeaders = array( );67 protected $_ignoredHeaders = array('return-path' => true); 66 68 67 69 /** 68 70 * Signer identity. 69 71 * 70 * @var unknown_type72 * @var string 71 73 */ 72 74 protected $_signerIdentity; … … 102 104 /** 103 105 * When will the signature expires false means not embedded, if sigTimestamp is auto 104 * Expiration is relative, otherw hise it's absolute.106 * Expiration is relative, otherwise it's absolute. 105 107 * 106 108 * @var int … … 124 126 125 127 /** 126 * If debugHeaders is set store debugData shere.128 * If debugHeaders is set store debugData here. 127 129 * 128 130 * @var string … … 143 145 */ 144 146 protected $_dkimHeader; 145 146 /**147 * Hash Handler.148 *149 * @var hash_ressource150 */151 private $_headerHashHandler;152 147 153 148 private $_bodyHashHandler; … … 182 177 $this->_signerIdentity = '@'.$domainName; 183 178 $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 } 184 184 } 185 185 … … 191 191 * @param string $selector 192 192 * 193 * @return Swift_Signers_DKIMSigner193 * @return self 194 194 */ 195 195 public static function newInstance($privateKey, $domainName, $selector) … … 207 207 $this->_headerHash = null; 208 208 $this->_signedHeaders = array(); 209 $this->_headerHashHandler = null;210 209 $this->_bodyHash = null; 211 210 $this->_bodyHashHandler = null; … … 232 231 * @return int 233 232 */ 233 // TODO fix return 234 234 public function write($bytes) 235 235 { … … 243 243 * For any bytes that are currently buffered inside the stream, force them 244 244 * off the buffer. 245 *246 * @throws Swift_IoException247 245 */ 248 246 public function commit() … … 285 283 } 286 284 } 287 288 return;289 285 } 290 286 … … 301 297 302 298 /** 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 308 306 */ 309 307 public function setHashAlgorithm($hash) 310 308 { 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); 316 321 } 317 322 … … 324 329 * @param string $canon 325 330 * 326 * @return Swift_Signers_DKIMSigner331 * @return $this 327 332 */ 328 333 public function setBodyCanon($canon) … … 342 347 * @param string $canon 343 348 * 344 * @return Swift_Signers_DKIMSigner349 * @return $this 345 350 */ 346 351 public function setHeaderCanon($canon) … … 360 365 * @param string $identity 361 366 * 362 * @return Swift_Signers_DKIMSigner367 * @return $this 363 368 */ 364 369 public function setSignerIdentity($identity) … … 374 379 * @param mixed $len (bool or int) 375 380 * 376 * @return Swift_Signers_DKIMSigner381 * @return $this 377 382 */ 378 383 public function setBodySignedLen($len) … … 382 387 $this->_maxLen = PHP_INT_MAX; 383 388 } elseif ($len === false) { 384 $this-> showLen = false;389 $this->_showLen = false; 385 390 $this->_maxLen = PHP_INT_MAX; 386 391 } else { … … 395 400 * Set the signature timestamp. 396 401 * 397 * @param timestamp $time398 * 399 * @return Swift_Signers_DKIMSigner402 * @param int $time A timestamp 403 * 404 * @return $this 400 405 */ 401 406 public function setSignatureTimestamp($time) … … 409 414 * Set the signature expiration timestamp. 410 415 * 411 * @param timestamp $time412 * 413 * @return Swift_Signers_DKIMSigner416 * @param int $time A timestamp 417 * 418 * @return $this 414 419 */ 415 420 public function setSignatureExpiration($time) … … 441 446 // Init 442 447 switch ($this->_hashAlgorithm) { 443 case 'rsa-sha256' :448 case 'rsa-sha256': 444 449 $this->_bodyHashHandler = hash_init('sha256'); 445 450 break; 446 case 'rsa-sha1' :451 case 'rsa-sha1': 447 452 $this->_bodyHashHandler = hash_init('sha1'); 448 453 break; … … 576 581 { 577 582 switch ($this->_headerCanon) { 578 case 'relaxed' :583 case 'relaxed': 579 584 // Prepare Header and cascade 580 585 $exploded = explode(':', $header, 2); … … 583 588 $value = preg_replace("/[ \t][ \t]+/", ' ', $value); 584 589 $header = $name.':'.trim($value).($is_sig ? '' : "\r\n"); 585 case 'simple' :590 case 'simple': 586 591 // Nothing to do 587 592 } … … 589 594 } 590 595 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 */ 591 601 protected function _endOfHeaders() 592 602 { 593 //$this->_headerHash=hash_final($this->_headerHashHandler, true);594 603 } 595 604 … … 605 614 } 606 615 switch ($string[$i]) { 607 case "\r" :616 case "\r": 608 617 $this->_bodyCanonLastChar = "\r"; 609 618 break; 610 case "\n" :619 case "\n": 611 620 if ($this->_bodyCanonLastChar == "\r") { 612 621 if ($method) { … … 624 633 } 625 634 break; 626 case ' ' :627 case "\t" :635 case ' ': 636 case "\t": 628 637 if ($method) { 629 638 $this->_bodyCanonSpace = true; 630 639 break; 631 640 } 632 default :641 default: 633 642 if ($this->_bodyCanonEmptyCounter > 0) { 634 643 $canon .= str_repeat("\r\n", $this->_bodyCanonEmptyCounter); … … 683 692 { 684 693 $signature = ''; 694 685 695 switch ($this->_hashAlgorithm) { 686 696 case 'rsa-sha1': -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Signers/DomainKeySigner.php
r1331083 r1653904 132 132 * @param string $selector 133 133 * 134 * @return Swift_Signers_DomainKeySigner134 * @return self 135 135 */ 136 136 public static function newInstance($privateKey, $domainName, $selector) … … 142 142 * Resets internal states. 143 143 * 144 * @return Swift_Signers_DomainKeysSigner144 * @return $this 145 145 */ 146 146 public function reset() … … 170 170 * @throws Swift_IoException 171 171 * 172 * @return int 173 * @return Swift_Signers_DomainKeysSigner 172 * @return $this 174 173 */ 175 174 public function write($bytes) … … 189 188 * @throws Swift_IoException 190 189 * 191 * @return Swift_Signers_DomainKeysSigner190 * @return $this 192 191 */ 193 192 public function commit() … … 204 203 * @param Swift_InputByteStream $is 205 204 * 206 * @return Swift_Signers_DomainKeysSigner205 * @return $this 207 206 */ 208 207 public function bind(Swift_InputByteStream $is) … … 222 221 * @param Swift_InputByteStream $is 223 222 * 224 * @return Swift_Signers_DomainKeysSigner223 * @return $this 225 224 */ 226 225 public function unbind(Swift_InputByteStream $is) … … 231 230 unset($this->_bound[$k]); 232 231 233 return;232 break; 234 233 } 235 234 } … … 244 243 * @throws Swift_IoException 245 244 * 246 * @return Swift_Signers_DomainKeysSigner245 * @return $this 247 246 */ 248 247 public function flushBuffers() … … 258 257 * @param string $hash 259 258 * 260 * @return Swift_Signers_DomainKeysSigner259 * @return $this 261 260 */ 262 261 public function setHashAlgorithm($hash) … … 272 271 * @param string $canon simple | nofws defaults to simple 273 272 * 274 * @return Swift_Signers_DomainKeysSigner273 * @return $this 275 274 */ 276 275 public function setCanon($canon) … … 290 289 * @param string $identity 291 290 * 292 * @return Swift_Signers_DomainKeySigner291 * @return $this 293 292 */ 294 293 public function setSignerIdentity($identity) … … 304 303 * @param bool $debug 305 304 * 306 * @return Swift_Signers_DomainKeySigner305 * @return $this 307 306 */ 308 307 public function setDebugHeaders($debug) … … 337 336 if ($this->_debugHeaders) { 338 337 return array('DomainKey-Signature', 'X-DebugHash'); 339 } else {340 return array('DomainKey-Signature'); 341 }338 } 339 340 return array('DomainKey-Signature'); 342 341 } 343 342 … … 347 346 * @param string $header_name 348 347 * 349 * @return Swift_Signers_DomainKeySigner348 * @return $this 350 349 */ 351 350 public function ignoreHeader($header_name) … … 361 360 * @param Swift_Mime_HeaderSet $headers 362 361 * 363 * @return Swift_Signers_DomainKeySigner362 * @return $this 364 363 */ 365 364 public function setHeaders(Swift_Mime_HeaderSet $headers) … … 393 392 * @param Swift_Mime_HeaderSet $headers 394 393 * 395 * @return Swift_Signers_DomainKeySigner394 * @return $this 396 395 */ 397 396 public function addSignature(Swift_Mime_HeaderSet $headers) … … 414 413 { 415 414 switch ($this->_canon) { 416 case 'nofws' :415 case 'nofws': 417 416 // Prepare Header and cascade 418 417 $exploded = explode(':', $header, 2); … … 421 420 $value = preg_replace("/[ \t][ \t]+/", ' ', $value); 422 421 $header = $name.':'.trim($value)."\r\n"; 423 case 'simple' :422 case 'simple': 424 423 // Nothing to do 425 424 } … … 443 442 } 444 443 switch ($string[$i]) { 445 case "\r" :444 case "\r": 446 445 $this->_bodyCanonLastChar = "\r"; 447 446 break; 448 case "\n" :447 case "\n": 449 448 if ($this->_bodyCanonLastChar == "\r") { 450 449 if ($nofws) { … … 462 461 } 463 462 break; 464 case ' ' :465 case "\t" :463 case ' ': 464 case "\t": 466 465 case "\x09": //HTAB 467 466 if ($nofws) { … … 469 468 break; 470 469 } 471 default :470 default: 472 471 if ($this->_bodyCanonEmptyCounter > 0) { 473 472 $canon .= str_repeat("\r\n", $this->_bodyCanonEmptyCounter); … … 499 498 // Init 500 499 switch ($this->_hashAlgorithm) { 501 case 'rsa-sha1' :500 case 'rsa-sha1': 502 501 $this->_hashHandler = hash_init('sha1'); 503 502 break; 504 503 } 505 $this->_ canonLine = '';504 $this->_bodyCanonLine = ''; 506 505 } 507 506 -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Signers/HeaderSigner.php
r1331083 r1653904 21 21 * @param string $header_name 22 22 * 23 * @return Swift_Signers_HeaderSigner23 * @return self 24 24 */ 25 25 public function ignoreHeader($header_name); … … 28 28 * Prepare the Signer to get a new Body. 29 29 * 30 * @return Swift_Signers_HeaderSigner30 * @return self 31 31 */ 32 32 public function startBody(); … … 35 35 * Give the signal that the body has finished streaming. 36 36 * 37 * @return Swift_Signers_HeaderSigner37 * @return self 38 38 */ 39 39 public function endBody(); … … 44 44 * @param Swift_Mime_SimpleHeaderSet $headers 45 45 * 46 * @return Swift_Signers_HeaderSigner46 * @return self 47 47 */ 48 48 public function setHeaders(Swift_Mime_HeaderSet $headers); … … 53 53 * @param Swift_Mime_HeaderSet $headers 54 54 * 55 * @return Swift_Signers_HeaderSigner55 * @return self 56 56 */ 57 57 public function addSignature(Swift_Mime_HeaderSet $headers); -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Signers/OpenDKIMSigner.php
r1331083 r1653904 30 30 public function __construct($privateKey, $domainName, $selector) 31 31 { 32 if (extension_loaded('opendkim')) { 33 $this->_peclLoaded = true; 34 } else { 32 if (!extension_loaded('opendkim')) { 35 33 throw new Swift_SwiftException('php-opendkim extension not found'); 36 34 } 35 36 $this->_peclLoaded = true; 37 37 38 parent::__construct($privateKey, $domainName, $selector); 38 39 } … … 62 63 $bodyLen = -1; 63 64 } 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; 67 68 $this->_dkimHandler = new OpenDKIMSign($this->_privateKey, $this->_selector, $this->_domainName, $headerCanon, $bodyCanon, $hash, $bodyLen); 68 69 // Hardcode signature Margin for now … … 131 132 * Set the signature timestamp. 132 133 * 133 * @param timestamp$time134 * @param int $time 134 135 * 135 * @return Swift_Signers_DKIMSigner136 * @return $this 136 137 */ 137 138 public function setSignatureTimestamp($time) … … 145 146 * Set the signature expiration timestamp. 146 147 * 147 * @param timestamp$time148 * @param int $time 148 149 * 149 * @return Swift_Signers_DKIMSigner150 * @return $this 150 151 */ 151 152 public function setSignatureExpiration($time) … … 161 162 * @param bool $debug 162 163 * 163 * @return Swift_Signers_DKIMSigner164 * @return $this 164 165 */ 165 166 public function setDebugHeaders($debug) -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Signers/SMimeSigner.php
r1331083 r1653904 42 42 * Constructor. 43 43 * 44 * @param string $certificate45 * @param string $privateKey46 * @param string $encryptCertificate44 * @param string|null $signCertificate 45 * @param string|null $signPrivateKey 46 * @param string|null $encryptCertificate 47 47 */ 48 48 public function __construct($signCertificate = null, $signPrivateKey = null, $encryptCertificate = null) … … 75 75 * @param string $privateKey 76 76 * 77 * @return Swift_Signers_SMimeSigner77 * @return self 78 78 */ 79 79 public static function newInstance($certificate = null, $privateKey = null) … … 85 85 * Set the certificate location to use for signing. 86 86 * 87 * @ linkhttp://www.php.net/manual/en/openssl.pkcs7.flags.php87 * @see http://www.php.net/manual/en/openssl.pkcs7.flags.php 88 88 * 89 89 * @param string $certificate … … 92 92 * @param string $extraCerts A file containing intermediate certificates needed by the signing certificate 93 93 * 94 * @return Swift_Signers_SMimeSigner94 * @return $this 95 95 */ 96 96 public function setSignCertificate($certificate, $privateKey = null, $signOptions = PKCS7_DETACHED, $extraCerts = null) … … 118 118 * Set the certificate location to use for encryption. 119 119 * 120 * @ linkhttp://www.php.net/manual/en/openssl.pkcs7.flags.php121 * @ linkhttp://nl3.php.net/manual/en/openssl.ciphers.php120 * @see http://www.php.net/manual/en/openssl.pkcs7.flags.php 121 * @see http://nl3.php.net/manual/en/openssl.ciphers.php 122 122 * 123 123 * @param string|array $recipientCerts Either an single X.509 certificate, or an assoc array of X.509 certificates. 124 124 * @param int $cipher 125 125 * 126 * @return Swift_Signers_SMimeSigner126 * @return $this 127 127 */ 128 128 public function setEncryptCertificate($recipientCerts, $cipher = null) … … 168 168 * As this goes against the official specs, its recommended to only use 'encryption -> signing' when specifically targeting these 'broken' clients. 169 169 * 170 * @param string$signThenEncrypt171 * 172 * @return Swift_Signers_SMimeSigner170 * @param bool $signThenEncrypt 171 * 172 * @return $this 173 173 */ 174 174 public function setSignThenEncrypt($signThenEncrypt = true) … … 190 190 * Resets internal states. 191 191 * 192 * @return Swift_Signers_SMimeSigner192 * @return $this 193 193 */ 194 194 public function reset() … … 202 202 * @param Swift_Message $message 203 203 * 204 * @return Swift_Signers_SMimeSigner204 * @return $this 205 205 */ 206 206 public function signMessage(Swift_Message $message) … … 401 401 402 402 $boundary = trim($contentTypeData['1'], '"'); 403 $boundaryLen = strlen($boundary);404 403 405 404 // Skip the header and CRLF CRLF -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/SmtpTransport.php
r1331083 r1653904 50 50 * @param string $security 51 51 * 52 * @return Swift_SmtpTransport52 * @return self 53 53 */ 54 54 public static function newInstance($host = 'localhost', $port = 25, $security = null) -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/SpoolTransport.php
r1331083 r1653904 39 39 * @param Swift_Spool $spool 40 40 * 41 * @return Swift_SpoolTransport41 * @return self 42 42 */ 43 43 public static function newInstance(Swift_Spool $spool) -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/StreamFilters/ByteArrayReplacementFilter.php
r1331083 r1653904 125 125 $newBuffer = array(); 126 126 $buf_size = count($buffer); 127 $last_size = 0; 127 128 for ($i = 0; $i < $buf_size; ++$i) { 128 129 $search_pos = $this->_tree; … … 131 132 for ($j = 0; $j <= $this->_treeMaxLen; ++$j) { 132 133 // 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]])) { 134 135 $search_pos = $search_pos[$buffer[$p]]; 135 136 // 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 43 43 public function shouldBuffer($buffer) 44 44 { 45 if ('' === $buffer) { 46 return false; 47 } 48 45 49 $endOfBuffer = substr($buffer, -1); 46 50 foreach ((array) $this->_search as $needle) { -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Transport/AbstractSmtpTransport.php
r1331083 r1653904 58 58 * @param string $domain 59 59 * 60 * @return Swift_Transport_AbstractSmtpTransport60 * @return $this 61 61 */ 62 62 public function setLocalDomain($domain) … … 397 397 $line = $this->_buffer->readLine($seq); 398 398 $response .= $line; 399 } while (null !== $line && false !== $line && ' ' != $line {3});399 } while (null !== $line && false !== $line && ' ' != $line[3]); 400 400 } catch (Swift_TransportException $e) { 401 401 $this->_throwException($e); … … 418 418 try { 419 419 $this->_doRcptToCommand($forwardPath); 420 $sent++;420 ++$sent; 421 421 } catch (Swift_TransportException $e) { 422 422 $failedRecipients[] = $forwardPath; … … 462 462 private function _lookupHostname() 463 463 { 464 if (!empty($_SERVER['SERVER_NAME']) 465 && $this->_isFqdn($_SERVER['SERVER_NAME'])) { 464 if (!empty($_SERVER['SERVER_NAME']) && $this->_isFqdn($_SERVER['SERVER_NAME'])) { 466 465 $this->_domain = $_SERVER['SERVER_NAME']; 467 466 } 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']); 469 475 } 470 476 } … … 476 482 if (false !== $dotPos = strpos($hostname, '.')) { 477 483 return ($dotPos > 0) && ($dotPos != strlen($hostname) - 1); 478 } else {479 return false; 480 }484 } 485 486 return false; 481 487 } 482 488 … … 486 492 public function __destruct() 487 493 { 488 $this->stop(); 494 try { 495 $this->stop(); 496 } catch (Exception $e) { 497 } 489 498 } 490 499 } -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php
r1331083 r1653904 42 42 public function authenticate(Swift_Transport_SmtpAgent $agent, $username, $password) 43 43 { 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')) { 49 45 throw new LogicException('The OpenSSL extension must be enabled to use the NTLM authenticator.'); 50 46 } 51 47 52 48 if (!function_exists('bcmul')) { 53 throw new LogicException('The BCMat ch functions must be enabled to use the NTLM authenticator.');49 throw new LogicException('The BCMath functions must be enabled to use the NTLM authenticator.'); 54 50 } 55 51 … … 301 297 } 302 298 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); 306 307 } 307 308 … … 366 367 { 367 368 // Get our timestamp (tricky!) 368 bcscale(0);369 370 369 $time = number_format($time, 0, '.', ''); // save microtime to string 371 $time = bcadd($time, '11644473600000' ); // add epoch time372 $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. 373 372 374 373 $binary = $this->si2bin($time, 64); // create 64 bit binary string 375 374 $timestamp = ''; 376 for ($i = 0; $i < 8; $i++) {375 for ($i = 0; $i < 8; ++$i) { 377 376 $timestamp .= chr(bindec(substr($binary, -(($i + 1) * 8), 8))); 378 377 } … … 438 437 $material = array(bin2hex($key[0])); 439 438 $len = strlen($key); 440 for ($i = 1; $i < $len; $i++) {439 for ($i = 1; $i < $len; ++$i) { 441 440 list($high, $low) = str_split(bin2hex($key[$i])); 442 441 $v = $this->castToByte(ord($key[$i - 1]) << (7 + 1 - $i) | $this->uRShift(hexdec(dechex(hexdec($high) & 0xf).dechex(hexdec($low) & 0xf)), $i)); … … 464 463 465 464 /** HELPER FUNCTIONS */ 465 466 466 /** 467 467 * Create our security buffer depending on length and offset. … … 566 566 567 567 /** ENCRYPTION ALGORITHMS */ 568 568 569 /** 569 570 * DES Encryption. 570 571 * 571 * @param string $value 572 * @param string $value An 8-byte string 572 573 * @param string $key 573 574 * … … 576 577 protected function desEncrypt($value, $key) 577 578 { 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); 582 581 } 583 582 -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Transport/Esmtp/AuthHandler.php
r1331083 r1653904 173 173 if (in_array(strtolower($authenticator->getAuthKeyword()), 174 174 array_map('strtolower', $this->_esmtpParams))) { 175 $count++;175 ++$count; 176 176 if ($authenticator->authenticate($agent, $this->_username, $this->_password)) { 177 177 return; -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Transport/EsmtpTransport.php
r1331083 r1653904 43 43 'tls' => false, 44 44 'type' => Swift_Transport_IoBuffer::TYPE_SOCKET, 45 'stream_context_options' => array(), 45 46 ); 46 47 … … 63 64 * @param string $host 64 65 * 65 * @return Swift_Transport_EsmtpTransport66 * @return $this 66 67 */ 67 68 public function setHost($host) … … 87 88 * @param int $port 88 89 * 89 * @return Swift_Transport_EsmtpTransport90 * @return $this 90 91 */ 91 92 public function setPort($port) … … 111 112 * @param int $timeout seconds 112 113 * 113 * @return Swift_Transport_EsmtpTransport114 * @return $this 114 115 */ 115 116 public function setTimeout($timeout) … … 136 137 * @param string $encryption 137 138 * 138 * @return Swift_Transport_EsmtpTransport139 * @return $this 139 140 */ 140 141 public function setEncryption($encryption) 141 142 { 143 $encryption = strtolower($encryption); 142 144 if ('tls' == $encryption) { 143 145 $this->_params['protocol'] = 'tcp'; … … 162 164 163 165 /** 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 /** 164 190 * Sets the source IP. 165 191 * 166 192 * @param string $source 167 193 * 168 * @return Swift_Transport_EsmtpTransport194 * @return $this 169 195 */ 170 196 public function setSourceIp($source) … … 190 216 * @param Swift_Transport_EsmtpHandler[] $handlers 191 217 * 192 * @return Swift_Transport_EsmtpTransport218 * @return $this 193 219 */ 194 220 public function setExtensionHandlers(array $handlers) … … 198 224 $assoc[$handler->getHandledKeyword()] = $handler; 199 225 } 200 uasort($assoc, array($this, '_sortHandlers')); 226 227 @uasort($assoc, array($this, '_sortHandlers')); 201 228 $this->_handlers = $assoc; 202 229 $this->_setHandlerParams(); … … 244 271 } 245 272 246 // -- Mixin invocation code247 248 273 /** Mixin handling method for ESMTP handlers */ 249 274 public function __call($method, $args) … … 255 280 $return = call_user_func_array(array($handler, $method), $args); 256 281 // Allow fluid method calls 257 if ( is_null($return)&& substr($method, 0, 3) == 'set') {282 if (null === $return && substr($method, 0, 3) == 'set') { 258 283 return $this; 259 284 } else { -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Transport/FailoverTransport.php
r1331083 r1653904 23 23 private $_currentTransport; 24 24 25 /** 26 * Creates a new FailoverTransport. 27 */ 25 // needed as __construct is called from elsewhere explicitly 28 26 public function __construct() 29 27 { … … 46 44 $maxTransports = count($this->_transports); 47 45 $sent = 0; 46 $this->_lastUsedTransport = null; 48 47 49 48 for ($i = 0; $i < $maxTransports … … 54 53 } 55 54 56 return $transport->send($message, $failedRecipients); 55 if ($sent = $transport->send($message, $failedRecipients)) { 56 $this->_lastUsedTransport = $transport; 57 58 return $sent; 59 } 57 60 } catch (Swift_TransportException $e) { 58 61 $this->_killCurrentTransport(); -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Transport/LoadBalancedTransport.php
r1331083 r1653904 31 31 32 32 /** 33 * Creates a new LoadBalancedTransport. 33 * The Transport used in the last successful send operation. 34 * 35 * @var Swift_Transport 34 36 */ 37 protected $_lastUsedTransport = null; 38 39 // needed as __construct is called from elsewhere explicitly 35 40 public function __construct() 36 41 { … … 56 61 { 57 62 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; 58 73 } 59 74 … … 101 116 $maxTransports = count($this->_transports); 102 117 $sent = 0; 118 $this->_lastUsedTransport = null; 103 119 104 120 for ($i = 0; $i < $maxTransports … … 109 125 } 110 126 if ($sent = $transport->send($message, $failedRecipients)) { 127 $this->_lastUsedTransport = $transport; 111 128 break; 112 129 } -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Transport/MailTransport.php
r1331083 r1653904 21 21 * 22 22 * @author Chris Corbyn 23 * 24 * @deprecated since 5.4.5 (to be removed in 6.0) 23 25 */ 24 26 class Swift_Transport_MailTransport implements Swift_Transport … … 41 43 public function __construct(Swift_Transport_MailInvoker $invoker, Swift_Events_EventDispatcher $eventDispatcher) 42 44 { 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 43 47 $this->_invoker = $invoker; 44 48 $this->_eventDispatcher = $eventDispatcher; … … 74 78 * @param string $params 75 79 * 76 * @return Swift_Transport_MailTransport80 * @return $this 77 81 */ 78 82 public function setExtraParams($params) … … 126 130 $subjectHeader = $message->getHeaders()->get('Subject'); 127 131 128 if ( !$toHeader) {132 if (0 === $count) { 129 133 $this->_throwException(new Swift_TransportException('Cannot send message without a recipient')); 130 134 } 131 $to = $toHeader ->getFieldBody();135 $to = $toHeader ? $toHeader->getFieldBody() : ''; 132 136 $subject = $subjectHeader ? $subjectHeader->getFieldBody() : ''; 133 137 … … 140 144 $messageStr = $message->toString(); 141 145 142 $message->getHeaders()->set($toHeader); 146 if ($toHeader) { 147 $message->getHeaders()->set($toHeader); 148 } 143 149 $message->getHeaders()->set($subjectHeader); 144 150 … … 157 163 // Non-windows (not using SMTP) 158 164 $headers = str_replace("\r\n", PHP_EOL, $headers); 165 $subject = str_replace("\r\n", PHP_EOL, $subject); 159 166 $body = str_replace("\r\n", PHP_EOL, $body); 167 $to = str_replace("\r\n", PHP_EOL, $to); 160 168 } else { 161 169 // Windows, using SMTP 162 170 $headers = str_replace("\r\n.", "\r\n..", $headers); 171 $subject = str_replace("\r\n.", "\r\n..", $subject); 163 172 $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))) { 168 177 if ($evt) { 169 178 $evt->setResult(Swift_Events_SendEvent::RESULT_SUCCESS); … … 235 244 return $path; 236 245 } 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 } 237 297 } -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Transport/SendmailTransport.php
r1331083 r1653904 65 65 * @param string $command 66 66 * 67 * @return Swift_Transport_SendmailTransport67 * @return $this 68 68 */ 69 69 public function setCommand($command) … … 103 103 $command = $this->getCommand(); 104 104 $buffer = $this->getBuffer(); 105 $count = 0; 105 106 106 107 if (false !== strpos($command, ' -t')) { -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Transport/SimpleMailInvoker.php
r994020 r1653904 33 33 if (!ini_get('safe_mode')) { 34 34 return @mail($to, $subject, $body, $headers, $extraParams); 35 } else {36 return @mail($to, $subject, $body, $headers);37 35 } 36 37 return @mail($to, $subject, $body, $headers); 38 38 } 39 39 } -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Transport/SpoolTransport.php
r1331083 r1653904 36 36 * @param Swift_Spool $spool 37 37 * 38 * @return Swift_Transport_SpoolTransport38 * @return $this 39 39 */ 40 40 public function setSpool(Swift_Spool $spool) -
cimy-swift-smtp/trunk/Swift/lib/classes/Swift/Transport/StreamBuffer.php
r1331083 r1653904 85 85 stream_set_blocking($this->_stream, 1); 86 86 } 87 88 87 } 89 88 } … … 261 260 $options['socket']['bindto'] = $this->_params['sourceIp'].':0'; 262 261 } 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); 264 267 if (false === $this->_stream) { 265 268 throw new Swift_TransportException( … … 289 292 2 => array('pipe', 'w'), 290 293 ); 294 $pipes = array(); 291 295 $this->_stream = proc_open($command, $descriptorSpec, $pipes); 292 296 stream_set_blocking($pipes[2], 0); -
cimy-swift-smtp/trunk/Swift/lib/dependency_maps/mime_deps.php
r994020 r1653904 1 1 <?php 2 2 3 require dirname(__FILE__).'/../mime_types.php';3 require __DIR__.'/../mime_types.php'; 4 4 5 5 Swift_DependencyContainer::getInstance() … … 118 118 // see https://github.com/php/php-src/commit/18bb426587d62f93c54c40bf8535eb8416603629 119 119 ->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') 121 121 ; 122 122 -
cimy-swift-smtp/trunk/Swift/lib/preferences.php
r994020 r1653904 21 21 // this should only be done when Swiftmailer won't use the native QP content encoder 22 22 // see mime_deps.php 23 if ( version_compare(phpversion(), '5.4.7', '<')) {23 if (PHP_VERSION_ID < 50407) { 24 24 $preferences->setQPDotEscape(false); 25 25 } -
cimy-swift-smtp/trunk/Swift/lib/swift_init.php
r994020 r1653904 20 20 21 21 // 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';22 require __DIR__.'/dependency_maps/cache_deps.php'; 23 require __DIR__.'/dependency_maps/mime_deps.php'; 24 require __DIR__.'/dependency_maps/message_deps.php'; 25 require __DIR__.'/dependency_maps/transport_deps.php'; 26 26 27 27 // Load in global library preferences 28 require dirname(__FILE__).'/preferences.php';28 require __DIR__.'/preferences.php'; -
cimy-swift-smtp/trunk/Swift/lib/swift_required.php
r994020 r1653904 18 18 19 19 // Load Swift utility class 20 require dirname(__FILE__).'/classes/Swift.php';20 require __DIR__.'/classes/Swift.php'; 21 21 22 22 if (!function_exists('_swiftmailer_init')) { 23 23 function _swiftmailer_init() 24 24 { 25 require dirname(__FILE__).'/swift_init.php';25 require __DIR__.'/swift_init.php'; 26 26 } 27 27 } -
cimy-swift-smtp/trunk/Swift/lib/swift_required_pear.php
r994020 r1653904 18 18 19 19 // Load Swift utility class 20 require dirname(__FILE__).'/Swift.php';20 require __DIR__.'/Swift.php'; 21 21 22 22 if (!function_exists('_swiftmailer_init')) { 23 23 function _swiftmailer_init() 24 24 { 25 require dirname(__FILE__).'/swift_init.php';25 require __DIR__.'/swift_init.php'; 26 26 } 27 27 } -
cimy-swift-smtp/trunk/cimy_swift_smtp.php
r1331085 r1653904 5 5 Description: Send email via SMTP (Compatible with GMAIL) 6 6 Author: Marco Cimmino 7 Version: 2.6. 27 Version: 2.6.3 8 8 Author URI: mailto:cimmino.marco@gmail.com 9 9 10 Copyright (c) 2007-201 6Marco Cimmino10 Copyright (c) 2007-2017 Marco Cimmino 11 11 12 12 Uses Swift Mailer engine - http://swiftmailer.org/ -
cimy-swift-smtp/trunk/readme.txt
r1331085 r1653904 5 5 Tags: cimy, email, smtp, gmail, swift, admin 6 6 Requires at least: 3.0 7 Tested up to: 4. 48 Stable tag: 2.6. 27 Tested up to: 4.7 8 Stable tag: 2.6.3 9 9 10 10 Send email via SMTP (Compatible with GMAIL)
Note: See TracChangeset
for help on using the changeset viewer.