@@ -21,11 +21,11 @@  | 
                                                    ||
| 21 | 21 | protected $openned = false;  | 
                                                        
| 22 | 22 | protected $filename;  | 
                                                        
| 23 | 23 | protected $pclzip;  | 
                                                        
| 24 | - /**  | 
                                                        |
| 25 | - * Class constructor  | 
                                                        |
| 26 | - *  | 
                                                        |
| 27 | - * @throws PclZipProxyException  | 
                                                        |
| 28 | - */  | 
                                                        |
| 24 | + /**  | 
                                                        |
| 25 | + * Class constructor  | 
                                                        |
| 26 | + *  | 
                                                        |
| 27 | + * @throws PclZipProxyException  | 
                                                        |
| 28 | + */  | 
                                                        |
| 29 | 29 | public function __construct($forcedir='')  | 
                                                        
| 30 | 30 |  	{ | 
                                                        
| 31 | 31 |  		if (! class_exists('PclZip')) { | 
                                                        
@@ -15,5 +15,5 @@  | 
                                                    ||
| 15 | 15 | // If possible, use a disk cache to enable attaching large attachments etc.  | 
                                                        
| 16 | 16 | // You can override the default temporary directory by setting the TMPDIR environment variable.  | 
                                                        
| 17 | 17 |  if (@is_writable($tmpDir = sys_get_temp_dir())) { | 
                                                        
| 18 | -    $preferences->setTempDir($tmpDir)->setCacheType('disk'); | 
                                                        |
| 18 | +	$preferences->setTempDir($tmpDir)->setCacheType('disk'); | 
                                                        |
| 19 | 19 | }  | 
                                                        
@@ -6,177 +6,177 @@  | 
                                                    ||
| 6 | 6 | |
| 7 | 7 | function generateUpToDateMimeArray()  | 
                                                        
| 8 | 8 |  { | 
                                                        
| 9 | - $preamble = "<?php\n\n";  | 
                                                        |
| 10 | - $preamble .= "/*\n";  | 
                                                        |
| 11 | - $preamble .= " * This file is part of SwiftMailer.\n";  | 
                                                        |
| 12 | - $preamble .= " * (c) 2004-2009 Chris Corbyn\n *\n";  | 
                                                        |
| 13 | - $preamble .= " * For the full copyright and license information, please view the LICENSE\n";  | 
                                                        |
| 14 | - $preamble .= " * file that was distributed with this source code.\n *\n";  | 
                                                        |
| 15 | - $preamble .= " * autogenerated using https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types\n";  | 
                                                        |
| 16 | - $preamble .= " * and https://raw.github.com/minad/mimemagic/master/script/freedesktop.org.xml\n";  | 
                                                        |
| 17 | - $preamble .= " */\n\n";  | 
                                                        |
| 18 | - $preamble .= "/*\n";  | 
                                                        |
| 19 | - $preamble .= " * List of MIME type automatically detected in Swift Mailer.\n";  | 
                                                        |
| 20 | - $preamble .= " */\n\n";  | 
                                                        |
| 21 | - $preamble .= "// You may add or take away what you like (lowercase required)\n\n";  | 
                                                        |
| 22 | -  | 
                                                        |
| 23 | - // get current mime types files  | 
                                                        |
| 24 | - $mime_types = @file_get_contents(APACHE_MIME_TYPES_URL);  | 
                                                        |
| 25 | - $mime_xml = @file_get_contents(FREEDESKTOP_XML_URL);  | 
                                                        |
| 26 | -  | 
                                                        |
| 27 | - // prepare valid mime types  | 
                                                        |
| 28 | - $valid_mime_types = [];  | 
                                                        |
| 29 | -  | 
                                                        |
| 30 | - // split mime type and extensions eg. "video/x-matroska mkv mk3d mks"  | 
                                                        |
| 31 | -    if (false !== preg_match_all('/^#?([a-z0-9\-\+\/\.]+)[\t]+(.*)$/miu', $mime_types, $matches)) { | 
                                                        |
| 32 | - // collection of predefined mimetypes (bugfix for wrong resolved or missing mime types)  | 
                                                        |
| 33 | - $valid_mime_types_preset = [  | 
                                                        |
| 34 | - 'php' => 'application/x-php',  | 
                                                        |
| 35 | - 'php3' => 'application/x-php',  | 
                                                        |
| 36 | - 'php4' => 'application/x-php',  | 
                                                        |
| 37 | - 'php5' => 'application/x-php',  | 
                                                        |
| 38 | - 'zip' => 'application/zip',  | 
                                                        |
| 39 | - 'gif' => 'image/gif',  | 
                                                        |
| 40 | - 'png' => 'image/png',  | 
                                                        |
| 41 | - 'css' => 'text/css',  | 
                                                        |
| 42 | - 'js' => 'text/javascript',  | 
                                                        |
| 43 | - 'txt' => 'text/plain',  | 
                                                        |
| 44 | - 'aif' => 'audio/x-aiff',  | 
                                                        |
| 45 | - 'aiff' => 'audio/x-aiff',  | 
                                                        |
| 46 | - 'avi' => 'video/avi',  | 
                                                        |
| 47 | - 'bmp' => 'image/bmp',  | 
                                                        |
| 48 | - 'bz2' => 'application/x-bz2',  | 
                                                        |
| 49 | - 'csv' => 'text/csv',  | 
                                                        |
| 50 | - 'dmg' => 'application/x-apple-diskimage',  | 
                                                        |
| 51 | - 'doc' => 'application/msword',  | 
                                                        |
| 52 | - 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',  | 
                                                        |
| 53 | - 'eml' => 'message/rfc822',  | 
                                                        |
| 54 | - 'aps' => 'application/postscript',  | 
                                                        |
| 55 | - 'exe' => 'application/x-ms-dos-executable',  | 
                                                        |
| 56 | - 'flv' => 'video/x-flv',  | 
                                                        |
| 57 | - 'gz' => 'application/x-gzip',  | 
                                                        |
| 58 | - 'hqx' => 'application/stuffit',  | 
                                                        |
| 59 | - 'htm' => 'text/html',  | 
                                                        |
| 60 | - 'html' => 'text/html',  | 
                                                        |
| 61 | - 'jar' => 'application/x-java-archive',  | 
                                                        |
| 62 | - 'jpeg' => 'image/jpeg',  | 
                                                        |
| 63 | - 'jpg' => 'image/jpeg',  | 
                                                        |
| 64 | - 'm3u' => 'audio/x-mpegurl',  | 
                                                        |
| 65 | - 'm4a' => 'audio/mp4',  | 
                                                        |
| 66 | - 'mdb' => 'application/x-msaccess',  | 
                                                        |
| 67 | - 'mid' => 'audio/midi',  | 
                                                        |
| 68 | - 'midi' => 'audio/midi',  | 
                                                        |
| 69 | - 'mov' => 'video/quicktime',  | 
                                                        |
| 70 | - 'mp3' => 'audio/mpeg',  | 
                                                        |
| 71 | - 'mp4' => 'video/mp4',  | 
                                                        |
| 72 | - 'mpeg' => 'video/mpeg',  | 
                                                        |
| 73 | - 'mpg' => 'video/mpeg',  | 
                                                        |
| 74 | - 'odg' => 'vnd.oasis.opendocument.graphics',  | 
                                                        |
| 75 | - 'odp' => 'vnd.oasis.opendocument.presentation',  | 
                                                        |
| 76 | - 'odt' => 'vnd.oasis.opendocument.text',  | 
                                                        |
| 77 | - 'ods' => 'vnd.oasis.opendocument.spreadsheet',  | 
                                                        |
| 78 | - 'ogg' => 'audio/ogg',  | 
                                                        |
| 79 | - 'pdf' => 'application/pdf',  | 
                                                        |
| 80 | - 'ppt' => 'application/vnd.ms-powerpoint',  | 
                                                        |
| 81 | - 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',  | 
                                                        |
| 82 | - 'ps' => 'application/postscript',  | 
                                                        |
| 83 | - 'rar' => 'application/x-rar-compressed',  | 
                                                        |
| 84 | - 'rtf' => 'application/rtf',  | 
                                                        |
| 85 | - 'tar' => 'application/x-tar',  | 
                                                        |
| 86 | - 'sit' => 'application/x-stuffit',  | 
                                                        |
| 87 | - 'svg' => 'image/svg+xml',  | 
                                                        |
| 88 | - 'tif' => 'image/tiff',  | 
                                                        |
| 89 | - 'tiff' => 'image/tiff',  | 
                                                        |
| 90 | - 'ttf' => 'application/x-font-truetype',  | 
                                                        |
| 91 | - 'vcf' => 'text/x-vcard',  | 
                                                        |
| 92 | - 'wav' => 'audio/wav',  | 
                                                        |
| 93 | - 'wma' => 'audio/x-ms-wma',  | 
                                                        |
| 94 | - 'wmv' => 'audio/x-ms-wmv',  | 
                                                        |
| 95 | - 'xls' => 'application/vnd.ms-excel',  | 
                                                        |
| 96 | - 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',  | 
                                                        |
| 97 | - 'xml' => 'application/xml',  | 
                                                        |
| 98 | - ];  | 
                                                        |
| 99 | -  | 
                                                        |
| 100 | - // wrap array for generating file  | 
                                                        |
| 101 | -        foreach ($valid_mime_types_preset as $extension => $mime_type) { | 
                                                        |
| 102 | - // generate array for mimetype to extension resolver (only first match)  | 
                                                        |
| 103 | -            $valid_mime_types[$extension] = "'{$extension}' => '{$mime_type}'"; | 
                                                        |
| 104 | - }  | 
                                                        |
| 105 | -  | 
                                                        |
| 106 | - // all extensions from second match  | 
                                                        |
| 107 | -        foreach ($matches[2] as $i => $extensions) { | 
                                                        |
| 108 | - // explode multiple extensions from string  | 
                                                        |
| 109 | -            $extensions = explode(' ', strtolower($extensions ?? '')); | 
                                                        |
| 110 | -  | 
                                                        |
| 111 | - // force array for foreach  | 
                                                        |
| 112 | -            if (!\is_array($extensions)) { | 
                                                        |
| 113 | - $extensions = [$extensions];  | 
                                                        |
| 114 | - }  | 
                                                        |
| 115 | -  | 
                                                        |
| 116 | -            foreach ($extensions as $extension) { | 
                                                        |
| 117 | - // get mime type  | 
                                                        |
| 118 | - $mime_type = $matches[1][$i];  | 
                                                        |
| 119 | -  | 
                                                        |
| 120 | - // check if string length lower than 10  | 
                                                        |
| 121 | -                if (\strlen($extension) < 10) { | 
                                                        |
| 122 | -                    if (!isset($valid_mime_types[$mime_type])) { | 
                                                        |
| 123 | - // generate array for mimetype to extension resolver (only first match)  | 
                                                        |
| 124 | -                        $valid_mime_types[$extension] = "'{$extension}' => '{$mime_type}'"; | 
                                                        |
| 125 | - }  | 
                                                        |
| 126 | - }  | 
                                                        |
| 127 | - }  | 
                                                        |
| 128 | - }  | 
                                                        |
| 129 | - }  | 
                                                        |
| 130 | -  | 
                                                        |
| 131 | - $xml = simplexml_load_string($mime_xml);  | 
                                                        |
| 132 | -  | 
                                                        |
| 133 | -    foreach ($xml as $node) { | 
                                                        |
| 134 | - // check if there is no pattern  | 
                                                        |
| 135 | -        if (!isset($node->glob['pattern'])) { | 
                                                        |
| 136 | - continue;  | 
                                                        |
| 137 | - }  | 
                                                        |
| 138 | -  | 
                                                        |
| 139 | - // get all matching extensions from match  | 
                                                        |
| 140 | -        foreach ((array) $node->glob['pattern'] as $extension) { | 
                                                        |
| 141 | - // skip none glob extensions  | 
                                                        |
| 142 | -            if (false === strpos($extension ?? '', '.')) { | 
                                                        |
| 143 | - continue;  | 
                                                        |
| 144 | - }  | 
                                                        |
| 145 | -  | 
                                                        |
| 146 | - // remove get only last part  | 
                                                        |
| 147 | -            $extension = explode('.', strtolower($extension ?? '')); | 
                                                        |
| 148 | - $extension = end($extension);  | 
                                                        |
| 149 | - }  | 
                                                        |
| 150 | -  | 
                                                        |
| 151 | -        if (isset($node->glob['pattern'][0])) { | 
                                                        |
| 152 | - // mime type  | 
                                                        |
| 153 | - $mime_type = strtolower((string) $node['type'] ?? '');  | 
                                                        |
| 154 | -  | 
                                                        |
| 155 | - // get first extension  | 
                                                        |
| 156 | - $extension = strtolower(trim($node->glob['ddpattern'][0] ?? '', '*.'));  | 
                                                        |
| 157 | -  | 
                                                        |
| 158 | - // skip none glob extensions and check if string length between 1 and 10  | 
                                                        |
| 159 | -            if (false !== strpos($extension, '.') || \strlen($extension) < 1 || \strlen($extension) > 9) { | 
                                                        |
| 160 | - continue;  | 
                                                        |
| 161 | - }  | 
                                                        |
| 162 | -  | 
                                                        |
| 163 | - // check if string length lower than 10  | 
                                                        |
| 164 | -            if (!isset($valid_mime_types[$mime_type])) { | 
                                                        |
| 165 | - // generate array for mimetype to extension resolver (only first match)  | 
                                                        |
| 166 | -                $valid_mime_types[$extension] = "'{$extension}' => '{$mime_type}'"; | 
                                                        |
| 167 | - }  | 
                                                        |
| 168 | - }  | 
                                                        |
| 169 | - }  | 
                                                        |
| 170 | -  | 
                                                        |
| 171 | - // full list of valid extensions only  | 
                                                        |
| 172 | - $valid_mime_types = array_unique($valid_mime_types);  | 
                                                        |
| 173 | - ksort($valid_mime_types);  | 
                                                        |
| 174 | -  | 
                                                        |
| 175 | - // combine mime types and extensions array  | 
                                                        |
| 176 | -    $output = "$preamble\$swift_mime_types = array(\n    ".implode(",\n    ", $valid_mime_types)."\n);"; | 
                                                        |
| 177 | -  | 
                                                        |
| 178 | - // write mime_types.php config file  | 
                                                        |
| 179 | -    @file_put_contents('./mime_types.php', $output); | 
                                                        |
| 9 | + $preamble = "<?php\n\n";  | 
                                                        |
| 10 | + $preamble .= "/*\n";  | 
                                                        |
| 11 | + $preamble .= " * This file is part of SwiftMailer.\n";  | 
                                                        |
| 12 | + $preamble .= " * (c) 2004-2009 Chris Corbyn\n *\n";  | 
                                                        |
| 13 | + $preamble .= " * For the full copyright and license information, please view the LICENSE\n";  | 
                                                        |
| 14 | + $preamble .= " * file that was distributed with this source code.\n *\n";  | 
                                                        |
| 15 | + $preamble .= " * autogenerated using https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types\n";  | 
                                                        |
| 16 | + $preamble .= " * and https://raw.github.com/minad/mimemagic/master/script/freedesktop.org.xml\n";  | 
                                                        |
| 17 | + $preamble .= " */\n\n";  | 
                                                        |
| 18 | + $preamble .= "/*\n";  | 
                                                        |
| 19 | + $preamble .= " * List of MIME type automatically detected in Swift Mailer.\n";  | 
                                                        |
| 20 | + $preamble .= " */\n\n";  | 
                                                        |
| 21 | + $preamble .= "// You may add or take away what you like (lowercase required)\n\n";  | 
                                                        |
| 22 | +  | 
                                                        |
| 23 | + // get current mime types files  | 
                                                        |
| 24 | + $mime_types = @file_get_contents(APACHE_MIME_TYPES_URL);  | 
                                                        |
| 25 | + $mime_xml = @file_get_contents(FREEDESKTOP_XML_URL);  | 
                                                        |
| 26 | +  | 
                                                        |
| 27 | + // prepare valid mime types  | 
                                                        |
| 28 | + $valid_mime_types = [];  | 
                                                        |
| 29 | +  | 
                                                        |
| 30 | + // split mime type and extensions eg. "video/x-matroska mkv mk3d mks"  | 
                                                        |
| 31 | +	if (false !== preg_match_all('/^#?([a-z0-9\-\+\/\.]+)[\t]+(.*)$/miu', $mime_types, $matches)) { | 
                                                        |
| 32 | + // collection of predefined mimetypes (bugfix for wrong resolved or missing mime types)  | 
                                                        |
| 33 | + $valid_mime_types_preset = [  | 
                                                        |
| 34 | + 'php' => 'application/x-php',  | 
                                                        |
| 35 | + 'php3' => 'application/x-php',  | 
                                                        |
| 36 | + 'php4' => 'application/x-php',  | 
                                                        |
| 37 | + 'php5' => 'application/x-php',  | 
                                                        |
| 38 | + 'zip' => 'application/zip',  | 
                                                        |
| 39 | + 'gif' => 'image/gif',  | 
                                                        |
| 40 | + 'png' => 'image/png',  | 
                                                        |
| 41 | + 'css' => 'text/css',  | 
                                                        |
| 42 | + 'js' => 'text/javascript',  | 
                                                        |
| 43 | + 'txt' => 'text/plain',  | 
                                                        |
| 44 | + 'aif' => 'audio/x-aiff',  | 
                                                        |
| 45 | + 'aiff' => 'audio/x-aiff',  | 
                                                        |
| 46 | + 'avi' => 'video/avi',  | 
                                                        |
| 47 | + 'bmp' => 'image/bmp',  | 
                                                        |
| 48 | + 'bz2' => 'application/x-bz2',  | 
                                                        |
| 49 | + 'csv' => 'text/csv',  | 
                                                        |
| 50 | + 'dmg' => 'application/x-apple-diskimage',  | 
                                                        |
| 51 | + 'doc' => 'application/msword',  | 
                                                        |
| 52 | + 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',  | 
                                                        |
| 53 | + 'eml' => 'message/rfc822',  | 
                                                        |
| 54 | + 'aps' => 'application/postscript',  | 
                                                        |
| 55 | + 'exe' => 'application/x-ms-dos-executable',  | 
                                                        |
| 56 | + 'flv' => 'video/x-flv',  | 
                                                        |
| 57 | + 'gz' => 'application/x-gzip',  | 
                                                        |
| 58 | + 'hqx' => 'application/stuffit',  | 
                                                        |
| 59 | + 'htm' => 'text/html',  | 
                                                        |
| 60 | + 'html' => 'text/html',  | 
                                                        |
| 61 | + 'jar' => 'application/x-java-archive',  | 
                                                        |
| 62 | + 'jpeg' => 'image/jpeg',  | 
                                                        |
| 63 | + 'jpg' => 'image/jpeg',  | 
                                                        |
| 64 | + 'm3u' => 'audio/x-mpegurl',  | 
                                                        |
| 65 | + 'm4a' => 'audio/mp4',  | 
                                                        |
| 66 | + 'mdb' => 'application/x-msaccess',  | 
                                                        |
| 67 | + 'mid' => 'audio/midi',  | 
                                                        |
| 68 | + 'midi' => 'audio/midi',  | 
                                                        |
| 69 | + 'mov' => 'video/quicktime',  | 
                                                        |
| 70 | + 'mp3' => 'audio/mpeg',  | 
                                                        |
| 71 | + 'mp4' => 'video/mp4',  | 
                                                        |
| 72 | + 'mpeg' => 'video/mpeg',  | 
                                                        |
| 73 | + 'mpg' => 'video/mpeg',  | 
                                                        |
| 74 | + 'odg' => 'vnd.oasis.opendocument.graphics',  | 
                                                        |
| 75 | + 'odp' => 'vnd.oasis.opendocument.presentation',  | 
                                                        |
| 76 | + 'odt' => 'vnd.oasis.opendocument.text',  | 
                                                        |
| 77 | + 'ods' => 'vnd.oasis.opendocument.spreadsheet',  | 
                                                        |
| 78 | + 'ogg' => 'audio/ogg',  | 
                                                        |
| 79 | + 'pdf' => 'application/pdf',  | 
                                                        |
| 80 | + 'ppt' => 'application/vnd.ms-powerpoint',  | 
                                                        |
| 81 | + 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',  | 
                                                        |
| 82 | + 'ps' => 'application/postscript',  | 
                                                        |
| 83 | + 'rar' => 'application/x-rar-compressed',  | 
                                                        |
| 84 | + 'rtf' => 'application/rtf',  | 
                                                        |
| 85 | + 'tar' => 'application/x-tar',  | 
                                                        |
| 86 | + 'sit' => 'application/x-stuffit',  | 
                                                        |
| 87 | + 'svg' => 'image/svg+xml',  | 
                                                        |
| 88 | + 'tif' => 'image/tiff',  | 
                                                        |
| 89 | + 'tiff' => 'image/tiff',  | 
                                                        |
| 90 | + 'ttf' => 'application/x-font-truetype',  | 
                                                        |
| 91 | + 'vcf' => 'text/x-vcard',  | 
                                                        |
| 92 | + 'wav' => 'audio/wav',  | 
                                                        |
| 93 | + 'wma' => 'audio/x-ms-wma',  | 
                                                        |
| 94 | + 'wmv' => 'audio/x-ms-wmv',  | 
                                                        |
| 95 | + 'xls' => 'application/vnd.ms-excel',  | 
                                                        |
| 96 | + 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',  | 
                                                        |
| 97 | + 'xml' => 'application/xml',  | 
                                                        |
| 98 | + ];  | 
                                                        |
| 99 | +  | 
                                                        |
| 100 | + // wrap array for generating file  | 
                                                        |
| 101 | +		foreach ($valid_mime_types_preset as $extension => $mime_type) { | 
                                                        |
| 102 | + // generate array for mimetype to extension resolver (only first match)  | 
                                                        |
| 103 | +			$valid_mime_types[$extension] = "'{$extension}' => '{$mime_type}'"; | 
                                                        |
| 104 | + }  | 
                                                        |
| 105 | +  | 
                                                        |
| 106 | + // all extensions from second match  | 
                                                        |
| 107 | +		foreach ($matches[2] as $i => $extensions) { | 
                                                        |
| 108 | + // explode multiple extensions from string  | 
                                                        |
| 109 | +			$extensions = explode(' ', strtolower($extensions ?? '')); | 
                                                        |
| 110 | +  | 
                                                        |
| 111 | + // force array for foreach  | 
                                                        |
| 112 | +			if (!\is_array($extensions)) { | 
                                                        |
| 113 | + $extensions = [$extensions];  | 
                                                        |
| 114 | + }  | 
                                                        |
| 115 | +  | 
                                                        |
| 116 | +			foreach ($extensions as $extension) { | 
                                                        |
| 117 | + // get mime type  | 
                                                        |
| 118 | + $mime_type = $matches[1][$i];  | 
                                                        |
| 119 | +  | 
                                                        |
| 120 | + // check if string length lower than 10  | 
                                                        |
| 121 | +				if (\strlen($extension) < 10) { | 
                                                        |
| 122 | +					if (!isset($valid_mime_types[$mime_type])) { | 
                                                        |
| 123 | + // generate array for mimetype to extension resolver (only first match)  | 
                                                        |
| 124 | +						$valid_mime_types[$extension] = "'{$extension}' => '{$mime_type}'"; | 
                                                        |
| 125 | + }  | 
                                                        |
| 126 | + }  | 
                                                        |
| 127 | + }  | 
                                                        |
| 128 | + }  | 
                                                        |
| 129 | + }  | 
                                                        |
| 130 | +  | 
                                                        |
| 131 | + $xml = simplexml_load_string($mime_xml);  | 
                                                        |
| 132 | +  | 
                                                        |
| 133 | +	foreach ($xml as $node) { | 
                                                        |
| 134 | + // check if there is no pattern  | 
                                                        |
| 135 | +		if (!isset($node->glob['pattern'])) { | 
                                                        |
| 136 | + continue;  | 
                                                        |
| 137 | + }  | 
                                                        |
| 138 | +  | 
                                                        |
| 139 | + // get all matching extensions from match  | 
                                                        |
| 140 | +		foreach ((array) $node->glob['pattern'] as $extension) { | 
                                                        |
| 141 | + // skip none glob extensions  | 
                                                        |
| 142 | +			if (false === strpos($extension ?? '', '.')) { | 
                                                        |
| 143 | + continue;  | 
                                                        |
| 144 | + }  | 
                                                        |
| 145 | +  | 
                                                        |
| 146 | + // remove get only last part  | 
                                                        |
| 147 | +			$extension = explode('.', strtolower($extension ?? '')); | 
                                                        |
| 148 | + $extension = end($extension);  | 
                                                        |
| 149 | + }  | 
                                                        |
| 150 | +  | 
                                                        |
| 151 | +		if (isset($node->glob['pattern'][0])) { | 
                                                        |
| 152 | + // mime type  | 
                                                        |
| 153 | + $mime_type = strtolower((string) $node['type'] ?? '');  | 
                                                        |
| 154 | +  | 
                                                        |
| 155 | + // get first extension  | 
                                                        |
| 156 | + $extension = strtolower(trim($node->glob['ddpattern'][0] ?? '', '*.'));  | 
                                                        |
| 157 | +  | 
                                                        |
| 158 | + // skip none glob extensions and check if string length between 1 and 10  | 
                                                        |
| 159 | +			if (false !== strpos($extension, '.') || \strlen($extension) < 1 || \strlen($extension) > 9) { | 
                                                        |
| 160 | + continue;  | 
                                                        |
| 161 | + }  | 
                                                        |
| 162 | +  | 
                                                        |
| 163 | + // check if string length lower than 10  | 
                                                        |
| 164 | +			if (!isset($valid_mime_types[$mime_type])) { | 
                                                        |
| 165 | + // generate array for mimetype to extension resolver (only first match)  | 
                                                        |
| 166 | +				$valid_mime_types[$extension] = "'{$extension}' => '{$mime_type}'"; | 
                                                        |
| 167 | + }  | 
                                                        |
| 168 | + }  | 
                                                        |
| 169 | + }  | 
                                                        |
| 170 | +  | 
                                                        |
| 171 | + // full list of valid extensions only  | 
                                                        |
| 172 | + $valid_mime_types = array_unique($valid_mime_types);  | 
                                                        |
| 173 | + ksort($valid_mime_types);  | 
                                                        |
| 174 | +  | 
                                                        |
| 175 | + // combine mime types and extensions array  | 
                                                        |
| 176 | +	$output = "$preamble\$swift_mime_types = array(\n    ".implode(",\n    ", $valid_mime_types)."\n);"; | 
                                                        |
| 177 | +  | 
                                                        |
| 178 | + // write mime_types.php config file  | 
                                                        |
| 179 | +	@file_put_contents('./mime_types.php', $output); | 
                                                        |
| 180 | 180 | }  | 
                                                        
| 181 | 181 | |
| 182 | 182 | generateUpToDateMimeArray();  | 
                                                        
@@ -1,23 +1,23 @@  | 
                                                    ||
| 1 | 1 | <?php  | 
                                                        
| 2 | 2 | |
| 3 | 3 | Swift_DependencyContainer::getInstance()  | 
                                                        
| 4 | -    ->register('cache') | 
                                                        |
| 5 | -    ->asAliasOf('cache.array') | 
                                                        |
| 4 | +	->register('cache') | 
                                                        |
| 5 | +	->asAliasOf('cache.array') | 
                                                        |
| 6 | 6 | |
| 7 | -    ->register('tempdir') | 
                                                        |
| 8 | -    ->asValue('/tmp') | 
                                                        |
| 7 | +	->register('tempdir') | 
                                                        |
| 8 | +	->asValue('/tmp') | 
                                                        |
| 9 | 9 | |
| 10 | -    ->register('cache.null') | 
                                                        |
| 11 | -    ->asSharedInstanceOf('Swift_KeyCache_NullKeyCache') | 
                                                        |
| 10 | +	->register('cache.null') | 
                                                        |
| 11 | +	->asSharedInstanceOf('Swift_KeyCache_NullKeyCache') | 
                                                        |
| 12 | 12 | |
| 13 | -    ->register('cache.array') | 
                                                        |
| 14 | -    ->asSharedInstanceOf('Swift_KeyCache_ArrayKeyCache') | 
                                                        |
| 15 | - ->withDependencies(['cache.inputstream'])  | 
                                                        |
| 13 | +	->register('cache.array') | 
                                                        |
| 14 | +	->asSharedInstanceOf('Swift_KeyCache_ArrayKeyCache') | 
                                                        |
| 15 | + ->withDependencies(['cache.inputstream'])  | 
                                                        |
| 16 | 16 | |
| 17 | -    ->register('cache.disk') | 
                                                        |
| 18 | -    ->asSharedInstanceOf('Swift_KeyCache_DiskKeyCache') | 
                                                        |
| 19 | - ->withDependencies(['cache.inputstream', 'tempdir'])  | 
                                                        |
| 17 | +	->register('cache.disk') | 
                                                        |
| 18 | +	->asSharedInstanceOf('Swift_KeyCache_DiskKeyCache') | 
                                                        |
| 19 | + ->withDependencies(['cache.inputstream', 'tempdir'])  | 
                                                        |
| 20 | 20 | |
| 21 | -    ->register('cache.inputstream') | 
                                                        |
| 22 | -    ->asNewInstanceOf('Swift_KeyCache_SimpleKeyCacheInputStream') | 
                                                        |
| 21 | +	->register('cache.inputstream') | 
                                                        |
| 22 | +	->asNewInstanceOf('Swift_KeyCache_SimpleKeyCacheInputStream') | 
                                                        |
| 23 | 23 | ;  | 
                                                        
@@ -3,132 +3,132 @@  | 
                                                    ||
| 3 | 3 | require __DIR__.'/../mime_types.php';  | 
                                                        
| 4 | 4 | |
| 5 | 5 | Swift_DependencyContainer::getInstance()  | 
                                                        
| 6 | -    ->register('properties.charset') | 
                                                        |
| 7 | -    ->asValue('utf-8') | 
                                                        |
| 8 | -  | 
                                                        |
| 9 | -    ->register('email.validator') | 
                                                        |
| 10 | -    ->asSharedInstanceOf('Egulias\EmailValidator\EmailValidator') | 
                                                        |
| 11 | -  | 
                                                        |
| 12 | -    ->register('mime.idgenerator.idright') | 
                                                        |
| 13 | - // As SERVER_NAME can come from the user in certain configurations, check that  | 
                                                        |
| 14 | - // it does not contain forbidden characters (see RFC 952 and RFC 2181). Use  | 
                                                        |
| 15 | - // preg_replace() instead of preg_match() to prevent DoS attacks with long host names.  | 
                                                        |
| 16 | -    ->asValue(!empty($_SERVER['SERVER_NAME']) && '' === preg_replace('/(?:^\[)?[a-zA-Z0-9-:\]_]+\.?/', '', $_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'swift.generated') | 
                                                        |
| 17 | -  | 
                                                        |
| 18 | -    ->register('mime.idgenerator') | 
                                                        |
| 19 | -    ->asSharedInstanceOf('Swift_Mime_IdGenerator') | 
                                                        |
| 20 | - ->withDependencies([  | 
                                                        |
| 21 | - 'mime.idgenerator.idright',  | 
                                                        |
| 22 | - ])  | 
                                                        |
| 23 | -  | 
                                                        |
| 24 | -    ->register('mime.message') | 
                                                        |
| 25 | -    ->asNewInstanceOf('Swift_Mime_SimpleMessage') | 
                                                        |
| 26 | - ->withDependencies([  | 
                                                        |
| 27 | - 'mime.headerset',  | 
                                                        |
| 28 | - 'mime.textcontentencoder',  | 
                                                        |
| 29 | - 'cache',  | 
                                                        |
| 30 | - 'mime.idgenerator',  | 
                                                        |
| 31 | - 'properties.charset',  | 
                                                        |
| 32 | - ])  | 
                                                        |
| 33 | -  | 
                                                        |
| 34 | -    ->register('mime.part') | 
                                                        |
| 35 | -    ->asNewInstanceOf('Swift_Mime_MimePart') | 
                                                        |
| 36 | - ->withDependencies([  | 
                                                        |
| 37 | - 'mime.headerset',  | 
                                                        |
| 38 | - 'mime.textcontentencoder',  | 
                                                        |
| 39 | - 'cache',  | 
                                                        |
| 40 | - 'mime.idgenerator',  | 
                                                        |
| 41 | - 'properties.charset',  | 
                                                        |
| 42 | - ])  | 
                                                        |
| 43 | -  | 
                                                        |
| 44 | -    ->register('mime.attachment') | 
                                                        |
| 45 | -    ->asNewInstanceOf('Swift_Mime_Attachment') | 
                                                        |
| 46 | - ->withDependencies([  | 
                                                        |
| 47 | - 'mime.headerset',  | 
                                                        |
| 48 | - 'mime.base64contentencoder',  | 
                                                        |
| 49 | - 'cache',  | 
                                                        |
| 50 | - 'mime.idgenerator',  | 
                                                        |
| 51 | - ])  | 
                                                        |
| 52 | - ->addConstructorValue($swift_mime_types)  | 
                                                        |
| 53 | -  | 
                                                        |
| 54 | -    ->register('mime.embeddedfile') | 
                                                        |
| 55 | -    ->asNewInstanceOf('Swift_Mime_EmbeddedFile') | 
                                                        |
| 56 | - ->withDependencies([  | 
                                                        |
| 57 | - 'mime.headerset',  | 
                                                        |
| 58 | - 'mime.base64contentencoder',  | 
                                                        |
| 59 | - 'cache',  | 
                                                        |
| 60 | - 'mime.idgenerator',  | 
                                                        |
| 61 | - ])  | 
                                                        |
| 62 | - ->addConstructorValue($swift_mime_types)  | 
                                                        |
| 63 | -  | 
                                                        |
| 64 | -    ->register('mime.headerfactory') | 
                                                        |
| 65 | -    ->asNewInstanceOf('Swift_Mime_SimpleHeaderFactory') | 
                                                        |
| 66 | - ->withDependencies([  | 
                                                        |
| 67 | - 'mime.qpheaderencoder',  | 
                                                        |
| 68 | - 'mime.rfc2231encoder',  | 
                                                        |
| 69 | - 'email.validator',  | 
                                                        |
| 70 | - 'properties.charset',  | 
                                                        |
| 71 | - 'address.idnaddressencoder',  | 
                                                        |
| 72 | - ])  | 
                                                        |
| 73 | -  | 
                                                        |
| 74 | -    ->register('mime.headerset') | 
                                                        |
| 75 | -    ->asNewInstanceOf('Swift_Mime_SimpleHeaderSet') | 
                                                        |
| 76 | - ->withDependencies(['mime.headerfactory', 'properties.charset'])  | 
                                                        |
| 77 | -  | 
                                                        |
| 78 | -    ->register('mime.qpheaderencoder') | 
                                                        |
| 79 | -    ->asNewInstanceOf('Swift_Mime_HeaderEncoder_QpHeaderEncoder') | 
                                                        |
| 80 | - ->withDependencies(['mime.charstream'])  | 
                                                        |
| 81 | -  | 
                                                        |
| 82 | -    ->register('mime.base64headerencoder') | 
                                                        |
| 83 | -    ->asNewInstanceOf('Swift_Mime_HeaderEncoder_Base64HeaderEncoder') | 
                                                        |
| 84 | - ->withDependencies(['mime.charstream'])  | 
                                                        |
| 85 | -  | 
                                                        |
| 86 | -    ->register('mime.charstream') | 
                                                        |
| 87 | -    ->asNewInstanceOf('Swift_CharacterStream_NgCharacterStream') | 
                                                        |
| 88 | - ->withDependencies(['mime.characterreaderfactory', 'properties.charset'])  | 
                                                        |
| 89 | -  | 
                                                        |
| 90 | -    ->register('mime.bytecanonicalizer') | 
                                                        |
| 91 | -    ->asSharedInstanceOf('Swift_StreamFilters_ByteArrayReplacementFilter') | 
                                                        |
| 92 | - ->addConstructorValue([[0x0D, 0x0A], [0x0D], [0x0A]])  | 
                                                        |
| 93 | - ->addConstructorValue([[0x0A], [0x0A], [0x0D, 0x0A]])  | 
                                                        |
| 94 | -  | 
                                                        |
| 95 | -    ->register('mime.characterreaderfactory') | 
                                                        |
| 96 | -    ->asSharedInstanceOf('Swift_CharacterReaderFactory_SimpleCharacterReaderFactory') | 
                                                        |
| 97 | -  | 
                                                        |
| 98 | -    ->register('mime.textcontentencoder') | 
                                                        |
| 99 | -    ->asAliasOf('mime.qpcontentencoder') | 
                                                        |
| 100 | -  | 
                                                        |
| 101 | -    ->register('mime.safeqpcontentencoder') | 
                                                        |
| 102 | -    ->asNewInstanceOf('Swift_Mime_ContentEncoder_QpContentEncoder') | 
                                                        |
| 103 | - ->withDependencies(['mime.charstream', 'mime.bytecanonicalizer'])  | 
                                                        |
| 104 | -  | 
                                                        |
| 105 | -    ->register('mime.rawcontentencoder') | 
                                                        |
| 106 | -    ->asNewInstanceOf('Swift_Mime_ContentEncoder_RawContentEncoder') | 
                                                        |
| 107 | -  | 
                                                        |
| 108 | -    ->register('mime.nativeqpcontentencoder') | 
                                                        |
| 109 | - ->withDependencies(['properties.charset'])  | 
                                                        |
| 110 | -    ->asNewInstanceOf('Swift_Mime_ContentEncoder_NativeQpContentEncoder') | 
                                                        |
| 111 | -  | 
                                                        |
| 112 | -    ->register('mime.qpcontentencoder') | 
                                                        |
| 113 | -    ->asNewInstanceOf('Swift_Mime_ContentEncoder_QpContentEncoderProxy') | 
                                                        |
| 114 | - ->withDependencies(['mime.safeqpcontentencoder', 'mime.nativeqpcontentencoder', 'properties.charset'])  | 
                                                        |
| 115 | -  | 
                                                        |
| 116 | -    ->register('mime.7bitcontentencoder') | 
                                                        |
| 117 | -    ->asNewInstanceOf('Swift_Mime_ContentEncoder_PlainContentEncoder') | 
                                                        |
| 118 | -    ->addConstructorValue('7bit') | 
                                                        |
| 119 | - ->addConstructorValue(true)  | 
                                                        |
| 120 | -  | 
                                                        |
| 121 | -    ->register('mime.8bitcontentencoder') | 
                                                        |
| 122 | -    ->asNewInstanceOf('Swift_Mime_ContentEncoder_PlainContentEncoder') | 
                                                        |
| 123 | -    ->addConstructorValue('8bit') | 
                                                        |
| 124 | - ->addConstructorValue(true)  | 
                                                        |
| 125 | -  | 
                                                        |
| 126 | -    ->register('mime.base64contentencoder') | 
                                                        |
| 127 | -    ->asSharedInstanceOf('Swift_Mime_ContentEncoder_Base64ContentEncoder') | 
                                                        |
| 128 | -  | 
                                                        |
| 129 | -    ->register('mime.rfc2231encoder') | 
                                                        |
| 130 | -    ->asNewInstanceOf('Swift_Encoder_Rfc2231Encoder') | 
                                                        |
| 131 | - ->withDependencies(['mime.charstream'])  | 
                                                        |
| 6 | +	->register('properties.charset') | 
                                                        |
| 7 | +	->asValue('utf-8') | 
                                                        |
| 8 | +  | 
                                                        |
| 9 | +	->register('email.validator') | 
                                                        |
| 10 | +	->asSharedInstanceOf('Egulias\EmailValidator\EmailValidator') | 
                                                        |
| 11 | +  | 
                                                        |
| 12 | +	->register('mime.idgenerator.idright') | 
                                                        |
| 13 | + // As SERVER_NAME can come from the user in certain configurations, check that  | 
                                                        |
| 14 | + // it does not contain forbidden characters (see RFC 952 and RFC 2181). Use  | 
                                                        |
| 15 | + // preg_replace() instead of preg_match() to prevent DoS attacks with long host names.  | 
                                                        |
| 16 | +	->asValue(!empty($_SERVER['SERVER_NAME']) && '' === preg_replace('/(?:^\[)?[a-zA-Z0-9-:\]_]+\.?/', '', $_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'swift.generated') | 
                                                        |
| 17 | +  | 
                                                        |
| 18 | +	->register('mime.idgenerator') | 
                                                        |
| 19 | +	->asSharedInstanceOf('Swift_Mime_IdGenerator') | 
                                                        |
| 20 | + ->withDependencies([  | 
                                                        |
| 21 | + 'mime.idgenerator.idright',  | 
                                                        |
| 22 | + ])  | 
                                                        |
| 23 | +  | 
                                                        |
| 24 | +	->register('mime.message') | 
                                                        |
| 25 | +	->asNewInstanceOf('Swift_Mime_SimpleMessage') | 
                                                        |
| 26 | + ->withDependencies([  | 
                                                        |
| 27 | + 'mime.headerset',  | 
                                                        |
| 28 | + 'mime.textcontentencoder',  | 
                                                        |
| 29 | + 'cache',  | 
                                                        |
| 30 | + 'mime.idgenerator',  | 
                                                        |
| 31 | + 'properties.charset',  | 
                                                        |
| 32 | + ])  | 
                                                        |
| 33 | +  | 
                                                        |
| 34 | +	->register('mime.part') | 
                                                        |
| 35 | +	->asNewInstanceOf('Swift_Mime_MimePart') | 
                                                        |
| 36 | + ->withDependencies([  | 
                                                        |
| 37 | + 'mime.headerset',  | 
                                                        |
| 38 | + 'mime.textcontentencoder',  | 
                                                        |
| 39 | + 'cache',  | 
                                                        |
| 40 | + 'mime.idgenerator',  | 
                                                        |
| 41 | + 'properties.charset',  | 
                                                        |
| 42 | + ])  | 
                                                        |
| 43 | +  | 
                                                        |
| 44 | +	->register('mime.attachment') | 
                                                        |
| 45 | +	->asNewInstanceOf('Swift_Mime_Attachment') | 
                                                        |
| 46 | + ->withDependencies([  | 
                                                        |
| 47 | + 'mime.headerset',  | 
                                                        |
| 48 | + 'mime.base64contentencoder',  | 
                                                        |
| 49 | + 'cache',  | 
                                                        |
| 50 | + 'mime.idgenerator',  | 
                                                        |
| 51 | + ])  | 
                                                        |
| 52 | + ->addConstructorValue($swift_mime_types)  | 
                                                        |
| 53 | +  | 
                                                        |
| 54 | +	->register('mime.embeddedfile') | 
                                                        |
| 55 | +	->asNewInstanceOf('Swift_Mime_EmbeddedFile') | 
                                                        |
| 56 | + ->withDependencies([  | 
                                                        |
| 57 | + 'mime.headerset',  | 
                                                        |
| 58 | + 'mime.base64contentencoder',  | 
                                                        |
| 59 | + 'cache',  | 
                                                        |
| 60 | + 'mime.idgenerator',  | 
                                                        |
| 61 | + ])  | 
                                                        |
| 62 | + ->addConstructorValue($swift_mime_types)  | 
                                                        |
| 63 | +  | 
                                                        |
| 64 | +	->register('mime.headerfactory') | 
                                                        |
| 65 | +	->asNewInstanceOf('Swift_Mime_SimpleHeaderFactory') | 
                                                        |
| 66 | + ->withDependencies([  | 
                                                        |
| 67 | + 'mime.qpheaderencoder',  | 
                                                        |
| 68 | + 'mime.rfc2231encoder',  | 
                                                        |
| 69 | + 'email.validator',  | 
                                                        |
| 70 | + 'properties.charset',  | 
                                                        |
| 71 | + 'address.idnaddressencoder',  | 
                                                        |
| 72 | + ])  | 
                                                        |
| 73 | +  | 
                                                        |
| 74 | +	->register('mime.headerset') | 
                                                        |
| 75 | +	->asNewInstanceOf('Swift_Mime_SimpleHeaderSet') | 
                                                        |
| 76 | + ->withDependencies(['mime.headerfactory', 'properties.charset'])  | 
                                                        |
| 77 | +  | 
                                                        |
| 78 | +	->register('mime.qpheaderencoder') | 
                                                        |
| 79 | +	->asNewInstanceOf('Swift_Mime_HeaderEncoder_QpHeaderEncoder') | 
                                                        |
| 80 | + ->withDependencies(['mime.charstream'])  | 
                                                        |
| 81 | +  | 
                                                        |
| 82 | +	->register('mime.base64headerencoder') | 
                                                        |
| 83 | +	->asNewInstanceOf('Swift_Mime_HeaderEncoder_Base64HeaderEncoder') | 
                                                        |
| 84 | + ->withDependencies(['mime.charstream'])  | 
                                                        |
| 85 | +  | 
                                                        |
| 86 | +	->register('mime.charstream') | 
                                                        |
| 87 | +	->asNewInstanceOf('Swift_CharacterStream_NgCharacterStream') | 
                                                        |
| 88 | + ->withDependencies(['mime.characterreaderfactory', 'properties.charset'])  | 
                                                        |
| 89 | +  | 
                                                        |
| 90 | +	->register('mime.bytecanonicalizer') | 
                                                        |
| 91 | +	->asSharedInstanceOf('Swift_StreamFilters_ByteArrayReplacementFilter') | 
                                                        |
| 92 | + ->addConstructorValue([[0x0D, 0x0A], [0x0D], [0x0A]])  | 
                                                        |
| 93 | + ->addConstructorValue([[0x0A], [0x0A], [0x0D, 0x0A]])  | 
                                                        |
| 94 | +  | 
                                                        |
| 95 | +	->register('mime.characterreaderfactory') | 
                                                        |
| 96 | +	->asSharedInstanceOf('Swift_CharacterReaderFactory_SimpleCharacterReaderFactory') | 
                                                        |
| 97 | +  | 
                                                        |
| 98 | +	->register('mime.textcontentencoder') | 
                                                        |
| 99 | +	->asAliasOf('mime.qpcontentencoder') | 
                                                        |
| 100 | +  | 
                                                        |
| 101 | +	->register('mime.safeqpcontentencoder') | 
                                                        |
| 102 | +	->asNewInstanceOf('Swift_Mime_ContentEncoder_QpContentEncoder') | 
                                                        |
| 103 | + ->withDependencies(['mime.charstream', 'mime.bytecanonicalizer'])  | 
                                                        |
| 104 | +  | 
                                                        |
| 105 | +	->register('mime.rawcontentencoder') | 
                                                        |
| 106 | +	->asNewInstanceOf('Swift_Mime_ContentEncoder_RawContentEncoder') | 
                                                        |
| 107 | +  | 
                                                        |
| 108 | +	->register('mime.nativeqpcontentencoder') | 
                                                        |
| 109 | + ->withDependencies(['properties.charset'])  | 
                                                        |
| 110 | +	->asNewInstanceOf('Swift_Mime_ContentEncoder_NativeQpContentEncoder') | 
                                                        |
| 111 | +  | 
                                                        |
| 112 | +	->register('mime.qpcontentencoder') | 
                                                        |
| 113 | +	->asNewInstanceOf('Swift_Mime_ContentEncoder_QpContentEncoderProxy') | 
                                                        |
| 114 | + ->withDependencies(['mime.safeqpcontentencoder', 'mime.nativeqpcontentencoder', 'properties.charset'])  | 
                                                        |
| 115 | +  | 
                                                        |
| 116 | +	->register('mime.7bitcontentencoder') | 
                                                        |
| 117 | +	->asNewInstanceOf('Swift_Mime_ContentEncoder_PlainContentEncoder') | 
                                                        |
| 118 | +	->addConstructorValue('7bit') | 
                                                        |
| 119 | + ->addConstructorValue(true)  | 
                                                        |
| 120 | +  | 
                                                        |
| 121 | +	->register('mime.8bitcontentencoder') | 
                                                        |
| 122 | +	->asNewInstanceOf('Swift_Mime_ContentEncoder_PlainContentEncoder') | 
                                                        |
| 123 | +	->addConstructorValue('8bit') | 
                                                        |
| 124 | + ->addConstructorValue(true)  | 
                                                        |
| 125 | +  | 
                                                        |
| 126 | +	->register('mime.base64contentencoder') | 
                                                        |
| 127 | +	->asSharedInstanceOf('Swift_Mime_ContentEncoder_Base64ContentEncoder') | 
                                                        |
| 128 | +  | 
                                                        |
| 129 | +	->register('mime.rfc2231encoder') | 
                                                        |
| 130 | +	->asNewInstanceOf('Swift_Encoder_Rfc2231Encoder') | 
                                                        |
| 131 | + ->withDependencies(['mime.charstream'])  | 
                                                        |
| 132 | 132 | ;  | 
                                                        
| 133 | 133 | |
| 134 | 134 | unset($swift_mime_types);  | 
                                                        
@@ -1,9 +1,9 @@  | 
                                                    ||
| 1 | 1 | <?php  | 
                                                        
| 2 | 2 | |
| 3 | 3 | Swift_DependencyContainer::getInstance()  | 
                                                        
| 4 | -    ->register('message.message') | 
                                                        |
| 5 | -    ->asNewInstanceOf('Swift_Message') | 
                                                        |
| 4 | +	->register('message.message') | 
                                                        |
| 5 | +	->asNewInstanceOf('Swift_Message') | 
                                                        |
| 6 | 6 | |
| 7 | -    ->register('message.mimepart') | 
                                                        |
| 8 | -    ->asNewInstanceOf('Swift_MimePart') | 
                                                        |
| 7 | +	->register('message.mimepart') | 
                                                        |
| 8 | +	->asNewInstanceOf('Swift_MimePart') | 
                                                        |
| 9 | 9 | ;  | 
                                                        
@@ -1,97 +1,97 @@  | 
                                                    ||
| 1 | 1 | <?php  | 
                                                        
| 2 | 2 | |
| 3 | 3 | Swift_DependencyContainer::getInstance()  | 
                                                        
| 4 | -    ->register('transport.localdomain') | 
                                                        |
| 5 | - // As SERVER_NAME can come from the user in certain configurations, check that  | 
                                                        |
| 6 | - // it does not contain forbidden characters (see RFC 952 and RFC 2181). Use  | 
                                                        |
| 7 | - // preg_replace() instead of preg_match() to prevent DoS attacks with long host names.  | 
                                                        |
| 8 | -    ->asValue(!empty($_SERVER['SERVER_NAME']) && '' === preg_replace('/(?:^\[)?[a-zA-Z0-9-:\]_]+\.?/', '', $_SERVER['SERVER_NAME']) ? trim($_SERVER['SERVER_NAME'], '[]') : '127.0.0.1') | 
                                                        |
| 9 | -  | 
                                                        |
| 10 | -    ->register('transport.smtp') | 
                                                        |
| 11 | -    ->asNewInstanceOf('Swift_Transport_EsmtpTransport') | 
                                                        |
| 12 | - ->withDependencies([  | 
                                                        |
| 13 | - 'transport.buffer',  | 
                                                        |
| 14 | - 'transport.smtphandlers',  | 
                                                        |
| 15 | - 'transport.eventdispatcher',  | 
                                                        |
| 16 | - 'transport.localdomain',  | 
                                                        |
| 17 | - 'address.idnaddressencoder',  | 
                                                        |
| 18 | - ])  | 
                                                        |
| 19 | -  | 
                                                        |
| 20 | -    ->register('transport.sendmail') | 
                                                        |
| 21 | -    ->asNewInstanceOf('Swift_Transport_SendmailTransport') | 
                                                        |
| 22 | - ->withDependencies([  | 
                                                        |
| 23 | - 'transport.buffer',  | 
                                                        |
| 24 | - 'transport.eventdispatcher',  | 
                                                        |
| 25 | - 'transport.localdomain',  | 
                                                        |
| 26 | - ])  | 
                                                        |
| 27 | -  | 
                                                        |
| 28 | -    ->register('transport.loadbalanced') | 
                                                        |
| 29 | -    ->asNewInstanceOf('Swift_Transport_LoadBalancedTransport') | 
                                                        |
| 30 | -  | 
                                                        |
| 31 | -    ->register('transport.failover') | 
                                                        |
| 32 | -    ->asNewInstanceOf('Swift_Transport_FailoverTransport') | 
                                                        |
| 33 | -  | 
                                                        |
| 34 | -    ->register('transport.spool') | 
                                                        |
| 35 | -    ->asNewInstanceOf('Swift_Transport_SpoolTransport') | 
                                                        |
| 36 | - ->withDependencies(['transport.eventdispatcher'])  | 
                                                        |
| 37 | -  | 
                                                        |
| 38 | -    ->register('transport.null') | 
                                                        |
| 39 | -    ->asNewInstanceOf('Swift_Transport_NullTransport') | 
                                                        |
| 40 | - ->withDependencies(['transport.eventdispatcher'])  | 
                                                        |
| 41 | -  | 
                                                        |
| 42 | -    ->register('transport.buffer') | 
                                                        |
| 43 | -    ->asNewInstanceOf('Swift_Transport_StreamBuffer') | 
                                                        |
| 44 | - ->withDependencies(['transport.replacementfactory'])  | 
                                                        |
| 45 | -  | 
                                                        |
| 46 | -    ->register('transport.smtphandlers') | 
                                                        |
| 47 | - ->asArray()  | 
                                                        |
| 48 | - ->withDependencies(['transport.authhandler'])  | 
                                                        |
| 49 | -  | 
                                                        |
| 50 | -    ->register('transport.authhandler') | 
                                                        |
| 51 | -    ->asNewInstanceOf('Swift_Transport_Esmtp_AuthHandler') | 
                                                        |
| 52 | - ->withDependencies(['transport.authhandlers'])  | 
                                                        |
| 53 | -  | 
                                                        |
| 54 | -    ->register('transport.authhandlers') | 
                                                        |
| 55 | - ->asArray()  | 
                                                        |
| 56 | - ->withDependencies([  | 
                                                        |
| 57 | - 'transport.crammd5auth',  | 
                                                        |
| 58 | - 'transport.loginauth',  | 
                                                        |
| 59 | - 'transport.plainauth',  | 
                                                        |
| 60 | - 'transport.ntlmauth',  | 
                                                        |
| 61 | - 'transport.xoauth2auth',  | 
                                                        |
| 62 | - ])  | 
                                                        |
| 63 | -  | 
                                                        |
| 64 | -    ->register('transport.smtputf8handler') | 
                                                        |
| 65 | -    ->asNewInstanceOf('Swift_Transport_Esmtp_SmtpUtf8Handler') | 
                                                        |
| 66 | -  | 
                                                        |
| 67 | -    ->register('transport.8bitmimehandler') | 
                                                        |
| 68 | -    ->asNewInstanceOf('Swift_Transport_Esmtp_EightBitMimeHandler') | 
                                                        |
| 69 | -    ->addConstructorValue('8BITMIME') | 
                                                        |
| 70 | -  | 
                                                        |
| 71 | -    ->register('transport.crammd5auth') | 
                                                        |
| 72 | -    ->asNewInstanceOf('Swift_Transport_Esmtp_Auth_CramMd5Authenticator') | 
                                                        |
| 73 | -  | 
                                                        |
| 74 | -    ->register('transport.loginauth') | 
                                                        |
| 75 | -    ->asNewInstanceOf('Swift_Transport_Esmtp_Auth_LoginAuthenticator') | 
                                                        |
| 76 | -  | 
                                                        |
| 77 | -    ->register('transport.plainauth') | 
                                                        |
| 78 | -    ->asNewInstanceOf('Swift_Transport_Esmtp_Auth_PlainAuthenticator') | 
                                                        |
| 79 | -  | 
                                                        |
| 80 | -    ->register('transport.xoauth2auth') | 
                                                        |
| 81 | -    ->asNewInstanceOf('Swift_Transport_Esmtp_Auth_XOAuth2Authenticator') | 
                                                        |
| 82 | -  | 
                                                        |
| 83 | -    ->register('transport.ntlmauth') | 
                                                        |
| 84 | -    ->asNewInstanceOf('Swift_Transport_Esmtp_Auth_NTLMAuthenticator') | 
                                                        |
| 85 | -  | 
                                                        |
| 86 | -    ->register('transport.eventdispatcher') | 
                                                        |
| 87 | -    ->asNewInstanceOf('Swift_Events_SimpleEventDispatcher') | 
                                                        |
| 88 | -  | 
                                                        |
| 89 | -    ->register('transport.replacementfactory') | 
                                                        |
| 90 | -    ->asSharedInstanceOf('Swift_StreamFilters_StringReplacementFilterFactory') | 
                                                        |
| 91 | -  | 
                                                        |
| 92 | -    ->register('address.idnaddressencoder') | 
                                                        |
| 93 | -    ->asNewInstanceOf('Swift_AddressEncoder_IdnAddressEncoder') | 
                                                        |
| 94 | -  | 
                                                        |
| 95 | -    ->register('address.utf8addressencoder') | 
                                                        |
| 96 | -    ->asNewInstanceOf('Swift_AddressEncoder_Utf8AddressEncoder') | 
                                                        |
| 4 | +	->register('transport.localdomain') | 
                                                        |
| 5 | + // As SERVER_NAME can come from the user in certain configurations, check that  | 
                                                        |
| 6 | + // it does not contain forbidden characters (see RFC 952 and RFC 2181). Use  | 
                                                        |
| 7 | + // preg_replace() instead of preg_match() to prevent DoS attacks with long host names.  | 
                                                        |
| 8 | +	->asValue(!empty($_SERVER['SERVER_NAME']) && '' === preg_replace('/(?:^\[)?[a-zA-Z0-9-:\]_]+\.?/', '', $_SERVER['SERVER_NAME']) ? trim($_SERVER['SERVER_NAME'], '[]') : '127.0.0.1') | 
                                                        |
| 9 | +  | 
                                                        |
| 10 | +	->register('transport.smtp') | 
                                                        |
| 11 | +	->asNewInstanceOf('Swift_Transport_EsmtpTransport') | 
                                                        |
| 12 | + ->withDependencies([  | 
                                                        |
| 13 | + 'transport.buffer',  | 
                                                        |
| 14 | + 'transport.smtphandlers',  | 
                                                        |
| 15 | + 'transport.eventdispatcher',  | 
                                                        |
| 16 | + 'transport.localdomain',  | 
                                                        |
| 17 | + 'address.idnaddressencoder',  | 
                                                        |
| 18 | + ])  | 
                                                        |
| 19 | +  | 
                                                        |
| 20 | +	->register('transport.sendmail') | 
                                                        |
| 21 | +	->asNewInstanceOf('Swift_Transport_SendmailTransport') | 
                                                        |
| 22 | + ->withDependencies([  | 
                                                        |
| 23 | + 'transport.buffer',  | 
                                                        |
| 24 | + 'transport.eventdispatcher',  | 
                                                        |
| 25 | + 'transport.localdomain',  | 
                                                        |
| 26 | + ])  | 
                                                        |
| 27 | +  | 
                                                        |
| 28 | +	->register('transport.loadbalanced') | 
                                                        |
| 29 | +	->asNewInstanceOf('Swift_Transport_LoadBalancedTransport') | 
                                                        |
| 30 | +  | 
                                                        |
| 31 | +	->register('transport.failover') | 
                                                        |
| 32 | +	->asNewInstanceOf('Swift_Transport_FailoverTransport') | 
                                                        |
| 33 | +  | 
                                                        |
| 34 | +	->register('transport.spool') | 
                                                        |
| 35 | +	->asNewInstanceOf('Swift_Transport_SpoolTransport') | 
                                                        |
| 36 | + ->withDependencies(['transport.eventdispatcher'])  | 
                                                        |
| 37 | +  | 
                                                        |
| 38 | +	->register('transport.null') | 
                                                        |
| 39 | +	->asNewInstanceOf('Swift_Transport_NullTransport') | 
                                                        |
| 40 | + ->withDependencies(['transport.eventdispatcher'])  | 
                                                        |
| 41 | +  | 
                                                        |
| 42 | +	->register('transport.buffer') | 
                                                        |
| 43 | +	->asNewInstanceOf('Swift_Transport_StreamBuffer') | 
                                                        |
| 44 | + ->withDependencies(['transport.replacementfactory'])  | 
                                                        |
| 45 | +  | 
                                                        |
| 46 | +	->register('transport.smtphandlers') | 
                                                        |
| 47 | + ->asArray()  | 
                                                        |
| 48 | + ->withDependencies(['transport.authhandler'])  | 
                                                        |
| 49 | +  | 
                                                        |
| 50 | +	->register('transport.authhandler') | 
                                                        |
| 51 | +	->asNewInstanceOf('Swift_Transport_Esmtp_AuthHandler') | 
                                                        |
| 52 | + ->withDependencies(['transport.authhandlers'])  | 
                                                        |
| 53 | +  | 
                                                        |
| 54 | +	->register('transport.authhandlers') | 
                                                        |
| 55 | + ->asArray()  | 
                                                        |
| 56 | + ->withDependencies([  | 
                                                        |
| 57 | + 'transport.crammd5auth',  | 
                                                        |
| 58 | + 'transport.loginauth',  | 
                                                        |
| 59 | + 'transport.plainauth',  | 
                                                        |
| 60 | + 'transport.ntlmauth',  | 
                                                        |
| 61 | + 'transport.xoauth2auth',  | 
                                                        |
| 62 | + ])  | 
                                                        |
| 63 | +  | 
                                                        |
| 64 | +	->register('transport.smtputf8handler') | 
                                                        |
| 65 | +	->asNewInstanceOf('Swift_Transport_Esmtp_SmtpUtf8Handler') | 
                                                        |
| 66 | +  | 
                                                        |
| 67 | +	->register('transport.8bitmimehandler') | 
                                                        |
| 68 | +	->asNewInstanceOf('Swift_Transport_Esmtp_EightBitMimeHandler') | 
                                                        |
| 69 | +	->addConstructorValue('8BITMIME') | 
                                                        |
| 70 | +  | 
                                                        |
| 71 | +	->register('transport.crammd5auth') | 
                                                        |
| 72 | +	->asNewInstanceOf('Swift_Transport_Esmtp_Auth_CramMd5Authenticator') | 
                                                        |
| 73 | +  | 
                                                        |
| 74 | +	->register('transport.loginauth') | 
                                                        |
| 75 | +	->asNewInstanceOf('Swift_Transport_Esmtp_Auth_LoginAuthenticator') | 
                                                        |
| 76 | +  | 
                                                        |
| 77 | +	->register('transport.plainauth') | 
                                                        |
| 78 | +	->asNewInstanceOf('Swift_Transport_Esmtp_Auth_PlainAuthenticator') | 
                                                        |
| 79 | +  | 
                                                        |
| 80 | +	->register('transport.xoauth2auth') | 
                                                        |
| 81 | +	->asNewInstanceOf('Swift_Transport_Esmtp_Auth_XOAuth2Authenticator') | 
                                                        |
| 82 | +  | 
                                                        |
| 83 | +	->register('transport.ntlmauth') | 
                                                        |
| 84 | +	->asNewInstanceOf('Swift_Transport_Esmtp_Auth_NTLMAuthenticator') | 
                                                        |
| 85 | +  | 
                                                        |
| 86 | +	->register('transport.eventdispatcher') | 
                                                        |
| 87 | +	->asNewInstanceOf('Swift_Events_SimpleEventDispatcher') | 
                                                        |
| 88 | +  | 
                                                        |
| 89 | +	->register('transport.replacementfactory') | 
                                                        |
| 90 | +	->asSharedInstanceOf('Swift_StreamFilters_StringReplacementFilterFactory') | 
                                                        |
| 91 | +  | 
                                                        |
| 92 | +	->register('address.idnaddressencoder') | 
                                                        |
| 93 | +	->asNewInstanceOf('Swift_AddressEncoder_IdnAddressEncoder') | 
                                                        |
| 94 | +  | 
                                                        |
| 95 | +	->register('address.utf8addressencoder') | 
                                                        |
| 96 | +	->asNewInstanceOf('Swift_AddressEncoder_Utf8AddressEncoder') | 
                                                        |
| 97 | 97 | ;  | 
                                                        
@@ -15,13 +15,13 @@  | 
                                                    ||
| 15 | 15 | */  | 
                                                        
| 16 | 16 | class Swift_RfcComplianceException extends Swift_SwiftException  | 
                                                        
| 17 | 17 |  { | 
                                                        
| 18 | - /**  | 
                                                        |
| 19 | - * Create a new RfcComplianceException with $message.  | 
                                                        |
| 20 | - *  | 
                                                        |
| 21 | - * @param string $message  | 
                                                        |
| 22 | - */  | 
                                                        |
| 23 | - public function __construct($message)  | 
                                                        |
| 24 | -    { | 
                                                        |
| 25 | - parent::__construct($message);  | 
                                                        |
| 26 | - }  | 
                                                        |
| 18 | + /**  | 
                                                        |
| 19 | + * Create a new RfcComplianceException with $message.  | 
                                                        |
| 20 | + *  | 
                                                        |
| 21 | + * @param string $message  | 
                                                        |
| 22 | + */  | 
                                                        |
| 23 | + public function __construct($message)  | 
                                                        |
| 24 | +	{ | 
                                                        |
| 25 | + parent::__construct($message);  | 
                                                        |
| 26 | + }  | 
                                                        |
| 27 | 27 | }  | 
                                                        
@@ -15,21 +15,21 @@  | 
                                                    ||
| 15 | 15 | */  | 
                                                        
| 16 | 16 | interface Swift_StreamFilter  | 
                                                        
| 17 | 17 |  { | 
                                                        
| 18 | - /**  | 
                                                        |
| 19 | - * Based on the buffer given, this returns true if more buffering is needed.  | 
                                                        |
| 20 | - *  | 
                                                        |
| 21 | - * @param mixed $buffer  | 
                                                        |
| 22 | - *  | 
                                                        |
| 23 | - * @return bool  | 
                                                        |
| 24 | - */  | 
                                                        |
| 25 | - public function shouldBuffer($buffer);  | 
                                                        |
| 18 | + /**  | 
                                                        |
| 19 | + * Based on the buffer given, this returns true if more buffering is needed.  | 
                                                        |
| 20 | + *  | 
                                                        |
| 21 | + * @param mixed $buffer  | 
                                                        |
| 22 | + *  | 
                                                        |
| 23 | + * @return bool  | 
                                                        |
| 24 | + */  | 
                                                        |
| 25 | + public function shouldBuffer($buffer);  | 
                                                        |
| 26 | 26 | |
| 27 | - /**  | 
                                                        |
| 28 | - * Filters $buffer and returns the changes.  | 
                                                        |
| 29 | - *  | 
                                                        |
| 30 | - * @param mixed $buffer  | 
                                                        |
| 31 | - *  | 
                                                        |
| 32 | - * @return mixed  | 
                                                        |
| 33 | - */  | 
                                                        |
| 34 | - public function filter($buffer);  | 
                                                        |
| 27 | + /**  | 
                                                        |
| 28 | + * Filters $buffer and returns the changes.  | 
                                                        |
| 29 | + *  | 
                                                        |
| 30 | + * @param mixed $buffer  | 
                                                        |
| 31 | + *  | 
                                                        |
| 32 | + * @return mixed  | 
                                                        |
| 33 | + */  | 
                                                        |
| 34 | + public function filter($buffer);  | 
                                                        |
| 35 | 35 | }  |