Fixed Trac#522: issue with non-ASCII characters in notifications subject.

SVN:1.2[1809]
This commit is contained in:
Denis Flaven
2012-01-24 18:24:34 +00:00
parent 9da00b83b2
commit 459a271d11

View File

@@ -95,7 +95,7 @@ class EMail
$bRes = mail
(
str_replace(array("\n", "\r"), ' ', $this->m_sTo), // Prevent header injection
str_replace(array("\n", "\r"), ' ', $this->m_sSubject), // Prevent header injection
$this->EncodeHeaderField($this->m_sSubject), // Prevent header injection & MIME Encode charsets
$this->m_sBody,
$sHeaders
);
@@ -225,6 +225,18 @@ class EMail
$this->m_sBody .= implode("--".$sDelimiter."\r\n", $aAttachments);
$this->m_sBody .= "--".$sDelimiter."--";
}
/**
* MIME encode the content of a header field according to RFC2047
* @param string $sFieldContent the content of the header to encode
* @return string The encoded string
*/
protected function EncodeHeaderField($sFieldContent)
{
$sTemp = str_replace(array("\n", "\r"), ' ', $sFieldContent);
$sTemp = iconv_mime_encode('Tagada', $sTemp, array('scheme' => 'Q', 'input_charset' => 'UTF-8', 'output_charset' => 'ISO-8859-1'));
return preg_replace('/^Tagada: /', '', $sTemp);
}
}
?>