X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Fdownload.php;h=78d3948dce104a1e4da5bf4564bd0de0c64cd46d;hb=80bb6546e5f0602d8c055df1f37b64ab030d6657;hp=a5b0382a13ac9011286fc6671cb5116cf4e512cc;hpb=a7ea7540551cc16c4e2f95eddbbafc131a371112;p=squirrelmail.git diff --git a/src/download.php b/src/download.php index a5b0382a..78d3948d 100644 --- a/src/download.php +++ b/src/download.php @@ -82,7 +82,14 @@ $charset = $header->charset; $type0 = $header->type0; $type1 = $header->type1; + if (isset($override_type0)) + $type0 = $override_type0; + if (isset($override_type1)) + $type1 = $override_type1; $filename = decodeHeader($header->filename); + if (!$filename) { + $filename = decodeHeader($header->name); + } if (strlen($filename) < 1) { if ($type1 == "plain" && $type0 == "text") $suffix = "txt"; @@ -113,20 +120,20 @@ case "text": $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\""); - set_up_language(getPref($data_dir, $username, "language")); if ($type1 == "plain") { - echo _("Subject") . ": " . decodeHeader(sqStripSlashes($top_header->subject)) . "\n"; - echo " " . _("From") . ": " . decodeHeader(sqStripSlashes($top_header->from)) . "\n"; - echo " " . _("To") . ": " . decodeHeader(sqStripSlashes(getLineOfAddrs($top_header->to))) . "\n"; + 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"; } echo trim($body); break; default: - header("Content-Disposition: attachment; filename=\"$filename\""); - header("Content-type: application/octet-stream; name=\"$filename\""); + header("Content-Disposition: inline; filename=\"$filename\""); + header("Content-type: application/download; name=\"$filename\""); mime_print_body_lines ($imapConnection, $passed_id, $passed_ent_id, $header->encoding); break; } @@ -142,7 +149,7 @@ $body = mime_fetch_body($imapConnection, $passed_id, $passed_ent_id); $body = decodeBody($body, $header->encoding); header("Content-type: $type0/$type1; name=\"$filename\""); - header("Content-Disposition: attachment; filename=\"$filename\""); + header("Content-Disposition: inline; filename=\"$filename\""); echo $body; } break; @@ -154,7 +161,7 @@ break; default: header("Content-type: $type0/$type1; name=\"$filename\""); - header("Content-Disposition: attachment; filename=\"$filename\""); + header("Content-Disposition: inline; filename=\"$filename\""); mime_print_body_lines ($imapConnection, $passed_id, $passed_ent_id, $header->encoding); break; }