-function viewText($color, $body, $id, $entid, $mailbox, $type1, $wrap_at, $imapConnection) {
- global $where, $what, $charset;
- global $startMessage;
-
- displayPageHeader($color, 'None');
-
- if ($where && $what) {
- // from a search
- $message_link_str = "<a href=\"read_body.php?mailbox=".urlencode($mailbox)."&passed_id=$id&where=".urlencode($where)."&what=".urlencode($what)."\">". _("View message") . "</a>";
- } else {
- $message_link_str = "<a href=\"read_body.php?mailbox=".urlencode($mailbox)."&passed_id=$id&startMessage=$startMessage&show_more=0\">". _("View message") . "</a>";
- }
- $urlmailbox = urlencode($mailbox);
-
- echo '<br>' .
- html_tag( 'table',
- html_tag( 'tr',
- html_tag( 'td',
- '<b><center>' .
- _("Viewing a text attachment") . ' - ' . $message_link_str . '</b></center>',
- 'left', $color[0] )
- ) .
- html_tag( 'tr',
- html_tag( 'td',
- '<center>' .
- "<A HREF=\"../src/download.php?absolute_dl=true&passed_id=$id&passed_ent_id=$entid&mailbox=$urlmailbox\">".
- _("Download this as a file").
- "</A></CENTER><BR>",
- 'left' )
- ),
- 'center', '', 'width="100%" border="0" cellspacing="0" cellpadding="2"' );
-
- if ($type1 == 'html') {
- $msg = sqimap_get_message($imapConnection, $id, $mailbox);
- $body = MagicHTML( $body, $id, $msg );
- } else {
- translateText($body, $wrap_at, $charset);
- }
-
- flush();
-
- //"<TABLE WIDTH=\"98%\" BORDER=0 CELLSPACING=0 CELLPADDING=2 ALIGN=CENTER><TR><TD BGCOLOR=\"$color[0]\">".
- //"<TR><TD BGCOLOR=\"$color[4]\"><TT>";
-
- html_tag( 'table',
- html_tag( 'tr',
- html_tag( 'td', '<tt>' . $body . '</tt>', 'left', $color[4] )
- ) ,
- 'center', '', 'width="98%" border="0" cellspacing="0" cellpadding="2"' );
-}
-
-function viewMessage($imapConnection, $id, $mailbox, $ent_id, $color, $wrap_at, $extracted) {
- global $startMessage;
-
-
- $msg = sqimap_get_message($imapConnection, $id, $mailbox);
- $msg = getEntity($msg, $ent_id);
-
- $header = sqimap_get_ent_header($imapConnection,$id,$mailbox,$ent_id);
- $header->id = $id;
- $msg->header = $header;
-
- $ent_ar = findDisplayEntity($msg, 0);
- $body = '';
- for ($i = 0; $i < count($ent_ar); $i++) {
- $body .= formatBody($imapConnection, $msg, $color, $wrap_at, $ent_ar[$i], false);
- }
-
- $bodyheader = viewHeader($header, $color);
- displayPageHeader($color, 'None');
-
- echo '<br>' .
- html_tag( 'table', '', 'center', '', 'width="100%" border="0" cellspacing="0" cellpadding="2"' );
-
- if ($extracted) {
- echo html_tag( 'tr',
- html_tag( 'td', '<center><h1>Message succesfully extracted</h1></center>', 'left', '', 'width="100%"' )
- );
- }
-
- $td_str = "<b><center>". _("Viewing a message attachment") . " - ";
- $td_str .= "<a href=\"read_body.php?mailbox=".urlencode($mailbox)."&passed_id=$id&startMessage=$startMessage&show_more=0\">". _("View message") . "</a></b></center>";
- echo html_tag( 'tr',
- html_tag( 'td', $td_str, 'left', $color[0] )
- );
-
- $urlmailbox = urlencode($mailbox);
- $td_str = "<center><b><A HREF=\"../src/download.php?absolute_dl=true&passed_id=$id&passed_ent_id=$ent_id&mailbox=$urlmailbox\">".
- _("Download this as a file").
- "</A><BR>".
- "</b></center>";
- echo html_tag( 'tr',
- html_tag( 'td', $td_str, 'left' )
- ) .
-
- "</TABLE>\n" .
- html_tag( 'table',
- html_tag( 'tr',
- html_tag( 'td', $bodyheader, 'left', $color[4] )
- ) ,
- 'center', '', 'width="100%" border="0" cellspacing="0" cellpadding="2"' ) . "\n" .
- html_tag( 'table',
- html_tag( 'tr',
- html_tag( 'td', '<tt><br>' . $body . '</tt>', 'left', $color[4] )
- ) ,
- 'center', '', 'width="98%" border="0" cellspacing="0" cellpadding="2"' ) . "<br>\n";
-
- echo html_tag( 'table', '', '', '', 'width="100%"' ) .
- html_tag( 'tr' ) .
- html_tag( 'td', '', 'center', $color[9], 'width="100%"' ) .
- '<form action="download.php" method="post"><small>'.
- "<input type=\"hidden\" name=\"passed_id\" value=\"$id\">".
- "<input type=\"hidden\" name=\"mailbox\" value=\"".$mailbox."\">".
- "<input type=\"hidden\" name=\"startMessage\" value=\"$startMessage\">".
- "<input type=\"hidden\" name=\"passed_ent_id\" value=\"$ent_id\">".
- "<input type=\"hidden\" name=\"extract_message\" value=\"1\">".
- _("Save to:") .
- ' <select name="targetMailbox">';
- get_extract_to_target_list($imapConnection);
- echo '</select> '.' '.
- '<input type="submit" value="' . _("Extract") . '">'.
- '</small>'.
- '</form>'.
- '</td></tr></table>';
-