da200a551d27c37c5b429915920233bb94d12124
6 * Copyright (c) 1999-2002 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 * This is the code to view the text attachments.
15 require_once('../src/validate.php');
16 require_once('../functions/imap.php');
17 require_once('../functions/mime.php');
19 $mailbox = urldecode($mailbox);
20 if (!isset($passed_ent_id)) {
24 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
25 $mbx_response = sqimap_mailbox_select($imapConnection, $mailbox);
27 $message = &$messages[$mbx_response['UIDVALIDITY']]["$passed_id"];
28 $message = &$message->getEntity($passed_ent_id);
30 $header = $message->header
;
31 $charset = $header->charset
;
32 $type0 = $header->type0
;
33 $type1 = $header->type1
;
34 $encoding = strtolower($header->encoding
);
36 $msg_url = 'read_body.php?' . $QUERY_STRING;
38 $body = mime_fetch_body($imapConnection, $passed_id, $passed_ent_id);
39 $body = decodeBody($body, $encoding);
41 displayPageHeader($color, 'None');
43 echo "<BR><TABLE WIDTH=\"100%\" BORDER=0 CELLSPACING=0 CELLPADDING=2 ALIGN=CENTER><TR><TD BGCOLOR=\"$color[0]\">".
45 _("Viewing a text attachment") . " - ";
46 echo '<a href="'.$msg_url.'">'. _("View message") . '</a>';
48 $dwnld_url = '../src/download.php?'. $QUERY_STRING.'&absolute_dl=1';
49 echo '</b></td><tr><tr><td><CENTER><A HREF="'.$dwnld_url. '">'.
50 _("Download this as a file").
54 "<TABLE WIDTH=\"98%\" BORDER=0 CELLSPACING=0 CELLPADDING=2 ALIGN=CENTER><TR><TD BGCOLOR=\"$color[0]\">".
55 "<TR><TD BGCOLOR=\"$color[4]\"><TT>";
57 if ($type1 == 'html') {
58 $msg = sqimap_get_message($imapConnection, $passed_id, $mailbox);
59 $msg = $msg->getEntity($passed_ent_id);
60 $body = MagicHTML( $body, $passed_id, $msg );
62 translateText($body, $wrap_at, $charset);
65 "</TT></TD></TR></TABLE>";