From d4ff4d67cf5bcc45fc072c15946da212ba005f46 Mon Sep 17 00:00:00 2001 From: lkehresman Date: Wed, 20 Sep 2000 05:13:07 +0000 Subject: [PATCH] Fixed bug I noticed when ONLY an attachment is sent (no text message), it would display junk. Now it shows the attachment box. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@749 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- ChangeLog | 2 ++ functions/mime.php | 46 +++++++++++++++++++++++++++++----------------- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index ab657b73..7348175a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ Version 0.5 -- DEVELOPMENT -------------------------- +- Fixed some lingering bugs in mime parsing +- Searching specifies CHARSET option - Security fixes - Fixed hyperlink rendering problems diff --git a/functions/mime.php b/functions/mime.php index f56f54d8..c837fd8d 100644 --- a/functions/mime.php +++ b/functions/mime.php @@ -436,29 +436,41 @@ // Get the right entity and redefine message to be this entity $ent_num = findDisplayEntity ($message); $body_message = getEntity($message, $ent_num); - - $body = mime_fetch_body ($imap_stream, $id, $ent_num); - $body = decodeBody($body, $body_message->header->encoding); - - // If there are other types that shouldn't be formatted, add - // them here - if ($message->header->type1 != "html") { - $body = translateText($body, $wrap_at, $body_message->header->charset); - } - - $body .= "
". _("Download this as a file") ."

"; - - /** Display the ATTACHMENTS: message if there's more than one part **/ - if ($message->entities) { + if (($body_message->header->type0 == "text") || + ($body_message->header->type0 == "rfc822")) { + + $body = mime_fetch_body ($imap_stream, $id, $ent_num); + $body = decodeBody($body, $body_message->header->encoding); + + // If there are other types that shouldn't be formatted, add + // them here + if ($message->header->type1 != "html") { + $body = translateText($body, $wrap_at, $body_message->header->charset); + } + + $body .= "
". _("Download this as a file") ."

"; + + /** Display the ATTACHMENTS: message if there's more than one part **/ + if ($message->entities) { + $body .= ""; + $body .= "
"; + $body .= "ATTACHMENTS:"; + $body .= "
"; + $num = 0; + + $body .= formatAttachments ($message, $ent_num, $message->header->mailbox, $id); + $body .= "
"; + } else { + $body .= ""; + } + } else { $body .= ""; $body .= "
"; $body .= "ATTACHMENTS:"; $body .= "
"; $num = 0; - $body .= formatAttachments ($message, $ent_num, $message->header->mailbox, $id); - $body .= "
"; - } else { + $body .= formatAttachments ($message, 999999, $message->header->mailbox, $id); $body .= ""; } return $body; -- 2.25.1