Changeset 33569
- Timestamp:
- 10/25/12 11:31:11 (7 months ago)
- Files:
-
- branches/1.4/lib/vendor/swiftmailer/classes/Swift.php (modified) (4 diffs)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Attachment.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/ByteStream/AbstractFilterableInputStream.php (modified) (2 diffs)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/ByteStream/ArrayByteStream.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/ByteStream/FileByteStream.php (modified) (9 diffs)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/CharacterReader.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/CharacterReader/GenericFixedWidthReader.php (modified) (6 diffs)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/CharacterReader/UsAsciiReader.php (modified) (2 diffs)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/CharacterReader/Utf8Reader.php (modified) (3 diffs)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/CharacterReaderFactory.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/CharacterReaderFactory/SimpleCharacterReaderFactory.php (modified) (8 diffs)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/CharacterStream/ArrayCharacterStream.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/CharacterStream/NgCharacterStream.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/DependencyContainer.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/DependencyException.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/EmbeddedFile.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Encoder.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Encoder/Base64Encoder.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Encoder/QpEncoder.php (modified) (5 diffs)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Encoder/Rfc2231Encoder.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Encoding.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Events/CommandEvent.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Events/CommandListener.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Events/EventDispatcher.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Events/EventObject.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Events/ResponseEvent.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Events/ResponseListener.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Events/SendEvent.php (modified) (3 diffs)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Events/SendListener.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Events/SimpleEventDispatcher.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Events/TransportChangeEvent.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Events/TransportChangeListener.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Events/TransportExceptionEvent.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Events/TransportExceptionListener.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/FailoverTransport.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/FileSpool.php (modified) (6 diffs)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/FileStream.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Filterable.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Image.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/IoException.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/KeyCache.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/KeyCache/ArrayKeyCache.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/KeyCache/DiskKeyCache.php (modified) (14 diffs)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/KeyCache/DummyKeyCache.php (added)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/KeyCache/KeyCacheInputStream.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/KeyCache/NullKeyCache.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/KeyCache/SimpleKeyCacheInputStream.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/LoadBalancedTransport.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/MailTransport.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mailer.php (modified) (5 diffs)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mailer/ArrayRecipientIterator.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/MemorySpool.php (added)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Message.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/Attachment.php (modified) (6 diffs)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/Base64ContentEncoder.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/PlainContentEncoder.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php (modified) (2 diffs)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/EmbeddedFile.php (modified) (2 diffs)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/EncodingObserver.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/Grammar.php (added)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/HeaderEncoder.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/HeaderEncoder/Base64HeaderEncoder.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/HeaderEncoder/QpHeaderEncoder.php (modified) (4 diffs)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/HeaderFactory.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/HeaderSet.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/AbstractHeader.php (modified) (9 diffs)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/DateHeader.php (modified) (2 diffs)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/IdentificationHeader.php (modified) (5 diffs)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/MailboxHeader.php (modified) (5 diffs)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/ParameterizedHeader.php (modified) (9 diffs)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/PathHeader.php (modified) (4 diffs)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/UnstructuredHeader.php (modified) (3 diffs)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/Message.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/MimeEntity.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/MimePart.php (modified) (7 diffs)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/ParameterizedHeader.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/SimpleHeaderFactory.php (modified) (9 diffs)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/SimpleHeaderSet.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/SimpleMessage.php (modified) (20 diffs)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/SimpleMimeEntity.php (modified) (18 diffs)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/MimePart.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Plugins/AntiFloodPlugin.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Plugins/BandwidthMonitorPlugin.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Plugins/DecoratorPlugin.php (modified) (6 diffs)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Plugins/ImpersonatePlugin.php (added)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Plugins/LoggerPlugin.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Plugins/MessageLogger.php (added)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Plugins/Pop/Pop3Exception.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Plugins/PopBeforeSmtpPlugin.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Plugins/Reporter.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Plugins/ReporterPlugin.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Plugins/Reporters/HitReporter.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Plugins/Reporters/HtmlReporter.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Plugins/ThrottlerPlugin.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Preferences.php (modified) (2 diffs)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/RfcComplianceException.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/SendmailTransport.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/SmtpTransport.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Spool.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/StreamFilters/ByteArrayReplacementFilter.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/StreamFilters/StringReplacementFilter.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/StreamFilters/StringReplacementFilterFactory.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Transport.php (modified) (2 diffs)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Transport/AbstractSmtpTransport.php (modified) (8 diffs)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Transport/Esmtp/Auth/CramMd5Authenticator.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Transport/Esmtp/Auth/LoginAuthenticator.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Transport/Esmtp/Auth/PlainAuthenticator.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Transport/Esmtp/AuthHandler.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Transport/Esmtp/Authenticator.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Transport/EsmtpHandler.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Transport/EsmtpTransport.php (modified) (9 diffs)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Transport/FailoverTransport.php (modified) (2 diffs)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Transport/IoBuffer.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Transport/LoadBalancedTransport.php (modified) (3 diffs)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Transport/MailTransport.php (modified) (4 diffs)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Transport/SendmailTransport.php (modified) (3 diffs)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Transport/SimpleMailInvoker.php (modified) (2 diffs)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Transport/SpoolTransport.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Transport/StreamBuffer.php (modified) (7 diffs)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/TransportException.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/classes/Swift/Validate.php (added)
- branches/1.4/lib/vendor/swiftmailer/dependency_maps/message_deps.php (added)
- branches/1.4/lib/vendor/swiftmailer/dependency_maps/mime_deps.php (modified) (7 diffs)
- branches/1.4/lib/vendor/swiftmailer/preferences.php (modified) (2 diffs)
- branches/1.4/lib/vendor/swiftmailer/swift_init.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/swift_required.php (modified) (1 diff)
- branches/1.4/lib/vendor/swiftmailer/swift_required_pear.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.4/lib/vendor/swiftmailer/classes/Swift.php
r32677 r33569 19 19 { 20 20 21 static $initialized = false; 22 static $initPath; 23 21 24 /** Swift Mailer Version number generated during dist release process */ 22 const VERSION = '4.1. 0-DEV';25 const VERSION = '4.1.8'; 23 26 24 27 /** … … 30 33 { 31 34 //Don't interfere with other autoloaders 32 if (0 !== strpos($class, 'Swift '))35 if (0 !== strpos($class, 'Swift_')) 33 36 { 34 return false;37 return; 35 38 } 36 39 … … 39 42 if (!file_exists($path)) 40 43 { 41 return false;44 return; 42 45 } 43 46 44 require_once $path; 47 if (self::$initPath && !self::$initialized) 48 { 49 self::$initialized = true; 50 require self::$initPath; 51 } 52 53 require $path; 45 54 } 46 55 … … 49 58 * 50 59 * This is designed to play nicely with other autoloaders. 60 * 61 * @param string $initPath The init script to load when autoloading the first Swift class 51 62 */ 52 public static function registerAutoload( )63 public static function registerAutoload($initPath = null) 53 64 { 65 self::$initPath = $initPath; 54 66 spl_autoload_register(array('Swift', 'autoload')); 55 67 } branches/1.4/lib/vendor/swiftmailer/classes/Swift/Attachment.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Mime/Attachment.php';12 //@require 'Swift/ByteStream/FileByteStream.php';13 //@require 'Swift/DependencyContainer.php';14 11 15 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/ByteStream/AbstractFilterableInputStream.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/InputByteStream.php';12 //@require 'Swift/Filterable.php';13 //@require 'Swift/StreamFilter.php';14 11 15 12 /** … … 24 21 25 22 /** Write sequence */ 26 pr ivate$_sequence = 0;23 protected $_sequence = 0; 27 24 28 25 /** StreamFilters */ branches/1.4/lib/vendor/swiftmailer/classes/Swift/ByteStream/ArrayByteStream.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/InputByteStream.php';12 //@require 'Swift/OutputByteStream.php';13 11 14 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/ByteStream/FileByteStream.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/ByteStream/AbstractFilterableInputStream.php';12 //@require 'Swift/InputByteStream.php';13 //@require 'Swift/FileStream.php';14 //@require 'Swift/IoException.php';15 11 16 12 /** … … 42 38 /** If magic_quotes_runtime is on, this will be true */ 43 39 private $_quotes = false; 40 41 /** If stream is seekable true/false, or null if not known */ 42 private $_seekable = null; 44 43 45 44 /** … … 52 51 $this->_path = $path; 53 52 $this->_mode = $writable ? 'w+b' : 'rb'; 54 $this->_quotes = get_magic_quotes_runtime(); 53 54 if (function_exists('get_magic_quotes_runtime') && @get_magic_quotes_runtime() == 1) 55 { 56 $this->_quotes = true; 57 } 55 58 } 56 59 … … 80 83 if ($this->_quotes) 81 84 { 82 set_magic_quotes_runtime(0);85 ini_set('magic_quotes_runtime', 0); 83 86 } 84 87 $bytes = fread($fp, $length); 85 88 if ($this->_quotes) 86 89 { 87 set_magic_quotes_runtime(1);90 ini_set('magic_quotes_runtime', 1); 88 91 } 89 92 $this->_offset = ftell($fp); … … 92 95 else 93 96 { 97 $this->_resetReadHandle(); 94 98 return false; 95 99 } … … 105 109 if (isset($this->_reader)) 106 110 { 107 fseek($this->_reader, $byteOffset, SEEK_SET);111 $this->_seekReadStreamToPosition($byteOffset); 108 112 } 109 113 $this->_offset = $byteOffset; … … 133 137 throw new Swift_IoException( 134 138 'Unable to open file for reading [' . $this->_path . ']' 135 ); 136 } 137 fseek($this->_reader, $this->_offset, SEEK_SET); 139 ); 140 } 141 if ($this->_offset <> 0) 142 { 143 $this->_getReadStreamSeekableStatus(); 144 $this->_seekReadStreamToPosition($this->_offset); 145 } 138 146 } 139 147 return $this->_reader; … … 149 157 throw new Swift_IoException( 150 158 'Unable to open file for writing [' . $this->_path . ']' 151 );159 ); 152 160 } 153 161 } 154 162 return $this->_writer; 155 }156 157 /** Force a reload of the resource for writing */158 private function _resetWriteHandle()159 {160 if (isset($this->_writer))161 {162 fclose($this->_writer);163 $this->_writer = null;164 }165 163 } 166 164 … … 175 173 } 176 174 175 /** Check if ReadOnly Stream is seekable */ 176 private function _getReadStreamSeekableStatus() 177 { 178 $metas = stream_get_meta_data($this->_reader); 179 $this->_seekable = $metas['seekable']; 180 } 181 182 /** Streams in a readOnly stream ensuring copy if needed */ 183 private function _seekReadStreamToPosition($offset) 184 { 185 if ($this->_seekable===null) 186 { 187 $this->_getReadStreamSeekableStatus(); 188 } 189 if ($this->_seekable === false) 190 { 191 $currentPos = ftell($this->_reader); 192 if ($currentPos<$offset) 193 { 194 $toDiscard = $offset-$currentPos; 195 fread($this->_reader, $toDiscard); 196 return; 197 } 198 $this->_copyReadStream(); 199 } 200 fseek($this->_reader, $offset, SEEK_SET); 201 } 202 203 /** Copy a readOnly Stream to ensure seekability */ 204 private function _copyReadStream() 205 { 206 if ($tmpFile = fopen('php://temp/maxmemory:4096', 'w+b')) 207 { 208 /* We have opened a php:// Stream Should work without problem */ 209 } 210 elseif (function_exists('sys_get_temp_dir') && is_writable(sys_get_temp_dir()) && ($tmpFile = tmpfile())) 211 { 212 /* We have opened a tmpfile */ 213 } 214 else 215 { 216 throw new Swift_IoException('Unable to copy the file to make it seekable, sys_temp_dir is not writable, php://memory not available'); 217 } 218 $currentPos = ftell($this->_reader); 219 fclose($this->_reader); 220 $source = fopen($this->_path, 'rb'); 221 if (!$source) 222 { 223 throw new Swift_IoException('Unable to open file for copying [' . $this->_path . ']'); 224 } 225 fseek($tmpFile, 0, SEEK_SET); 226 while (!feof($source)) 227 { 228 fwrite($tmpFile, fread($source, 4096)); 229 } 230 fseek($tmpFile, $currentPos, SEEK_SET); 231 fclose($source); 232 $this->_reader = $tmpFile; 233 } 177 234 } branches/1.4/lib/vendor/swiftmailer/classes/Swift/CharacterReader.php
r22246 r33569 35 35 /** 36 36 * Returns mapType 37 * @ int mapType37 * @return int mapType 38 38 */ 39 39 public function getMapType(); branches/1.4/lib/vendor/swiftmailer/classes/Swift/CharacterReader/GenericFixedWidthReader.php
r22246 r33569 9 9 */ 10 10 11 //@require 'Swift/CharacterReader.php';12 11 13 12 /** … … 21 20 implements Swift_CharacterReader 22 21 { 23 24 22 /** 25 23 * The number of bytes in a single character. … … 28 26 */ 29 27 private $_width; 30 28 31 29 /** 32 30 * Creates a new GenericFixedWidthReader using $width bytes per character. … … 49 47 public function getCharPositions($string, $startOffset, &$currentMap, &$ignoredChars) 50 48 { 51 $strlen = strlen($string);52 // % and / are CPU intensive, so, maybe find a better way53 $ignored = $strlen%$this->_width;54 $ignoredChars = substr($string, - $ignored);55 $currentMap = $this->_width;56 return ($strlen - $ignored)/$this->_width; 57 49 $strlen = strlen($string); 50 // % and / are CPU intensive, so, maybe find a better way 51 $ignored = $strlen%$this->_width; 52 $ignoredChars = substr($string, - $ignored); 53 $currentMap = $this->_width; 54 55 return ($strlen - $ignored)/$this->_width; 58 56 } 59 57 60 58 /** 61 59 * Returns mapType 62 * @ int mapType60 * @return int mapType 63 61 */ 64 62 public function getMapType() 65 63 { 66 return self::MAP_TYPE_FIXED_LEN;64 return self::MAP_TYPE_FIXED_LEN; 67 65 } 68 66 … … 79 77 { 80 78 $needed = $this->_width - $size; 81 return ($needed > -1) 82 ? $needed 83 : -1 84 ; 79 80 return ($needed > -1) ? $needed : -1; 85 81 } 86 82 … … 93 89 return $this->_width; 94 90 } 95 96 91 } branches/1.4/lib/vendor/swiftmailer/classes/Swift/CharacterReader/UsAsciiReader.php
r22246 r33569 9 9 */ 10 10 11 //@require 'Swift/CharacterReader.php';12 11 13 12 /** … … 29 28 public function getCharPositions($string, $startOffset, &$currentMap, &$ignoredChars) 30 29 { 31 $strlen=strlen($string);32 $ignoredChars='';33 for( $i = 0; $i < $strlen; ++$i)34 {35 if ($string[$i]>"\x07F")36 { // Invalid char37 $currentMap[$i+$startOffset]=$string[$i];38 }39 }40 return $strlen;30 $strlen=strlen($string); 31 $ignoredChars=''; 32 for( $i = 0; $i < $strlen; ++$i) 33 { 34 if ($string[$i]>"\x07F") 35 { // Invalid char 36 $currentMap[$i+$startOffset]=$string[$i]; 37 } 38 } 39 return $strlen; 41 40 } 42 41 43 42 /** 44 43 * Returns mapType 45 * @ int mapType44 * @return int mapType 46 45 */ 47 46 public function getMapType() 48 47 { 49 return self::MAP_TYPE_INVALID;48 return self::MAP_TYPE_INVALID; 50 49 } 51 50 branches/1.4/lib/vendor/swiftmailer/classes/Swift/CharacterReader/Utf8Reader.php
r22246 r33569 9 9 */ 10 10 11 //@require 'Swift/CharacterReader.php';12 11 13 12 /** … … 87 86 public function getCharPositions($string, $startOffset, &$currentMap, &$ignoredChars) 88 87 { 89 if (!isset($currentMap['i']) || !isset($currentMap['p']))90 {91 $currentMap['p'] = $currentMap['i'] = array();92 }93 $strlen=strlen($string);94 $charPos=count($currentMap['p']);95 $foundChars=0;96 $invalid=false;97 for ($i=0; $i<$strlen; ++$i)98 {99 $char=$string[$i];100 $size=self::$s_length_map[$char];101 if ($size==0)102 {103 /* char is invalid, we must wait for a resync */104 $invalid=true;105 continue;106 }107 else108 {109 if ($invalid==true)110 {111 /* We mark the chars as invalid and start a new char */112 $currentMap['p'][$charPos+$foundChars]=$startOffset+$i;113 $currentMap['i'][$charPos+$foundChars]=true;114 ++$foundChars;115 $invalid=false;116 }117 if (($i+$size) > $strlen){118 $ignoredChars=substr($string, $i);119 break;120 }121 for ($j=1; $j<$size; ++$j)122 {88 if (!isset($currentMap['i']) || !isset($currentMap['p'])) 89 { 90 $currentMap['p'] = $currentMap['i'] = array(); 91 } 92 $strlen=strlen($string); 93 $charPos=count($currentMap['p']); 94 $foundChars=0; 95 $invalid=false; 96 for ($i=0; $i<$strlen; ++$i) 97 { 98 $char=$string[$i]; 99 $size=self::$s_length_map[$char]; 100 if ($size==0) 101 { 102 /* char is invalid, we must wait for a resync */ 103 $invalid=true; 104 continue; 105 } 106 else 107 { 108 if ($invalid==true) 109 { 110 /* We mark the chars as invalid and start a new char */ 111 $currentMap['p'][$charPos+$foundChars]=$startOffset+$i; 112 $currentMap['i'][$charPos+$foundChars]=true; 113 ++$foundChars; 114 $invalid=false; 115 } 116 if (($i+$size) > $strlen){ 117 $ignoredChars=substr($string, $i); 118 break; 119 } 120 for ($j=1; $j<$size; ++$j) 121 { 123 122 $char=$string[$i+$j]; 124 123 if ($char>"\x7F" && $char<"\xC0") … … 132 131 continue 2; 133 132 } 134 }135 /* Ok we got a complete char here */136 $lastChar=$currentMap['p'][$charPos+$foundChars]=$startOffset+$i+$size;137 $i+=$j-1;138 ++$foundChars;139 }140 }141 return $foundChars;133 } 134 /* Ok we got a complete char here */ 135 $currentMap['p'][$charPos+$foundChars]=$startOffset+$i+$size; 136 $i+=$j-1; 137 ++$foundChars; 138 } 139 } 140 return $foundChars; 142 141 } 143 142 144 143 /** 145 144 * Returns mapType 146 * @ int mapType145 * @return int mapType 147 146 */ 148 147 public function getMapType() 149 148 { 150 return self::MAP_TYPE_POSITIONS;149 return self::MAP_TYPE_POSITIONS; 151 150 } 152 151 branches/1.4/lib/vendor/swiftmailer/classes/Swift/CharacterReaderFactory.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/CharacterReader.php';12 11 13 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/CharacterReaderFactory/SimpleCharacterReaderFactory.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/CharacterReaderFactory.php';12 11 13 12 /** … … 26 25 * @access private 27 26 */ 28 private $_map = array();27 private static $_map = array(); 29 28 30 29 /** … … 33 32 * @access private 34 33 */ 35 private $_loaded = array();34 private static $_loaded = array(); 36 35 37 36 /** … … 40 39 public function __construct() 41 40 { 41 $this->init(); 42 } 43 44 public function __wakeup() 45 { 46 $this->init(); 47 } 48 49 public function init() 50 { 51 if(count(self::$_map) > 0) 52 { 53 return; 54 } 55 42 56 $prefix = 'Swift_CharacterReader_'; 43 57 … … 58 72 59 73 //Utf-8 60 $this->_map['utf-?8'] = array(74 self::$_map['utf-?8'] = array( 61 75 'class' => $prefix . 'Utf8Reader', 62 76 'constructor' => array() … … 64 78 65 79 //7-8 bit charsets 66 $this->_map['(us-)?ascii'] = $singleByte;67 $this->_map['(iso|iec)-?8859-?[0-9]+'] = $singleByte;68 $this->_map['windows-?125[0-9]'] = $singleByte;69 $this->_map['cp-?[0-9]+'] = $singleByte;70 $this->_map['ansi'] = $singleByte;71 $this->_map['macintosh'] = $singleByte;72 $this->_map['koi-?7'] = $singleByte;73 $this->_map['koi-?8-?.+'] = $singleByte;74 $this->_map['mik'] = $singleByte;75 $this->_map['(cork|t1)'] = $singleByte;76 $this->_map['v?iscii'] = $singleByte;80 self::$_map['(us-)?ascii'] = $singleByte; 81 self::$_map['(iso|iec)-?8859-?[0-9]+'] = $singleByte; 82 self::$_map['windows-?125[0-9]'] = $singleByte; 83 self::$_map['cp-?[0-9]+'] = $singleByte; 84 self::$_map['ansi'] = $singleByte; 85 self::$_map['macintosh'] = $singleByte; 86 self::$_map['koi-?7'] = $singleByte; 87 self::$_map['koi-?8-?.+'] = $singleByte; 88 self::$_map['mik'] = $singleByte; 89 self::$_map['(cork|t1)'] = $singleByte; 90 self::$_map['v?iscii'] = $singleByte; 77 91 78 92 //16 bits 79 $this->_map['(ucs-?2|utf-?16)'] = $doubleByte;93 self::$_map['(ucs-?2|utf-?16)'] = $doubleByte; 80 94 81 95 //32 bits 82 $this->_map['(ucs-?4|utf-?32)'] = $fourBytes;96 self::$_map['(ucs-?4|utf-?32)'] = $fourBytes; 83 97 84 98 //Fallback 85 $this->_map['.*'] = $singleByte;99 self::$_map['.*'] = $singleByte; 86 100 } 87 101 … … 94 108 { 95 109 $charset = trim(strtolower($charset)); 96 foreach ( $this->_map as $pattern => $spec)110 foreach (self::$_map as $pattern => $spec) 97 111 { 98 112 $re = '/^' . $pattern . '$/D'; 99 113 if (preg_match($re, $charset)) 100 114 { 101 if (!array_key_exists($pattern, $this->_loaded))115 if (!array_key_exists($pattern, self::$_loaded)) 102 116 { 103 117 $reflector = new ReflectionClass($spec['class']); … … 110 124 $reader = $reflector->newInstance(); 111 125 } 112 $this->_loaded[$pattern] = $reader;126 self::$_loaded[$pattern] = $reader; 113 127 } 114 return $this->_loaded[$pattern];128 return self::$_loaded[$pattern]; 115 129 } 116 130 } branches/1.4/lib/vendor/swiftmailer/classes/Swift/CharacterStream/ArrayCharacterStream.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/CharacterStream.php';12 //@require 'Swift/OutputByteStream.php';13 11 14 12 branches/1.4/lib/vendor/swiftmailer/classes/Swift/CharacterStream/NgCharacterStream.php
r22246 r33569 19 19 */ 20 20 21 //@require 'Swift/CharacterStream.php';22 //@require 'Swift/OutputByteStream.php';23 21 24 22 branches/1.4/lib/vendor/swiftmailer/classes/Swift/DependencyContainer.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/DependencyException.php';12 11 13 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/DependencyException.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/SwiftException.php';12 11 13 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/EmbeddedFile.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Mime/Attachment.php';12 //@require 'Swift/DependencyContainer.php';13 //@require 'Swift/ByteStream/FileByteStream.php';14 11 15 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Encoder.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Mime/CharsetObserver.php';12 11 13 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Encoder/Base64Encoder.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Encoder.php';12 11 13 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Encoder/QpEncoder.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Encoder.php';12 //@require 'Swift/CharacterStream.php';13 11 14 12 /** … … 96 94 ); 97 95 96 protected static $_safeMapShare = array(); 97 98 98 /** 99 99 * A map of non-encoded ascii characters. … … 101 101 * @access protected 102 102 */ 103 protected static$_safeMap = array();103 protected $_safeMap = array(); 104 104 105 105 /** … … 112 112 { 113 113 $this->_charStream = $charStream; 114 if (empty(self::$_safeMap)) 115 { 116 foreach (array_merge( 117 array(0x09, 0x20), range(0x21, 0x3C), range(0x3E, 0x7E)) as $byte) 118 { 119 self::$_safeMap[$byte] = chr($byte); 120 } 114 if(!isset(self::$_safeMapShare[$this->getSafeMapShareId()])) 115 { 116 $this->initSafeMap(); 117 self::$_safeMapShare[$this->getSafeMapShareId()] = $this->_safeMap; 118 } 119 else 120 { 121 $this->_safeMap = self::$_safeMapShare[$this->getSafeMapShareId()]; 121 122 } 122 123 $this->_filter = $filter; 124 } 125 126 public function __sleep() 127 { 128 return array('_charStream', '_filter'); 129 } 130 131 public function __wakeup() 132 { 133 if(!isset(self::$_safeMapShare[$this->getSafeMapShareId()])) 134 { 135 $this->initSafeMap(); 136 self::$_safeMapShare[$this->getSafeMapShareId()] = $this->_safeMap; 137 } 138 else 139 { 140 $this->_safeMap = self::$_safeMapShare[$this->getSafeMapShareId()]; 141 } 142 } 143 144 protected function getSafeMapShareId() 145 { 146 return get_class($this); 147 } 148 149 protected function initSafeMap() 150 { 151 foreach (array_merge( 152 array(0x09, 0x20), range(0x21, 0x3C), range(0x3E, 0x7E)) as $byte) 153 { 154 $this->_safeMap[$byte] = chr($byte); 155 } 123 156 } 124 157 … … 216 249 foreach ($bytes as $b) 217 250 { 218 if (isset( self::$_safeMap[$b]))219 { 220 $ret .= self::$_safeMap[$b];251 if (isset($this->_safeMap[$b])) 252 { 253 $ret .= $this->_safeMap[$b]; 221 254 ++$size; 222 255 } branches/1.4/lib/vendor/swiftmailer/classes/Swift/Encoder/Rfc2231Encoder.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Encoder.php';12 //@require 'Swift/CharacterStream.php';13 11 14 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Encoding.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/DependencyContainer.php';12 11 13 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Events/CommandEvent.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Events/EventObject.php';12 //@require 'Swift/Transport.php';13 11 14 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Events/CommandListener.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Events/EventListener.php';12 //@require 'Swift/Events/CommandEvent.php';13 11 14 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Events/EventDispatcher.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Events/EventListener.php';12 //@require 'Swift/Event.php';13 11 14 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Events/EventObject.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Events/Event.php';12 11 13 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Events/ResponseEvent.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Events/EventObject.php';12 11 13 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Events/ResponseListener.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Events/EventListener.php';12 //@require 'Swift/Events/ResponseEvent.php';13 11 14 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Events/SendEvent.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Events/EventObject.php';12 11 13 12 /** … … 39 38 40 39 /** 41 * The Transport used in sending.42 * @var Swift_Transport43 */44 private $_transport;45 46 /**47 40 * Any recipients which failed after sending. 48 41 * @var string[] 49 42 */ 50 private $ failedRecipients = array();43 private $_failedRecipients = array(); 51 44 52 45 /** … … 54 47 * @var int 55 48 */ 56 private $ result;49 private $_result; 57 50 58 51 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Events/SendListener.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Events/EventListener.php';12 //@require 'Swift/Events/SendEvent.php';13 11 14 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Events/SimpleEventDispatcher.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Events/EventDispatcher.php';12 //@require 'Swift/Events/EventListener.php';13 //@require 'Swift/Events/EventObject.php';14 //@require 'Swift/Events/CommandEvent.php';15 //@require 'Swift/Events/ResponseEvent.php';16 //@require 'Swift/Events/SendEvent.php';17 //@require 'Swift/Events/TransportChangeEvent.php';18 //@require 'Swift/Events/TransportExceptionEvent.php';19 11 20 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Events/TransportChangeEvent.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Events/EventObject.php';12 11 13 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Events/TransportChangeListener.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Events/EventListener.php';12 //@require 'Swift/Events/TransportChangeEvent.php';13 11 14 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Events/TransportExceptionEvent.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Events/EventObject.php';12 //@require 'Swift/TransportException.php';13 11 14 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Events/TransportExceptionListener.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Events/EventListener.php';12 //@require 'Swift/Events/TransportExceptionEvent.php';13 11 14 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/FailoverTransport.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Transport/FailoverTransport.php';12 //@require 'Swift/DependencyContainer.php';13 11 14 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/FileSpool.php
r23762 r33569 13 13 * @package Swift 14 14 * @author Fabien Potencier 15 * @author Xavier De Cock <xdecock@gmail.com> 15 16 */ 16 17 class Swift_FileSpool extends Swift_ConfigurableSpool … … 20 21 21 22 /** 23 * File WriteRetry Limit 24 * @var int 25 */ 26 private $_retryLimit=10; 27 28 /** 22 29 * Create a new FileSpool. 23 30 * @param string $path 31 * @throws Swift_IoException 24 32 */ 25 33 public function __construct($path) … … 29 37 if (!file_exists($this->_path)) 30 38 { 31 mkdir($this->_path, 0777, true); 39 if (!mkdir($this->_path, 0777, true)) 40 { 41 throw new Swift_IoException('Unable to create Path ['.$this->_path.']'); 42 } 32 43 } 33 44 } … … 58 69 59 70 /** 71 * Allow to manage the enqueuing retry limit. 72 * Default, is ten and allows over 64^20 different fileNames 73 * 74 * @param integer $limit 75 */ 76 public function setRetryLimit($limit) 77 { 78 $this->_retryLimit=$limit; 79 } 80 81 /** 60 82 * Queues a message. 61 83 * @param Swift_Mime_Message $message The message to store 84 * @return boolean 85 * @throws Swift_IoException 62 86 */ 63 87 public function queueMessage(Swift_Mime_Message $message) 64 88 { 65 89 $ser = serialize($message); 90 $fileName=$this->_path.'/'.$this->getRandomString(10); 91 for ($i = 0; $i < $this->_retryLimit; ++$i) 92 { 93 /* We try an exclusive creation of the file 94 * This is an atomic operation, it avoid locking mechanism 95 */ 96 $fp = @fopen($fileName.'.message', 'x'); 97 if (false !== $fp) 98 { 99 if (false === fwrite($fp, $ser)) 100 { 101 return false; 102 } 103 104 return fclose($fp); 105 } 106 else 107 { 108 /* The file allready exists, we try a longer fileName 109 */ 110 $fileName.=$this->getRandomString(1); 111 } 112 } 66 113 67 file_put_contents($this->_path.'/'.md5($ser.uniqid()).'.message', $ser); 114 throw new Swift_IoException('Unable to create a file for enqueuing Message'); 115 } 116 117 /** 118 * Execute a recovery if for anyreason a process is sending for too long 119 * 120 * @param int $timeout in second Defaults is for very slow smtp responses 121 */ 122 public function recover($timeout=900) 123 { 124 foreach (new DirectoryIterator($this->_path) as $file) 125 { 126 $file = $file->getRealPath(); 127 128 if (substr($file, -16)=='.message.sending') 129 { 130 $lockedtime=filectime($file); 131 if ((time()-$lockedtime)>$timeout) 132 { 133 rename($file, substr($file, 0, -8)); 134 } 135 } 136 } 68 137 } 69 138 … … 90 159 $file = $file->getRealPath(); 91 160 92 if ( !strpos($file, '.message'))161 if (substr($file, -8) != '.message') 93 162 { 94 163 continue; 95 164 } 96 165 97 $message = unserialize(file_get_contents($file)); 98 99 $count += $transport->send($message, $failedRecipients); 100 101 unlink($file); 166 /* We try a rename, it's an atomic operation, and avoid locking the file */ 167 if (rename($file, $file.'.sending')) 168 { 169 $message = unserialize(file_get_contents($file.'.sending')); 170 171 $count += $transport->send($message, $failedRecipients); 172 173 unlink($file.'.sending'); 174 } 175 else 176 { 177 /* This message has just been catched by another process */ 178 continue; 179 } 102 180 103 181 if ($this->getMessageLimit() && $count >= $this->getMessageLimit()) … … 114 192 return $count; 115 193 } 194 195 /** 196 * Returns a random string needed to generate a fileName for the queue. 197 * @param int $count 198 */ 199 protected function getRandomString($count) { 200 // This string MUST stay FS safe, avoid special chars 201 $base="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-."; 202 $ret=''; 203 $strlen=strlen($base); 204 for ($i=0; $i<$count; ++$i) 205 { 206 $ret.=$base[((int)rand(0,$strlen-1))]; 207 } 208 return $ret; 209 } 116 210 } branches/1.4/lib/vendor/swiftmailer/classes/Swift/FileStream.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/OutputByteStream.php';12 11 13 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Filterable.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/StreamFilter.php';12 11 13 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Image.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Image.php';12 //@require 'Swift/ByteStream/FileByteStream.php';13 11 14 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/IoException.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/SwiftException.php';12 11 13 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/KeyCache.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/InputByteStream.php';12 //@require 'Swift/OutputByteStream.php';13 11 14 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/KeyCache/ArrayKeyCache.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/KeyCache.php';12 //@require 'Swift/KeyCacheInputStream.php';13 //@require 'Swift/InputByteStream.php';14 //@require 'Swift/OutputByteStrean.php';15 //@require 'Swift/SwiftException.php';16 11 17 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/KeyCache/DiskKeyCache.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/KeyCache.php';12 //@require 'Swift/KeyCacheInputStream.php';13 //@require 'Swift/InputByteStream.php';14 //@require 'Swift/OutputByteStrean.php';15 //@require 'Swift/SwiftException.php';16 //@require 'Swift/IoException.php';17 11 18 12 /** … … 30 24 /** Signal to place pointer at end of file */ 31 25 const POSITION_END = 1; 26 27 /** Signal to leave pointer in whatever position it currently is */ 28 const POSITION_CURRENT = 2; 32 29 33 30 /** … … 69 66 $this->_stream = $stream; 70 67 $this->_path = $path; 71 $this->_quotes = get_magic_quotes_runtime(); 68 69 if (function_exists('get_magic_quotes_runtime') && @get_magic_quotes_runtime() == 1) 70 { 71 $this->_quotes = true; 72 } 72 73 } 73 74 … … 100 101 } 101 102 fwrite($fp, $string); 103 $this->_freeHandle($nsKey, $itemKey); 102 104 } 103 105 … … 134 136 fwrite($fp, $bytes); 135 137 } 138 $this->_freeHandle($nsKey, $itemKey); 136 139 } 137 140 … … 172 175 if ($this->_quotes) 173 176 { 174 set_magic_quotes_runtime(0);177 ini_set('magic_quotes_runtime', 0); 175 178 } 176 179 $str = ''; … … 181 184 if ($this->_quotes) 182 185 { 183 set_magic_quotes_runtime(1); 184 } 186 ini_set('magic_quotes_runtime', 1); 187 } 188 $this->_freeHandle($nsKey, $itemKey); 185 189 return $str; 186 190 } … … 200 204 if ($this->_quotes) 201 205 { 202 set_magic_quotes_runtime(0);206 ini_set('magic_quotes_runtime', 0); 203 207 } 204 208 while (!feof($fp) && false !== $bytes = fread($fp, 8192)) … … 208 212 if ($this->_quotes) 209 213 { 210 set_magic_quotes_runtime(1); 211 } 214 ini_set('magic_quotes_runtime', 1); 215 } 216 $this->_freeHandle($nsKey, $itemKey); 212 217 } 213 218 } … … 233 238 if ($this->hasKey($nsKey, $itemKey)) 234 239 { 235 $fp = $this->_getHandle($nsKey, $itemKey, self::POSITION_END); 236 fclose($fp); 240 $this->_freeHandle($nsKey, $itemKey); 237 241 unlink($this->_path . '/' . $nsKey . '/' . $itemKey); 238 242 } 239 unset($this->_keys[$nsKey][$itemKey]);240 243 } 241 244 … … 252 255 $this->clearKey($nsKey, $itemKey); 253 256 } 254 rmdir($this->_path . '/' . $nsKey); 257 if (is_dir($this->_path . '/' . $nsKey)) 258 { 259 rmdir($this->_path . '/' . $nsKey); 260 } 255 261 unset($this->_keys[$nsKey]); 256 262 } … … 287 293 private function _getHandle($nsKey, $itemKey, $position) 288 294 { 289 if (!isset($this->_keys[$nsKey]) || !array_key_exists($itemKey, $this->_keys[$nsKey])) 290 { 291 $fp = fopen($this->_path . '/' . $nsKey . '/' . $itemKey, 'w+b'); 295 if (!isset($this->_keys[$nsKey][$itemKey])) 296 { 297 $openMode = $this->hasKey($nsKey, $itemKey) 298 ? 'r+b' 299 : 'w+b' 300 ; 301 $fp = fopen($this->_path . '/' . $nsKey . '/' . $itemKey, $openMode); 292 302 $this->_keys[$nsKey][$itemKey] = $fp; 293 303 } … … 296 306 fseek($this->_keys[$nsKey][$itemKey], 0, SEEK_SET); 297 307 } 298 else 308 elseif (self::POSITION_END == $position) 299 309 { 300 310 fseek($this->_keys[$nsKey][$itemKey], 0, SEEK_END); … … 302 312 return $this->_keys[$nsKey][$itemKey]; 303 313 } 314 315 private function _freeHandle($nsKey, $itemKey) 316 { 317 $fp = $this->_getHandle($nsKey, $itemKey, self::POSITION_CURRENT); 318 fclose($fp); 319 $this->_keys[$nsKey][$itemKey] = null; 320 } 304 321 305 322 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/KeyCache/KeyCacheInputStream.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/KeyCache.php';12 //@require 'Swift/InputByteStream.php';13 11 14 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/KeyCache/NullKeyCache.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/KeyCache.php';12 //@require 'Swift/KeyCacheInputStream.php';13 //@require 'Swift/InputByteStream.php';14 //@require 'Swift/OutputByteStrean.php';15 11 16 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/KeyCache/SimpleKeyCacheInputStream.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/KeyCache.php';12 //@require 'Swift/KeyCacheInputStream.php';13 11 14 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/LoadBalancedTransport.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Transport/LoadBalancedTransport.php';12 //@require 'Swift/DependencyContainer.php';13 11 14 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/MailTransport.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Transport/MailTransport.php';12 //@require 'Swift/DependencyContainer.php';13 11 14 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mailer.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Transport.php';12 //@require 'Swift/Mime/Message.php';13 //@require 'Swift/Mailer/RecipientIterator.php';14 //@require 'Swift/Events/EventListener.php';15 11 16 12 /** … … 46 42 return new self($transport); 47 43 } 48 44 45 /** 46 * Create a new class instance of one if the message services 47 * For example 'mimepart' would create a 'message.mimepart' instance 48 * 49 * @param string $service 50 * @return object 51 */ 52 public function createMessage($service = 'message') 53 { 54 return Swift_DependencyContainer::getInstance() 55 ->lookup('message.'.$service); 56 } 57 49 58 /** 50 59 * Send the given Message like it would be sent in a mail client. … … 53 62 * recipients this message was sent to. 54 63 * 55 * If you need to send to each recipient without disclosing details about the 56 * other recipients see {@link batchSend()}. 57 * 58 * Recipient/sender data will be retreived from the Message object. 64 * Recipient/sender data will be retrieved from the Message object. 59 65 * 60 66 * The return value is the number of recipients who were accepted for … … 64 70 * @param array &$failedRecipients, optional 65 71 * @return int 66 * @see batchSend()67 72 */ 68 73 public function send(Swift_Mime_Message $message, &$failedRecipients = null) … … 75 80 } 76 81 77 return $this->_transport->send($message, $failedRecipients); 78 } 79 80 /** 81 * Send the given Message to all recipients individually. 82 * 83 * This differs from {@link send()} in the way headers are presented to the 84 * recipient. The only recipient in the "To:" field will be the individual 85 * recipient it was sent to. 86 * 87 * If an iterator is provided, recipients will be read from the iterator 88 * one-by-one, otherwise recipient data will be retreived from the Message 89 * object. 90 * 91 * Sender information is always read from the Message object. 92 * 93 * The return value is the number of recipients who were accepted for 94 * delivery. 95 * 96 * @param Swift_Mime_Message $message 97 * @param array &$failedRecipients, optional 98 * @param Swift_Mailer_RecipientIterator $it, optional 99 * @return int 100 * @see send() 101 */ 102 public function batchSend(Swift_Mime_Message $message, 103 &$failedRecipients = null, 104 Swift_Mailer_RecipientIterator $it = null) 105 { 106 $failedRecipients = (array) $failedRecipients; 82 $sent = 0; 107 83 108 $sent = 0; 109 $to = $message->getTo(); 110 $cc = $message->getCc(); 111 $bcc = $message->getBcc(); 112 113 if (!empty($cc)) 84 try 114 85 { 115 $ message->setCc(array());86 $sent = $this->_transport->send($message, $failedRecipients); 116 87 } 117 if (!empty($bcc))88 catch (Swift_RfcComplianceException $e) 118 89 { 119 $message->setBcc(array()); 120 } 121 122 //Use an iterator if set 123 if (isset($it)) 124 { 125 while ($it->hasNext()) 90 foreach ($message->getTo() as $address => $name) 126 91 { 127 $message->setTo($it->nextRecipient()); 128 $sent += $this->send($message, $failedRecipients); 92 $failedRecipients[] = $address; 129 93 } 130 }131 else132 {133 foreach ($to as $address => $name)134 {135 $message->setTo(array($address => $name));136 $sent += $this->send($message, $failedRecipients);137 }138 }139 140 $message->setTo($to);141 142 if (!empty($cc))143 {144 $message->setCc($cc);145 }146 if (!empty($bcc))147 {148 $message->setBcc($bcc);149 94 } 150 95 branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mailer/ArrayRecipientIterator.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Mailer/RecipientIterator.php';12 11 13 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Message.php
r22246 r33569 9 9 */ 10 10 11 //@require 'Swift/Mime/SimpleMessage.php';12 //@require 'Swift/MimePart.php';13 //@require 'Swift/DependencyContainer.php';14 11 15 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/Attachment.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Mime/SimpleMimeEntity.php';12 //@require 'Swift/Mime/ContentEncoder.php';13 //@require 'Swift/Mime/HeaderSet.php';14 //@require 'Swift/FileStream.php';15 //@require 'Swift/KeyCache.php';16 11 17 12 /** … … 32 27 * @param Swift_Mime_ContentEncoder $encoder 33 28 * @param Swift_KeyCache $cache 29 * @param Swift_Mime_Grammar $grammar 34 30 * @param array $mimeTypes optional 35 31 */ 36 32 public function __construct(Swift_Mime_HeaderSet $headers, 37 33 Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, 38 $mimeTypes = array())34 Swift_Mime_Grammar $grammar, $mimeTypes = array()) 39 35 { 40 parent::__construct($headers, $encoder, $cache );36 parent::__construct($headers, $encoder, $cache, $grammar); 41 37 $this->setDisposition('attachment'); 42 38 $this->setContentType('application/octet-stream'); … … 67 63 * Set the Content-Disposition of this attachment. 68 64 * @param string $disposition 65 * @return Swift_Mime_Attachment 69 66 */ 70 67 public function setDisposition($disposition) … … 91 88 * Set the filename of this attachment. 92 89 * @param string $filename 90 * @return Swift_Mime_Attachment 93 91 */ 94 92 public function setFilename($filename) … … 111 109 * Set the file size of this attachment. 112 110 * @param int $size 111 * @return Swift_Mime_Attachment 113 112 */ 114 113 public function setSize($size) … … 122 121 * @param Swift_FileStream $file 123 122 * @param string $contentType optional 123 * @return Swift_Mime_Attachment 124 124 */ 125 125 public function setFile(Swift_FileStream $file, $contentType = null) branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Encoder.php';12 //@require 'Swift/InputByteStream.php';13 //@require 'Swift/OutputByteStream.php';14 11 15 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/Base64ContentEncoder.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Mime/ContentEncoder.php';12 //@require 'Swift/Encoder/Base64Encoder.php';13 //@require 'Swift/InputByteStream.php';14 //@require 'Swift/OutputByteStream.php';15 11 16 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/PlainContentEncoder.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Mime/ContentEncoder.php';12 //@require 'Swift/InputByteStream.php';13 //@require 'Swift/OutputByteStream.php';14 11 15 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php
r23762 r33569 9 9 */ 10 10 11 //@require 'Swift/Mime/ContentEncoder.php';12 //@require 'Swift/Encoder/QpEncoder.php';13 //@require 'Swift/InputByteStrean.php';14 //@require 'Swift/OutputByteStream.php';15 //@require 'Swift/CharacterStream.php';16 11 17 12 /** … … 25 20 { 26 21 22 protected $_dotEscape; 23 27 24 /** 28 25 * Creates a new QpContentEncoder for the given CharacterStream. 29 26 * @param Swift_CharacterStream $charStream to use for reading characters 30 27 * @param Swift_StreamFilter $filter if canonicalization should occur 28 * @param boolean $dotEscape if dot stuffing workaround must be enabled 31 29 */ 32 30 public function __construct(Swift_CharacterStream $charStream, 33 Swift_StreamFilter $filter = null )31 Swift_StreamFilter $filter = null, $dotEscape=false) 34 32 { 33 $this->_dotEscape = $dotEscape; 35 34 parent::__construct($charStream, $filter); 35 } 36 37 public function __sleep() 38 { 39 return array('_charStream', '_filter', '_dotEscape'); 40 } 41 42 protected function getSafeMapShareId() 43 { 44 return get_class($this).($this->_dotEscape ? '.dotEscape' : ''); 45 } 46 47 protected function initSafeMap() 48 { 49 parent::initSafeMap(); 50 if ($this->_dotEscape) { 51 /* Encode . as =2e for buggy remote servers */ 52 unset($this->_safeMap[0x2e]); 53 } 36 54 } 37 55 branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/EmbeddedFile.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Mime/Attachment.php';12 //@require 'Swift/Mime/ContentEncoder.php';13 //@require 'Swift/KeyCache.php';14 //@require15 11 16 12 /** … … 28 24 * @param Swift_Mime_ContentEncoder $encoder 29 25 * @param Swift_KeyCache $cache 26 * @param Swift_Mime_Grammar $grammar 30 27 * @param array $mimeTypes optional 31 28 */ 32 29 public function __construct(Swift_Mime_HeaderSet $headers, 33 30 Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, 34 $mimeTypes = array())31 Swift_Mime_Grammar $grammar, $mimeTypes = array()) 35 32 { 36 parent::__construct($headers, $encoder, $cache, $ mimeTypes);33 parent::__construct($headers, $encoder, $cache, $grammar, $mimeTypes); 37 34 $this->setDisposition('inline'); 38 35 $this->setId($this->getId()); branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/EncodingObserver.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Mime/ContentEncoder.php';12 11 13 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/HeaderEncoder.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Encoder.php';12 11 13 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/HeaderEncoder/Base64HeaderEncoder.php
r21985 r33569 33 33 return 'B'; 34 34 } 35 35 36 37 /** 38 * Takes an unencoded string and produces a Base64 encoded string from it. 39 * If the charset is iso-2022-jp, it uses mb_encode_mimeheader instead of 40 * default encodeString, otherwise pass to the parent method. 41 * @param string $string to encode 42 * @param int $firstLineOffset 43 * @param int $maxLineLength, optional, 0 indicates the default of 76 bytes 44 * @param string $charset 45 * @return string 46 */ 47 public function encodeString($string, $firstLineOffset = 0, 48 $maxLineLength = 0, $charset = 'utf-8') 49 { 50 if (strtolower($charset) === 'iso-2022-jp') 51 { 52 $old = mb_internal_encoding(); 53 mb_internal_encoding('utf-8'); 54 $newstring = mb_encode_mimeheader($string, $charset, $this->getName(), "\r\n"); 55 mb_internal_encoding($old); 56 return $newstring; 57 } 58 return parent::encodeString($string, $firstLineOffset, $maxLineLength); 59 } 60 36 61 } branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/HeaderEncoder/QpHeaderEncoder.php
r21985 r33569 23 23 { 24 24 25 private static $_headerSafeMap = array();26 27 25 /** 28 26 * Creates a new QpHeaderEncoder for the given CharacterStream. … … 32 30 { 33 31 parent::__construct($charStream); 34 if (empty(self::$_headerSafeMap)) 32 } 33 34 protected function initSafeMap() 35 { 36 foreach (array_merge( 37 range(0x61, 0x7A), range(0x41, 0x5A), 38 range(0x30, 0x39), array(0x20, 0x21, 0x2A, 0x2B, 0x2D, 0x2F) 39 ) as $byte) 35 40 { 36 foreach (array_merge( 37 range(0x61, 0x7A), range(0x41, 0x5A), 38 range(0x30, 0x39), array(0x20, 0x21, 0x2A, 0x2B, 0x2D, 0x2F) 39 ) as $byte) 40 { 41 self::$_headerSafeMap[$byte] = chr($byte); 42 } 41 $this->_safeMap[$byte] = chr($byte); 43 42 } 44 43 } … … 62 61 */ 63 62 public function encodeString($string, $firstLineOffset = 0, 64 $maxLineLength = 0 )63 $maxLineLength = 0, $charst = 'utf-8') 65 64 { 66 65 return str_replace(array(' ', '=20', "=\r\n"), array('_', '_', "\r\n"), … … 69 68 } 70 69 71 // -- Overridden points of extension72 73 /**74 * Encode the given byte array into a verbatim QP form.75 * @param int[] $bytes76 * @return string77 * @access protected78 */79 protected function _encodeByteSequence(array $bytes, &$size)80 {81 $ret = '';82 $size=0;83 foreach ($bytes as $b)84 {85 if (isset(self::$_headerSafeMap[$b]))86 {87 $ret .= self::$_headerSafeMap[$b];88 ++$size;89 }90 else91 {92 $ret .= self::$_qpMap[$b];93 $size+=3;94 }95 }96 return $ret;97 }98 99 70 } branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/HeaderFactory.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Mime/CharsetObserver.php';12 11 13 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/HeaderSet.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Mime/CharsetObserver.php';12 11 13 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/AbstractHeader.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Mime/Header.php';12 //@require 'Swift/Mime/HeaderEncoder.php';13 //@require 'Swift/RfcComplianceException.php';14 15 11 /** 16 12 * An abstract base MIME Header. … … 23 19 24 20 /** 25 * Special characters used in the syntax which need to be escaped.26 * @var string[]27 * @access private28 */29 private $_specials = array();30 31 /**32 * Tokens defined in RFC 2822 (and some related RFCs).33 * @var string[]34 * @access private35 */36 private $_grammar = array();37 38 /**39 21 * The name of this Header. 40 22 * @var string … … 44 26 45 27 /** 28 * The Grammar used for this Header. 29 * @var Swift_Mime_Grammar 30 * @access private 31 */ 32 private $_grammar; 33 34 /** 46 35 * The Encoder used to encode this Header. 47 36 * @var Swift_Encoder … … 76 65 */ 77 66 private $_cachedValue = null; 67 68 /** 69 * Creates a new Header. 70 * @param Swift_Mime_Grammar $grammar 71 */ 72 public function __construct(Swift_Mime_Grammar $grammar) 73 { 74 $this->setGrammar($grammar); 75 } 78 76 79 77 /** … … 141 139 142 140 /** 141 * Set the grammar used for the header. 142 * @param Swift_Mime_Grammar $grammar 143 */ 144 public function setGrammar(Swift_Mime_Grammar $grammar) 145 { 146 $this->_grammar = $grammar; 147 $this->setCachedValue(null); 148 } 149 150 /** 151 * Get the grammar used for this Header. 152 * @return Swift_Mime_Grammar 153 */ 154 public function getGrammar() 155 { 156 return $this->_grammar; 157 } 158 159 /** 143 160 * Get the name of this header (e.g. charset). 144 161 * @return string … … 200 217 { 201 218 $this->_name = $name; 202 }203 204 /**205 * Initialize some RFC 2822 (and friends) ABNF grammar definitions.206 * @access protected207 */208 protected function initializeGrammar()209 {210 $this->_specials = array(211 '(', ')', '<', '>', '[', ']',212 ':', ';', '@', ',', '.', '"'213 );214 215 /*** Refer to RFC 2822 for ABNF grammar ***/216 217 //All basic building blocks218 $this->_grammar['NO-WS-CTL'] = '[\x01-\x08\x0B\x0C\x0E-\x19\x7F]';219 $this->_grammar['WSP'] = '[ \t]';220 $this->_grammar['CRLF'] = '(?:\r\n)';221 $this->_grammar['FWS'] = '(?:(?:' . $this->_grammar['WSP'] . '*' .222 $this->_grammar['CRLF'] . ')?' . $this->_grammar['WSP'] . ')';223 $this->_grammar['text'] = '[\x00-\x08\x0B\x0C\x0E-\x7F]';224 $this->_grammar['quoted-pair'] = '(?:\\\\' . $this->_grammar['text'] . ')';225 $this->_grammar['ctext'] = '(?:' . $this->_grammar['NO-WS-CTL'] .226 '|[\x21-\x27\x2A-\x5B\x5D-\x7E])';227 //Uses recursive PCRE (?1) -- could be a weak point??228 $this->_grammar['ccontent'] = '(?:' . $this->_grammar['ctext'] . '|' .229 $this->_grammar['quoted-pair'] . '|(?1))';230 $this->_grammar['comment'] = '(\((?:' . $this->_grammar['FWS'] . '|' .231 $this->_grammar['ccontent']. ')*' . $this->_grammar['FWS'] . '?\))';232 $this->_grammar['CFWS'] = '(?:(?:' . $this->_grammar['FWS'] . '?' .233 $this->_grammar['comment'] . ')*(?:(?:' . $this->_grammar['FWS'] . '?' .234 $this->_grammar['comment'] . ')|' . $this->_grammar['FWS'] . '))';235 $this->_grammar['qtext'] = '(?:' . $this->_grammar['NO-WS-CTL'] .236 '|[\x21\x23-\x5B\x5D-\x7E])';237 $this->_grammar['qcontent'] = '(?:' . $this->_grammar['qtext'] . '|' .238 $this->_grammar['quoted-pair'] . ')';239 $this->_grammar['quoted-string'] = '(?:' . $this->_grammar['CFWS'] . '?"' .240 '(' . $this->_grammar['FWS'] . '?' . $this->_grammar['qcontent'] . ')*' .241 $this->_grammar['FWS'] . '?"' . $this->_grammar['CFWS'] . '?)';242 $this->_grammar['atext'] = '[a-zA-Z0-9!#\$%&\'\*\+\-\/=\?\^_`\{\}\|~]';243 $this->_grammar['atom'] = '(?:' . $this->_grammar['CFWS'] . '?' .244 $this->_grammar['atext'] . '+' . $this->_grammar['CFWS'] . '?)';245 $this->_grammar['dot-atom-text'] = '(?:' . $this->_grammar['atext'] . '+' .246 '(\.' . $this->_grammar['atext'] . '+)*)';247 $this->_grammar['dot-atom'] = '(?:' . $this->_grammar['CFWS'] . '?' .248 $this->_grammar['dot-atom-text'] . '+' . $this->_grammar['CFWS'] . '?)';249 $this->_grammar['word'] = '(?:' . $this->_grammar['atom'] . '|' .250 $this->_grammar['quoted-string'] . ')';251 $this->_grammar['phrase'] = '(?:' . $this->_grammar['word'] . '+?)';252 $this->_grammar['no-fold-quote'] = '(?:"(?:' . $this->_grammar['qtext'] .253 '|' . $this->_grammar['quoted-pair'] . ')*")';254 $this->_grammar['dtext'] = '(?:' . $this->_grammar['NO-WS-CTL'] .255 '|[\x21-\x5A\x5E-\x7E])';256 $this->_grammar['no-fold-literal'] = '(?:\[(?:' . $this->_grammar['dtext'] .257 '|' . $this->_grammar['quoted-pair'] . ')*\])';258 259 //Message IDs260 $this->_grammar['id-left'] = '(?:' . $this->_grammar['dot-atom-text'] . '|' .261 $this->_grammar['no-fold-quote'] . ')';262 $this->_grammar['id-right'] = '(?:' . $this->_grammar['dot-atom-text'] . '|' .263 $this->_grammar['no-fold-literal'] . ')';264 265 //Addresses, mailboxes and paths266 $this->_grammar['local-part'] = '(?:' . $this->_grammar['dot-atom'] . '|' .267 $this->_grammar['quoted-string'] . ')';268 $this->_grammar['dcontent'] = '(?:' . $this->_grammar['dtext'] . '|' .269 $this->_grammar['quoted-pair'] . ')';270 $this->_grammar['domain-literal'] = '(?:' . $this->_grammar['CFWS'] . '?\[(' .271 $this->_grammar['FWS'] . '?' . $this->_grammar['dcontent'] . ')*?' .272 $this->_grammar['FWS'] . '?\]' . $this->_grammar['CFWS'] . '?)';273 $this->_grammar['domain'] = '(?:' . $this->_grammar['dot-atom'] . '|' .274 $this->_grammar['domain-literal'] . ')';275 $this->_grammar['addr-spec'] = '(?:' . $this->_grammar['local-part'] . '@' .276 $this->_grammar['domain'] . ')';277 }278 279 /**280 * Get the grammar defined for $name token.281 * @param string $name execatly as written in the RFC282 * @return string283 */284 protected function getGrammar($name)285 {286 if (array_key_exists($name, $this->_grammar))287 {288 return $this->_grammar[$name];289 }290 else291 {292 throw new Swift_RfcComplianceException(293 "No such grammar '" . $name . "' defined."294 );295 }296 }297 298 /**299 * Escape special characters in a string (convert to quoted-pairs).300 * @param string $token301 * @param string[] $include additonal chars to escape302 * @param string[] $exclude chars from escaping303 * @return string304 */305 protected function escapeSpecials($token, $include = array(),306 $exclude = array())307 {308 foreach (309 array_merge(array('\\'), array_diff($this->_specials, $exclude), $include) as $char)310 {311 $token = str_replace($char, '\\' . $char, $token);312 }313 return $token;314 219 } 315 220 … … 329 234 $phraseStr = $string; 330 235 //If it's not valid 331 if (!preg_match('/^' . $this-> _grammar['phrase']. '$/D', $phraseStr))236 if (!preg_match('/^' . $this->getGrammar()->getDefinition('phrase') . '$/D', $phraseStr)) 332 237 { 333 238 // .. but it is just ascii text, try escaping some characters 334 239 // and make it a quoted-string 335 if (preg_match('/^' . $this-> _grammar['text']. '*$/D', $phraseStr))336 { 337 $phraseStr = $this-> escapeSpecials(338 $phraseStr, array('"'), $this-> _specials240 if (preg_match('/^' . $this->getGrammar()->getDefinition('text') . '*$/D', $phraseStr)) 241 { 242 $phraseStr = $this->getGrammar()->escapeSpecials( 243 $phraseStr, array('"'), $this->getGrammar()->getSpecials() 339 244 ); 340 245 $phraseStr = '"' . $phraseStr . '"'; … … 473 378 $encodedTextLines = explode("\r\n", 474 379 $this->_encoder->encodeString( 475 $token, $firstLineOffset, 75 - $encodingWrapperLength 380 $token, $firstLineOffset, 75 - $encodingWrapperLength, $this->_charset 476 381 ) 477 ); 478 479 foreach ($encodedTextLines as $lineNum => $line) 480 { 481 $encodedTextLines[$lineNum] = '=?' . $charsetDecl . 482 '?' . $this->_encoder->getName() . 483 '?' . $line . '?='; 382 ); 383 384 if (strtolower($this->_charset) !== 'iso-2022-jp') // special encoding for iso-2022-jp using mb_encode_mimeheader 385 { 386 foreach ($encodedTextLines as $lineNum => $line) 387 { 388 $encodedTextLines[$lineNum] = '=?' . $charsetDecl . 389 '?' . $this->_encoder->getName() . 390 '?' . $line . '?='; 391 } 484 392 } 485 393 … … 535 443 /** 536 444 * Generate a list of all tokens in the final header. 537 * @param string $string input, optional538 * @return string[]539 * @access pr ivate445 * @param string $string The string to tokenize 446 * @return array An array of tokens as strings 447 * @access protected 540 448 */ 541 449 protected function toTokens($string = null) branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/DateHeader.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Mime/Headers/AbstractHeader.php';12 11 13 12 … … 37 36 * </code> 38 37 * @param string $name of Header 38 * @param Swift_Mime_Grammar $grammar 39 39 */ 40 public function __construct($name )40 public function __construct($name, Swift_Mime_Grammar $grammar) 41 41 { 42 42 $this->setFieldName($name); 43 parent::__construct($grammar); 43 44 } 44 45 branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/IdentificationHeader.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Mime/Headers/AbstractHeader.php';12 //@require 'Swift/RfcComplianceException.php';13 11 14 12 /** … … 33 31 * Creates a new IdentificationHeader with the given $name and $id. 34 32 * @param string $name 33 * @param Swift_Mime_Grammar $grammar 35 34 */ 36 public function __construct($name )35 public function __construct($name, Swift_Mime_Grammar $grammar) 37 36 { 38 37 $this->setFieldName($name); 39 $this->initializeGrammar();38 parent::__construct($grammar); 40 39 } 41 40 … … 74 73 /** 75 74 * Set the ID used in the value of this header. 76 * @param string $id75 * @param string|array $id 77 76 * @throws Swift_RfcComplianceException 78 77 */ 79 78 public function setId($id) 80 79 { 81 return $this->setIds(array($id));80 $this->setIds(is_array($id) ? $id : array($id)); 82 81 } 83 82 … … 104 103 $actualIds = array(); 105 104 106 foreach ($ids as $ k => $id)105 foreach ($ids as $id) 107 106 { 108 if (preg_match( 109 '/^' . $this->getGrammar('id-left') . '@' . 110 $this->getGrammar('id-right') . '$/D', 111 $id 112 )) 113 { 114 $actualIds[] = $id; 115 } 116 else 117 { 118 throw new Swift_RfcComplianceException( 119 'Invalid ID given <' . $id . '>' 120 ); 121 } 107 $this->_assertValidId($id); 108 $actualIds[] = $id; 122 109 } 123 110 … … 159 146 } 160 147 148 /** 149 * Throws an Exception if the id passed does not comply with RFC 2822. 150 * @param string $id 151 * @throws Swift_RfcComplianceException 152 */ 153 private function _assertValidId($id) 154 { 155 if (!preg_match( 156 '/^' . $this->getGrammar()->getDefinition('id-left') . '@' . 157 $this->getGrammar()->getDefinition('id-right') . '$/D', 158 $id 159 )) 160 { 161 throw new Swift_RfcComplianceException( 162 'Invalid ID given <' . $id . '>' 163 ); 164 } 165 } 161 166 } branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/MailboxHeader.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Mime/Headers/AbstractHeader.php';12 //@require 'Swift/Mime/HeaderEncoder.php';13 11 14 12 /** … … 32 30 * @param string $name of Header 33 31 * @param Swift_Mime_HeaderEncoder $encoder 34 */ 35 public function __construct($name, Swift_Mime_HeaderEncoder $encoder) 32 * @param Swift_Mime_Grammar $grammar 33 */ 34 public function __construct($name, Swift_Mime_HeaderEncoder $encoder, Swift_Mime_Grammar $grammar) 36 35 { 37 36 $this->setFieldName($name); 38 37 $this->setEncoder($encoder); 39 $this->initializeGrammar();38 parent::__construct($grammar); 40 39 } 41 40 … … 169 168 public function setAddresses($addresses) 170 169 { 171 return$this->setNameAddresses(array_values((array) $addresses));170 $this->setNameAddresses(array_values((array) $addresses)); 172 171 } 173 172 … … 269 268 return implode(', ', $this->_createNameAddressStrings($mailboxes)); 270 269 } 270 271 /** 272 * Redefine the encoding requirements for mailboxes. Commas and semicolons are used to separate 273 * multiple addresses, and should therefore be encoded 274 * @param string $token 275 * @return boolean 276 */ 277 protected function tokenNeedsEncoding($token) 278 { 279 return preg_match('/[,;]/', $token) || parent::tokenNeedsEncoding($token); 280 } 271 281 272 282 // -- Private methods … … 299 309 * Throws an Exception if the address passed does not comply with RFC 2822. 300 310 * @param string $address 301 * @throws Exception If invalid.302 * @access pr otected311 * @throws Swift_RfcComplianceException If invalid. 312 * @access private 303 313 */ 304 314 private function _assertValidAddress($address) 305 315 { 306 if (!preg_match('/^' . $this->getGrammar( 'addr-spec') . '$/D',316 if (!preg_match('/^' . $this->getGrammar()->getDefinition('addr-spec') . '$/D', 307 317 $address)) 308 318 { branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/ParameterizedHeader.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Mime/Headers/UnstructuredHeader.php';12 //@require 'Swift/Mime/HeaderEncoder.php';13 //@require 'Swift/Mime/ParameterizedHeader.php';14 //@require 'Swift/Encoder.php';15 11 16 12 /** … … 26 22 27 23 /** 24 * RFC 2231's definition of a token. 25 * @var string 26 */ 27 const TOKEN_REGEX = '(?:[\x21\x23-\x27\x2A\x2B\x2D\x2E\x30-\x39\x41-\x5A\x5E-\x7E]+)'; 28 29 /** 28 30 * The Encoder used to encode the parameters. 29 31 * @var Swift_Encoder … … 38 40 */ 39 41 private $_params = array(); 40 41 /**42 * RFC 2231's definition of a token.43 * @var string44 * @access private45 */46 private $_tokenRe;47 42 48 43 /** … … 51 46 * @param Swift_Mime_HeaderEncoder $encoder 52 47 * @param Swift_Encoder $paramEncoder, optional 48 * @param Swift_Mime_Grammar $grammar 53 49 */ 54 50 public function __construct($name, Swift_Mime_HeaderEncoder $encoder, 55 Swift_Encoder $paramEncoder = null) 56 { 57 $this->setFieldName($name); 58 $this->setEncoder($encoder); 51 Swift_Encoder $paramEncoder = null, Swift_Mime_Grammar $grammar) 52 { 53 parent::__construct($name, $encoder, $grammar); 59 54 $this->_paramEncoder = $paramEncoder; 60 $this->initializeGrammar();61 $this->_tokenRe = '(?:[\x21\x23-\x27\x2A\x2B\x2D\x2E\x30-\x39\x41-\x5A\x5E-\x7E]+)';62 55 } 63 56 … … 151 144 * This doesn't need to be overridden in theory, but it is for implementation 152 145 * reasons to prevent potential breakage of attributes. 153 * @return string[] 146 * @param string $string The string to tokenize 147 * @return array An array of tokens as strings 154 148 * @access protected 155 149 */ … … 193 187 194 188 //If it's not already a valid parameter value... 195 if (!preg_match('/^' . $this->_tokenRe. '$/D', $value))189 if (!preg_match('/^' . self::TOKEN_REGEX . '$/D', $value)) 196 190 { 197 191 //TODO: text, or something else?? 198 192 //... and it's not ascii 199 if (!preg_match('/^' . $this->getGrammar( 'text') . '*$/D', $value))193 if (!preg_match('/^' . $this->getGrammar()->getDefinition('text') . '*$/D', $value)) 200 194 { 201 195 $encoded = true; … … 214 208 { 215 209 $value = $this->_paramEncoder->encodeString( 216 $origValue, $firstLineOffset, $maxValueLength 210 $origValue, $firstLineOffset, $maxValueLength, $this->getCharset() 217 211 ); 218 212 } … … 233 227 { 234 228 $paramLines[] = $name . '*' . $i . 235 $this->_getEndOfParameterValue($line, $encoded, $i == 0);229 $this->_getEndOfParameterValue($line, true, $i == 0); 236 230 } 237 231 return implode(";\r\n ", $paramLines); … … 255 249 private function _getEndOfParameterValue($value, $encoded = false, $firstLine = false) 256 250 { 257 if (!preg_match('/^' . $this->_tokenRe. '$/D', $value))251 if (!preg_match('/^' . self::TOKEN_REGEX . '$/D', $value)) 258 252 { 259 253 $value = '"' . $value . '"'; branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/PathHeader.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Mime/Headers/AbstractHeader.php';12 //@require 'Swift/RfcComplianceException.php';13 11 14 12 /** … … 31 29 * Creates a new PathHeader with the given $name. 32 30 * @param string $name 31 * @param Swift_Mime_Grammar $grammar 33 32 */ 34 public function __construct($name )33 public function __construct($name, Swift_Mime_Grammar $grammar) 35 34 { 36 35 $this->setFieldName($name); 37 $this->initializeGrammar();36 parent::__construct($grammar); 38 37 } 39 38 … … 81 80 $this->_address = null; 82 81 } 83 elseif ('' == $address 84 || preg_match('/^' . $this->getGrammar('addr-spec') . '$/D', $address)) 82 elseif ('' == $address) 85 83 { 86 $this->_address = $address;84 $this->_address = ''; 87 85 } 88 86 else 89 87 { 90 throw new Swift_RfcComplianceException( 91 'Address set in PathHeader does not comply with addr-spec of RFC 2822.' 92 ); 88 $this->_assertValidAddress($address); 89 $this->_address = $address; 93 90 } 94 91 $this->setCachedValue(null); … … 124 121 } 125 122 123 /** 124 * Throws an Exception if the address passed does not comply with RFC 2822. 125 * @param string $address 126 * @throws Swift_RfcComplianceException If invalid. 127 * @access private 128 */ 129 private function _assertValidAddress($address) 130 { 131 if (!preg_match('/^' . $this->getGrammar()->getDefinition('addr-spec') . '$/D', 132 $address)) 133 { 134 throw new Swift_RfcComplianceException( 135 'Address set in PathHeader does not comply with addr-spec of RFC 2822.' 136 ); 137 } 138 } 139 126 140 } branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/Headers/UnstructuredHeader.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Mime/Headers/AbstractHeader.php';12 //@require 'Swift/Mime/HeaderEncoder.php';13 11 14 12 /** … … 33 31 * @param string $name 34 32 * @param Swift_Mime_HeaderEncoder $encoder 33 * @param Swift_Mime_Grammar $grammar 35 34 */ 36 public function __construct($name, Swift_Mime_HeaderEncoder $encoder )35 public function __construct($name, Swift_Mime_HeaderEncoder $encoder, Swift_Mime_Grammar $grammar) 37 36 { 38 37 $this->setFieldName($name); 39 38 $this->setEncoder($encoder); 39 parent::__construct($grammar); 40 40 } 41 41 42 /** 42 43 * Get the type of Header that this instance represents. … … 98 99 { 99 100 $this->setCachedValue( 100 str_replace('\\', '\\\\', $this->encodeWords( 101 $this, $this->_value, -1, $this->getCharset(), $this->getEncoder() 102 )) 101 $this->encodeWords($this, $this->_value) 103 102 ); 104 103 } branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/Message.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Mime/MimeEntity.php';12 11 13 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/MimeEntity.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/InputByteStream.php';12 //@require 'Swift/Mime/EncodingObserver.php';13 //@require 'Swift/Mime/CharsetObserver.php';14 11 15 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/MimePart.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Mime/SimpleMimeEntity.php';12 //@require 'Swift/Mime/ContentEncoder.php';13 //@require 'Swift/Mime/HeaderSet.php';14 //@require 'Swift/KeyCache.php';15 11 16 12 /** … … 42 38 * @param Swift_Mime_ContentEncoder $encoder 43 39 * @param Swift_KeyCache $cache 40 * @param Swift_Mime_Grammar $grammar 44 41 * @param string $charset 45 42 */ 46 43 public function __construct(Swift_Mime_HeaderSet $headers, 47 Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, $charset = null)48 { 49 parent::__construct($headers, $encoder, $cache );44 Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_Mime_Grammar $grammar, $charset = null) 45 { 46 parent::__construct($headers, $encoder, $cache, $grammar); 50 47 $this->setContentType('text/plain'); 51 48 if (!is_null($charset)) … … 62 59 * @param string $contentType optional 63 60 * @param string $charset optional 61 * @param Swift_Mime_MimePart 64 62 */ 65 63 public function setBody($body, $contentType = null, $charset = null) 66 64 { 65 if (isset($charset)) 66 { 67 $this->setCharset($charset); 68 } 69 $body = $this->_convertString($body); 70 67 71 parent::setBody($body, $contentType); 68 if (isset($charset)) 69 { 70 $this->setCharset($charset); 71 } 72 72 73 return $this; 73 74 } … … 87 88 * 88 89 * @param string $charset 90 * @param Swift_Mime_MimePart 89 91 */ 90 92 public function setCharset($charset) … … 114 116 * 115 117 * @param string $format 118 * @param Swift_Mime_MimePart 116 119 */ 117 120 public function setFormat($format) … … 138 141 * 139 142 * @param boolean $delsp 143 * @param Swift_Mime_MimePart 140 144 */ 141 145 public function setDelSp($delsp = true) … … 194 198 } 195 199 200 /** Encode charset when charset is not utf-8 */ 201 protected function _convertString($string) 202 { 203 $charset = strtolower($this->getCharset()); 204 if (!in_array($charset, array('utf-8', 'iso-8859-1', ""))) 205 { 206 // mb_convert_encoding must be the first one to check, since iconv cannot convert some words. 207 if (function_exists('mb_convert_encoding')) 208 { 209 $string = mb_convert_encoding($string, $charset, 'utf-8'); 210 } 211 else if (function_exists('iconv')) 212 { 213 $string = iconv($charset, 'utf-8//TRANSLIT//IGNORE', $string); 214 } 215 else 216 { 217 throw new Swift_SwiftException('No suitable convert encoding function (use UTF-8 as your harset or install the mbstring or iconv extension).'); 218 } 219 return $string; 220 } 221 return $string; 222 } 223 196 224 } branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/ParameterizedHeader.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Mime/Header.php';12 11 13 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/SimpleHeaderFactory.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Mime/HeaderFactory.php';12 //@require 'Swift/Mime/HeaderEncoder.php';13 //@require 'Swift/Encoder.php';14 //@require 'Swift/Mime/Headers/MailboxHeader.php';15 //@require 'Swift/Mime/Headers/DateHeader.php';16 //@require 'Swift/Mime/Headers/UnstructuredHeader.php';17 //@require 'Swift/Mime/Headers/ParameterizedHeader.php';18 //@require 'Swift/Mime/Headers/IdentificationHeader.php';19 //@require 'Swift/Mime/Headers/PathHeader.php';20 11 21 12 /** … … 34 25 private $_paramEncoder; 35 26 27 /** The Grammar */ 28 private $_grammar; 29 36 30 /** The charset of created Headers */ 37 31 private $_charset; … … 41 35 * @param Swift_Mime_HeaderEncoder $encoder 42 36 * @param Swift_Encoder $paramEncoder 37 * @param Swift_Mime_Grammar $grammar 43 38 * @param string $charset 44 39 */ 45 40 public function __construct(Swift_Mime_HeaderEncoder $encoder, 46 Swift_Encoder $paramEncoder, $charset = null)41 Swift_Encoder $paramEncoder, Swift_Mime_Grammar $grammar, $charset = null) 47 42 { 48 43 $this->_encoder = $encoder; 49 44 $this->_paramEncoder = $paramEncoder; 45 $this->_grammar = $grammar; 50 46 $this->_charset = $charset; 51 47 } … … 59 55 public function createMailboxHeader($name, $addresses = null) 60 56 { 61 $header = new Swift_Mime_Headers_MailboxHeader($name, $this->_encoder );57 $header = new Swift_Mime_Headers_MailboxHeader($name, $this->_encoder, $this->_grammar); 62 58 if (isset($addresses)) 63 59 { … … 76 72 public function createDateHeader($name, $timestamp = null) 77 73 { 78 $header = new Swift_Mime_Headers_DateHeader($name );74 $header = new Swift_Mime_Headers_DateHeader($name, $this->_grammar); 79 75 if (isset($timestamp)) 80 76 { … … 93 89 public function createTextHeader($name, $value = null) 94 90 { 95 $header = new Swift_Mime_Headers_UnstructuredHeader($name, $this->_encoder );91 $header = new Swift_Mime_Headers_UnstructuredHeader($name, $this->_encoder, $this->_grammar); 96 92 if (isset($value)) 97 93 { … … 115 111 $this->_encoder, (strtolower($name) == 'content-disposition') 116 112 ? $this->_paramEncoder 117 : null 113 : null, 114 $this->_grammar 118 115 ); 119 116 if (isset($value)) … … 137 134 public function createIdHeader($name, $ids = null) 138 135 { 139 $header = new Swift_Mime_Headers_IdentificationHeader($name );136 $header = new Swift_Mime_Headers_IdentificationHeader($name, $this->_grammar); 140 137 if (isset($ids)) 141 138 { … … 154 151 public function createPathHeader($name, $path = null) 155 152 { 156 $header = new Swift_Mime_Headers_PathHeader($name );153 $header = new Swift_Mime_Headers_PathHeader($name, $this->_grammar); 157 154 if (isset($path)) 158 155 { branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/SimpleHeaderSet.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Mime/HeaderSet.php';12 //@require 'Swift/Mime/HeaderFactory.php';13 11 14 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/SimpleMessage.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Mime/Message.php';12 //@require 'Swift/Mime/MimePart.php';13 //@require 'Swift/Mime/MimeEntity.php';14 //@require 'Swift/Mime/HeaderSet.php';15 //@require 'Swift/Mime/ContentEncoder.php';16 11 17 12 /** … … 30 25 * @param Swift_Mime_ContentEncoder $encoder 31 26 * @param Swift_KeyCache $cache 27 * @param Swift_Mime_Grammar $grammar 32 28 * @param string $charset 33 29 */ 34 30 public function __construct(Swift_Mime_HeaderSet $headers, 35 Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, $charset = null)36 { 37 parent::__construct($headers, $encoder, $cache, $ charset);31 Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_Mime_Grammar $grammar, $charset = null) 32 { 33 parent::__construct($headers, $encoder, $cache, $grammar, $charset); 38 34 $this->getHeaders()->defineOrdering(array( 39 35 'Return-Path', … … 72 68 * Set the subject of this message. 73 69 * @param string $subject 70 * @return Swift_Mime_SimpleMessage 74 71 */ 75 72 public function setSubject($subject) … … 94 91 * Set the date at which this message was created. 95 92 * @param int $date 93 * @return Swift_Mime_SimpleMessage 96 94 */ 97 95 public function setDate($date) … … 116 114 * Set the return-path (the bounce address) of this message. 117 115 * @param string $address 116 * @return Swift_Mime_SimpleMessage 118 117 */ 119 118 public function setReturnPath($address) … … 140 139 * @param string $sender 141 140 * @param string $name optional 141 * @return Swift_Mime_SimpleMessage 142 142 */ 143 143 public function setSender($address, $name = null) … … 189 189 * @param string $addresses 190 190 * @param string $name optional 191 * @return Swift_Mime_SimpleMessage 191 192 */ 192 193 public function setFrom($addresses, $name = null) … … 221 222 * @param string $address 222 223 * @param string $name optional 224 * @return Swift_Mime_SimpleMessage 223 225 */ 224 226 public function addReplyTo($address, $name = null) … … 239 241 * @param string $addresses 240 242 * @param string $name optional 243 * @return Swift_Mime_SimpleMessage 241 244 */ 242 245 public function setReplyTo($addresses, $name = null) … … 271 274 * @param string $address 272 275 * @param string $name optional 276 * @return Swift_Mime_SimpleMessage 273 277 */ 274 278 public function addTo($address, $name = null) … … 289 293 * @param array $addresses 290 294 * @param string $name optional 295 * @return Swift_Mime_SimpleMessage 291 296 */ 292 297 public function setTo($addresses, $name = null) … … 321 326 * @param string $address 322 327 * @param string $name optional 328 * @return Swift_Mime_SimpleMessage 323 329 */ 324 330 public function addCc($address, $name = null) … … 337 343 * @param array $addresses 338 344 * @param string $name optional 345 * @return Swift_Mime_SimpleMessage 339 346 */ 340 347 public function setCc($addresses, $name = null) … … 369 376 * @param string $address 370 377 * @param string $name optional 378 * @return Swift_Mime_SimpleMessage 371 379 */ 372 380 public function addBcc($address, $name = null) … … 385 393 * @param array $addresses 386 394 * @param string $name optional 395 * @return Swift_Mime_SimpleMessage 387 396 */ 388 397 public function setBcc($addresses, $name = null) … … 414 423 * The value is an integer where 1 is the highest priority and 5 is the lowest. 415 424 * @param int $priority 425 * @return Swift_Mime_SimpleMessage 416 426 */ 417 427 public function setPriority($priority) … … 459 469 * Ask for a delivery receipt from the recipient to be sent to $addresses 460 470 * @param array $addresses 471 * @return Swift_Mime_SimpleMessage 461 472 */ 462 473 public function setReadReceiptTo($addresses) … … 482 493 * Attach a {@link Swift_Mime_MimeEntity} such as an Attachment or MimePart. 483 494 * @param Swift_Mime_MimeEntity $entity 495 * @return Swift_Mime_SimpleMessage 484 496 */ 485 497 public function attach(Swift_Mime_MimeEntity $entity) … … 492 504 * Remove an already attached entity. 493 505 * @param Swift_Mime_MimeEntity $entity 506 * @return Swift_Mime_SimpleMessage 494 507 */ 495 508 public function detach(Swift_Mime_MimeEntity $entity) … … 582 595 { 583 596 $part = new parent($this->getHeaders()->newInstance(), $this->getEncoder(), 584 $this->_getCache(), $this->_ userCharset597 $this->_getCache(), $this->_getGrammar(), $this->_userCharset 585 598 ); 586 599 $part->setContentType($this->_userContentType); branches/1.4/lib/vendor/swiftmailer/classes/Swift/Mime/SimpleMimeEntity.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Mime/HeaderSet.php';12 //@require 'Swift/OutputByteStream.php';13 //@require 'Swift/Mime/ContentEncoder.php';14 //@require 'Swift/KeyCache.php';15 11 16 12 /** … … 31 27 /** The encoder that encodes the body into a streamable format */ 32 28 private $_encoder; 29 30 /** The grammar to use for id validation */ 31 private $_grammar; 33 32 34 33 /** A mime bounary, if any is used */ … … 80 79 * @param Swift_Mime_ContentEncoder $encoder 81 80 * @param Swift_KeyCache $cache 81 * @param Swift_Mime_Grammar $grammar 82 82 */ 83 83 public function __construct(Swift_Mime_HeaderSet $headers, 84 Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache) 84 Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, 85 Swift_Mime_Grammar $grammar) 85 86 { 86 87 $this->_cacheKey = uniqid(); 87 88 $this->_cache = $cache; 88 89 $this->_headers = $headers; 90 $this->_grammar = $grammar; 89 91 $this->setEncoder($encoder); 90 92 $this->_headers->defineOrdering( … … 113 115 ) 114 116 ); 115 $this->generateId(); 117 118 $this->_id = $this->getRandomId(); 116 119 } 117 120 … … 122 125 public function generateId() 123 126 { 124 $idLeft = time() . '.' . uniqid(); 125 $idRight = !empty($_SERVER['SERVER_NAME']) 126 ? $_SERVER['SERVER_NAME'] 127 : 'swift.generated'; 128 $this->_id = $idLeft . '@' . $idRight; 129 return $this->getId(); 127 $this->setId($this->getRandomId()); 128 return $this->_id; 130 129 } 131 130 … … 161 160 * Set the Content-type of this entity. 162 161 * @param string $type 162 * @return Swift_Mime_SimpleMimeEntity 163 163 */ 164 164 public function setContentType($type) … … 186 186 * Set the CID of this entity. 187 187 * @param string $id 188 * @return Swift_Mime_SimpleMimeEntity 188 189 */ 189 190 public function setId($id) … … 211 212 * This method sets a value in the Content-ID header. 212 213 * @param string $description 214 * @return Swift_Mime_SimpleMimeEntity 213 215 */ 214 216 public function setDescription($description) … … 234 236 * Though not enforced by the library, lines should not exceed 1000 chars. 235 237 * @param int $length 238 * @return Swift_Mime_SimpleMimeEntity 236 239 */ 237 240 public function setMaxLineLength($length) … … 254 257 * @param array $children Swiift_Mime_Entity instances 255 258 * @param int $compoundLevel For internal use only 259 * @return Swift_Mime_SimpleMimeEntity 256 260 */ 257 261 public function setChildren(array $children, $compoundLevel = null) … … 347 351 * @param mixed $body 348 352 * @param string $contentType optional 353 * @return Swift_Mime_SimpleMimeEntity 349 354 */ 350 355 public function setBody($body, $contentType = null) … … 375 380 * Set the encoder used for the body of this entity. 376 381 * @param Swift_Mime_ContentEncoder $encoder 382 * @return Swift_Mime_SimpleMimeEntity 377 383 */ 378 384 public function setEncoder(Swift_Mime_ContentEncoder $encoder) … … 406 412 * @param string $boundary 407 413 * @throws Swift_RfcComplianceException 414 * @return Swift_Mime_SimpleMimeEntity 408 415 */ 409 416 public function setBoundary($boundary) … … 636 643 637 644 /** 645 * Get the grammar used for validation. 646 * @return Swift_Mime_Grammar 647 */ 648 protected function _getGrammar() 649 { 650 return $this->_grammar; 651 } 652 653 /** 638 654 * Empty the KeyCache for this entity. 639 655 */ … … 641 657 { 642 658 $this->_cache->clearKey($this->_cacheKey, 'body'); 659 } 660 661 /** 662 * Returns a random Content-ID or Message-ID. 663 * @return string 664 */ 665 protected function getRandomId() 666 { 667 $idLeft = time() . '.' . uniqid(); 668 $idRight = !empty($_SERVER['SERVER_NAME']) 669 ? $_SERVER['SERVER_NAME'] 670 : 'swift.generated'; 671 $id = $idLeft . '@' . $idRight; 672 673 try 674 { 675 $this->_assertValidId($id); 676 } 677 catch (Swift_RfcComplianceException $e) 678 { 679 $id = $idLeft . '@swift.generated'; 680 } 681 682 return $id; 643 683 } 644 684 … … 669 709 $boundary)) 670 710 { 671 throw new Exception('Mime boundary set is not RFC 2046 compliant.');711 throw new Swift_RfcComplianceException('Mime boundary set is not RFC 2046 compliant.'); 672 712 } 673 713 } … … 724 764 { 725 765 return new self($this->_headers->newInstance(), 726 $this->_encoder, $this->_cache );766 $this->_encoder, $this->_cache, $this->_grammar); 727 767 } 728 768 … … 791 831 } 792 832 833 /** 834 * Throws an Exception if the id passed does not comply with RFC 2822. 835 * @param string $id 836 * @throws Swift_RfcComplianceException 837 */ 838 private function _assertValidId($id) 839 { 840 if (!preg_match( 841 '/^' . $this->_grammar->getDefinition('id-left') . '@' . 842 $this->_grammar->getDefinition('id-right') . '$/D', 843 $id 844 )) 845 { 846 throw new Swift_RfcComplianceException( 847 'Invalid ID given <' . $id . '>' 848 ); 849 } 850 } 851 793 852 } branches/1.4/lib/vendor/swiftmailer/classes/Swift/MimePart.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Mime/MimePart.php';12 //@require 'Swift/DependencyContainer.php';13 11 14 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Plugins/AntiFloodPlugin.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Events/SendListener.php';12 //@require 'Swift/Events/SendEvent.php';13 //@require 'Swift/Plugins/Sleeper.php';14 11 15 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Plugins/BandwidthMonitorPlugin.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Events/SendListener.php';12 //@require 'Swift/Events/SendEvent.php';13 //@require 'Swift/Events/CommandListener.php';14 //@require 'Swift/Events/CommandEvent.php';15 //@require 'Swift/Events/ResponseListener.php';16 //@require 'Swift/Events/ResponseEvent.php';17 //@require 'Swift/InputByteStream.php';18 11 19 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Plugins/DecoratorPlugin.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Events/SendListener.php';12 //@require 'Swift/Events/SendEvent.php';13 //@require 'Swift/Plugins/Decorator/Replacements.php';14 11 15 12 /** … … 20 17 * 21 18 * @author Chris Corbyn 19 * @author Fabien Potencier 22 20 */ 23 21 class Swift_Plugins_DecoratorPlugin … … 29 27 30 28 /** The body as it was before replacements */ 31 private $_or ginalBody;32 33 /** The original subjectof the message, before replacements */34 private $_original Subject;29 private $_originalBody; 30 31 /** The original headers of the message, before replacements */ 32 private $_originalHeaders = array(); 35 33 36 34 /** Bodies of children before they are replaced */ … … 58 56 * given to {@link Swift_Plugins_Decorator_Replacements::getReplacementsFor()}. 59 57 * 60 * @param mixed $replacements 58 * @param mixed $replacements Array or Swift_Plugins_Decorator_Replacements 61 59 */ 62 60 public function __construct($replacements) 63 61 { 64 if (!($replacements instanceof Swift_Plugins_Decorator_Replacements)) 62 $this->setReplacements($replacements); 63 } 64 65 /** 66 * Sets replacements. 67 * 68 * @param mixed $replacements Array or Swift_Plugins_Decorator_Replacements 69 * 70 * @see __construct() 71 */ 72 public function setReplacements($replacements) 73 { 74 if (!($replacements instanceof \Swift_Plugins_Decorator_Replacements)) 65 75 { 66 76 $this->_replacements = (array) $replacements; … … 96 106 $message->setBody($bodyReplaced); 97 107 } 98 $subject = $message->getSubject(); 99 $subjectReplaced = str_replace( 100 $search, $replace, $subject 101 ); 102 if ($subject != $subjectReplaced) 103 { 104 $this->_originalSubject = $subject; 105 $message->setSubject($subjectReplaced); 106 } 108 109 foreach ($message->getHeaders()->getAll() as $header) 110 { 111 $body = $header->getFieldBodyModel(); 112 $count = 0; 113 if (is_array($body)) 114 { 115 $bodyReplaced = array(); 116 foreach ($body as $key => $value) 117 { 118 $count1 = 0; 119 $count2 = 0; 120 $key = is_string($key) ? str_replace($search, $replace, $key, $count1) : $key; 121 $value = is_string($value) ? str_replace($search, $replace, $value, $count2) : $value; 122 $bodyReplaced[$key] = $value; 123 124 if (!$count && ($count1 || $count2)) 125 { 126 $count = 1; 127 } 128 } 129 } 130 else 131 { 132 $bodyReplaced = str_replace($search, $replace, $body, $count); 133 } 134 135 if ($count) 136 { 137 $this->_originalHeaders[$header->getFieldName()] = $body; 138 $header->setFieldBodyModel($bodyReplaced); 139 } 140 } 141 107 142 $children = (array) $message->getChildren(); 108 143 foreach ($children as $child) … … 177 212 $this->_originalBody = null; 178 213 } 179 if (isset($this->_originalSubject)) 180 { 181 $message->setSubject($this->_originalSubject); 182 $this->_originalSubject = null; 214 if (!empty($this->_originalHeaders)) 215 { 216 foreach ($message->getHeaders()->getAll() as $header) 217 { 218 if (array_key_exists($header->getFieldName(), $this->_originalHeaders)) 219 { 220 $header->setFieldBodyModel($this->_originalHeaders[$header->getFieldName()]); 221 } 222 } 223 $this->_originalHeaders = array(); 183 224 } 184 225 if (!empty($this->_originalChildBodies)) branches/1.4/lib/vendor/swiftmailer/classes/Swift/Plugins/LoggerPlugin.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Events/CommandListener.php';12 //@require 'Swift/Events/CommandEvent.php';13 //@require 'Swift/Events/ResponseListener.php';14 //@require 'Swift/Events/ResponseEvent.php';15 //@require 'Swift/Events/TransportChangeListener.php';16 //@require 'Swift/Events/TransportChangeEvent.php';17 //@require 'Swift/Events/TransportExceptionEvent.php';18 //@require 'Swift/Events/TransportExceptionListener.php';19 //@require 'Swift/Events/TransportException.php';20 //@require 'Swift/Plugins/Logger.php';21 11 22 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Plugins/Pop/Pop3Exception.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/IoException.php';12 11 13 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Plugins/PopBeforeSmtpPlugin.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Events/TransportChangeListener.php';12 //@require 'Swift/Events/TransportChangeEvent.php';13 11 14 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Plugins/Reporter.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Mime/Message.php';12 11 13 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Plugins/ReporterPlugin.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Events/SendListener.php';12 //@require 'Swift/Events/SendEvent.php';13 //@require 'Swift/Plugins/Reporter.php';14 11 15 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Plugins/Reporters/HitReporter.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Plugins/Reporter.php';12 //@require 'Swift/Mime/Message.php';13 11 14 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Plugins/Reporters/HtmlReporter.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Plugins/Reporter.php';12 //@require 'Swift/Mime/Message.php';13 11 14 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Plugins/ThrottlerPlugin.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Events/SendEvent.php';12 //@require 'Swift/Plugins/BandwidthMonitorPlugin.php';13 //@require 'Swift/Plugins/Sleeper.php';14 //@require 'Swift/Plugins/Timer.php';15 11 16 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Preferences.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/DependencyContainer.php';12 11 13 12 /** … … 74 73 } 75 74 75 /** 76 * Add the 77 * @param boolean $dotEscape 78 * @return Swift_Preferences 79 */ 80 public function setQPDotEscape($dotEscape) 81 { 82 $dotEscape=!empty($dotEscape); 83 Swift_DependencyContainer::getInstance() 84 -> register('mime.qpcontentencoder') 85 -> asNewInstanceOf('Swift_Mime_ContentEncoder_QpContentEncoder') 86 -> withDependencies(array('mime.charstream', 'mime.bytecanonicalizer')) 87 -> addConstructorValue($dotEscape); 88 return $this; 89 } 90 76 91 } branches/1.4/lib/vendor/swiftmailer/classes/Swift/RfcComplianceException.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/SwiftException.php';12 11 13 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/SendmailTransport.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Transport/SendmailTransport.php';12 //@require 'Swift/DependencyContainer.php';13 11 14 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/SmtpTransport.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Transport/EsmtpTransport.php';12 //@require 'Swift/DependencyContainer.php';13 11 14 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Spool.php
r23762 r33569 36 36 * Queues a message. 37 37 * @param Swift_Mime_Message $message The message to store 38 * 39 * @return boolean Whether the operation has succeeded 38 40 */ 39 41 public function queueMessage(Swift_Mime_Message $message); branches/1.4/lib/vendor/swiftmailer/classes/Swift/StreamFilters/ByteArrayReplacementFilter.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/StreamFilter.php';12 11 13 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/StreamFilters/StringReplacementFilter.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/StreamFilter.php';12 11 13 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/StreamFilters/StringReplacementFilterFactory.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/StreamFilters/StringReplacementFilter.php';12 //@require 'Swift/StreamFilterFactory.php';13 11 14 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Transport.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Mime/Message.php';12 //@require 'Swift/Events/EventListener.php';13 11 14 12 /** … … 42 40 * Send the given Message. 43 41 * 44 * Recipient/sender data will be retr eived from the Message API.42 * Recipient/sender data will be retrieved from the Message API. 45 43 * The return value is the number of recipients who were accepted for delivery. 46 44 * branches/1.4/lib/vendor/swiftmailer/classes/Swift/Transport/AbstractSmtpTransport.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Transport.php';12 //@require 'Swift/Transport/IoBuffer.php';13 //@require 'Swift/Transport/CommandSentException.php';14 //@require 'Swift/TransportException.php';15 //@require 'Swift/Mime/Message.php';16 //@require 'Swift/Events/EventDispatcher.php';17 //@require 'Swift/Events/EventListener.php';18 11 19 12 /** … … 40 33 protected $_eventDispatcher; 41 34 35 /** Source Ip */ 36 protected $_sourceIp; 37 42 38 /** Return an array of params for the Buffer */ 43 39 abstract protected function _getBufferParams(); … … 64 60 * 65 61 * @param string $domain 62 * @return Swift_Transport_AbstractSmtpTransport 66 63 */ 67 64 public function setLocalDomain($domain) … … 81 78 } 82 79 80 81 /** 82 * Sets the sourceIp 83 * @param string $source 84 */ 85 public function setSourceIp($source) 86 { 87 $this->_sourceIp=$source; 88 } 89 90 /** 91 * Returns the ip used to connect to the destination 92 * @return string 93 */ 94 public function getSourceIp() 95 { 96 return $this->_sourceIp; 97 } 98 83 99 /** 84 100 * Start the SMTP connection. … … 130 146 * Send the given Message. 131 147 * 132 * Recipient/sender data will be retr eived from the Message API.148 * Recipient/sender data will be retrieved from the Message API. 133 149 * The return value is the number of recipients who were accepted for delivery. 134 150 * … … 142 158 $failedRecipients = (array) $failedRecipients; 143 159 160 if ($evt = $this->_eventDispatcher->createSendEvent($this, $message)) 161 { 162 $this->_eventDispatcher->dispatchEvent($evt, 'beforeSendPerformed'); 163 if ($evt->bubbleCancelled()) 164 { 165 return 0; 166 } 167 } 168 144 169 if (!$reversePath = $this->_getReversePath($message)) 145 170 { … … 147 172 'Cannot send message without a sender address' 148 173 ); 149 }150 151 if ($evt = $this->_eventDispatcher->createSendEvent($this, $message))152 {153 $this->_eventDispatcher->dispatchEvent($evt, 'beforeSendPerformed');154 if ($evt->bubbleCancelled())155 {156 return 0;157 }158 174 } 159 175 … … 392 408 protected function _assertResponseCode($response, $wanted) 393 409 { 394 list($code , $separator, $text) = sscanf($response, '%3d%[ -]%s');410 list($code) = sscanf($response, '%3d'); 395 411 $valid = (empty($wanted) || in_array($code, $wanted)); 396 412 branches/1.4/lib/vendor/swiftmailer/classes/Swift/Transport/Esmtp/Auth/CramMd5Authenticator.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Transport/Esmtp/Authenticator.php';12 //@require 'Swift/Transport/SmtpAgent.php';13 //@require 'Swift/TransportException.php';14 11 15 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Transport/Esmtp/Auth/LoginAuthenticator.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Transport/Esmtp/Authenticator.php';12 //@require 'Swift/Transport/SmtpAgent.php';13 //@require 'Swift/TransportException.php';14 11 15 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Transport/Esmtp/Auth/PlainAuthenticator.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Transport/Esmtp/Authenticator.php';12 //@require 'Swift/Transport/SmtpAgent.php';13 //@require 'Swift/TransportException.php';14 11 15 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Transport/Esmtp/AuthHandler.php
r22246 r33569 9 9 */ 10 10 11 //@require 'Swift/TransportException.php';12 //@require 'Swift/Transport/EsmtpHandler.php';13 //@require 'Swift/Transport/SmtpAgent.php';14 11 15 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Transport/Esmtp/Authenticator.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Transport/SmtpAgent.php';12 11 13 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Transport/EsmtpHandler.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Transport/EsmtpBufferWrapper.php';12 11 13 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Transport/EsmtpTransport.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Transport/AbstractSmtpTransport.php';12 //@require 'Swift/Transport/EsmtpHandler.php';13 //@require 'Swift/Transport/IoBuffer.php';14 //@require 'Swift/Transport/SmtpAgent.php';15 //@require 'Swift/TransportException.php';16 //@require 'Swift/Mime/Message.php';17 //@require 'Swift/Events/EventDispatcher.php';18 11 19 12 /** … … 53 46 'timeout' => 30, 54 47 'blocking' => 1, 48 'tls' => false, 55 49 'type' => Swift_Transport_IoBuffer::TYPE_SOCKET 56 50 ); … … 72 66 * Set the host to connect to. 73 67 * @param string $host 68 * @return Swift_Transport_EsmtpTransport 74 69 */ 75 70 public function setHost($host) … … 91 86 * Set the port to connect to. 92 87 * @param int $port 88 * @return Swift_Transport_EsmtpTransport 93 89 */ 94 90 public function setPort($port) … … 110 106 * Set the connection timeout. 111 107 * @param int $timeout seconds 108 * @return Swift_Transport_EsmtpTransport 112 109 */ 113 110 public function setTimeout($timeout) 114 111 { 115 112 $this->_params['timeout'] = (int) $timeout; 113 $this->_buffer->setParam('timeout', (int) $timeout); 116 114 return $this; 117 115 } … … 129 127 * Set the encryption type (tls or ssl) 130 128 * @param string $encryption 129 * @return Swift_Transport_EsmtpTransport 131 130 */ 132 131 public function setEncryption($enc) 133 132 { 134 $this->_params['protocol'] = $enc; 133 if ('tls' == $enc) 134 { 135 $this->_params['protocol'] = 'tcp'; 136 $this->_params['tls'] = true; 137 } else { 138 $this->_params['protocol'] = $enc; 139 $this->_params['tls'] = false; 140 } 135 141 return $this; 136 142 } … … 142 148 public function getEncryption() 143 149 { 144 return $this->_params['protocol']; 150 return $this->_params['tls'] ? 'tls' : $this->_params['protocol']; 151 } 152 153 /** 154 * Sets the sourceIp 155 * @param string $source 156 * @return Swift_Transport_EsmtpTransport 157 */ 158 public function setSourceIp($source) 159 { 160 $this->_params['sourceIp']=$source; 161 return $this; 162 } 163 164 /** 165 * Returns the ip used to connect to the destination 166 * @return string 167 */ 168 public function getSourceIp() 169 { 170 return $this->_params['sourceIp']; 145 171 } 146 172 … … 148 174 * Set ESMTP extension handlers. 149 175 * @param Swift_Transport_EsmtpHandler[] $handlers 176 * @return Swift_Transport_EsmtpTransport 150 177 */ 151 178 public function setExtensionHandlers(array $handlers) … … 240 267 sprintf("EHLO %s\r\n", $this->_domain), array(250) 241 268 ); 242 $this->_capabilities = $this->_getCapabilities($response);243 $this->_setHandlerParams();244 foreach ($this->_getActiveHandlers() as $handler)245 {246 $handler->afterEhlo($this);247 }248 269 } 249 270 catch (Swift_TransportException $e) 250 271 { 251 parent::_doHeloCommand(); 272 return parent::_doHeloCommand(); 273 } 274 275 if ($this->_params['tls']) 276 { 277 try 278 { 279 $this->executeCommand("STARTTLS\r\n", array(220)); 280 281 if (!$this->_buffer->startTLS()) 282 { 283 throw new Swift_TransportException('Unable to connect with TLS encryption'); 284 } 285 286 try 287 { 288 $response = $this->executeCommand( 289 sprintf("EHLO %s\r\n", $this->_domain), array(250) 290 ); 291 } 292 catch (Swift_TransportException $e) 293 { 294 return parent::_doHeloCommand(); 295 } 296 } 297 catch (Swift_TransportException $e) 298 { 299 $this->_throwException($e); 300 } 301 } 302 303 $this->_capabilities = $this->_getCapabilities($response); 304 $this->_setHandlerParams(); 305 foreach ($this->_getActiveHandlers() as $handler) 306 { 307 $handler->afterEhlo($this); 252 308 } 253 309 } branches/1.4/lib/vendor/swiftmailer/classes/Swift/Transport/FailoverTransport.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Transport/LoadBalancedTransport.php';12 //@require 'Swift/Mime/Message.php';13 11 14 12 /** … … 39 37 /** 40 38 * Send the given Message. 41 * Recipient/sender data will be retr eived from the Message API.39 * Recipient/sender data will be retrieved from the Message API. 42 40 * The return value is the number of recipients who were accepted for delivery. 43 41 * @param Swift_Mime_Message $message branches/1.4/lib/vendor/swiftmailer/classes/Swift/Transport/IoBuffer.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/InputByteStream.php';12 //@require 'Swift/OutputByteStream.php';13 11 14 12 /** branches/1.4/lib/vendor/swiftmailer/classes/Swift/Transport/LoadBalancedTransport.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Transport.php';12 //@require 'Swift/Mime/Message.php';13 //@require 'Swift/Events/EventListener.php';14 11 15 12 /** … … 57 54 * @return array Swift_Transport 58 55 */ 59 public function getTransports( array $transports)56 public function getTransports() 60 57 { 61 58 return array_merge($this->_transports, $this->_deadTransports); … … 94 91 * Send the given Message. 95 92 * 96 * Recipient/sender data will be retr eived from the Message API.93 * Recipient/sender data will be retrieved from the Message API. 97 94 * The return value is the number of recipients who were accepted for delivery. 98 95 * branches/1.4/lib/vendor/swiftmailer/classes/Swift/Transport/MailTransport.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Transport.php';12 //@require 'Swift/Transport/MailInvoker.php';13 //@require 'Swift/Mime/Message.php';14 //@require 'Swift/Events/EventListener.php';15 11 16 12 /** … … 80 76 * 81 77 * @param string $params 78 * @return Swift_Transport_MailTransport 82 79 */ 83 80 public function setExtraParams($params) … … 102 99 * Send the given Message. 103 100 * 104 * Recipient/sender data will be retr eived from the Message API.101 * Recipient/sender data will be retrieved from the Message API. 105 102 * The return value is the number of recipients who were accepted for delivery. 106 103 * … … 131 128 $subjectHeader = $message->getHeaders()->get('Subject'); 132 129 130 if (!$toHeader) 131 { 132 throw new Swift_TransportException( 133 'Cannot send message without a recipient' 134 ); 135 } 133 136 $to = $toHeader->getFieldBody(); 134 $subject = $subjectHeader ->getFieldBody();137 $subject = $subjectHeader ? $subjectHeader->getFieldBody() : ''; 135 138 136 139 $reversePath = $this->_getReversePath($message); branches/1.4/lib/vendor/swiftmailer/classes/Swift/Transport/SendmailTransport.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/Transport/EsmtpTransport.php';12 //@require 'Swift/Transport/IoBuffer.php';13 //@require 'Swift/Transport/Log.php';14 //@require 'Swift/Events/EventDispatcher.php';15 11 16 12 /** … … 71 67 * are hence possible. 72 68 * @param string $command 69 * @return Swift_Transport_SendmailTransport 73 70 */ 74 71 public function setCommand($command) … … 89 86 /** 90 87 * Send the given Message. 91 * Recipient/sender data will be retr eived from the Message API.88 * Recipient/sender data will be retrieved from the Message API. 92 89 * The return value is the number of recipients who were accepted for delivery. 93 90 * NOTE: If using 'sendmail -t' you will not be aware of any failures until branches/1.4/lib/vendor/swiftmailer/classes/Swift/Transport/SimpleMailInvoker.php
r21808 r33569 19 19 */ 20 20 21 //@require 'Swift/Transport/MailInvoker.php';22 21 23 22 /** … … 48 47 if (!ini_get('safe_mode')) 49 48 { 50 return mail($to, $subject, $body, $headers, $extraParams);49 return @mail($to, $subject, $body, $headers, $extraParams); 51 50 } 52 51 else 53 52 { 54 return mail($to, $subject, $body, $headers);53 return @mail($to, $subject, $body, $headers); 55 54 } 56 55 } branches/1.4/lib/vendor/swiftmailer/classes/Swift/Transport/SpoolTransport.php
r22247 r33569 34 34 * Sets the spool object. 35 35 * @param Swift_Spool $spool 36 * @return Swift_Transport_SpoolTransport 36 37 */ 37 38 public function setSpool(Swift_Spool $spool) branches/1.4/lib/vendor/swiftmailer/classes/Swift/Transport/StreamBuffer.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/ByteStream/AbstractFilterableInputStream.php';12 //@require 'Swift/ReplacementFilterFactory.php';13 //@require 'Swift/Transport/IoBuffer.php';14 //@require 'Swift/TransportException.php';15 11 16 12 /** … … 84 80 switch ($param) 85 81 { 86 case 'protocol': 87 if (!array_key_exists('protocol', $this->_params) 88 || $value != $this->_params['protocol']) 82 case 'timeout': 83 if ($this->_stream) 89 84 { 90 if ('tls' == $value) 91 { 92 stream_socket_enable_crypto( 93 $this->_stream, true, STREAM_CRYPTO_METHOD_TLS_CLIENT 94 ); 95 } 85 stream_set_timeout($this->_stream, $value); 96 86 } 97 87 break; 88 89 case 'blocking': 90 if ($this->_stream) 91 { 92 stream_set_blocking($this->_stream, 1); 93 } 94 98 95 } 99 96 } 100 97 $this->_params[$param] = $value; 98 } 99 100 public function startTLS() 101 { 102 return stream_socket_enable_crypto($this->_stream, true, STREAM_CRYPTO_METHOD_TLS_CLIENT); 101 103 } 102 104 … … 166 168 { 167 169 $line = fgets($this->_out); 170 if (strlen($line)==0) 171 { 172 $metas = stream_get_meta_data($this->_out); 173 if ($metas['timed_out']) { 174 throw new Swift_IoException( 175 'Connection to ' . 176 $this->_getReadConnectionDescription() . 177 ' Timed Out' 178 ); 179 } 180 } 168 181 return $line; 169 182 } … … 183 196 { 184 197 $ret = fread($this->_out, $length); 198 if (strlen($ret)==0) 199 { 200 $metas = stream_get_meta_data($this->_out); 201 if ($metas['timed_out']) 202 { 203 throw new Swift_IoException( 204 'Connection to ' . 205 $this->_getReadConnectionDescription() . 206 ' Timed Out' 207 ); 208 } 209 } 185 210 return $ret; 186 211 } … … 231 256 $timeout = $this->_params['timeout']; 232 257 } 233 if (!$this->_stream = fsockopen($host, $this->_params['port'], $errno, $errstr, $timeout)) 258 $options = array(); 259 if (!empty($this->_params['sourceIp'])) 260 { 261 $options['socket']['bindto']=$this->_params['sourceIp'].':0'; 262 } 263 $this->_stream = @stream_socket_client($host.':'.$this->_params['port'], $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT, stream_context_create($options)); 264 if (false === $this->_stream) 234 265 { 235 266 throw new Swift_TransportException( … … 246 277 stream_set_blocking($this->_stream, 0); 247 278 } 279 stream_set_timeout($this->_stream, $timeout); 248 280 $this->_in =& $this->_stream; 249 281 $this->_out =& $this->_stream; … … 274 306 } 275 307 308 309 private function _getReadConnectionDescription() 310 { 311 switch ($this->_params['type']) 312 { 313 case self::TYPE_PROCESS: 314 return 'Process '.$this->_params['command']; 315 break; 316 317 case self::TYPE_SOCKET: 318 default: 319 $host = $this->_params['host']; 320 if (!empty($this->_params['protocol'])) 321 { 322 $host = $this->_params['protocol'] . '://' . $host; 323 } 324 $host.=':'.$this->_params['port']; 325 return $host; 326 break; 327 } 328 } 276 329 } branches/1.4/lib/vendor/swiftmailer/classes/Swift/TransportException.php
r21985 r33569 9 9 */ 10 10 11 //@require 'Swift/IoException.php';12 11 13 12 /** branches/1.4/lib/vendor/swiftmailer/dependency_maps/mime_deps.php
r22246 r33569 1 1 <?php 2 2 3 require _oncedirname(__FILE__) . '/../mime_types.php';3 require dirname(__FILE__) . '/../mime_types.php'; 4 4 5 5 Swift_DependencyContainer::getInstance() … … 7 7 -> register('properties.charset') 8 8 -> asValue('utf-8') 9 10 -> register('mime.grammar') 11 -> asSharedInstanceOf('Swift_Mime_Grammar') 9 12 10 13 -> register('mime.message') … … 14 17 'mime.qpcontentencoder', 15 18 'cache', 19 'mime.grammar', 16 20 'properties.charset' 17 21 )) … … 23 27 'mime.qpcontentencoder', 24 28 'cache', 29 'mime.grammar', 25 30 'properties.charset' 26 31 )) … … 31 36 'mime.headerset', 32 37 'mime.base64contentencoder', 33 'cache' 38 'cache', 39 'mime.grammar' 34 40 )) 35 41 -> addConstructorValue($swift_mime_types) … … 40 46 'mime.headerset', 41 47 'mime.base64contentencoder', 42 'cache' 48 'cache', 49 'mime.grammar' 43 50 )) 44 51 -> addConstructorValue($swift_mime_types) … … 49 56 'mime.qpheaderencoder', 50 57 'mime.rfc2231encoder', 58 'mime.grammar', 51 59 'properties.charset' 52 60 )) branches/1.4/lib/vendor/swiftmailer/preferences.php
r21808 r33569 10 10 Swift_Preferences::getInstance()->setCharset('utf-8'); 11 11 12 // Without these lines the default caching mechanism is "array" but this uses 13 // a lot of memory.14 // If possible, use a disk cache to enable attaching large attachments etc12 // Without these lines the default caching mechanism is "array" but this uses a lot of memory. 13 // If possible, use a disk cache to enable attaching large attachments etc. 14 // You can override the default temporary directory by setting the TMPDIR environment variable. 15 15 if (function_exists('sys_get_temp_dir') && is_writable(sys_get_temp_dir())) 16 16 { … … 19 19 -> setCacheType('disk'); 20 20 } 21 22 Swift_Preferences::getInstance()->setQPDotEscape(false); branches/1.4/lib/vendor/swiftmailer/swift_init.php
r21985 r33569 13 13 */ 14 14 15 if (defined('SWIFT_INIT_LOADED')) 16 return; 17 18 define('SWIFT_INIT_LOADED', true); 19 15 20 //Load in dependency maps 16 require_once dirname(__FILE__) . '/dependency_maps/cache_deps.php'; 17 require_once dirname(__FILE__) . '/dependency_maps/mime_deps.php'; 18 require_once dirname(__FILE__) . '/dependency_maps/transport_deps.php'; 21 require dirname(__FILE__) . '/dependency_maps/cache_deps.php'; 22 require dirname(__FILE__) . '/dependency_maps/mime_deps.php'; 23 require dirname(__FILE__) . '/dependency_maps/message_deps.php'; 24 require dirname(__FILE__) . '/dependency_maps/transport_deps.php'; 19 25 20 26 //Load in global library preferences 21 require _oncedirname(__FILE__) . '/preferences.php';27 require dirname(__FILE__) . '/preferences.php'; branches/1.4/lib/vendor/swiftmailer/swift_required.php
r21985 r33569 13 13 */ 14 14 15 if (defined('SWIFT_REQUIRED_LOADED')) 16 return; 17 18 define('SWIFT_REQUIRED_LOADED', true); 19 15 20 //Load Swift utility class 16 require _oncedirname(__FILE__) . '/classes/Swift.php';21 require dirname(__FILE__) . '/classes/Swift.php'; 17 22 18 //Start the autoloader 19 Swift::registerAutoload(); 20 21 //Load the init script to set up dependency injection 22 require_once dirname(__FILE__) . '/swift_init.php'; 23 //Start the autoloader and lazy-load the init script to set up dependency injection 24 Swift::registerAutoload(dirname(__FILE__) . '/swift_init.php'); branches/1.4/lib/vendor/swiftmailer/swift_required_pear.php
r23762 r33569 13 13 */ 14 14 15 if (defined('SWIFT_REQUIRED_LOADED')) 16 return; 17 18 define('SWIFT_REQUIRED_LOADED', true); 19 15 20 //Load Swift utility class 16 require _oncedirname(__FILE__) . '/Swift.php';21 require dirname(__FILE__) . '/Swift.php'; 17 22 18 23 //Start the autoloader … … 20 25 21 26 //Load the init script to set up dependency injection 22 require _oncedirname(__FILE__) . '/swift_init.php';27 require dirname(__FILE__) . '/swift_init.php';