Happy New Year
[squirrelmail.git] / src / view_html.php
index 0763b191560bd499b54a0996e183a45f1361826d..fef0c9fb7dbba718bc811440eeda7f38763ed0bd 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 /**
- * $Source$
+ * view_html
  * Displays html message parts
  *
  * File is used to display html message parts. Usually inside iframe.
  * optional. User must be authenticated ($key in cookie. $username and
  * $onetimepad in session).
  *
- * @copyright &copy; 1999-2006 The SquirrelMail Project Team
+ * @copyright 1999-2020 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package squirrelmail
  */
 
+/** This is the view_html page */
+define('PAGE_NAME', 'view_html');
+
 /**
- * Path for SquirrelMail required files.
- * @ignore
+ * Include the SquirrelMail initialization file.
  */
-define('SM_PATH','../');
+require('../include/init.php');
 
 /** SquirrelMail required files. */
-include_once(SM_PATH . 'include/validate.php');
-include_once(SM_PATH . 'functions/imap.php');
+require_once(SM_PATH . 'functions/imap.php');
+require_once(SM_PATH . 'functions/mime.php');
+require_once(SM_PATH . 'functions/date.php');
 
 /** Get globals */
-sqgetGlobalVar('key',        $key,          SQ_COOKIE);
-sqgetGlobalVar('username',   $username,     SQ_SESSION);
-sqgetGlobalVar('onetimepad', $onetimepad,   SQ_SESSION);
 sqgetGlobalVar('messages',   $messages,     SQ_SESSION);
 sqgetGlobalVar('mailbox',    $mailbox,      SQ_GET);
 sqgetGlobalVar('ent_id',     $ent_id,       SQ_GET);
 sqgetGlobalVar('passed_ent_id', $passed_ent_id, SQ_GET);
-if (sqgetGlobalVar('passed_id', $temp, SQ_GET)) {
-    $passed_id = (int) $temp;
-}
+sqgetGlobalVar('passed_id', $passed_id, SQ_GET, NULL, SQ_TYPE_BIGINT);
 
 // TODO: add required var checks here.
 
-$imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
+global $imap_stream_options; // in case not defined in config
+$imap_stream = sqimap_login($username, false, $imapServerAddress, $imapPort, 0, $imap_stream_options);
 $mbx_response = sqimap_mailbox_select($imap_stream, $mailbox);
 
 $message = &$messages[$mbx_response['UIDVALIDITY']][$passed_id];
@@ -59,8 +58,7 @@ $encoding = strtolower($header->encoding);
 
 $body = mime_fetch_body($imap_stream, $passed_id, $ent_id);
 $body = decodeBody($body, $encoding);
-$hookResults = do_hook('message_body', $body);
-$body = $hookResults[1];
+do_hook('message_body', $body);
 
 /**
  * TODO: check if xtra_code is needed.
@@ -78,5 +76,3 @@ $body = MagicHTML( $body, $passed_id, $message, $mailbox);
 /** TODO: charset might be part of html code. */
 header('Content-Type: text/html; charset=' . $charset);
 echo $body;
-
-?>
\ No newline at end of file