From: stekkel Date: Tue, 14 Jan 2003 16:07:26 +0000 (+0000) Subject: * modifications for using ent_id=0 for downloading full messages X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=6914aa18b99a1f3919ad7cc66eefa611d508d20f;p=squirrelmail.git * modifications for using ent_id=0 for downloading full messages * patch from Seth E. Randall for setting the filename of the mime-entities git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@4418 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/src/download.php b/src/download.php index 28fe5c80..1be2b9eb 100644 --- a/src/download.php +++ b/src/download.php @@ -50,18 +50,26 @@ if (!is_object($message)) { $message = sqimap_get_message($imapConnection,$passed_id, $mailbox); } $subject = $message->rfc822_header->subject; -$message = &$message->getEntity($ent_id); -$header = $message->header; -if ($message->rfc822_header) { - $subject = $message->rfc822_header->subject; - $charset = $header->content_type->properties['charset']; +if ($ent_id) { + $message = &$message->getEntity($ent_id); + $header = $message->header; + + if ($message->rfc822_header) { + $subject = $message->rfc822_header->subject; + $charset = $header->content_type->properties['charset']; + } else { + $header = $message->header; + $charset = $header->getParameter('charset'); + } + $type0 = $header->type0; + $type1 = $header->type1; + $encoding = strtolower($header->encoding); } else { - $header = $message->header; - $charset = $header->getParameter('charset'); + /* raw message */ + $type0 = 'message'; + $type1 = 'rfc822'; + $encoding = "US-ASCII"; } -$type0 = $header->type0; -$type1 = $header->type1; -$encoding = strtolower($header->encoding); /* * lets redefine message as this particular entity that we wish to display. @@ -81,6 +89,9 @@ if (is_object($message->header->disposition)) { if (!$filename) { $filename = decodeHeader($header->disposition->getProperty('name')); } + if (!$filename) { + $filename = decodeHeader($header->getParameter('name')); + } } if (strlen($filename) < 1) { if ($type1 == 'plain' && $type0 == 'text') {