Adding comments about obsolete plugins.
[squirrelmail.git] / src / view_text.php
CommitLineData
facf44e7 1<?php
2
86725763 3/**
4 * view_text.php -- Displays the main frameset
5 *
86725763 6 * Who knows what this file does. However PUT IT HERE DID NOT PUT
7 * A SINGLE FREAKING COMMENT IN! Whoever is responsible for this,
8 * be very ashamed.
9 *
47ccfad4 10 * @copyright &copy; 1999-2006 The SquirrelMail Project Team
4b4abf93 11 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
30967a1e 12 * @version $Id$
8f6f9ba5 13 * @package squirrelmail
86725763 14 */
15
30967a1e 16/**
17 * Path for SquirrelMail required files.
18 * @ignore
19 */
86725763 20define('SM_PATH','../');
21
22/* SquirrelMail required files. */
5c4ff7bf 23include_once(SM_PATH . 'include/validate.php');
1e12d1ff 24require_once(SM_PATH . 'functions/global.php');
86725763 25require_once(SM_PATH . 'functions/imap.php');
26require_once(SM_PATH . 'functions/mime.php');
27require_once(SM_PATH . 'functions/html.php');
1e12d1ff 28
29sqgetGlobalVar('key', $key, SQ_COOKIE);
30sqgetGlobalVar('username', $username, SQ_SESSION);
31sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION);
2e30aa64 32sqgetGlobalVar('messages', $messages, SQ_SESSION);
33sqgetGlobalVar('mailbox', $mailbox, SQ_GET);
34sqgetGlobalVar('ent_id', $ent_id, SQ_GET);
35sqgetGlobalVar('passed_ent_id', $passed_ent_id, SQ_GET);
1e12d1ff 36sqgetGlobalVar('QUERY_STRING', $QUERY_STRING, SQ_SERVER);
2e30aa64 37if (sqgetGlobalVar('passed_id', $temp, SQ_GET)) {
38 $passed_id = (int) $temp;
a8393c89 39}
86725763 40
41$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
24419a72 42$mbx_response = sqimap_mailbox_select($imapConnection, $mailbox);
86725763 43
2e30aa64 44$message = &$messages[$mbx_response['UIDVALIDITY']][$passed_id];
45if (!is_object($message)) {
46 $message = sqimap_get_message($imapConnection, $passed_id, $mailbox);
47}
d08f6513 48$message_ent = $message->getEntity($ent_id);
86725763 49if ($passed_ent_id) {
50 $message = &$message->getEntity($passed_ent_id);
51}
2e30aa64 52$header = $message_ent->header;
53$type0 = $header->type0;
54$type1 = $header->type1;
55$charset = $header->getParameter('charset');
86725763 56$encoding = strtolower($header->encoding);
57
2e30aa64 58$msg_url = 'read_body.php?' . $QUERY_STRING;
59$msg_url = set_url_var($msg_url, 'ent_id', 0);
e6e9ed4a 60$dwnld_url = '../src/download.php?' . $QUERY_STRING . '&amp;absolute_dl=true';
86725763 61
62$body = mime_fetch_body($imapConnection, $passed_id, $ent_id);
63$body = decodeBody($body, $encoding);
64
2e30aa64 65if (isset($languages[$squirrelmail_language]['XTRA_CODE']) &&
f4bb5d22 66 function_exists($languages[$squirrelmail_language]['XTRA_CODE'].'_decode')) {
2e30aa64 67 if (mb_detect_encoding($body) != 'ASCII') {
f4bb5d22 68 $body = call_user_func($languages[$squirrelmail_language]['XTRA_CODE'] . '_decode', $body);
e842b215 69 }
2e30aa64 70}
e842b215 71
86725763 72if ($type1 == 'html' || (isset($override_type1) && $override_type1 == 'html')) {
73 $body = MagicHTML( $body, $passed_id, $message, $mailbox);
ea51e94a 74 // html attachment with character set information
75 if (! empty($charset))
76 $body = charset_decode($charset,$body,false,true);
86725763 77} else {
78 translateText($body, $wrap_at, $charset);
79}
86725763 80
2e30aa64 81displayPageHeader($color, 'None');
24419a72 82?>
e6e9ed4a 83<br /><table width="100%" border="0" cellspacing="0" cellpadding="2" align="center"><tr><td bgcolor="<?php echo $color[0]; ?>">
f265009a 84<b><div style="text-align: center;">
24419a72 85<?php
86echo _("Viewing a text attachment") . ' - ' .
e6e9ed4a 87 '<a href="'.$msg_url.'">' . _("View message") . '</a>';
24419a72 88?>
f265009a 89</b></td><tr><tr><td><div style="text-align: center;">
24419a72 90<?php
91echo '<a href="' . $dwnld_url . '">' . _("Download this as a file") . '</a>';
92?>
f265009a 93</div><br />
94</div></b>
24419a72 95</td></tr></table>
96<table width="98%" border="0" cellspacing="0" cellpadding="2" align="center"><tr><td bgcolor="<?php echo $color[0]; ?>">
97<tr><td bgcolor="<?php echo $color[4]; ?>"><tt>
98<?php echo $body; ?>
99</tt></td></tr></table>
5c4ff7bf 100<?php
101$oTemplate->display('footer.tpl');
102?>