Allowing display of unsafe images when viewing HTML attachments and when HTML is...
[squirrelmail.git] / src / view_html.php
index 250bfe8771d303351f53754a28481913a99ea8ba..0763b191560bd499b54a0996e183a45f1361826d 100644 (file)
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * $Source$
  * Displays html message parts
@@ -9,23 +10,8 @@
  * optional. User must be authenticated ($key in cookie. $username and
  * $onetimepad in session).
  *
- * Copyright (c) 1999-2005 The SquirrelMail Project Team
- * This file is part of SquirrelMail webmail interface.
- *
- * SquirrelMail is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * SquirrelMail is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with SquirrelMail; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
+ * @copyright &copy; 1999-2006 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package squirrelmail
  */
@@ -37,7 +23,7 @@
 define('SM_PATH','../');
 
 /** SquirrelMail required files. */
-require_once(SM_PATH . 'include/validate.php');
+include_once(SM_PATH . 'include/validate.php');
 include_once(SM_PATH . 'functions/imap.php');
 
 /** Get globals */
@@ -52,13 +38,6 @@ if (sqgetGlobalVar('passed_id', $temp, SQ_GET)) {
     $passed_id = (int) $temp;
 }
 
-global $view_unsafe_images;
-if (sqgetGlobalVar('view_unsafe_images', $temp, SQ_GET)) {
-    $view_unsafe_images = (bool) $temp;
-} else {
-    $view_unsafe_images = false;
-}
-
 // TODO: add required var checks here.
 
 $imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
@@ -68,9 +47,9 @@ $message = &$messages[$mbx_response['UIDVALIDITY']][$passed_id];
 if (!is_object($message)) {
     $message = sqimap_get_message($imap_stream, $passed_id, $mailbox);
 }
-$message_ent = &$message->getEntity($ent_id);
+$message_ent = $message->getEntity($ent_id);
 if ($passed_ent_id) {
-    $message = &$message->getEntity($passed_ent_id);
+    $message = $message->getEntity($passed_ent_id);
 }
 $header   = $message_ent->header;
 $type0    = $header->type0;
@@ -80,6 +59,8 @@ $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];
 
 /**
  * TODO: check if xtra_code is needed.
@@ -97,4 +78,5 @@ $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