forked from extern/egroupware
fix bug regarding certain russian filenames when forwarding/compose as new, as AddStringAttachment is using basename to make sure only a filename will be used for the namepart; some fixes backported from phpmailer5.2.1
This commit is contained in:
parent
98d17d7ca4
commit
e5a80d758a
@ -28,7 +28,7 @@ class egw_mailer extends PHPMailer
|
||||
parent::__construct(true); // throw exceptions instead of echoing errors
|
||||
|
||||
// setting EGroupware specific path for PHPMailer lang files
|
||||
list($lang,$nation) = explode('-',$GLOBALS['egw_info']['user']['preferences']['common']['lang']);
|
||||
if (!empty($GLOBALS['egw_info']['user']['preferences']['common']['lang'])) list($lang,$nation) = explode('-',$GLOBALS['egw_info']['user']['preferences']['common']['lang']);
|
||||
$lang_path = EGW_SERVER_ROOT.'/phpgwapi/lang/';
|
||||
if ($nation && file_exists($lang_path."phpmailer.lang-$nation.php")) // atm. only for pt-br => br
|
||||
{
|
||||
@ -198,4 +198,33 @@ class egw_mailer extends PHPMailer
|
||||
|
||||
return parent::AddBCC($address, $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a string or binary attachment (non-filesystem) to the list.
|
||||
* This method can be used to attach ascii or binary data,
|
||||
* such as a BLOB record from a database.
|
||||
* @param string $string String attachment data.
|
||||
* @param string $filename Name of the attachment. We assume that this is NOT a path
|
||||
* @param string $encoding File encoding (see $Encoding).
|
||||
* @param string $type File extension (MIME) type.
|
||||
* @return void
|
||||
*/
|
||||
public function AddStringAttachment($string, $filename, $encoding = 'base64', $type = 'application/octet-stream')
|
||||
{
|
||||
// Append to $attachment array
|
||||
//already encoded?
|
||||
//TODO: maybe add an parameter to AddStringAttachment to avoid using the basename
|
||||
$x += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $filename, $matches);
|
||||
$this->attachment[] = array(
|
||||
0 => $string,
|
||||
1 => $filename,
|
||||
2 => ($x?basename($filename):$filename),
|
||||
3 => $encoding,
|
||||
4 => $type,
|
||||
5 => true, // isStringAttachment
|
||||
6 => 'attachment',
|
||||
7 => 0
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -345,7 +345,7 @@ class PHPMailer {
|
||||
private $bcc = array();
|
||||
private $ReplyTo = array();
|
||||
private $all_recipients = array();
|
||||
private $attachment = array();
|
||||
protected $attachment = array(); //this way extended classes may use this variable
|
||||
private $CustomHeader = array();
|
||||
private $message_type = '';
|
||||
private $boundary = array();
|
||||
@ -1265,7 +1265,7 @@ class PHPMailer {
|
||||
$body = '';
|
||||
|
||||
if ($this->sign_key_file) {
|
||||
$body .= $this->GetMailMIME();
|
||||
$body .= $this->GetMailMIME()."\n";
|
||||
}
|
||||
|
||||
$this->SetWordWrap();
|
||||
@ -1330,8 +1330,8 @@ class PHPMailer {
|
||||
$signed = tempnam("", "signed");
|
||||
if (@openssl_pkcs7_sign($file, $signed, "file://".$this->sign_cert_file, array("file://".$this->sign_key_file, $this->sign_key_pass), NULL)) {
|
||||
@unlink($file);
|
||||
@unlink($signed);
|
||||
$body = file_get_contents($signed);
|
||||
@unlink($signed);
|
||||
} else {
|
||||
@unlink($file);
|
||||
@unlink($signed);
|
||||
|
Loading…
Reference in New Issue
Block a user