From d3b244e069b5876091f999f04f0dee718ed46775 Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Tue, 25 Feb 2014 15:59:22 +0000 Subject: [PATCH] use html::content_header for gathering download headers on getAttachment and saveMessage --- mail/inc/class.mail_compose.inc.php | 14 +------------- mail/inc/class.mail_ui.inc.php | 22 ++-------------------- 2 files changed, 3 insertions(+), 33 deletions(-) diff --git a/mail/inc/class.mail_compose.inc.php b/mail/inc/class.mail_compose.inc.php index bf31d87466..5007432384 100644 --- a/mail/inc/class.mail_compose.inc.php +++ b/mail/inc/class.mail_compose.inc.php @@ -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(); diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php index b708f3047d..f44b742ff5 100644 --- a/mail/inc/class.mail_ui.inc.php +++ b/mail/inc/class.mail_ui.inc.php @@ -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();