* Forgot to mention that "Download this as a file" now sets showHeaders
authorfidian <fidian@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 20 Apr 2001 14:34:37 +0000 (14:34 +0000)
committerfidian <fidian@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 20 Apr 2001 14:34:37 +0000 (14:34 +0000)
  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

index 501421a44e3bae6b8168c2bfabcb8cbf00ccaf2d..c64d732d6bfeb718bb714a71fce3b230d9ebf94b 100644 (file)
             $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 '<table><tr><th align=right>' . _("Subject");
+              echo ':</th><td>' . decodeHeader($top_header->subject);
+              echo "</td></tr>\n<tr><th align=right>" . _("From");
+              echo ':</th><td>' . decodeHeader($top_header->from);
+              echo "</td></tr>\n<tr><th align=right>" . _("To");
+              echo ':</th><td>' . decodeHeader(getLineOfAddrs($top_header->to));
+              echo "</td></tr>\n<tr><th align=right>" . _("Date");
+              echo ':</th><td>' . getLongDateString($top_header->date);
+              echo "</td></tr>\n</table>\n<hr>\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;
       }
             } 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;
             }