modified html_link to redirect output to view_text.
[squirrelmail.git] / src / view_text.php
CommitLineData
facf44e7 1<?php
2
facf44e7 3 require_once('../src/validate.php');
4 require_once('../functions/imap.php');
5 require_once('../functions/mime.php');
f5563549 6 require_once('../functions/html.php');
7
facf44e7 8 $mailbox = urldecode($mailbox);
9 if (!isset($passed_ent_id)) {
10 $passed_ent_id = '';
11 }
12
13 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
14 $mbx_response = sqimap_mailbox_select($imapConnection, $mailbox);
15
16 $message = &$messages[$mbx_response['UIDVALIDITY']]["$passed_id"];
f5563549 17 $message = &$message->getEntity($ent_id);
4124e322 18
facf44e7 19 $header = $message->header;
f5563549 20 $charset = $header->getParameter('charset');
facf44e7 21 $type0 = $header->type0;
22 $type1 = $header->type1;
23 $encoding = strtolower($header->encoding);
24
25 $msg_url = 'read_body.php?' . $QUERY_STRING;
f5563549 26 $msg_url = set_url_var($msg_url, 'ent_id', 0);
facf44e7 27
4124e322 28 $body = mime_fetch_body($imapConnection, $passed_id, $ent_id);
facf44e7 29 $body = decodeBody($body, $encoding);
30
31 displayPageHeader($color, 'None');
32
33 echo "<BR><TABLE WIDTH=\"100%\" BORDER=0 CELLSPACING=0 CELLPADDING=2 ALIGN=CENTER><TR><TD BGCOLOR=\"$color[0]\">".
34 "<B><CENTER>".
35 _("Viewing a text attachment") . " - ";
36 echo '<a href="'.$msg_url.'">'. _("View message") . '</a>';
37
f498a104 38 $dwnld_url = '../src/download.php?'. $QUERY_STRING.'&amp;absolute_dl=true';
facf44e7 39 echo '</b></td><tr><tr><td><CENTER><A HREF="'.$dwnld_url. '">'.
40 _("Download this as a file").
41 "</A></CENTER><BR>".
42 "</CENTER></B>".
43 "</TD></TR></TABLE>".
44 "<TABLE WIDTH=\"98%\" BORDER=0 CELLSPACING=0 CELLPADDING=2 ALIGN=CENTER><TR><TD BGCOLOR=\"$color[0]\">".
45 "<TR><TD BGCOLOR=\"$color[4]\"><TT>";
f498a104 46 if ($type1 == 'html' || $override_type1 == 'html') {
facf44e7 47 $msg = sqimap_get_message($imapConnection, $passed_id, $mailbox);
f498a104 48 $msg = $msg->getEntity($ent_id);
facf44e7 49 $body = MagicHTML( $body, $passed_id, $msg );
50 } else {
51 translateText($body, $wrap_at, $charset);
52 }
53 echo $body .
54 "</TT></TD></TR></TABLE>";
55?>