-require_once('../src/validate.php');
-require_once('../functions/imap.php');
-require_once('../functions/mime.php');
-require_once('../functions/date.php');
-require_once('../functions/html.php');
-
-header('Pragma: ');
-header('Cache-Control: cache');
-
-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] )
- );