From 7085fa781edecb09839b682808e516796a60b6e5 Mon Sep 17 00:00:00 2001 From: lkehresman Date: Wed, 5 Jan 2000 18:17:37 +0000 Subject: [PATCH] Bugfixes in MIME stuff git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@104 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/mime.php | 23 +++++++++++++---------- src/download.php | 5 ++--- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/functions/mime.php b/functions/mime.php index d6e98d85..068c754a 100644 --- a/functions/mime.php +++ b/functions/mime.php @@ -122,25 +122,29 @@ /** this if statement checks for the entity to show as the primary message. To add more of them, just put them in the order that is their priority. **/ + $id = $message["INFO"]["ID"]; + $urlmailbox = urlencode($message["INFO"]["MAILBOX"]); + $body = ""; + if (containsType($message, "text", "html", $ent_num)) { - $body = decodeBody($message["ENTITIES"][$ent_num]["BODY"], $message["ENTITIES"][$ent_num]["ENCODING"]); + $body .= decodeBody($message["ENTITIES"][$ent_num]["BODY"], $message["ENTITIES"][$ent_num]["ENCODING"]); } else if (containsType($message, "text", "plain", $ent_num)) { - $body = decodeBody($message["ENTITIES"][$ent_num]["BODY"], $message["ENTITIES"][$ent_num]["ENCODING"]); - $body = "" . nl2br($body) . ""; + $tmpbody = decodeBody($message["ENTITIES"][$ent_num]["BODY"], $message["ENTITIES"][$ent_num]["ENCODING"]); + $body .= "" . nl2br($tmpbody) . ""; } // add other primary displaying message types here else { // find any type that's displayable if (containsType($message, "text", "any_type", $ent_num)) { - $body = decodeBody($message["ENTITIES"][$ent_num]["BODY"], $message["ENTITIES"][$ent_num]["ENCODING"]); - $body = "" . nl2br($body) . ""; + $tmpbody = decodeBody($message["ENTITIES"][$ent_num]["BODY"], $message["ENTITIES"][$ent_num]["ENCODING"]); + $body .= "" . nl2br($tmpbody) . ""; } else if (containsType($message, "message", "any_type", $ent_num)) { - $body = decodeBody($message["ENTITIES"][$ent_num]["BODY"], $message["ENTITIES"][$ent_num]["ENCODING"]); - $body = "" . nl2br($body) . ""; + $tmpbody = decodeBody($message["ENTITIES"][$ent_num]["BODY"], $message["ENTITIES"][$ent_num]["ENCODING"]); + $body .= "" . nl2br($tmpbody) . ""; } } - $body .= "
"; + $body .= "
Download this as a file

"; /** Display the ATTACHMENTS: message if there's more than one part **/ if (count($message["ENTITIES"]) > 1) { @@ -160,8 +164,7 @@ $num++; $filename = $message["ENTITIES"][$i]["FILENAME"]; if (trim($filename) == "") { - $filename = "UNKNOWN_FORMAT_" . time() . $i; - $display_filename = "Attachment $i"; + $display_filename = "untitled$i"; } else { $display_filename = $filename; } diff --git a/src/download.php b/src/download.php index 07e6e142..56c57335 100644 --- a/src/download.php +++ b/src/download.php @@ -32,7 +32,7 @@ $filename = $message["ENTITIES"][$passed_ent_id]["FILENAME"]; if (strlen($filename) < 1) { - $filename = "message" . time(); + $filename = "untitled$passed_ent_id"; } if ($absolute_dl == "true") { @@ -41,8 +41,7 @@ $body = decodeBody($message["ENTITIES"][$passed_ent_id]["BODY"], $message["ENTITIES"][$passed_ent_id]["ENCODING"]); header("Content-type: $type0/$type1"); header("Content-Disposition: attachment; filename=\"$filename\""); - if ($type1 != "html") - echo nl2br($body); + echo $body; break; default: $body = decodeBody($message["ENTITIES"][$passed_ent_id]["BODY"], $message["ENTITIES"][$passed_ent_id]["ENCODING"]); -- 2.25.1