4 * view_text.php -- Displays the main frameset
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,
10 * @copyright © 1999-2006 The SquirrelMail Project Team
11 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
13 * @package squirrelmail
17 * Path for SquirrelMail required files.
20 define('SM_PATH','../');
22 /* SquirrelMail required files. */
23 include_once(SM_PATH
. 'include/validate.php');
24 require_once(SM_PATH
. 'functions/global.php');
25 require_once(SM_PATH
. 'functions/imap.php');
26 require_once(SM_PATH
. 'functions/mime.php');
27 require_once(SM_PATH
. 'functions/html.php');
29 sqgetGlobalVar('key', $key, SQ_COOKIE
);
30 sqgetGlobalVar('username', $username, SQ_SESSION
);
31 sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION
);
32 sqgetGlobalVar('messages', $messages, SQ_SESSION
);
33 sqgetGlobalVar('mailbox', $mailbox, SQ_GET
);
34 sqgetGlobalVar('ent_id', $ent_id, SQ_GET
);
35 sqgetGlobalVar('passed_ent_id', $passed_ent_id, SQ_GET
);
36 sqgetGlobalVar('QUERY_STRING', $QUERY_STRING, SQ_SERVER
);
37 if (sqgetGlobalVar('passed_id', $temp, SQ_GET
)) {
38 $passed_id = (int) $temp;
41 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
42 $mbx_response = sqimap_mailbox_select($imapConnection, $mailbox);
44 $message = &$messages[$mbx_response['UIDVALIDITY']][$passed_id];
45 if (!is_object($message)) {
46 $message = sqimap_get_message($imapConnection, $passed_id, $mailbox);
48 $message_ent = $message->getEntity($ent_id);
50 $message = &$message->getEntity($passed_ent_id);
52 $header = $message_ent->header
;
53 $type0 = $header->type0
;
54 $type1 = $header->type1
;
55 $charset = $header->getParameter('charset');
56 $encoding = strtolower($header->encoding
);
58 $msg_url = 'read_body.php?' . $QUERY_STRING;
59 $msg_url = set_url_var($msg_url, 'ent_id', 0);
60 $dwnld_url = '../src/download.php?' . $QUERY_STRING . '&absolute_dl=true';
62 $body = mime_fetch_body($imapConnection, $passed_id, $ent_id);
63 $body = decodeBody($body, $encoding);
65 if (isset($languages[$squirrelmail_language]['XTRA_CODE']) &&
66 function_exists($languages[$squirrelmail_language]['XTRA_CODE'].'_decode')) {
67 if (mb_detect_encoding($body) != 'ASCII') {
68 $body = call_user_func($languages[$squirrelmail_language]['XTRA_CODE'] . '_decode', $body);
72 if ($type1 == 'html' ||
(isset($override_type1) && $override_type1 == 'html')) {
73 $body = MagicHTML( $body, $passed_id, $message, $mailbox);
74 // html attachment with character set information
75 if (! empty($charset))
76 $body = charset_decode($charset,$body,false,true);
78 translateText($body, $wrap_at, $charset);
81 displayPageHeader($color, 'None');
83 <br
/><table width
="100%" border
="0" cellspacing
="0" cellpadding
="2" align
="center"><tr
><td bgcolor
="<?php echo $color[0]; ?>">
86 echo _("Viewing a text attachment") . ' - ' .
87 '<a href="'.$msg_url.'">' . _("View message") . '</a>';
89 </b
></td
><tr
><tr
><td
><center
>
91 echo '<a href="' . $dwnld_url . '">' . _("Download this as a file") . '</a>';
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
>
99 </tt
></td
></tr
></table
>
101 $oTemplate->display('footer.tpl');