use html::content_header for gathering download headers on getAttachment and saveMessage

This commit is contained in:
Klaus Leithoff 2014-02-25 15:59:22 +00:00
parent a1663631da
commit d3b244e069
2 changed files with 3 additions and 33 deletions

View File

@ -1878,19 +1878,7 @@ class mail_compose
}
//error_log(__METHOD__.__LINE__.'->'.array2string($attachment));
$filename = ($attachment['name']?$attachment['name']:($attachment['filename']?$attachment['filename']:$mailbox.'_uid'.$uid.'_part'.$part));
header ("Content-Type: ".$attachment['type']."; name=\"". $filename ."\"");
if($_GET['mode'] == "save") {
// ask for download
header ("Content-Disposition: attachment; filename=\"". $filename ."\"");
} else {
// display it
header ("Content-Disposition: inline; filename=\"". $filename ."\"");
}
header("Expires: 0");
// the next headers are for IE and SSL
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: public");
html::content_header($filename,$attachment['type'],0,True,($_GET['mode'] == "save"));
echo $attachment['attachment'];
$GLOBALS['egw']->common->egw_exit();

View File

@ -2533,19 +2533,7 @@ unset($query['actions']);
}
//error_log(__METHOD__.__LINE__.'->'.array2string($attachment));
$filename = ($attachment['name']?$attachment['name']:($attachment['filename']?$attachment['filename']:$mailbox.'_uid'.$uid.'_part'.$part));
header ("Content-Type: ".$attachment['type']."; name=\"". $filename ."\"");
if($_GET['mode'] == "save") {
// ask for download
header ("Content-Disposition: attachment; filename=\"". $filename ."\"");
} else {
// display it
header ("Content-Disposition: inline; filename=\"". $filename ."\"");
}
header("Expires: 0");
// the next headers are for IE and SSL
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: public");
html::content_header($filename,$attachment['type'],0,True,($_GET['mode'] == "save"));
echo $attachment['attachment'];
$GLOBALS['egw']->common->egw_exit();
@ -2580,13 +2568,7 @@ unset($query['actions']);
if ($display==false)
{
$subject = str_replace('$$','__',mail_bo::decode_header($headers['SUBJECT']));
header ("Content-Type: message/rfc822; name=\"". $subject .".eml\"");
header ("Content-Disposition: attachment; filename=\"". $subject .".eml\"");
header("Expires: 0");
// the next headers are for IE and SSL
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: public");
html::content_header($subject .".eml",'message/rfc822',0,True,($display==false));
echo $message;
$GLOBALS['egw']->common->egw_exit();