<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[19632] trunk/wp-includes: Update PHPMailer to version 5.2.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/19632">19632</a></dd>
<dt>Author</dt> <dd>westi</dd>
<dt>Date</dt> <dd>2011-12-28 12:59:13 +0000 (Wed, 28 Dec 2011)</dd>
</dl>
<h3>Log Message</h3>
<pre>Update PHPMailer to version 5.2. See <a href="http://core.trac.wordpress.org/ticket/19677">#19677</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpincludesclassphpmailerphp">trunk/wp-includes/class-phpmailer.php</a></li>
<li><a href="#trunkwpincludesclasssmtpphp">trunk/wp-includes/class-smtp.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpincludesclassphpmailerphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/class-phpmailer.php (19631 => 19632)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/class-phpmailer.php        2011-12-25 17:27:39 UTC (rev 19631)
+++ trunk/wp-includes/class-phpmailer.php        2011-12-28 12:59:13 UTC (rev 19632)
</span><span class="lines">@@ -2,15 +2,15 @@
</span><span class="cx"> /*~ class.phpmailer.php
</span><span class="cx"> .---------------------------------------------------------------------------.
</span><span class="cx"> | Software: PHPMailer - PHP email class |
</span><del>-| Version: 5.1 |
-| Contact: via sourceforge.net support pages (also www.worxware.com) |
-| Info: http://phpmailer.sourceforge.net |
-| Support: http://sourceforge.net/projects/phpmailer/ |
</del><ins>+| Version: 5.2 |
+| Site: https://code.google.com/a/apache-extras.org/p/phpmailer/ |
</ins><span class="cx"> | ------------------------------------------------------------------------- |
</span><del>-| Admin: Andy Prevost (project admininistrator) |
</del><ins>+| Admin: Jim Jagielski (project admininistrator) |
</ins><span class="cx"> | Authors: Andy Prevost (codeworxtech) codeworxtech@users.sourceforge.net |
</span><span class="cx"> | : Marcus Bointon (coolbru) coolbru@users.sourceforge.net |
</span><ins>+| : Jim Jagielski (jimjag) jimjag@gmail.com |
</ins><span class="cx"> | Founder: Brent R. Matzelle (original founder) |
</span><ins>+| Copyright (c) 2010-2011, Jim Jagielski. All Rights Reserved. |
</ins><span class="cx"> | Copyright (c) 2004-2009, Andy Prevost. All Rights Reserved. |
</span><span class="cx"> | Copyright (c) 2001-2003, Brent R. Matzelle |
</span><span class="cx"> | ------------------------------------------------------------------------- |
</span><span class="lines">@@ -19,11 +19,6 @@
</span><span class="cx"> | This program is distributed in the hope that it will be useful - WITHOUT |
</span><span class="cx"> | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
</span><span class="cx"> | FITNESS FOR A PARTICULAR PURPOSE. |
</span><del>-| ------------------------------------------------------------------------- |
-| We offer a number of paid services (www.worxware.com): |
-| - Web Hosting on highly optimized fast and secure servers |
-| - Technology Consulting |
-| - Oursourcing (highly qualified programmers and graphic designers) |
</del><span class="cx"> '---------------------------------------------------------------------------'
</span><span class="cx"> */
</span><span class="cx">
</span><span class="lines">@@ -33,8 +28,10 @@
</span><span class="cx"> * @package PHPMailer
</span><span class="cx"> * @author Andy Prevost
</span><span class="cx"> * @author Marcus Bointon
</span><ins>+ * @author Jim Jagielski
+ * @copyright 2010 - 2011 Jim Jagielski
</ins><span class="cx"> * @copyright 2004 - 2009 Andy Prevost
</span><del>- * @version $Id: class.phpmailer.php 447 2009-05-25 01:36:38Z codeworxtech $
</del><ins>+ * @version $Id: class.phpmailer.php 450 2010-06-23 16:46:33Z coolbru $
</ins><span class="cx"> * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
</span><span class="cx"> */
</span><span class="cx">
</span><span class="lines">@@ -119,6 +116,20 @@
</span><span class="cx"> public $AltBody = '';
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * Stores the complete compiled MIME message body.
+ * @var string
+ * @access protected
+ */
+ protected $MIMEBody = '';
+
+ /**
+ * Stores the complete compiled MIME message headers.
+ * @var string
+ * @access protected
+ */
+ protected $MIMEHeader = '';
+
+ /**
</ins><span class="cx"> * Sets word wrapping on the body of the message to a given number of
</span><span class="cx"> * characters.
</span><span class="cx"> * @var int
</span><span class="lines">@@ -271,6 +282,12 @@
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Used with DKIM DNS Resource Record
</span><ins>+ * @var string
+ */
+ public $DKIM_passphrase = '';
+
+ /**
+ * Used with DKIM DNS Resource Record
</ins><span class="cx"> * optional, in format of email address 'you@yourdomain.com'
</span><span class="cx"> * @var string
</span><span class="cx"> */
</span><span class="lines">@@ -300,28 +317,34 @@
</span><span class="cx"> * Sets the PHPMailer Version number
</span><span class="cx"> * @var string
</span><span class="cx"> */
</span><del>- public $Version = '5.1';
</del><ins>+ public $Version = '5.2';
</ins><span class="cx">
</span><ins>+ /**
+ * What to use in the X-Mailer header
+ * @var string
+ */
+ public $XMailer = '';
+
</ins><span class="cx"> /////////////////////////////////////////////////
</span><span class="cx"> // PROPERTIES, PRIVATE AND PROTECTED
</span><span class="cx"> /////////////////////////////////////////////////
</span><span class="cx">
</span><del>- private $smtp = NULL;
- private $to = array();
- private $cc = array();
- private $bcc = array();
- private $ReplyTo = array();
- private $all_recipients = array();
- private $attachment = array();
- private $CustomHeader = array();
- private $message_type = '';
- private $boundary = array();
- protected $language = array();
- private $error_count = 0;
- private $sign_cert_file = "";
- private $sign_key_file = "";
- private $sign_key_pass = "";
- private $exceptions = false;
</del><ins>+ protected $smtp = NULL;
+ protected $to = array();
+ protected $cc = array();
+ protected $bcc = array();
+ protected $ReplyTo = array();
+ protected $all_recipients = array();
+ protected $attachment = array();
+ protected $CustomHeader = array();
+ protected $message_type = '';
+ protected $boundary = array();
+ protected $language = array();
+ protected $error_count = 0;
+ protected $sign_cert_file = '';
+ protected $sign_key_file = '';
+ protected $sign_key_pass = '';
+ protected $exceptions = false;
</ins><span class="cx">
</span><span class="cx"> /////////////////////////////////////////////////
</span><span class="cx"> // CONSTANTS
</span><span class="lines">@@ -447,11 +470,15 @@
</span><span class="cx"> * @param string $address The email address to send to
</span><span class="cx"> * @param string $name
</span><span class="cx"> * @return boolean true on success, false if address already used or invalid in some way
</span><del>- * @access private
</del><ins>+ * @access protected
</ins><span class="cx"> */
</span><del>- private function AddAnAddress($kind, $address, $name = '') {
</del><ins>+ protected function AddAnAddress($kind, $address, $name = '') {
</ins><span class="cx"> if (!preg_match('/^(to|cc|bcc|ReplyTo)$/', $kind)) {
</span><del>- echo 'Invalid recipient array: ' . $kind;
</del><ins>+ $this->SetError($this->Lang('Invalid recipient array').': '.$kind);
+ if ($this->exceptions) {
+ throw new phpmailerException('Invalid recipient array: ' . $kind);
+ }
+ echo $this->Lang('Invalid recipient array').': '.$kind;
</ins><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx"> $address = trim($address);
</span><span class="lines">@@ -485,7 +512,7 @@
</span><span class="cx"> * @param string $name
</span><span class="cx"> * @return boolean
</span><span class="cx"> */
</span><del>- public function SetFrom($address, $name = '',$auto=1) {
</del><ins>+ public function SetFrom($address, $name = '', $auto = 1) {
</ins><span class="cx"> $address = trim($address);
</span><span class="cx"> $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
</span><span class="cx"> if (!self::ValidateAddress($address)) {
</span><span class="lines">@@ -544,6 +571,19 @@
</span><span class="cx"> */
</span><span class="cx"> public function Send() {
</span><span class="cx"> try {
</span><ins>+ if(!$this->PreSend()) return false;
+ return $this->PostSend();
+ } catch (phpmailerException $e) {
+ $this->SetError($e->getMessage());
+ if ($this->exceptions) {
+ throw $e;
+ }
+ return false;
+ }
+ }
+
+ protected function PreSend() {
+ try {
</ins><span class="cx"> if ((count($this->to) + count($this->cc) + count($this->bcc)) < 1) {
</span><span class="cx"> throw new phpmailerException($this->Lang('provide_address'), self::STOP_CRITICAL);
</span><span class="cx"> }
</span><span class="lines">@@ -555,27 +595,41 @@
</span><span class="cx">
</span><span class="cx"> $this->error_count = 0; // reset errors
</span><span class="cx"> $this->SetMessageType();
</span><del>- $header = $this->CreateHeader();
- $body = $this->CreateBody();
-
</del><ins>+ //Refuse to send an empty message
</ins><span class="cx"> if (empty($this->Body)) {
</span><span class="cx"> throw new phpmailerException($this->Lang('empty_message'), self::STOP_CRITICAL);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ $this->MIMEHeader = $this->CreateHeader();
+ $this->MIMEBody = $this->CreateBody();
+
+
</ins><span class="cx"> // digitally sign with DKIM if enabled
</span><span class="cx"> if ($this->DKIM_domain && $this->DKIM_private) {
</span><del>- $header_dkim = $this->DKIM_Add($header,$this->Subject,$body);
- $header = str_replace("\r\n","\n",$header_dkim) . $header;
</del><ins>+ $header_dkim = $this->DKIM_Add($this->MIMEHeader, $this->EncodeHeader($this->SecureHeader($this->Subject)), $this->MIMEBody);
+ $this->MIMEHeader = str_replace("\r\n", "\n", $header_dkim) . $this->MIMEHeader;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+ return true;
+ } catch (phpmailerException $e) {
+ $this->SetError($e->getMessage());
+ if ($this->exceptions) {
+ throw $e;
+ }
+ return false;
+ }
+ }
+
+ protected function PostSend() {
+ try {
</ins><span class="cx"> // Choose the mailer and send through it
</span><span class="cx"> switch($this->Mailer) {
</span><span class="cx"> case 'sendmail':
</span><del>- return $this->SendmailSend($header, $body);
</del><ins>+ return $this->SendmailSend($this->MIMEHeader, $this->MIMEBody);
</ins><span class="cx"> case 'smtp':
</span><del>- return $this->SmtpSend($header, $body);
</del><ins>+ return $this->SmtpSend($this->MIMEHeader, $this->MIMEBody);
</ins><span class="cx"> default:
</span><del>- return $this->MailSend($header, $body);
</del><ins>+ return $this->MailSend($this->MIMEHeader, $this->MIMEBody);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> } catch (phpmailerException $e) {
</span><span class="lines">@@ -612,7 +666,7 @@
</span><span class="cx"> $result = pclose($mail);
</span><span class="cx"> // implement call back function if it exists
</span><span class="cx"> $isSent = ($result == 0) ? 1 : 0;
</span><del>- $this->doCallback($isSent,$val,$this->cc,$this->bcc,$this->Subject,$body);
</del><ins>+ $this->doCallback($isSent, $val, $this->cc, $this->bcc, $this->Subject, $body);
</ins><span class="cx"> if($result != 0) {
</span><span class="cx"> throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
</span><span class="cx"> }
</span><span class="lines">@@ -626,7 +680,7 @@
</span><span class="cx"> $result = pclose($mail);
</span><span class="cx"> // implement call back function if it exists
</span><span class="cx"> $isSent = ($result == 0) ? 1 : 0;
</span><del>- $this->doCallback($isSent,$this->to,$this->cc,$this->bcc,$this->Subject,$body);
</del><ins>+ $this->doCallback($isSent, $this->to, $this->cc, $this->bcc, $this->Subject, $body);
</ins><span class="cx"> if($result != 0) {
</span><span class="cx"> throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
</span><span class="cx"> }
</span><span class="lines">@@ -648,8 +702,12 @@
</span><span class="cx"> }
</span><span class="cx"> $to = implode(', ', $toArr);
</span><span class="cx">
</span><del>- $params = sprintf("-oi -f %s", $this->Sender);
- if ($this->Sender != '' && strlen(ini_get('safe_mode'))< 1) {
</del><ins>+ if (empty($this->Sender)) {
+ $params = "-oi -f %s";
+ } else {
+ $params = sprintf("-oi -f %s", $this->Sender);
+ }
+ if ($this->Sender != '' and !ini_get('safe_mode')) {
</ins><span class="cx"> $old_from = ini_get('sendmail_from');
</span><span class="cx"> ini_set('sendmail_from', $this->Sender);
</span><span class="cx"> if ($this->SingleTo === true && count($toArr) > 1) {
</span><span class="lines">@@ -657,13 +715,13 @@
</span><span class="cx"> $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
</span><span class="cx"> // implement call back function if it exists
</span><span class="cx"> $isSent = ($rt == 1) ? 1 : 0;
</span><del>- $this->doCallback($isSent,$val,$this->cc,$this->bcc,$this->Subject,$body);
</del><ins>+ $this->doCallback($isSent, $val, $this->cc, $this->bcc, $this->Subject, $body);
</ins><span class="cx"> }
</span><span class="cx"> } else {
</span><span class="cx"> $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
</span><span class="cx"> // implement call back function if it exists
</span><span class="cx"> $isSent = ($rt == 1) ? 1 : 0;
</span><del>- $this->doCallback($isSent,$to,$this->cc,$this->bcc,$this->Subject,$body);
</del><ins>+ $this->doCallback($isSent, $to, $this->cc, $this->bcc, $this->Subject, $body);
</ins><span class="cx"> }
</span><span class="cx"> } else {
</span><span class="cx"> if ($this->SingleTo === true && count($toArr) > 1) {
</span><span class="lines">@@ -671,13 +729,13 @@
</span><span class="cx"> $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
</span><span class="cx"> // implement call back function if it exists
</span><span class="cx"> $isSent = ($rt == 1) ? 1 : 0;
</span><del>- $this->doCallback($isSent,$val,$this->cc,$this->bcc,$this->Subject,$body);
</del><ins>+ $this->doCallback($isSent, $val, $this->cc, $this->bcc, $this->Subject, $body);
</ins><span class="cx"> }
</span><span class="cx"> } else {
</span><span class="cx"> $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header);
</span><span class="cx"> // implement call back function if it exists
</span><span class="cx"> $isSent = ($rt == 1) ? 1 : 0;
</span><del>- $this->doCallback($isSent,$to,$this->cc,$this->bcc,$this->Subject,$body);
</del><ins>+ $this->doCallback($isSent, $to, $this->cc, $this->bcc, $this->Subject, $body);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> if (isset($old_from)) {
</span><span class="lines">@@ -699,7 +757,7 @@
</span><span class="cx"> * @return bool
</span><span class="cx"> */
</span><span class="cx"> protected function SmtpSend($header, $body) {
</span><del>- require_once $this->PluginDir . 'class-smtp.php';
</del><ins>+ require_once $this->PluginDir . 'class.smtp.php';
</ins><span class="cx"> $bad_rcpt = array();
</span><span class="cx">
</span><span class="cx"> if(!$this->SmtpConnect()) {
</span><span class="lines">@@ -716,11 +774,11 @@
</span><span class="cx"> $bad_rcpt[] = $to[0];
</span><span class="cx"> // implement call back function if it exists
</span><span class="cx"> $isSent = 0;
</span><del>- $this->doCallback($isSent,$to[0],'','',$this->Subject,$body);
</del><ins>+ $this->doCallback($isSent, $to[0], '', '', $this->Subject, $body);
</ins><span class="cx"> } else {
</span><span class="cx"> // implement call back function if it exists
</span><span class="cx"> $isSent = 1;
</span><del>- $this->doCallback($isSent,$to[0],'','',$this->Subject,$body);
</del><ins>+ $this->doCallback($isSent, $to[0], '', '', $this->Subject, $body);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> foreach($this->cc as $cc) {
</span><span class="lines">@@ -728,11 +786,11 @@
</span><span class="cx"> $bad_rcpt[] = $cc[0];
</span><span class="cx"> // implement call back function if it exists
</span><span class="cx"> $isSent = 0;
</span><del>- $this->doCallback($isSent,'',$cc[0],'',$this->Subject,$body);
</del><ins>+ $this->doCallback($isSent, '', $cc[0], '', $this->Subject, $body);
</ins><span class="cx"> } else {
</span><span class="cx"> // implement call back function if it exists
</span><span class="cx"> $isSent = 1;
</span><del>- $this->doCallback($isSent,'',$cc[0],'',$this->Subject,$body);
</del><ins>+ $this->doCallback($isSent, '', $cc[0], '', $this->Subject, $body);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> foreach($this->bcc as $bcc) {
</span><span class="lines">@@ -740,11 +798,11 @@
</span><span class="cx"> $bad_rcpt[] = $bcc[0];
</span><span class="cx"> // implement call back function if it exists
</span><span class="cx"> $isSent = 0;
</span><del>- $this->doCallback($isSent,'','',$bcc[0],$this->Subject,$body);
</del><ins>+ $this->doCallback($isSent, '', '', $bcc[0], $this->Subject, $body);
</ins><span class="cx"> } else {
</span><span class="cx"> // implement call back function if it exists
</span><span class="cx"> $isSent = 1;
</span><del>- $this->doCallback($isSent,'','',$bcc[0],$this->Subject,$body);
</del><ins>+ $this->doCallback($isSent, '', '', $bcc[0], $this->Subject, $body);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -942,7 +1000,7 @@
</span><span class="cx">
</span><span class="cx"> $line = explode($this->LE, $message);
</span><span class="cx"> $message = '';
</span><del>- for ($i=0 ;$i < count($line); $i++) {
</del><ins>+ for ($i = 0 ;$i < count($line); $i++) {
</ins><span class="cx"> $line_part = explode(' ', $line[$i]);
</span><span class="cx"> $buf = '';
</span><span class="cx"> for ($e = 0; $e<count($line_part); $e++) {
</span><span class="lines">@@ -1056,7 +1114,9 @@
</span><span class="cx">
</span><span class="cx"> switch($this->message_type) {
</span><span class="cx"> case 'alt':
</span><del>- case 'alt_attachments':
</del><ins>+ case 'alt_inline':
+ case 'alt_attach':
+ case 'alt_inline_attach':
</ins><span class="cx"> $this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap);
</span><span class="cx"> break;
</span><span class="cx"> default:
</span><span class="lines">@@ -1077,6 +1137,7 @@
</span><span class="cx"> $uniq_id = md5(uniqid(time()));
</span><span class="cx"> $this->boundary[1] = 'b1_' . $uniq_id;
</span><span class="cx"> $this->boundary[2] = 'b2_' . $uniq_id;
</span><ins>+ $this->boundary[3] = 'b3_' . $uniq_id;
</ins><span class="cx">
</span><span class="cx"> $result .= $this->HeaderLine('Date', self::RFCDate());
</span><span class="cx"> if($this->Sender == '') {
</span><span class="lines">@@ -1125,12 +1186,16 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if($this->MessageID != '') {
</span><del>- $result .= $this->HeaderLine('Message-ID',$this->MessageID);
</del><ins>+ $result .= $this->HeaderLine('Message-ID', $this->MessageID);
</ins><span class="cx"> } else {
</span><span class="cx"> $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE);
</span><span class="cx"> }
</span><span class="cx"> $result .= $this->HeaderLine('X-Priority', $this->Priority);
</span><del>- $result .= $this->HeaderLine('X-Mailer', 'PHPMailer '.$this->Version.' (phpmailer.sourceforge.net)');
</del><ins>+ if($this->XMailer) {
+ $result .= $this->HeaderLine('X-Mailer', $this->XMailer);
+ } else {
+ $result .= $this->HeaderLine('X-Mailer', 'PHPMailer '.$this->Version.' (http://code.google.com/a/apache-extras.org/p/phpmailer/)');
+ }
</ins><span class="cx">
</span><span class="cx"> if($this->ConfirmReadingTo != '') {
</span><span class="cx"> $result .= $this->HeaderLine('Disposition-Notification-To', '<' . trim($this->ConfirmReadingTo) . '>');
</span><span class="lines">@@ -1158,18 +1223,21 @@
</span><span class="cx"> switch($this->message_type) {
</span><span class="cx"> case 'plain':
</span><span class="cx"> $result .= $this->HeaderLine('Content-Transfer-Encoding', $this->Encoding);
</span><del>- $result .= sprintf("Content-Type: %s; charset=\"%s\"", $this->ContentType, $this->CharSet);
</del><ins>+ $result .= $this->TextLine('Content-Type: '.$this->ContentType.'; charset="'.$this->CharSet.'"');
</ins><span class="cx"> break;
</span><del>- case 'attachments':
- case 'alt_attachments':
- if($this->InlineImageExists()){
- $result .= sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s", 'multipart/related', $this->LE, $this->LE, $this->boundary[1], $this->LE);
- } else {
- $result .= $this->HeaderLine('Content-Type', 'multipart/mixed;');
- $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
- }
</del><ins>+ case 'inline':
+ $result .= $this->HeaderLine('Content-Type', 'multipart/related;');
+ $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
</ins><span class="cx"> break;
</span><ins>+ case 'attach':
+ case 'inline_attach':
+ case 'alt_attach':
+ case 'alt_inline_attach':
+ $result .= $this->HeaderLine('Content-Type', 'multipart/mixed;');
+ $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
+ break;
</ins><span class="cx"> case 'alt':
</span><ins>+ case 'alt_inline':
</ins><span class="cx"> $result .= $this->HeaderLine('Content-Type', 'multipart/alternative;');
</span><span class="cx"> $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
</span><span class="cx"> break;
</span><span class="lines">@@ -1197,6 +1265,33 @@
</span><span class="cx"> $this->SetWordWrap();
</span><span class="cx">
</span><span class="cx"> switch($this->message_type) {
</span><ins>+ case 'plain':
+ $body .= $this->EncodeString($this->Body, $this->Encoding);
+ break;
+ case 'inline':
+ $body .= $this->GetBoundary($this->boundary[1], '', '', '');
+ $body .= $this->EncodeString($this->Body, $this->Encoding);
+ $body .= $this->LE.$this->LE;
+ $body .= $this->AttachAll("inline", $this->boundary[1]);
+ break;
+ case 'attach':
+ $body .= $this->GetBoundary($this->boundary[1], '', '', '');
+ $body .= $this->EncodeString($this->Body, $this->Encoding);
+ $body .= $this->LE.$this->LE;
+ $body .= $this->AttachAll("attachment", $this->boundary[1]);
+ break;
+ case 'inline_attach':
+ $body .= $this->TextLine("--" . $this->boundary[1]);
+ $body .= $this->HeaderLine('Content-Type', 'multipart/related;');
+ $body .= $this->TextLine("\tboundary=\"" . $this->boundary[2] . '"');
+ $body .= $this->LE;
+ $body .= $this->GetBoundary($this->boundary[2], '', '', '');
+ $body .= $this->EncodeString($this->Body, $this->Encoding);
+ $body .= $this->LE.$this->LE;
+ $body .= $this->AttachAll("inline", $this->boundary[2]);
+ $body .= $this->LE;
+ $body .= $this->AttachAll("attachment", $this->boundary[1]);
+ break;
</ins><span class="cx"> case 'alt':
</span><span class="cx"> $body .= $this->GetBoundary($this->boundary[1], '', 'text/plain', '');
</span><span class="cx"> $body .= $this->EncodeString($this->AltBody, $this->Encoding);
</span><span class="lines">@@ -1206,26 +1301,56 @@
</span><span class="cx"> $body .= $this->LE.$this->LE;
</span><span class="cx"> $body .= $this->EndBoundary($this->boundary[1]);
</span><span class="cx"> break;
</span><del>- case 'plain':
</del><ins>+ case 'alt_inline':
+ $body .= $this->GetBoundary($this->boundary[1], '', 'text/plain', '');
+ $body .= $this->EncodeString($this->AltBody, $this->Encoding);
+ $body .= $this->LE.$this->LE;
+ $body .= $this->TextLine("--" . $this->boundary[1]);
+ $body .= $this->HeaderLine('Content-Type', 'multipart/related;');
+ $body .= $this->TextLine("\tboundary=\"" . $this->boundary[2] . '"');
+ $body .= $this->LE;
+ $body .= $this->GetBoundary($this->boundary[2], '', 'text/html', '');
</ins><span class="cx"> $body .= $this->EncodeString($this->Body, $this->Encoding);
</span><ins>+ $body .= $this->LE.$this->LE;
+ $body .= $this->AttachAll("inline", $this->boundary[2]);
+ $body .= $this->LE;
+ $body .= $this->EndBoundary($this->boundary[1]);
</ins><span class="cx"> break;
</span><del>- case 'attachments':
- $body .= $this->GetBoundary($this->boundary[1], '', '', '');
</del><ins>+ case 'alt_attach':
+ $body .= $this->TextLine("--" . $this->boundary[1]);
+ $body .= $this->HeaderLine('Content-Type', 'multipart/alternative;');
+ $body .= $this->TextLine("\tboundary=\"" . $this->boundary[2] . '"');
+ $body .= $this->LE;
+ $body .= $this->GetBoundary($this->boundary[2], '', 'text/plain', '');
+ $body .= $this->EncodeString($this->AltBody, $this->Encoding);
+ $body .= $this->LE.$this->LE;
+ $body .= $this->GetBoundary($this->boundary[2], '', 'text/html', '');
</ins><span class="cx"> $body .= $this->EncodeString($this->Body, $this->Encoding);
</span><ins>+ $body .= $this->LE.$this->LE;
+ $body .= $this->EndBoundary($this->boundary[2]);
</ins><span class="cx"> $body .= $this->LE;
</span><del>- $body .= $this->AttachAll();
</del><ins>+ $body .= $this->AttachAll("attachment", $this->boundary[1]);
</ins><span class="cx"> break;
</span><del>- case 'alt_attachments':
- $body .= sprintf("--%s%s", $this->boundary[1], $this->LE);
- $body .= sprintf("Content-Type: %s;%s" . "\tboundary=\"%s\"%s", 'multipart/alternative', $this->LE, $this->boundary[2], $this->LE.$this->LE);
- $body .= $this->GetBoundary($this->boundary[2], '', 'text/plain', '') . $this->LE; // Create text body
</del><ins>+ case 'alt_inline_attach':
+ $body .= $this->TextLine("--" . $this->boundary[1]);
+ $body .= $this->HeaderLine('Content-Type', 'multipart/alternative;');
+ $body .= $this->TextLine("\tboundary=\"" . $this->boundary[2] . '"');
+ $body .= $this->LE;
+ $body .= $this->GetBoundary($this->boundary[2], '', 'text/plain', '');
</ins><span class="cx"> $body .= $this->EncodeString($this->AltBody, $this->Encoding);
</span><span class="cx"> $body .= $this->LE.$this->LE;
</span><del>- $body .= $this->GetBoundary($this->boundary[2], '', 'text/html', '') . $this->LE; // Create the HTML body
</del><ins>+ $body .= $this->TextLine("--" . $this->boundary[2]);
+ $body .= $this->HeaderLine('Content-Type', 'multipart/related;');
+ $body .= $this->TextLine("\tboundary=\"" . $this->boundary[3] . '"');
+ $body .= $this->LE;
+ $body .= $this->GetBoundary($this->boundary[3], '', 'text/html', '');
</ins><span class="cx"> $body .= $this->EncodeString($this->Body, $this->Encoding);
</span><span class="cx"> $body .= $this->LE.$this->LE;
</span><ins>+ $body .= $this->AttachAll("inline", $this->boundary[3]);
+ $body .= $this->LE;
</ins><span class="cx"> $body .= $this->EndBoundary($this->boundary[2]);
</span><del>- $body .= $this->AttachAll();
</del><ins>+ $body .= $this->LE;
+ $body .= $this->AttachAll("attachment", $this->boundary[1]);
</ins><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1258,9 +1383,10 @@
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Returns the start of a message boundary.
</span><del>- * @access private
</del><ins>+ * @access protected
+ * @return string
</ins><span class="cx"> */
</span><del>- private function GetBoundary($boundary, $charSet, $contentType, $encoding) {
</del><ins>+ protected function GetBoundary($boundary, $charSet, $contentType, $encoding) {
</ins><span class="cx"> $result = '';
</span><span class="cx"> if($charSet == '') {
</span><span class="cx"> $charSet = $this->CharSet;
</span><span class="lines">@@ -1272,7 +1398,7 @@
</span><span class="cx"> $encoding = $this->Encoding;
</span><span class="cx"> }
</span><span class="cx"> $result .= $this->TextLine('--' . $boundary);
</span><del>- $result .= sprintf("Content-Type: %s; charset = \"%s\"", $contentType, $charSet);
</del><ins>+ $result .= sprintf("Content-Type: %s; charset=\"%s\"", $contentType, $charSet);
</ins><span class="cx"> $result .= $this->LE;
</span><span class="cx"> $result .= $this->HeaderLine('Content-Transfer-Encoding', $encoding);
</span><span class="cx"> $result .= $this->LE;
</span><span class="lines">@@ -1282,31 +1408,25 @@
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Returns the end of a message boundary.
</span><del>- * @access private
</del><ins>+ * @access protected
+ * @return string
</ins><span class="cx"> */
</span><del>- private function EndBoundary($boundary) {
</del><ins>+ protected function EndBoundary($boundary) {
</ins><span class="cx"> return $this->LE . '--' . $boundary . '--' . $this->LE;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Sets the message type.
</span><del>- * @access private
</del><ins>+ * @access protected
</ins><span class="cx"> * @return void
</span><span class="cx"> */
</span><del>- private function SetMessageType() {
- if(count($this->attachment) < 1 && strlen($this->AltBody) < 1) {
- $this->message_type = 'plain';
- } else {
- if(count($this->attachment) > 0) {
- $this->message_type = 'attachments';
- }
- if(strlen($this->AltBody) > 0 && count($this->attachment) < 1) {
- $this->message_type = 'alt';
- }
- if(strlen($this->AltBody) > 0 && count($this->attachment) > 0) {
- $this->message_type = 'alt_attachments';
- }
- }
</del><ins>+ protected function SetMessageType() {
+ $this->message_type = array();
+ if($this->AlternativeExists()) $this->message_type[] = "alt";
+ if($this->InlineImageExists()) $this->message_type[] = "inline";
+ if($this->AttachmentExists()) $this->message_type[] = "attach";
+ $this->message_type = implode("_", $this->message_type);
+ if($this->message_type == "") $this->message_type = "plain";
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -1386,10 +1506,10 @@
</span><span class="cx"> /**
</span><span class="cx"> * Attaches all fs, string, and binary attachments to the message.
</span><span class="cx"> * Returns an empty string on failure.
</span><del>- * @access private
</del><ins>+ * @access protected
</ins><span class="cx"> * @return string
</span><span class="cx"> */
</span><del>- private function AttachAll() {
</del><ins>+ protected function AttachAll($disposition_type, $boundary) {
</ins><span class="cx"> // Return text of body
</span><span class="cx"> $mime = array();
</span><span class="cx"> $cidUniq = array();
</span><span class="lines">@@ -1397,54 +1517,58 @@
</span><span class="cx">
</span><span class="cx"> // Add all attachments
</span><span class="cx"> foreach ($this->attachment as $attachment) {
</span><del>- // Check for string attachment
- $bString = $attachment[5];
- if ($bString) {
- $string = $attachment[0];
- } else {
- $path = $attachment[0];
- }
</del><ins>+ // CHECK IF IT IS A VALID DISPOSITION_FILTER
+ if($attachment[6] == $disposition_type) {
+ // Check for string attachment
+ $bString = $attachment[5];
+ if ($bString) {
+ $string = $attachment[0];
+ } else {
+ $path = $attachment[0];
+ }
</ins><span class="cx">
</span><del>- if (in_array($attachment[0], $incl)) { continue; }
- $filename = $attachment[1];
- $name = $attachment[2];
- $encoding = $attachment[3];
- $type = $attachment[4];
- $disposition = $attachment[6];
- $cid = $attachment[7];
- $incl[] = $attachment[0];
- if ( $disposition == 'inline' && isset($cidUniq[$cid]) ) { continue; }
- $cidUniq[$cid] = true;
</del><ins>+ $inclhash = md5(serialize($attachment));
+ if (in_array($inclhash, $incl)) { continue; }
+ $incl[] = $inclhash;
+ $filename = $attachment[1];
+ $name = $attachment[2];
+ $encoding = $attachment[3];
+ $type = $attachment[4];
+ $disposition = $attachment[6];
+ $cid = $attachment[7];
+ if ( $disposition == 'inline' && isset($cidUniq[$cid]) ) { continue; }
+ $cidUniq[$cid] = true;
</ins><span class="cx">
</span><del>- $mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE);
- $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $this->EncodeHeader($this->SecureHeader($name)), $this->LE);
- $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE);
</del><ins>+ $mime[] = sprintf("--%s%s", $boundary, $this->LE);
+ $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $this->EncodeHeader($this->SecureHeader($name)), $this->LE);
+ $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE);
</ins><span class="cx">
</span><del>- if($disposition == 'inline') {
- $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE);
- }
</del><ins>+ if($disposition == 'inline') {
+ $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE);
+ }
</ins><span class="cx">
</span><del>- $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $this->EncodeHeader($this->SecureHeader($name)), $this->LE.$this->LE);
</del><ins>+ $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $this->EncodeHeader($this->SecureHeader($name)), $this->LE.$this->LE);
</ins><span class="cx">
</span><del>- // Encode as string attachment
- if($bString) {
- $mime[] = $this->EncodeString($string, $encoding);
- if($this->IsError()) {
- return '';
</del><ins>+ // Encode as string attachment
+ if($bString) {
+ $mime[] = $this->EncodeString($string, $encoding);
+ if($this->IsError()) {
+ return '';
+ }
+ $mime[] = $this->LE.$this->LE;
+ } else {
+ $mime[] = $this->EncodeFile($path, $encoding);
+ if($this->IsError()) {
+ return '';
+ }
+ $mime[] = $this->LE.$this->LE;
</ins><span class="cx"> }
</span><del>- $mime[] = $this->LE.$this->LE;
- } else {
- $mime[] = $this->EncodeFile($path, $encoding);
- if($this->IsError()) {
- return '';
- }
- $mime[] = $this->LE.$this->LE;
</del><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- $mime[] = sprintf("--%s--%s", $this->boundary[1], $this->LE);
</del><ins>+ $mime[] = sprintf("--%s--%s", $boundary, $this->LE);
</ins><span class="cx">
</span><del>- return join('', $mime);
</del><ins>+ return implode("", $mime);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -1453,10 +1577,10 @@
</span><span class="cx"> * @param string $path The full path to the file
</span><span class="cx"> * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
</span><span class="cx"> * @see EncodeFile()
</span><del>- * @access private
</del><ins>+ * @access protected
</ins><span class="cx"> * @return string
</span><span class="cx"> */
</span><del>- private function EncodeFile($path, $encoding = 'base64') {
</del><ins>+ protected function EncodeFile($path, $encoding = 'base64') {
</ins><span class="cx"> try {
</span><span class="cx"> if (!is_readable($path)) {
</span><span class="cx"> throw new phpmailerException($this->Lang('file_open') . $path, self::STOP_CONTINUE);
</span><span class="lines">@@ -1466,13 +1590,15 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>- if (PHP_VERSION < 6) {
</del><ins>+ if (version_compare(PHP_VERSION, '5.3.0', '<')) {
</ins><span class="cx"> $magic_quotes = get_magic_quotes_runtime();
</span><span class="cx"> set_magic_quotes_runtime(0);
</span><span class="cx"> }
</span><span class="cx"> $file_buffer = file_get_contents($path);
</span><span class="cx"> $file_buffer = $this->EncodeString($file_buffer, $encoding);
</span><del>- if (PHP_VERSION < 6) { set_magic_quotes_runtime($magic_quotes); }
</del><ins>+ if (version_compare(PHP_VERSION, '5.3.0', '<')) {
+ set_magic_quotes_runtime($magic_quotes);
+ }
</ins><span class="cx"> return $file_buffer;
</span><span class="cx"> } catch (Exception $e) {
</span><span class="cx"> $this->SetError($e->getMessage());
</span><span class="lines">@@ -1488,7 +1614,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @return string
</span><span class="cx"> */
</span><del>- public function EncodeString ($str, $encoding = 'base64') {
</del><ins>+ public function EncodeString($str, $encoding = 'base64') {
</ins><span class="cx"> $encoded = '';
</span><span class="cx"> switch(strtolower($encoding)) {
</span><span class="cx"> case 'base64':
</span><span class="lines">@@ -1637,7 +1763,7 @@
</span><span class="cx"> * @return string
</span><span class="cx"> */
</span><span class="cx"> public function EncodeQPphp( $input = '', $line_max = 76, $space_conv = false) {
</span><del>- $hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
</del><ins>+ $hex = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F');
</ins><span class="cx"> $lines = preg_split('/(?:\r\n|\r|\n)/', $input);
</span><span class="cx"> $eol = "\r\n";
</span><span class="cx"> $escape = '=';
</span><span class="lines">@@ -1718,7 +1844,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @return string
</span><span class="cx"> */
</span><del>- public function EncodeQ ($str, $position = 'text') {
</del><ins>+ public function EncodeQ($str, $position = 'text') {
</ins><span class="cx"> // There should not be any EOL in the string
</span><span class="cx"> $encoded = preg_replace('/[\r\n]*/', '', $str);
</span><span class="cx">
</span><span class="lines">@@ -1733,7 +1859,7 @@
</span><span class="cx"> // Replace every high ascii, control =, ? and _ characters
</span><span class="cx"> //TODO using /e (equivalent to eval()) is probably not a good idea
</span><span class="cx"> $encoded = preg_replace('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/e',
</span><del>- "'='.sprintf('%02X', ord('\\1'))", $encoded);
</del><ins>+ "'='.sprintf('%02X', ord(stripslashes('\\1')))", $encoded);
</ins><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1807,6 +1933,20 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ public function AddStringEmbeddedImage($string, $cid, $filename = '', $encoding = 'base64', $type = 'application/octet-stream') {
+ // Append to $attachment array
+ $this->attachment[] = array(
+ 0 => $string,
+ 1 => $filename,
+ 2 => basename($filename),
+ 3 => $encoding,
+ 4 => $type,
+ 5 => true, // isStringAttachment
+ 6 => 'inline',
+ 7 => $cid
+ );
+ }
+
</ins><span class="cx"> /**
</span><span class="cx"> * Returns true if an inline attachment is present.
</span><span class="cx"> * @access public
</span><span class="lines">@@ -1821,6 +1961,19 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ public function AttachmentExists() {
+ foreach($this->attachment as $attachment) {
+ if ($attachment[6] == 'attachment') {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public function AlternativeExists() {
+ return strlen($this->AltBody)>0;
+ }
+
</ins><span class="cx"> /////////////////////////////////////////////////
</span><span class="cx"> // CLASS METHODS, MESSAGE RESET
</span><span class="cx"> /////////////////////////////////////////////////
</span><span class="lines">@@ -1933,10 +2086,10 @@
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Returns the server hostname or 'localhost.localdomain' if unknown.
</span><del>- * @access private
</del><ins>+ * @access protected
</ins><span class="cx"> * @return string
</span><span class="cx"> */
</span><del>- private function ServerHostname() {
</del><ins>+ protected function ServerHostname() {
</ins><span class="cx"> if (!empty($this->Hostname)) {
</span><span class="cx"> $result = $this->Hostname;
</span><span class="cx"> } elseif (isset($_SERVER['SERVER_NAME'])) {
</span><span class="lines">@@ -1950,10 +2103,10 @@
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Returns a message in the appropriate language.
</span><del>- * @access private
</del><ins>+ * @access protected
</ins><span class="cx"> * @return string
</span><span class="cx"> */
</span><del>- private function Lang($key) {
</del><ins>+ protected function Lang($key) {
</ins><span class="cx"> if(count($this->language) < 1) {
</span><span class="cx"> $this->SetLanguage('en'); // set the default language
</span><span class="cx"> }
</span><span class="lines">@@ -1976,10 +2129,10 @@
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Changes every end of line from CR or LF to CRLF.
</span><del>- * @access private
</del><ins>+ * @access public
</ins><span class="cx"> * @return string
</span><span class="cx"> */
</span><del>- private function FixEOL($str) {
</del><ins>+ public function FixEOL($str) {
</ins><span class="cx"> $str = str_replace("\r\n", "\n", $str);
</span><span class="cx"> $str = str_replace("\r", "\n", $str);
</span><span class="cx"> $str = str_replace("\n", $this->LE, $str);
</span><span class="lines">@@ -2005,16 +2158,16 @@
</span><span class="cx"> if(isset($images[2])) {
</span><span class="cx"> foreach($images[2] as $i => $url) {
</span><span class="cx"> // do not change urls for absolute images (thanks to corvuscorax)
</span><del>- if (!preg_match('#^[A-z]+://#',$url)) {
</del><ins>+ if (!preg_match('#^[A-z]+://#', $url)) {
</ins><span class="cx"> $filename = basename($url);
</span><span class="cx"> $directory = dirname($url);
</span><del>- ($directory == '.')?$directory='':'';
</del><ins>+ ($directory == '.') ? $directory='': '';
</ins><span class="cx"> $cid = 'cid:' . md5($filename);
</span><span class="cx"> $ext = pathinfo($filename, PATHINFO_EXTENSION);
</span><span class="cx"> $mimeType = self::_mime_types($ext);
</span><del>- if ( strlen($basedir) > 1 && substr($basedir,-1) != '/') { $basedir .= '/'; }
- if ( strlen($directory) > 1 && substr($directory,-1) != '/') { $directory .= '/'; }
- if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64',$mimeType) ) {
</del><ins>+ if ( strlen($basedir) > 1 && substr($basedir, -1) != '/') { $basedir .= '/'; }
+ if ( strlen($directory) > 1 && substr($directory, -1) != '/') { $directory .= '/'; }
+ if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64', $mimeType) ) {
</ins><span class="cx"> $message = preg_replace("/".$images[1][$i]."=\"".preg_quote($url, '/')."\"/Ui", $images[1][$i]."=\"".$cid."\"", $message);
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -2022,7 +2175,7 @@
</span><span class="cx"> }
</span><span class="cx"> $this->IsHTML(true);
</span><span class="cx"> $this->Body = $message;
</span><del>- $textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s','',$message)));
</del><ins>+ $textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s', '', $message)));
</ins><span class="cx"> if (!empty($textMsg) && empty($this->AltBody)) {
</span><span class="cx"> $this->AltBody = html_entity_decode($textMsg);
</span><span class="cx"> }
</span><span class="lines">@@ -2192,14 +2345,14 @@
</span><span class="cx"> * @param string $key_pass Password for private key
</span><span class="cx"> */
</span><span class="cx"> public function DKIM_QP($txt) {
</span><del>- $tmp="";
- $line="";
- for ($i=0;$i<strlen($txt);$i++) {
- $ord=ord($txt[$i]);
</del><ins>+ $tmp = '';
+ $line = '';
+ for ($i = 0; $i < strlen($txt); $i++) {
+ $ord = ord($txt[$i]);
</ins><span class="cx"> if ( ((0x21 <= $ord) && ($ord <= 0x3A)) || $ord == 0x3C || ((0x3E <= $ord) && ($ord <= 0x7E)) ) {
</span><del>- $line.=$txt[$i];
</del><ins>+ $line .= $txt[$i];
</ins><span class="cx"> } else {
</span><del>- $line.="=".sprintf("%02X",$ord);
</del><ins>+ $line .= "=".sprintf("%02X", $ord);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> return $line;
</span><span class="lines">@@ -2213,8 +2366,8 @@
</span><span class="cx"> */
</span><span class="cx"> public function DKIM_Sign($s) {
</span><span class="cx"> $privKeyStr = file_get_contents($this->DKIM_private);
</span><del>- if ($this->DKIM_passphrase!='') {
- $privKey = openssl_pkey_get_private($privKeyStr,$this->DKIM_passphrase);
</del><ins>+ if ($this->DKIM_passphrase != '') {
+ $privKey = openssl_pkey_get_private($privKeyStr, $this->DKIM_passphrase);
</ins><span class="cx"> } else {
</span><span class="cx"> $privKey = $privKeyStr;
</span><span class="cx"> }
</span><span class="lines">@@ -2230,15 +2383,15 @@
</span><span class="cx"> * @param string $s Header
</span><span class="cx"> */
</span><span class="cx"> public function DKIM_HeaderC($s) {
</span><del>- $s=preg_replace("/\r\n\s+/"," ",$s);
- $lines=explode("\r\n",$s);
- foreach ($lines as $key=>$line) {
- list($heading,$value)=explode(":",$line,2);
- $heading=strtolower($heading);
- $value=preg_replace("/\s+/"," ",$value) ; // Compress useless spaces
- $lines[$key]=$heading.":".trim($value) ; // Don't forget to remove WSP around the value
</del><ins>+ $s = preg_replace("/\r\n\s+/", " ", $s);
+ $lines = explode("\r\n", $s);
+ foreach ($lines as $key => $line) {
+ list($heading, $value) = explode(":", $line, 2);
+ $heading = strtolower($heading);
+ $value = preg_replace("/\s+/", " ", $value) ; // Compress useless spaces
+ $lines[$key] = $heading.":".trim($value) ; // Don't forget to remove WSP around the value
</ins><span class="cx"> }
</span><del>- $s=implode("\r\n",$lines);
</del><ins>+ $s = implode("\r\n", $lines);
</ins><span class="cx"> return $s;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2251,11 +2404,11 @@
</span><span class="cx"> public function DKIM_BodyC($body) {
</span><span class="cx"> if ($body == '') return "\r\n";
</span><span class="cx"> // stabilize line endings
</span><del>- $body=str_replace("\r\n","\n",$body);
- $body=str_replace("\n","\r\n",$body);
</del><ins>+ $body = str_replace("\r\n", "\n", $body);
+ $body = str_replace("\n", "\r\n", $body);
</ins><span class="cx"> // END stabilize line endings
</span><del>- while (substr($body,strlen($body)-4,4) == "\r\n\r\n") {
- $body=substr($body,0,strlen($body)-2);
</del><ins>+ while (substr($body, strlen($body) - 4, 4) == "\r\n\r\n") {
+ $body = substr($body, 0, strlen($body) - 2);
</ins><span class="cx"> }
</span><span class="cx"> return $body;
</span><span class="cx"> }
</span><span class="lines">@@ -2268,23 +2421,23 @@
</span><span class="cx"> * @param string $subject Subject
</span><span class="cx"> * @param string $body Body
</span><span class="cx"> */
</span><del>- public function DKIM_Add($headers_line,$subject,$body) {
</del><ins>+ public function DKIM_Add($headers_line, $subject, $body) {
</ins><span class="cx"> $DKIMsignatureType = 'rsa-sha1'; // Signature & hash algorithms
</span><span class="cx"> $DKIMcanonicalization = 'relaxed/simple'; // Canonicalization of header/body
</span><span class="cx"> $DKIMquery = 'dns/txt'; // Query method
</span><span class="cx"> $DKIMtime = time() ; // Signature Timestamp = seconds since 00:00:00 - Jan 1, 1970 (UTC time zone)
</span><span class="cx"> $subject_header = "Subject: $subject";
</span><del>- $headers = explode("\r\n",$headers_line);
</del><ins>+ $headers = explode($this->LE, $headers_line);
</ins><span class="cx"> foreach($headers as $header) {
</span><del>- if (strpos($header,'From:') === 0) {
- $from_header=$header;
- } elseif (strpos($header,'To:') === 0) {
- $to_header=$header;
</del><ins>+ if (strpos($header, 'From:') === 0) {
+ $from_header = $header;
+ } elseif (strpos($header, 'To:') === 0) {
+ $to_header = $header;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><del>- $from = str_replace('|','=7C',$this->DKIM_QP($from_header));
- $to = str_replace('|','=7C',$this->DKIM_QP($to_header));
- $subject = str_replace('|','=7C',$this->DKIM_QP($subject_header)) ; // Copied header fields (dkim-quoted-printable
</del><ins>+ $from = str_replace('|', '=7C', $this->DKIM_QP($from_header));
+ $to = str_replace('|', '=7C', $this->DKIM_QP($to_header));
+ $subject = str_replace('|', '=7C', $this->DKIM_QP($subject_header)) ; // Copied header fields (dkim-quoted-printable
</ins><span class="cx"> $body = $this->DKIM_BodyC($body);
</span><span class="cx"> $DKIMlen = strlen($body) ; // Length of body
</span><span class="cx"> $DKIMb64 = base64_encode(pack("H*", sha1($body))) ; // Base64 of packed binary SHA-1 hash of body
</span><span class="lines">@@ -2303,10 +2456,10 @@
</span><span class="cx"> return "X-PHPMAILER-DKIM: phpmailer.worxware.com\r\n".$dkimhdrs.$signed."\r\n";
</span><span class="cx"> }
</span><span class="cx">
</span><del>- protected function doCallback($isSent,$to,$cc,$bcc,$subject,$body) {
</del><ins>+ protected function doCallback($isSent, $to, $cc, $bcc, $subject, $body) {
</ins><span class="cx"> if (!empty($this->action_function) && function_exists($this->action_function)) {
</span><del>- $params = array($isSent,$to,$cc,$bcc,$subject,$body);
- call_user_func_array($this->action_function,$params);
</del><ins>+ $params = array($isSent, $to, $cc, $bcc, $subject, $body);
+ call_user_func_array($this->action_function, $params);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -2317,4 +2470,4 @@
</span><span class="cx"> return $errorMsg;
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>-?>
</del><span class="cx">\ No newline at end of file
</span><ins>+?>
</ins></span></pre></div>
<a id="trunkwpincludesclasssmtpphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/class-smtp.php (19631 => 19632)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/class-smtp.php        2011-12-25 17:27:39 UTC (rev 19631)
+++ trunk/wp-includes/class-smtp.php        2011-12-28 12:59:13 UTC (rev 19632)
</span><span class="lines">@@ -2,15 +2,15 @@
</span><span class="cx"> /*~ class.smtp.php
</span><span class="cx"> .---------------------------------------------------------------------------.
</span><span class="cx"> | Software: PHPMailer - PHP email class |
</span><del>-| Version: 5.1 |
-| Contact: via sourceforge.net support pages (also www.codeworxtech.com) |
-| Info: http://phpmailer.sourceforge.net |
-| Support: http://sourceforge.net/projects/phpmailer/ |
</del><ins>+| Version: 5.2 |
+| Site: https://code.google.com/a/apache-extras.org/p/phpmailer/ |
</ins><span class="cx"> | ------------------------------------------------------------------------- |
</span><del>-| Admin: Andy Prevost (project admininistrator) |
</del><ins>+| Admin: Jim Jagielski (project admininistrator) |
</ins><span class="cx"> | Authors: Andy Prevost (codeworxtech) codeworxtech@users.sourceforge.net |
</span><span class="cx"> | : Marcus Bointon (coolbru) coolbru@users.sourceforge.net |
</span><ins>+| : Jim Jagielski (jimjag) jimjag@gmail.com |
</ins><span class="cx"> | Founder: Brent R. Matzelle (original founder) |
</span><ins>+| Copyright (c) 2010-2011, Jim Jagielski. All Rights Reserved. |
</ins><span class="cx"> | Copyright (c) 2004-2009, Andy Prevost. All Rights Reserved. |
</span><span class="cx"> | Copyright (c) 2001-2003, Brent R. Matzelle |
</span><span class="cx"> | ------------------------------------------------------------------------- |
</span><span class="lines">@@ -19,11 +19,6 @@
</span><span class="cx"> | This program is distributed in the hope that it will be useful - WITHOUT |
</span><span class="cx"> | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
</span><span class="cx"> | FITNESS FOR A PARTICULAR PURPOSE. |
</span><del>-| ------------------------------------------------------------------------- |
-| We offer a number of paid services (www.codeworxtech.com): |
-| - Web Hosting on highly optimized fast and secure servers |
-| - Technology Consulting |
-| - Oursourcing (highly qualified programmers and graphic designers) |
</del><span class="cx"> '---------------------------------------------------------------------------'
</span><span class="cx"> */
</span><span class="cx">
</span><span class="lines">@@ -34,8 +29,10 @@
</span><span class="cx"> * @author Andy Prevost
</span><span class="cx"> * @author Marcus Bointon
</span><span class="cx"> * @copyright 2004 - 2008 Andy Prevost
</span><ins>+ * @author Jim Jagielski
+ * @copyright 2010 - 2011 Jim Jagielski
</ins><span class="cx"> * @license http://www.gnu.org/copyleft/lesser.html Distributed under the Lesser General Public License (LGPL)
</span><del>- * @version $Id: class.smtp.php 444 2009-05-05 11:22:26Z coolbru $
</del><ins>+ * @version $Id: class.smtp.php 450 2010-06-23 16:46:33Z coolbru $
</ins><span class="cx"> */
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -71,6 +68,12 @@
</span><span class="cx"> */
</span><span class="cx"> public $do_verp = false;
</span><span class="cx">
</span><ins>+ /**
+ * Sets the SMTP PHPMailer Version number
+ * @var string
+ */
+ public $Version = '5.2';
+
</ins><span class="cx"> /////////////////////////////////////////////////
</span><span class="cx"> // PROPERTIES, PRIVATE AND PROTECTED
</span><span class="cx"> /////////////////////////////////////////////////
</span><span class="lines">@@ -811,4 +814,4 @@
</span><span class="cx">
</span><span class="cx"> }
</span><span class="cx">
</span><del>-?>
</del><span class="cx">\ No newline at end of file
</span><ins>+?>
</ins></span></pre>
</div>
</div>
</body>
</html>