- echo "startMessage=$startMessage&show_more=$show_more&view_hdr=1\">" .
- _("View Full Header") . "</A>\n";
-}
-
-/* Output the printer friendly link if we are in subtle mode. */
-if ($pf_subtle_link) {
- echo printer_friendly_link(true);
-}
-
-do_hook("read_body_header_right");
-echo '</small></TD>' . "\n" .
- ' </TR>' ."\n";
-
-/** from **/
-echo ' <TR>' . "\n" .
- ' <TD BGCOLOR="' . $color[0] . '" ALIGN="RIGHT">' . "\n" .
- _("From:") .
- ' </TD><TD BGCOLOR="' . $color[0] . '">' . "\n" .
- " <B>$from_name</B> \n" .
- ' </TD>' . "\n" .
- ' </TR>' . "\n";
-/** date **/
-echo ' <TR>' . "\n" .
- ' <TD BGCOLOR="' . $color[0] . '" ALIGN="RIGHT">' . "\n" .
- _("Date:") .
- " </TD><TD BGCOLOR=\"$color[0]\">\n" .
- " <B>$dateString</B> \n" .
- ' </TD>' . "\n" .
- ' </TR>' . "\n";
-
-/** to **/
-echo " <TR>\n" .
- " <TD BGCOLOR=\"$color[0]\" ALIGN=RIGHT VALIGN=TOP>\n" .
- _("To:") .
- ' </TD><TD BGCOLOR="' . $color[0] . '" VALIGN="TOP">' . "\n" .
- " <B>$to_string</B> \n" .
- ' </TD>' . "\n" .
- ' </TR>' . "\n";
-/** cc **/
-if (isset($cc_string)) {
- echo " <TR>\n" .
- " <TD BGCOLOR=\"$color[0]\" ALIGN=RIGHT VALIGN=TOP>\n" .
- ' Cc:' . "\n" .
- " </TD><TD BGCOLOR=\"$color[0]\" VALIGN=TOP colspan=2>\n" .
- " <B>$cc_string</B> \n" .
- ' </TD>' . "\n" .
- ' </TR>' . "\n";
-}
-
-/** bcc **/
-if (isset($bcc_string)) {
- echo " <TR>\n" .
- " <TD BGCOLOR=\"$color[0]\" ALIGN=RIGHT VALIGN=TOP>\n" .
- ' Bcc:' . "\n" .
- " </TD><TD BGCOLOR=\"$color[0]\" VALIGN=TOP colspan=2>\n" .
- " <B>$bcc_string</B> \n" .
- ' </TD>' . "\n" .
- ' </TR>' . "\n";
-}
-if ($default_use_priority) {
- if (isset($priority_string)) {
- echo " <TR>\n" .
- " <TD BGCOLOR=\"$color[0]\" ALIGN=RIGHT VALIGN=TOP>\n" .
- " "._("Priority").": \n".
- " </TD><TD BGCOLOR=\"$color[0]\" VALIGN=TOP colspan=2>\n" .
- " <B>$priority_string</B> \n" .
- " </TD>" . "\n" .
- " </TR>" . "\n";
- }
-}
-
-if ($show_xmailer_default) {
- $read = sqimap_run_command ($imapConnection, "FETCH $passed_id BODY.PEEK[HEADER.FIELDS (X-Mailer User-Agent)]", true,
- $response, $readmessage);
- $mailer = substr($read[1], strpos($read[1], " "));
- if (trim($mailer)) {
- echo " <TR>\n" .
- " <TD BGCOLOR=\"$color[0]\" ALIGN=RIGHT VALIGN=TOP>\n" .
- " "._("Mailer").": \n".
- " </TD><TD BGCOLOR=\"$color[0]\" VALIGN=TOP colspan=2>\n" .
- " <B>$mailer</B> \n" .
- " </TD>" . "\n" .
- " </TR>" . "\n";
- }
-}
-
-/* Output the printer friendly link if we are not in subtle mode. */
-if (!$pf_subtle_link) {
- echo printer_friendly_link(true);
-}
-
-do_hook('read_body_header');
-echo '</TABLE>' .
- ' </TD></TR>' .
- '</TABLE>';
-flush();
-
-echo "<TABLE CELLSPACING=0 WIDTH=\"97%\" BORDER=0 ALIGN=CENTER CELLPADDING=0>\n" .
- " <TR><TD BGCOLOR=\"$color[4]\" WIDTH=\"100%\">\n" .
- '<BR>'.
- formatBody($imapConnection, $message, $color, $wrap_at).
- '</TABLE>' .
- '<TABLE CELLSPACING="0" WIDTH="100%" BORDER="0" ALIGN="CENTER" CELLPADDING="0">' . "\n" .
- " <TR><TD BGCOLOR=\"$color[9]\"> </TD></TR>" .
- '</TABLE>' . "\n";
+ $ent_ar = $message->findDisplayEntity(array(), array('text/plain'));
+}
+$cnt = count($ent_ar);
+for ($i = 0; $i < $cnt; $i++) {
+ $messagebody .= formatBody($imapConnection, $message, $color, $wrap_at, $ent_ar[$i], $passed_id, $mailbox);
+ if ($i != $cnt-1) {
+ $messagebody .= '<hr noshade size=1>';
+ }
+}
+
+displayPageHeader($color, $mailbox);
+formatMenuBar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_response);
+formatEnvheader($mailbox, $passed_id, $passed_ent_id, $message, $color, $FirstTimeSee);
+echo '<table width="100%" cellpadding="0" cellspacing="0" align="center" border="0">';
+echo ' <tr><td>';
+echo ' <table width="100%" cellpadding="1" cellspacing="0" align="center" border="0" bgcolor="'.$color[9].'">';
+echo ' <tr><td>';
+echo ' <table width="100%" cellpadding="3" cellspacing="0" align="center" border="0">';
+echo ' <tr bgcolor="'.$color[4].'"><td>';
+echo ' <table cellpadding="1" cellspacing="5" align="left" border="0">';
+echo ' <tr>' . html_tag( 'td', '<br>'. $messagebody."\n", 'left')
+ . '</tr>';
+echo ' </table>';
+echo ' </td></tr>';
+echo ' </table></td></tr>';
+echo ' </table>';
+echo ' </td></tr>';
+
+echo '<TR><TD HEIGHT="5" COLSPAN="2" BGCOLOR="'.
+ $color[4].'"></TD></TR>'."\n";
+
+$attachmentsdisplay = formatAttachments($message,$ent_ar,$mailbox, $passed_id);
+if ($attachmentsdisplay) {
+ echo ' <tr><td>';
+ echo ' <table width="100%" cellpadding="1" cellspacing="0" align="center"'.' border="0" bgcolor="'.$color[9].'">';
+ echo ' <tr><td>';
+ echo ' <table width="100%" cellpadding="0" cellspacing="0" align="center" border="0" bgcolor="'.$color[4].'">';
+ echo ' <tr><td ALIGN="left" bgcolor="'.$color[9].'">';
+ echo ' <b>' . _("Attachments") . ':</b>';
+ echo ' </td></tr>';
+ echo ' <tr><td>';
+ echo ' <table width="100%" cellpadding="2" cellspacing="2" align="center"'.' border="0" bgcolor="'.$color[0].'"><tr><td>';
+ echo $attachmentsdisplay;
+ echo ' </td></tr></table>';
+ echo ' </td></tr></table>';
+ echo ' </td></tr></table>';
+ echo ' </td></tr>';
+ echo '<TR><TD HEIGHT="5" COLSPAN="2" BGCOLOR="'.
+ $color[4].'"></TD></TR>';
+}
+echo '</table>';