From be38f51cc727cf79b669663dde573720f7b56976 Mon Sep 17 00:00:00 2001 From: slawkens1 Date: Sun, 19 Nov 2017 20:25:03 +0100 Subject: [PATCH] * updated phpmailer to version 5.2.26 (from 5.2.23) --- system/libs/phpmailer/class.phpmailer.php | 25 ++++--- system/libs/phpmailer/class.pop3.php | 2 +- system/libs/phpmailer/class.smtp.php | 65 +++++++++++++------ .../phpmailer/language/phpmailer.lang-ba.php | 26 ++++++++ .../phpmailer/language/phpmailer.lang-nb.php | 32 ++++----- .../language/phpmailer.lang-pt_br.php | 3 +- ...iler.lang-sr.php => phpmailer.lang-rs.php} | 2 +- .../phpmailer/language/phpmailer.lang-tr.php | 3 +- .../language/phpmailer.lang-zh_cn.php | 7 +- 9 files changed, 112 insertions(+), 53 deletions(-) create mode 100644 system/libs/phpmailer/language/phpmailer.lang-ba.php rename system/libs/phpmailer/language/{phpmailer.lang-sr.php => phpmailer.lang-rs.php} (96%) diff --git a/system/libs/phpmailer/class.phpmailer.php b/system/libs/phpmailer/class.phpmailer.php index 1b31ec14..99f9092c 100644 --- a/system/libs/phpmailer/class.phpmailer.php +++ b/system/libs/phpmailer/class.phpmailer.php @@ -31,7 +31,7 @@ class PHPMailer * The PHPMailer Version number. * @var string */ - public $Version = '5.2.23'; + public $Version = '5.2.26'; /** * Email priority. @@ -440,9 +440,9 @@ class PHPMailer * * Parameters: * boolean $result result of the send action - * string $to email address of the recipient - * string $cc cc email addresses - * string $bcc bcc email addresses + * array $to email addresses of the recipients + * array $cc cc email addresses + * array $bcc bcc email addresses * string $subject the subject * string $body the email body * string $from email address of sender @@ -659,6 +659,8 @@ class PHPMailer if ($exceptions !== null) { $this->exceptions = (boolean)$exceptions; } + //Pick an appropriate debug output format automatically + $this->Debugoutput = (strpos(PHP_SAPI, 'cli') !== false ? 'echo' : 'html'); } /** @@ -1622,8 +1624,13 @@ class PHPMailer foreach ($hosts as $hostentry) { $hostinfo = array(); - if (!preg_match('/^((ssl|tls):\/\/)*([a-zA-Z0-9\.-]*):?([0-9]*)$/', trim($hostentry), $hostinfo)) { + if (!preg_match( + '/^((ssl|tls):\/\/)*([a-zA-Z0-9\.-]*|\[[a-fA-F0-9:]+\]):?([0-9]*)$/', + trim($hostentry), + $hostinfo + )) { // Not a valid host entry + $this->edebug('Ignoring invalid host: ' . $hostentry); continue; } // $hostinfo[2]: optional ssl or tls prefix @@ -1742,6 +1749,7 @@ class PHPMailer 'dk' => 'da', 'no' => 'nb', 'se' => 'sv', + 'sr' => 'rs' ); if (isset($renamed_langcodes[$langcode])) { @@ -2024,10 +2032,7 @@ class PHPMailer { $result = ''; - if ($this->MessageDate == '') { - $this->MessageDate = self::rfcDate(); - } - $result .= $this->headerLine('Date', $this->MessageDate); + $result .= $this->headerLine('Date', $this->MessageDate == '' ? self::rfcDate() : $this->MessageDate); // To be created automatically by mail() if ($this->SingleTo) { @@ -4033,7 +4038,7 @@ class phpmailerException extends Exception */ public function errorMessage() { - $errorMsg = '' . $this->getMessage() . "
\n"; + $errorMsg = '' . htmlspecialchars($this->getMessage()) . "
\n"; return $errorMsg; } } diff --git a/system/libs/phpmailer/class.pop3.php b/system/libs/phpmailer/class.pop3.php index c464f90c..f833ac61 100644 --- a/system/libs/phpmailer/class.pop3.php +++ b/system/libs/phpmailer/class.pop3.php @@ -34,7 +34,7 @@ class POP3 * @var string * @access public */ - public $Version = '5.2.23'; + public $Version = '5.2.26'; /** * Default POP3 port number. diff --git a/system/libs/phpmailer/class.smtp.php b/system/libs/phpmailer/class.smtp.php index 01cee820..be6ddce4 100644 --- a/system/libs/phpmailer/class.smtp.php +++ b/system/libs/phpmailer/class.smtp.php @@ -30,7 +30,7 @@ class SMTP * The PHPMailer SMTP version number. * @var string */ - const VERSION = '5.2.23'; + const VERSION = '5.2.26'; /** * SMTP line break constant. @@ -81,7 +81,7 @@ class SMTP * @deprecated Use the `VERSION` constant instead * @see SMTP::VERSION */ - public $Version = '5.2.23'; + public $Version = '5.2.26'; /** * SMTP server port number. @@ -151,9 +151,8 @@ class SMTP public $Timelimit = 300; /** - * @var array patterns to extract smtp transaction id from smtp reply - * Only first capture group will be use, use non-capturing group to deal with it - * Extend this class to override this property to fulfil your needs. + * @var array Patterns to extract an SMTP transaction id from reply to a DATA command. + * The first capture group in each regex will be used as the ID. */ protected $smtp_transaction_id_patterns = array( 'exim' => '/[0-9]{3} OK id=(.*)/', @@ -161,6 +160,12 @@ class SMTP 'postfix' => '/[0-9]{3} 2.0.0 Ok: queued as (.*)/' ); + /** + * @var string The last transaction ID issued in response to a DATA command, + * if one was detected + */ + protected $last_smtp_transaction_id; + /** * The socket for the server connection. * @var resource @@ -227,7 +232,7 @@ class SMTP break; case 'html': //Cleans up output a bit for a better looking, HTML-safe output - echo htmlentities( + echo gmdate('Y-m-d H:i:s') . ' ' . htmlentities( preg_replace('/[\r\n]+/', '', $str), ENT_QUOTES, 'UTF-8' @@ -709,6 +714,7 @@ class SMTP $savetimelimit = $this->Timelimit; $this->Timelimit = $this->Timelimit * 2; $result = $this->sendCommand('DATA END', '.', 250); + $this->recordLastTransactionID(); //Restore timelimit $this->Timelimit = $savetimelimit; return $result; @@ -989,7 +995,10 @@ class SMTP public function client_send($data) { $this->edebug("CLIENT -> SERVER: $data", self::DEBUG_CLIENT); - return fwrite($this->smtp_conn, $data); + set_error_handler(array($this, 'errorHandler')); + $result = fwrite($this->smtp_conn, $data); + restore_error_handler(); + return $result; } /** @@ -1089,8 +1098,10 @@ class SMTP $this->edebug("SMTP -> get_lines(): \$data is \"$data\"", self::DEBUG_LOWLEVEL); $this->edebug("SMTP -> get_lines(): \$str is \"$str\"", self::DEBUG_LOWLEVEL); $data .= $str; - // If 4th character is a space, we are done reading, break the loop, micro-optimisation over strlen - if ((isset($str[3]) and $str[3] == ' ')) { + // If response is only 3 chars (not valid, but RFC5321 S4.2 says it must be handled), + // or 4th character is a space, we are done reading, break the loop, + // string array access is a micro-optimisation over strlen + if (!isset($str[3]) or (isset($str[3]) and $str[3] == ' ')) { break; } // Timed-out? Log and break @@ -1226,26 +1237,40 @@ class SMTP } /** - * Will return the ID of the last smtp transaction based on a list of patterns provided - * in SMTP::$smtp_transaction_id_patterns. + * Extract and return the ID of the last SMTP transaction based on + * a list of patterns provided in SMTP::$smtp_transaction_id_patterns. + * Relies on the host providing the ID in response to a DATA command. * If no reply has been received yet, it will return null. - * If no pattern has been matched, it will return false. + * If no pattern was matched, it will return false. * @return bool|null|string */ - public function getLastTransactionID() + protected function recordLastTransactionID() { $reply = $this->getLastReply(); if (empty($reply)) { - return null; - } - - foreach ($this->smtp_transaction_id_patterns as $smtp_transaction_id_pattern) { - if (preg_match($smtp_transaction_id_pattern, $reply, $matches)) { - return $matches[1]; + $this->last_smtp_transaction_id = null; + } else { + $this->last_smtp_transaction_id = false; + foreach ($this->smtp_transaction_id_patterns as $smtp_transaction_id_pattern) { + if (preg_match($smtp_transaction_id_pattern, $reply, $matches)) { + $this->last_smtp_transaction_id = $matches[1]; + } } } - return false; + return $this->last_smtp_transaction_id; + } + + /** + * Get the queue/transaction ID of the last SMTP transaction + * If no reply has been received yet, it will return null. + * If no pattern was matched, it will return false. + * @return bool|null|string + * @see recordLastTransactionID() + */ + public function getLastTransactionID() + { + return $this->last_smtp_transaction_id; } } diff --git a/system/libs/phpmailer/language/phpmailer.lang-ba.php b/system/libs/phpmailer/language/phpmailer.lang-ba.php new file mode 100644 index 00000000..095dee3e --- /dev/null +++ b/system/libs/phpmailer/language/phpmailer.lang-ba.php @@ -0,0 +1,26 @@ + + */ + +$PHPMAILER_LANG['authenticate'] = 'SMTP Greška: Neuspjela prijava.'; +$PHPMAILER_LANG['connect_host'] = 'SMTP Greška: Ne moguće se spojiti sa SMTP serverom.'; +$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Greška: Podatci nisu prihvaćeni.'; +$PHPMAILER_LANG['empty_message'] = 'Sadržaj poruke je prazan.'; +$PHPMAILER_LANG['encoding'] = 'Nepoznata kriptografija: '; +$PHPMAILER_LANG['execute'] = 'Nije moguće izvršiti naredbu: '; +$PHPMAILER_LANG['file_access'] = 'Nije moguće pristupiti datoteci: '; +$PHPMAILER_LANG['file_open'] = 'Nije moguće otvoriti datoteku: '; +$PHPMAILER_LANG['from_failed'] = 'SMTP Greška: Slanje sa navedenih e-mail adresa nije uspjelo: '; +$PHPMAILER_LANG['recipients_failed'] = 'SMTP Greška: Slanje na navedene e-mail adrese nije uspjelo: '; +$PHPMAILER_LANG['instantiate'] = 'Ne mogu pokrenuti mail funkcionalnost.'; +$PHPMAILER_LANG['invalid_address'] = 'E-mail nije poslan. Neispravna e-mail adresa: '; +$PHPMAILER_LANG['mailer_not_supported'] = ' mailer nije podržan.'; +$PHPMAILER_LANG['provide_address'] = 'Definišite barem jednu adresu primaoca.'; +$PHPMAILER_LANG['signing'] = 'Greška prilikom prijave: '; +$PHPMAILER_LANG['smtp_connect_failed'] = 'Spajanje na SMTP server nije uspjelo.'; +$PHPMAILER_LANG['smtp_error'] = 'SMTP greška: '; +$PHPMAILER_LANG['variable_set'] = 'Nije moguće postaviti varijablu ili je vratiti nazad: '; +$PHPMAILER_LANG['extension_missing'] = 'Nedostaje ekstenzija: '; \ No newline at end of file diff --git a/system/libs/phpmailer/language/phpmailer.lang-nb.php b/system/libs/phpmailer/language/phpmailer.lang-nb.php index 383dd516..44610542 100644 --- a/system/libs/phpmailer/language/phpmailer.lang-nb.php +++ b/system/libs/phpmailer/language/phpmailer.lang-nb.php @@ -1,25 +1,25 @@ * @author Lucas Guimarães * @author Phelipe Alves + * @author Fabio Beneditto */ $PHPMAILER_LANG['authenticate'] = 'Erro de SMTP: Não foi possível autenticar.'; @@ -15,7 +16,7 @@ $PHPMAILER_LANG['encoding'] = 'Codificação desconhecida: '; $PHPMAILER_LANG['execute'] = 'Não foi possível executar: '; $PHPMAILER_LANG['file_access'] = 'Não foi possível acessar o arquivo: '; $PHPMAILER_LANG['file_open'] = 'Erro de Arquivo: Não foi possível abrir o arquivo: '; -$PHPMAILER_LANG['from_failed'] = 'Os seguintes remententes falharam: '; +$PHPMAILER_LANG['from_failed'] = 'Os seguintes remetentes falharam: '; $PHPMAILER_LANG['instantiate'] = 'Não foi possível instanciar a função mail.'; $PHPMAILER_LANG['invalid_address'] = 'Endereço de e-mail inválido: '; $PHPMAILER_LANG['mailer_not_supported'] = ' mailer não é suportado.'; diff --git a/system/libs/phpmailer/language/phpmailer.lang-sr.php b/system/libs/phpmailer/language/phpmailer.lang-rs.php similarity index 96% rename from system/libs/phpmailer/language/phpmailer.lang-sr.php rename to system/libs/phpmailer/language/phpmailer.lang-rs.php index ed95ca6e..0502f021 100644 --- a/system/libs/phpmailer/language/phpmailer.lang-sr.php +++ b/system/libs/phpmailer/language/phpmailer.lang-rs.php @@ -23,4 +23,4 @@ $PHPMAILER_LANG['signing'] = 'Грешка приликом при $PHPMAILER_LANG['smtp_connect_failed'] = 'Повезивање са SMTP сервером није успело.'; $PHPMAILER_LANG['smtp_error'] = 'Грешка SMTP сервера: '; $PHPMAILER_LANG['variable_set'] = 'Није могуће задати променљиву, нити је вратити уназад: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; +$PHPMAILER_LANG['extension_missing'] = 'Недостаје проширење: '; diff --git a/system/libs/phpmailer/language/phpmailer.lang-tr.php b/system/libs/phpmailer/language/phpmailer.lang-tr.php index 323fb4b5..cfe8eaae 100644 --- a/system/libs/phpmailer/language/phpmailer.lang-tr.php +++ b/system/libs/phpmailer/language/phpmailer.lang-tr.php @@ -6,6 +6,7 @@ * @author Can Yılmaz * @author Mehmet Benlioğlu * @author @yasinaydin + * @author Ogün Karakuş */ $PHPMAILER_LANG['authenticate'] = 'SMTP Hatası: Oturum açılamadı.'; @@ -26,4 +27,4 @@ $PHPMAILER_LANG['signing'] = 'İmzalama hatası: '; $PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP connect() fonksiyonu başarısız.'; $PHPMAILER_LANG['smtp_error'] = 'SMTP sunucu hatası: '; $PHPMAILER_LANG['variable_set'] = 'Değişken ayarlanamadı ya da sıfırlanamadı: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; +$PHPMAILER_LANG['extension_missing'] = 'Eklenti bulunamadı: '; diff --git a/system/libs/phpmailer/language/phpmailer.lang-zh_cn.php b/system/libs/phpmailer/language/phpmailer.lang-zh_cn.php index d85a0b1a..37537802 100644 --- a/system/libs/phpmailer/language/phpmailer.lang-zh_cn.php +++ b/system/libs/phpmailer/language/phpmailer.lang-zh_cn.php @@ -4,13 +4,14 @@ * @package PHPMailer * @author liqwei * @author young + * @author Teddysun */ $PHPMAILER_LANG['authenticate'] = 'SMTP 错误:登录失败。'; $PHPMAILER_LANG['connect_host'] = 'SMTP 错误:无法连接到 SMTP 主机。'; $PHPMAILER_LANG['data_not_accepted'] = 'SMTP 错误:数据不被接受。'; $PHPMAILER_LANG['empty_message'] = '邮件正文为空。'; -$PHPMAILER_LANG['encoding'] = '未知编码: '; +$PHPMAILER_LANG['encoding'] = '未知编码:'; $PHPMAILER_LANG['execute'] = '无法执行:'; $PHPMAILER_LANG['file_access'] = '无法访问文件:'; $PHPMAILER_LANG['file_open'] = '文件错误:无法打开文件:'; @@ -22,6 +23,6 @@ $PHPMAILER_LANG['provide_address'] = '必须提供至少一个收件人地 $PHPMAILER_LANG['recipients_failed'] = 'SMTP 错误:收件人地址错误:'; $PHPMAILER_LANG['signing'] = '登录失败:'; $PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP服务器连接失败。'; -$PHPMAILER_LANG['smtp_error'] = 'SMTP服务器出错: '; +$PHPMAILER_LANG['smtp_error'] = 'SMTP服务器出错:'; $PHPMAILER_LANG['variable_set'] = '无法设置或重置变量:'; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; +$PHPMAILER_LANG['extension_missing'] = '丢失模块 Extension:';