Ticket #9697: 9697.4.patch
| File 9697.4.patch, 14.6 KB (added by , 17 years ago) |
|---|
-
wp-includes/class-phpmailer.php
2 2 /*~ class.phpmailer.php 3 3 .---------------------------------------------------------------------------. 4 4 | Software: PHPMailer - PHP email class | 5 | Version: 2.0. 2|5 | Version: 2.0.4 | 6 6 | Contact: via sourceforge.net support pages (also www.codeworxtech.com) | 7 7 | Info: http://phpmailer.sourceforge.net | 8 8 | Support: http://sourceforge.net/projects/phpmailer/ | … … 28 28 * PHPMailer - PHP email transport class 29 29 * @package PHPMailer 30 30 * @author Andy Prevost 31 * @copyright 2004 - 200 8Andy Prevost31 * @copyright 2004 - 2009 Andy Prevost 32 32 */ 33 33 34 34 class PHPMailer { … … 139 139 * Holds PHPMailer version. 140 140 * @var string 141 141 */ 142 var $Version = "2.0. 2";142 var $Version = "2.0.4"; 143 143 144 144 /** 145 145 * Sets the email address that a reading confirmation will be sent. … … 257 257 var $language = array(); 258 258 var $error_count = 0; 259 259 var $LE = "\n"; 260 var $sign_cert_file = ""; 260 261 var $sign_key_file = ""; 261 262 var $sign_key_pass = ""; 262 263 … … 649 650 } elseif (file_exists($lang_path.'phpmailer.lang-en.php')) { 650 651 include($lang_path.'phpmailer.lang-en.php'); 651 652 } else { 652 $this->SetError('Could not load language file'); 653 return false; 653 $PHPMAILER_LANG = array(); 654 $PHPMAILER_LANG["provide_address"] = 'You must provide at least one ' . 655 $PHPMAILER_LANG["mailer_not_supported"] = ' mailer is not supported.'; 656 $PHPMAILER_LANG["execute"] = 'Could not execute: '; 657 $PHPMAILER_LANG["instantiate"] = 'Could not instantiate mail function.'; 658 $PHPMAILER_LANG["authenticate"] = 'SMTP Error: Could not authenticate.'; 659 $PHPMAILER_LANG["from_failed"] = 'The following From address failed: '; 660 $PHPMAILER_LANG["recipients_failed"] = 'SMTP Error: The following ' . 661 $PHPMAILER_LANG["data_not_accepted"] = 'SMTP Error: Data not accepted.'; 662 $PHPMAILER_LANG["connect_host"] = 'SMTP Error: Could not connect to SMTP host.'; 663 $PHPMAILER_LANG["file_access"] = 'Could not access file: '; 664 $PHPMAILER_LANG["file_open"] = 'File Error: Could not open file: '; 665 $PHPMAILER_LANG["encoding"] = 'Unknown encoding: '; 666 $PHPMAILER_LANG["signing"] = 'Signing Error: '; 654 667 } 655 668 $this->language = $PHPMAILER_LANG; 656 669 … … 864 877 } elseif (count($this->cc) == 0) { 865 878 $result .= $this->HeaderLine('To', 'undisclosed-recipients:;'); 866 879 } 867 if(count($this->cc) > 0) {868 $result .= $this->AddrAppend('Cc', $this->cc);869 }870 880 } 871 881 872 882 $from = array(); … … 1007 1017 fclose($fp); 1008 1018 $signed = tempnam("", "signed"); 1009 1019 1010 if (@openssl_pkcs7_sign($file, $signed, "file://".$this->sign_ key_file, array("file://".$this->sign_key_file, $this->sign_key_pass), null)) {1020 if (@openssl_pkcs7_sign($file, $signed, "file://".$this->sign_cert_file, array("file://".$this->sign_key_file, $this->sign_key_pass), null)) { 1011 1021 $fp = fopen($signed, "r"); 1012 1022 $result = fread($fp, filesize($this->sign_key_file)); 1023 $result = ''; 1024 while(!feof($fp)){ 1025 $result = $result . fread($fp, 1024); 1026 } 1013 1027 fclose($fp); 1014 1028 } else { 1015 1029 $this->SetError($this->Lang("signing").openssl_error_string()); … … 1159 1173 $cid = $this->attachment[$i][7]; 1160 1174 1161 1175 $mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE); 1162 $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $ name, $this->LE);1176 $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $this->EncodeHeader($this->SecureHeader($name)), $this->LE); 1163 1177 $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE); 1164 1178 1165 1179 if($disposition == 'inline') { 1166 1180 $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE); 1167 1181 } 1168 1182 1169 $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $ name, $this->LE.$this->LE);1183 $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $this->EncodeHeader($this->SecureHeader($name)), $this->LE.$this->LE); 1170 1184 1171 1185 /* Encode as string attachment */ 1172 1186 if($bString) { … … 1399 1413 } // end of for 1400 1414 $output .= $newline.$eol; 1401 1415 } // end of while 1402 return trim($output);1416 return $output; 1403 1417 } 1404 1418 1405 1419 /** … … 1408 1422 * @return string 1409 1423 */ 1410 1424 function EncodeQ_callback ($matches) { 1411 return "=".sprintf("%02X", ord($matches[1]));1425 return sprintf('=%02X', ord($matches[1])); 1412 1426 } 1413 1427 1414 1428 /** … … 1421 1435 $encoded = preg_replace("/[\r\n]/", '', $str); 1422 1436 1423 1437 switch (strtolower($position)) { 1424 case 'phrase': 1425 $encoded = preg_replace_callback("/([^A-Za-z0-9!*+\/ -])/", 1426 "EncodeQ_callback", $encoded); 1438 case 'phrase': 1439 $encoded = preg_replace_callback("/([^A-Za-z0-9!*+\/ -])/", array('PHPMailer', 'EncodeQ_callback') , $encoded); 1427 1440 break; 1428 1441 case 'comment': 1429 $encoded = preg_replace_callback("/([\(\)\"])/", 1430 "EncodeQ_callback", $encoded); 1431 break; 1442 $encoded = preg_replace_callback("/([\(\)\"])/", array('PHPMailer', 'EncodeQ_callback'), $encoded); 1432 1443 case 'text': 1433 1444 default: 1434 1445 /* Replace every high ascii, control =, ? and _ characters */ 1435 1446 $encoded = preg_replace_callback('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/', 1436 "EncodeQ_callback", $encoded);1447 array('PHPMailer', 'EncodeQ_callback'), $encoded); 1437 1448 break; 1438 1449 } 1439 1450 … … 1722 1733 $ext = $fileParts[1]; 1723 1734 $mimeType = $this->_mime_types($ext); 1724 1735 if ( strlen($basedir) > 1 && substr($basedir,-1) != '/') { $basedir .= '/'; } 1725 if ( strlen($directory) > 1 && substr($basedir,-1) != '/') { $directory .= '/'; } 1726 $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64', $mimeType); 1736 if ( strlen($directory) > 1 && substr($directory,-1) != '/') { $directory .= '/'; } 1727 1737 if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64',$mimeType) ) { 1728 1738 $message = preg_replace("/".$images[1][$i]."=\"".preg_quote($url, '/')."\"/Ui", $images[1][$i]."=\"".$cid."\"", $message); 1729 1739 } … … 1734 1744 $this->Body = $message; 1735 1745 $textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s','',$message))); 1736 1746 if ( !empty($textMsg) && empty($this->AltBody) ) { 1737 $this->AltBody = $textMsg;1747 $this->AltBody = html_entity_decode($textMsg); 1738 1748 } 1739 1749 if ( empty($this->AltBody) ) { 1740 1750 $this->AltBody = 'To view this email message, open the email in with HTML compatibility!' . "\n\n"; … … 1748 1758 */ 1749 1759 function _mime_types($ext = '') { 1750 1760 $mimes = array( 1751 'hqx' => 'application/mac-binhex40', 1752 'cpt' => 'application/mac-compactpro', 1753 'doc' => 'application/msword', 1761 'ai' => 'application/postscript', 1762 'aif' => 'audio/x-aiff', 1763 'aifc' => 'audio/x-aiff', 1764 'aiff' => 'audio/x-aiff', 1765 'avi' => 'video/x-msvideo', 1754 1766 'bin' => 'application/macbinary', 1755 'dms' => 'application/octet-stream', 1756 'lha' => 'application/octet-stream', 1757 'lzh' => 'application/octet-stream', 1758 'exe' => 'application/octet-stream', 1767 'bmp' => 'image/bmp', 1759 1768 'class' => 'application/octet-stream', 1760 'psd' => 'application/octet-stream', 1761 'so' => 'application/octet-stream', 1762 'sea' => 'application/octet-stream', 1763 'dll' => 'application/octet-stream', 1764 'oda' => 'application/oda', 1765 'pdf' => 'application/pdf', 1766 'ai' => 'application/postscript', 1767 'eps' => 'application/postscript', 1768 'ps' => 'application/postscript', 1769 'smi' => 'application/smil', 1770 'smil' => 'application/smil', 1771 'mif' => 'application/vnd.mif', 1772 'xls' => 'application/vnd.ms-excel', 1773 'ppt' => 'application/vnd.ms-powerpoint', 1774 'wbxml' => 'application/vnd.wap.wbxml', 1775 'wmlc' => 'application/vnd.wap.wmlc', 1769 'cpt' => 'application/mac-compactpro', 1770 'css' => 'text/css', 1776 1771 'dcr' => 'application/x-director', 1777 1772 'dir' => 'application/x-director', 1773 'dll' => 'application/octet-stream', 1774 'dms' => 'application/octet-stream', 1775 'doc' => 'application/msword', 1776 'dvi' => 'application/x-dvi', 1778 1777 'dxr' => 'application/x-director', 1779 'dvi' => 'application/x-dvi', 1778 'eml' => 'message/rfc822', 1779 'eps' => 'application/postscript', 1780 'exe' => 'application/octet-stream', 1781 'gif' => 'image/gif', 1780 1782 'gtar' => 'application/x-gtar', 1781 'php' => 'application/x-httpd-php', 1782 'php4' => 'application/x-httpd-php', 1783 'php3' => 'application/x-httpd-php', 1784 'phtml' => 'application/x-httpd-php', 1785 'phps' => 'application/x-httpd-php-source', 1783 'htm' => 'text/html', 1784 'html' => 'text/html', 1785 'jpe' => 'image/jpeg', 1786 'jpeg' => 'image/jpeg', 1787 'jpg' => 'image/jpeg', 1788 'hqx' => 'application/mac-binhex40', 1786 1789 'js' => 'application/x-javascript', 1787 'swf' => 'application/x-shockwave-flash', 1788 'sit' => 'application/x-stuffit', 1789 'tar' => 'application/x-tar', 1790 'tgz' => 'application/x-tar', 1791 'xhtml' => 'application/xhtml+xml', 1792 'xht' => 'application/xhtml+xml', 1793 'zip' => 'application/zip', 1790 'lha' => 'application/octet-stream', 1791 'log' => 'text/plain', 1792 'lzh' => 'application/octet-stream', 1794 1793 'mid' => 'audio/midi', 1795 1794 'midi' => 'audio/midi', 1796 'mpga' => 'audio/mpeg', 1795 'mif' => 'application/vnd.mif', 1796 'mov' => 'video/quicktime', 1797 'movie' => 'video/x-sgi-movie', 1797 1798 'mp2' => 'audio/mpeg', 1798 1799 'mp3' => 'audio/mpeg', 1799 'aif' => 'audio/x-aiff', 1800 'aiff' => 'audio/x-aiff', 1801 'aifc' => 'audio/x-aiff', 1800 'mpe' => 'video/mpeg', 1801 'mpeg' => 'video/mpeg', 1802 'mpg' => 'video/mpeg', 1803 'mpga' => 'audio/mpeg', 1804 'oda' => 'application/oda', 1805 'pdf' => 'application/pdf', 1806 'php' => 'application/x-httpd-php', 1807 'php3' => 'application/x-httpd-php', 1808 'php4' => 'application/x-httpd-php', 1809 'phps' => 'application/x-httpd-php-source', 1810 'phtml' => 'application/x-httpd-php', 1811 'png' => 'image/png', 1812 'ppt' => 'application/vnd.ms-powerpoint', 1813 'ps' => 'application/postscript', 1814 'psd' => 'application/octet-stream', 1815 'qt' => 'video/quicktime', 1816 'ra' => 'audio/x-realaudio', 1802 1817 'ram' => 'audio/x-pn-realaudio', 1803 1818 'rm' => 'audio/x-pn-realaudio', 1804 1819 'rpm' => 'audio/x-pn-realaudio-plugin', 1805 'ra' => 'audio/x-realaudio', 1820 'rtf' => 'text/rtf', 1821 'rtx' => 'text/richtext', 1806 1822 'rv' => 'video/vnd.rn-realvideo', 1807 'wav' => 'audio/x-wav', 1808 'bmp' => 'image/bmp', 1809 'gif' => 'image/gif', 1810 'jpeg' => 'image/jpeg', 1811 'jpg' => 'image/jpeg', 1812 'jpe' => 'image/jpeg', 1813 'png' => 'image/png', 1814 'tiff' => 'image/tiff', 1815 'tif' => 'image/tiff', 1816 'css' => 'text/css', 1817 'html' => 'text/html', 1818 'htm' => 'text/html', 1823 'sea' => 'application/octet-stream', 1819 1824 'shtml' => 'text/html', 1825 'sit' => 'application/x-stuffit', 1826 'so' => 'application/octet-stream', 1827 'smi' => 'application/smil', 1828 'smil' => 'application/smil', 1829 'swf' => 'application/x-shockwave-flash', 1830 'tar' => 'application/x-tar', 1831 'text' => 'text/plain', 1820 1832 'txt' => 'text/plain', 1821 'text' => 'text/plain', 1822 'log' => 'text/plain', 1823 'rtx' => 'text/richtext', 1824 'rtf' => 'text/rtf', 1833 'tgz' => 'application/x-tar', 1834 'tif' => 'image/tiff', 1835 'tiff' => 'image/tiff', 1836 'wav' => 'audio/x-wav', 1837 'wbxml' => 'application/vnd.wap.wbxml', 1838 'wmlc' => 'application/vnd.wap.wmlc', 1839 'word' => 'application/msword', 1840 'xht' => 'application/xhtml+xml', 1841 'xhtml' => 'application/xhtml+xml', 1842 'xl' => 'application/excel', 1843 'xls' => 'application/vnd.ms-excel', 1825 1844 'xml' => 'text/xml', 1826 1845 'xsl' => 'text/xml', 1827 'mpeg' => 'video/mpeg', 1828 'mpg' => 'video/mpeg', 1829 'mpe' => 'video/mpeg', 1830 'qt' => 'video/quicktime', 1831 'mov' => 'video/quicktime', 1832 'avi' => 'video/x-msvideo', 1833 'movie' => 'video/x-sgi-movie', 1834 'doc' => 'application/msword', 1835 'word' => 'application/msword', 1836 'xl' => 'application/excel', 1837 'eml' => 'message/rfc822' 1846 'zip' => 'application/zip' 1838 1847 ); 1839 1848 return ( ! isset($mimes[strtolower($ext)])) ? 'application/octet-stream' : $mimes[strtolower($ext)]; 1840 1849 } … … 1898 1907 * @param string $key_filename Parameter File Name 1899 1908 * @param string $key_pass Password for private key 1900 1909 */ 1901 function Sign($key_filename, $key_pass) { 1910 function Sign($cert_filename, $key_filename, $key_pass) { 1911 $this->sign_cert_file = $cert_filename; 1902 1912 $this->sign_key_file = $key_filename; 1903 1913 $this->sign_key_pass = $key_pass; 1904 1914 } -
wp-includes/class-smtp.php
2 2 /*~ class.smtp.php 3 3 .---------------------------------------------------------------------------. 4 4 | Software: PHPMailer - PHP email class | 5 | Version: 2.0. 2|5 | Version: 2.0.4 | 6 6 | Contact: via sourceforge.net support pages (also www.codeworxtech.com) | 7 7 | Info: http://phpmailer.sourceforge.net | 8 8 | Support: http://sourceforge.net/projects/phpmailer/ |