563b8778db7a1a020baa5d6c40bd9bf98d6150e7
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 /* SquirrelMail required files. */
18 include('../include/init.php');
19 include(SM_PATH
. 'functions/imap_general.php');
20 include(SM_PATH
. 'functions/imap_messages.php');
21 include(SM_PATH
. 'functions/mime.php');
22 include(SM_PATH
. 'functions/date.php');
23 include(SM_PATH
. 'functions/url_parser.php');
25 sqgetGlobalVar('key', $key, SQ_COOKIE
);
26 sqgetGlobalVar('username', $username, SQ_SESSION
);
27 sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION
);
28 sqgetGlobalVar('messages', $messages, SQ_SESSION
);
29 sqgetGlobalVar('mailbox', $mailbox, SQ_GET
);
30 sqgetGlobalVar('ent_id', $ent_id, SQ_GET
);
31 sqgetGlobalVar('passed_ent_id', $passed_ent_id, SQ_GET
);
32 sqgetGlobalVar('QUERY_STRING', $QUERY_STRING, SQ_SERVER
);
33 if (sqgetGlobalVar('passed_id', $temp, SQ_GET
)) {
34 $passed_id = (int) $temp;
37 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
38 $mbx_response = sqimap_mailbox_select($imapConnection, $mailbox);
40 $message = &$messages[$mbx_response['UIDVALIDITY']][$passed_id];
41 if (!is_object($message)) {
42 $message = sqimap_get_message($imapConnection, $passed_id, $mailbox);
44 $message_ent = $message->getEntity($ent_id);
46 $message = &$message->getEntity($passed_ent_id);
48 $header = $message_ent->header
;
49 $type0 = $header->type0
;
50 $type1 = $header->type1
;
51 $charset = $header->getParameter('charset');
52 $encoding = strtolower($header->encoding
);
54 $msg_url = 'read_body.php?' . $QUERY_STRING;
55 $msg_url = set_url_var($msg_url, 'ent_id', 0);
56 $dwnld_url = '../src/download.php?' . $QUERY_STRING . '&absolute_dl=true';
58 $body = mime_fetch_body($imapConnection, $passed_id, $ent_id);
59 $body = decodeBody($body, $encoding);
60 $hookResults = do_hook('message_body', $body);
61 $body = $hookResults[1];
63 if (isset($languages[$squirrelmail_language]['XTRA_CODE']) &&
64 function_exists($languages[$squirrelmail_language]['XTRA_CODE'].'_decode')) {
65 if (mb_detect_encoding($body) != 'ASCII') {
66 $body = call_user_func($languages[$squirrelmail_language]['XTRA_CODE'] . '_decode', $body);
70 if ($type1 == 'html' ||
(isset($override_type1) && $override_type1 == 'html')) {
71 $body = MagicHTML( $body, $passed_id, $message, $mailbox);
72 // html attachment with character set information
73 if (! empty($charset))
74 $body = charset_decode($charset,$body,false,true);
76 translateText($body, $wrap_at, $charset);
79 displayPageHeader($color, 'None');
81 <br
/><table width
="100%" border
="0" cellspacing
="0" cellpadding
="2" align
="center"><tr
><td bgcolor
="<?php echo $color[0]; ?>">
82 <b
><div style
="text-align: center;">
84 echo _("Viewing a text attachment") . ' - ' .
85 '<a href="'.$msg_url.'">' . _("View message") . '</a>';
87 </b
></td
><tr
><tr
><td
><div style
="text-align: center;">
89 echo '<a href="' . $dwnld_url . '">' . _("Download this as a file") . '</a>';
94 <table width
="98%" border
="0" cellspacing
="0" cellpadding
="2" align
="center"><tr
><td bgcolor
="<?php echo $color[0]; ?>">
95 <tr
><td bgcolor
="<?php echo $color[4]; ?>"><tt
>
97 </tt
></td
></tr
></table
>
99 $oTemplate->display('footer.tpl');