MDL-24896 MDL-23240 class.phpmailer.php reverted to the vanilla upstream version
This commit is contained in:
@@ -9,8 +9,3 @@ class.pop3.php
|
||||
docs/
|
||||
examples/
|
||||
test/
|
||||
|
||||
Our changes:
|
||||
* Modified EncodeQP() in class.phpmailer.php to not use php's implementation of quoted
|
||||
printable encoding as it was causing problems for some users MDL-23240
|
||||
* Changed PHPMailer::ReplyTo from private to public as it is used in moodlelib.php
|
||||
|
||||
@@ -310,7 +310,7 @@ class PHPMailer {
|
||||
private $to = array();
|
||||
private $cc = array();
|
||||
private $bcc = array();
|
||||
public $ReplyTo = array();
|
||||
private $ReplyTo = array();
|
||||
private $all_recipients = array();
|
||||
private $attachment = array();
|
||||
private $CustomHeader = array();
|
||||
@@ -1690,10 +1690,9 @@ class PHPMailer {
|
||||
* @author Marcus Bointon
|
||||
*/
|
||||
public function EncodeQP($string, $line_max = 76, $space_conv = false) {
|
||||
//MDL-23240 php's implementation causes problems for some users
|
||||
//if (function_exists('quoted_printable_encode')) { //Use native function if it's available (>= PHP5.3)
|
||||
// return quoted_printable_encode($string);
|
||||
//}
|
||||
if (function_exists('quoted_printable_encode')) { //Use native function if it's available (>= PHP5.3)
|
||||
return quoted_printable_encode($string);
|
||||
}
|
||||
$filters = stream_get_filters();
|
||||
if (!in_array('convert.*', $filters)) { //Got convert stream filter?
|
||||
return $this->EncodeQPphp($string, $line_max, $space_conv); //Fall back to old implementation
|
||||
@@ -2318,4 +2317,4 @@ class phpmailerException extends Exception {
|
||||
return $errorMsg;
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -104,4 +104,31 @@ class moodle_phpmailer extends PHPMailer {
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a temporary replacement of the parent::EncodeQP() that does not
|
||||
* call quoted_printable_encode() even if it is available. See MDL-23240 for details
|
||||
*
|
||||
* @see parent::EncodeQP() for full documentation
|
||||
*/
|
||||
public function EncodeQP($string, $line_max = 76, $space_conv = false) {
|
||||
//if (function_exists('quoted_printable_encode')) { //Use native function if it's available (>= PHP5.3)
|
||||
// return quoted_printable_encode($string);
|
||||
//}
|
||||
$filters = stream_get_filters();
|
||||
if (!in_array('convert.*', $filters)) { //Got convert stream filter?
|
||||
return $this->EncodeQPphp($string, $line_max, $space_conv); //Fall back to old implementation
|
||||
}
|
||||
$fp = fopen('php://temp/', 'r+');
|
||||
$string = preg_replace('/\r\n?/', $this->LE, $string); //Normalise line breaks
|
||||
$params = array('line-length' => $line_max, 'line-break-chars' => $this->LE);
|
||||
$s = stream_filter_append($fp, 'convert.quoted-printable-encode', STREAM_FILTER_READ, $params);
|
||||
fputs($fp, $string);
|
||||
rewind($fp);
|
||||
$out = stream_get_contents($fp);
|
||||
stream_filter_remove($s);
|
||||
$out = preg_replace('/^\./m', '=2E', $out); //Encode . if it is first char on a line, workaround for bug in Exchange
|
||||
fclose($fp);
|
||||
return $out;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user