9768caf5ee04ab86972837365bc5fa6f018c457f
3 require_once('../src/validate.php');
4 require_once('../functions/imap.php');
5 require_once('../functions/mime.php');
6 require_once('../functions/html.php');
8 $mailbox = urldecode($mailbox);
9 if (!isset($passed_ent_id)) {
13 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
14 $mbx_response = sqimap_mailbox_select($imapConnection, $mailbox);
16 $message = &$messages[$mbx_response['UIDVALIDITY']]["$passed_id"];
17 $message = &$message->getEntity($ent_id);
19 $header = $message->header
;
20 $charset = $header->getParameter('charset');
21 $type0 = $header->type0
;
22 $type1 = $header->type1
;
23 $encoding = strtolower($header->encoding
);
25 $msg_url = 'read_body.php?' . $QUERY_STRING;
26 $msg_url = set_url_var($msg_url, 'ent_id', 0);
28 $body = mime_fetch_body($imapConnection, $passed_id, $ent_id);
29 $body = decodeBody($body, $encoding);
31 displayPageHeader($color, 'None');
33 echo "<BR><TABLE WIDTH=\"100%\" BORDER=0 CELLSPACING=0 CELLPADDING=2 ALIGN=CENTER><TR><TD BGCOLOR=\"$color[0]\">".
35 _("Viewing a text attachment") . " - ";
36 echo '<a href="'.$msg_url.'">'. _("View message") . '</a>';
38 $dwnld_url = '../src/download.php?'. $QUERY_STRING.'&absolute_dl=1';
39 echo '</b></td><tr><tr><td><CENTER><A HREF="'.$dwnld_url. '">'.
40 _("Download this as a file").
44 "<TABLE WIDTH=\"98%\" BORDER=0 CELLSPACING=0 CELLPADDING=2 ALIGN=CENTER><TR><TD BGCOLOR=\"$color[0]\">".
45 "<TR><TD BGCOLOR=\"$color[4]\"><TT>";
47 if ($type1 == 'html') {
48 $msg = sqimap_get_message($imapConnection, $passed_id, $mailbox);
49 $msg = $msg->getEntity($passed_ent_id);
50 $body = MagicHTML( $body, $passed_id, $msg );
52 translateText($body, $wrap_at, $charset);
55 "</TT></TD></TR></TABLE>";