X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fclasses%2Fthird_party%2Fphp_mailer%2Fclass.phpmailer.php;h=419b26b68a3fa4709939b876fe365834f47c73b6;hb=49f84a522f0ccac3b70728cd41011a0be0eed8cf;hp=856faafde9efb4409967a830275c61723df5855a;hpb=c6d73b0e3246efc824cb98338d4be7ee5bc9f308;p=core.git diff --git a/inc/classes/third_party/php_mailer/class.phpmailer.php b/inc/classes/third_party/php_mailer/class.phpmailer.php index 856faafd..419b26b6 100644 --- a/inc/classes/third_party/php_mailer/class.phpmailer.php +++ b/inc/classes/third_party/php_mailer/class.phpmailer.php @@ -2,7 +2,7 @@ /*~ class.phpmailer.php .---------------------------------------------------------------------------. | Software: PHPMailer - PHP email class | -| Version: 2.1 | +| Version: 2.3 | | Contact: via sourceforge.net support pages (also www.codeworxtech.com) | | Info: http://phpmailer.sourceforge.net | | Support: http://sourceforge.net/projects/phpmailer/ | @@ -140,7 +140,7 @@ class PHPMailer { * Holds PHPMailer version. * @var string */ - public $Version = "2.1"; + public $Version = "2.3"; /** * Sets the email address that a reading confirmation will be sent. @@ -242,6 +242,12 @@ class PHPMailer { */ public $SingleTo = false; + /** + * Provides the ability to change the line ending + * @var string + */ + public $LE = "\r\n"; + ///////////////////////////////////////////////// // PROPERTIES, PRIVATE ///////////////////////////////////////////////// @@ -257,7 +263,7 @@ class PHPMailer { private $boundary = array(); private $language = array(); private $error_count = 0; - private $LE = "\n"; + private $sign_cert_file = ""; private $sign_key_file = ""; private $sign_key_pass = ""; @@ -603,7 +609,7 @@ class PHPMailer { if($this->smtp->Connect(($ssl ? 'ssl://':'').$host, $port, $this->Timeout)) { - $hello = ($this->Helo != '' ? $this->Hello : $this->ServerHostname()); + $hello = ($this->Helo != '' ? $this->Helo : $this->ServerHostname()); $this->smtp->Hello($hello); if($tls) { @@ -659,8 +665,20 @@ class PHPMailer { */ function SetLanguage($lang_type = 'en', $lang_path = 'language/') { if( !(@include $lang_path.'phpmailer.lang-'.$lang_type.'.php') ) { - $this->SetError('Could not load language file'); - return false; + $PHPMAILER_LANG = array(); + $PHPMAILER_LANG["provide_address"] = 'You must provide at least one ' . + $PHPMAILER_LANG["mailer_not_supported"] = ' mailer is not supported.'; + $PHPMAILER_LANG["execute"] = 'Could not execute: '; + $PHPMAILER_LANG["instantiate"] = 'Could not instantiate mail function.'; + $PHPMAILER_LANG["authenticate"] = 'SMTP Error: Could not authenticate.'; + $PHPMAILER_LANG["from_failed"] = 'The following From address failed: '; + $PHPMAILER_LANG["recipients_failed"] = 'SMTP Error: The following ' . + $PHPMAILER_LANG["data_not_accepted"] = 'SMTP Error: Data not accepted.'; + $PHPMAILER_LANG["connect_host"] = 'SMTP Error: Could not connect to SMTP host.'; + $PHPMAILER_LANG["file_access"] = 'Could not access file: '; + $PHPMAILER_LANG["file_open"] = 'File Error: Could not open file: '; + $PHPMAILER_LANG["encoding"] = 'Unknown encoding: '; + $PHPMAILER_LANG["signing"] = 'Signing Error: '; } $this->language = $PHPMAILER_LANG; return true; @@ -874,9 +892,6 @@ class PHPMailer { } elseif (count($this->cc) == 0) { $result .= $this->HeaderLine('To', 'undisclosed-recipients:;'); } - if(count($this->cc) > 0) { - $result .= $this->AddrAppend('Cc', $this->cc); - } } $from = array(); @@ -919,7 +934,6 @@ class PHPMailer { for($index = 0; $index < count($this->CustomHeader); $index++) { $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), $this->EncodeHeader(trim($this->CustomHeader[$index][1]))); } - //$result .= $this->HeaderLine('MIME-Version', '1.0'); if (!$this->sign_key_file) { $result .= $this->HeaderLine('MIME-Version', '1.0'); $result .= $this->GetMailMIME(); @@ -1019,9 +1033,12 @@ class PHPMailer { fclose($fp); $signed = tempnam("", "signed"); - if (@openssl_pkcs7_sign($file, $signed, "file://".$this->sign_key_file, array("file://".$this->sign_key_file, $this->sign_key_pass), null)) { + if (@openssl_pkcs7_sign($file, $signed, "file://".$this->sign_cert_file, array("file://".$this->sign_key_file, $this->sign_key_pass), null)) { $fp = fopen($signed, "r"); - $result = fread($fp, filesize($this->sign_key_file)); + $result = ''; + while(!feof($fp)){ + $result = $result . fread($fp, 1024); + } fclose($fp); } else { $this->SetError($this->Lang("signing").openssl_error_string()); @@ -1171,14 +1188,16 @@ class PHPMailer { $cid = $this->attachment[$i][7]; $mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE); - $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $name, $this->LE); + //$mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $name, $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); if($disposition == 'inline') { $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE); } - $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $name, $this->LE.$this->LE); + //$mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $name, $this->LE.$this->LE); + $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $this->EncodeHeader($this->SecureHeader($name)), $this->LE.$this->LE); /* Encode as string attachment */ if($bString) { @@ -1212,13 +1231,19 @@ class PHPMailer { $this->SetError($this->Lang('file_open') . $path); return ''; } - $magic_quotes = get_magic_quotes_runtime(); - set_magic_quotes_runtime(0); - $file_buffer = file_get_contents($path); - $file_buffer = $this->EncodeString($file_buffer, $encoding); + if (function_exists('get_magic_quotes')) { + function get_magic_quotes() { + return false; + } +} + if (PHP_VERSION < 6) { + $magic_quotes = get_magic_quotes_runtime(); + set_magic_quotes_runtime(0); + } + $file_buffer = file_get_contents($path); + $file_buffer = $this->EncodeString($file_buffer, $encoding); fclose($fd); - set_magic_quotes_runtime($magic_quotes); - + if (PHP_VERSION < 6) { set_magic_quotes_runtime($magic_quotes); } return $file_buffer; } @@ -1412,7 +1437,7 @@ class PHPMailer { } // end of for $output .= $newline.$eol; } // end of while - return trim($output); + return $output; } /** @@ -1700,8 +1725,7 @@ class PHPMailer { $ext = $fileParts[1]; $mimeType = $this->_mime_types($ext); if ( strlen($basedir) > 1 && substr($basedir,-1) != '/') { $basedir .= '/'; } - if ( strlen($directory) > 1 && substr($basedir,-1) != '/') { $directory .= '/'; } - $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64', $mimeType); + if ( strlen($directory) > 1 && substr($directory,-1) != '/') { $directory .= '/'; } if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64',$mimeType) ) { $message = preg_replace("/".$images[1][$i]."=\"".preg_quote($url, '/')."\"/Ui", $images[1][$i]."=\"".$cid."\"", $message); } @@ -1712,7 +1736,7 @@ class PHPMailer { $this->Body = $message; $textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s','',$message))); if ( !empty($textMsg) && empty($this->AltBody) ) { - $this->AltBody = $textMsg; + $this->AltBody = html_entity_decode($textMsg); } if ( empty($this->AltBody) ) { $this->AltBody = 'To view this email message, open the email in with HTML compatibility!' . "\n\n"; @@ -1876,11 +1900,11 @@ class PHPMailer { * @param string $key_filename Parameter File Name * @param string $key_pass Password for private key */ - public function Sign($key_filename, $key_pass) { + public function Sign($cert_filename, $key_filename, $key_pass) { + $this->sign_cert_file = $cert_filename; $this->sign_key_file = $key_filename; $this->sign_key_pass = $key_pass; } - } -?> +?> \ No newline at end of file