From a900c1e68bbc2b343af346c0071f18faf72b1201 Mon Sep 17 00:00:00 2001 From: fidian Date: Fri, 20 Apr 2001 14:34:37 +0000 Subject: [PATCH] * Forgot to mention that "Download this as a file" now sets showHeaders when calling download.php * Changed the header types (mentioned on the list) * Shows the To/From/Subject/Date headers only if showHeaders is set (instead of always for text attachments * Shows the To/From/Subject/Date headers differently if you like to see HTML mail instead of normal mail git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1271 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- src/download.php | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/download.php b/src/download.php index 501421a4..c64d732d 100644 --- a/src/download.php +++ b/src/download.php @@ -116,19 +116,30 @@ $body = mime_fetch_body($imapConnection, $passed_id, $passed_ent_id); $body = decodeBody($body, $header->encoding); set_up_language(getPref($data_dir, $username, "language")); - header("Content-Disposition: attachment; filename=\"$filename\""); - header("Content-type: application/octet-stream; name=\"$filename\""); - if ($type1 == "plain") { + header("Content-Disposition: inline; filename=\"$filename\""); + header("Content-Type: application/download; name=\"$filename\""); + if ($type1 == "plain" && isset($showHeaders)) { echo _("Subject") . ": " . decodeHeader($top_header->subject) . "\n"; echo " " . _("From") . ": " . decodeHeader($top_header->from) . "\n"; echo " " . _("To") . ": " . decodeHeader(getLineOfAddrs($top_header->to)) . "\n"; echo " " . _("Date") . ": " . getLongDateString($top_header->date) . "\n\n"; } + elseif ($type1 == "html" && isset($showHeaders)) { + echo '\n\n\n\n
' . _("Subject"); + echo ':' . decodeHeader($top_header->subject); + echo "
" . _("From"); + echo ':' . decodeHeader($top_header->from); + echo "
" . _("To"); + echo ':' . decodeHeader(getLineOfAddrs($top_header->to)); + echo "
" . _("Date"); + echo ':' . getLongDateString($top_header->date); + echo "
\n
\n"; + } echo trim($body); break; default: header("Content-Disposition: inline; filename=\"$filename\""); - header("Content-type: application/download; name=\"$filename\""); + header("Content-Type: application/download; name=\"$filename\""); mime_print_body_lines ($imapConnection, $passed_id, $passed_ent_id, $header->encoding); break; } @@ -143,7 +154,7 @@ } else { $body = mime_fetch_body($imapConnection, $passed_id, $passed_ent_id); $body = decodeBody($body, $header->encoding); - header("Content-type: $type0/$type1; name=\"$filename\""); + header("Content-Type: $type0/$type1; name=\"$filename\""); header("Content-Disposition: inline; filename=\"$filename\""); echo $body; } -- 2.25.1