insert empty line before the forward header
[squirrelmail.git] / src / view_text.php
1 <?php
2
3 /**
4 * view_text.php -- Displays the main frameset
5 *
6 * Copyright (c) 1999-2002 The SquirrelMail development team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
8 *
9 * Who knows what this file does. However PUT IT HERE DID NOT PUT
10 * A SINGLE FREAKING COMMENT IN! Whoever is responsible for this,
11 * be very ashamed.
12 *
13 * $Id$
14 */
15
16 /* Path for SquirrelMail required files. */
17 define('SM_PATH','../');
18
19 /* SquirrelMail required files. */
20 require_once(SM_PATH . 'include/validate.php');
21 require_once(SM_PATH . 'functions/imap.php');
22 require_once(SM_PATH . 'functions/mime.php');
23 require_once(SM_PATH . 'functions/html.php');
24
25 $mailbox = urldecode($_GET['mailbox']);
26 if (!isset($_GET['passed_ent_id'])) {
27 $passed_ent_id = '';
28 } else {
29 $passed_ent_id = $_GET['passed_ent_id'];
30 }
31 $passed_id = $_GET['passed_id'];
32 $ent_id = $_GET['ent_id'];
33 $username = $_SESSION['username'];
34 $key = $_COOKIE['key'];
35 $delimiter = $_SESSION['delimiter'];
36 $onetimepad = $_SESSION['onetimepad'];
37 $QUERY_STRING = $_SERVER['QUERY_STRING'];
38 sqextractGlobalVar('messages');
39
40 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
41 $mbx_response = sqimap_mailbox_select($imapConnection, $mailbox);
42
43 $message = &$messages[$mbx_response['UIDVALIDITY']]["$passed_id"];
44 $message_ent = &$message->getEntity($ent_id);
45 if ($passed_ent_id) {
46 $message = &$message->getEntity($passed_ent_id);
47 }
48
49 $header = $message_ent->header;
50 $charset = $header->getParameter('charset');
51 $type0 = $header->type0;
52 $type1 = $header->type1;
53 $encoding = strtolower($header->encoding);
54
55 $msg_url = 'read_body.php?' . $QUERY_STRING;
56 $msg_url = set_url_var($msg_url, 'ent_id', 0);
57
58 $body = mime_fetch_body($imapConnection, $passed_id, $ent_id);
59 $body = decodeBody($body, $encoding);
60
61 displayPageHeader($color, 'None');
62
63 echo "<BR><TABLE WIDTH=\"100%\" BORDER=0 CELLSPACING=0 CELLPADDING=2 ALIGN=CENTER><TR><TD BGCOLOR=\"$color[0]\">".
64 "<B><CENTER>".
65 _("Viewing a text attachment") . " - ";
66 echo '<a href="'.$msg_url.'">'. _("View message") . '</a>';
67
68 $dwnld_url = '../src/download.php?'. $QUERY_STRING.'&amp;absolute_dl=true';
69 echo '</b></td><tr><tr><td><CENTER><A HREF="'.$dwnld_url. '">'.
70 _("Download this as a file").
71 "</A></CENTER><BR>".
72 "</CENTER></B>".
73 "</TD></TR></TABLE>".
74 "<TABLE WIDTH=\"98%\" BORDER=0 CELLSPACING=0 CELLPADDING=2 ALIGN=CENTER><TR><TD BGCOLOR=\"$color[0]\">".
75 "<TR><TD BGCOLOR=\"$color[4]\"><TT>";
76 if ($type1 == 'html' || (isset($override_type1) && $override_type1 == 'html')) {
77 $body = MagicHTML( $body, $passed_id, $message, $mailbox);
78 } else {
79 translateText($body, $wrap_at, $charset);
80 }
81 echo $body . "</TT></TD></TR></TABLE>";
82
83 ?>