phpDocumentor updates
[squirrelmail.git] / functions / mime.php
index a7e6cbf30ecaa4e68037fac0de4b0ea8c9b6dc37..ebd0e87344975f0655796c30ddf3fe27f29df4e7 100644 (file)
@@ -3,12 +3,11 @@
 /**
  * mime.php
  *
- * Copyright (c) 1999-2005 The SquirrelMail Project Team
- * Licensed under the GNU GPL. For full terms see the file COPYING.
- *
  * This contains the functions necessary to detect and decode MIME
  * messages.
  *
+ * @copyright © 1999-2005 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package squirrelmail
  */
@@ -388,7 +387,9 @@ function formatBody($imap_stream, $message, $color, $wrap_at, $ent_num, $id, $ma
                  * If we don't add html message between iframe tags,
                  * we must detect unsafe images and modify $has_unsafe_images.
                  */
-                $html_body =  magicHTML($body, $id, $message, $mailbox);
+                $html_body = magicHTML($body, $id, $message, $mailbox); 
+                // Convert character set in order to display html mails in different character set
+                $html_body = charset_decode($body_message->header->getParameter('charset'),$html_body,false,true);
 
                 // creating iframe url
                 $iframeurl=sqm_baseuri().'src/view_html.php?'
@@ -427,6 +428,12 @@ function formatBody($imap_stream, $message, $color, $wrap_at, $ent_num, $id, $ma
             } else {
                 // old way of html rendering
                 $body = magicHTML($body, $id, $message, $mailbox);
+                /**
+                 * convert character set. charset_decode does not remove html special chars 
+                 * applied by magicHTML functions and does not sanitize them second time if
+                 * fourth argument is true. 
+                 */ 
+                $body = charset_decode($body_message->header->getParameter('charset'),$body,false,true);
             }
         } else {
             translateText($body, $wrap_at,
@@ -2354,4 +2361,4 @@ function SendDownloadHeaders($type0, $type1, $filename, $force, $filesize=0) {
 
 }  // end fn SendDownloadHeaders
 
-?>
+?>
\ No newline at end of file