Replacing deprecated HTML "center" element.
[squirrelmail.git] / plugins / message_details / message_details_bottom.php
index f5f68db9f28174253cdf948812ec2146bfcd2ffc..0852e5ca8c61ff3678081b0822141cfa716b12b0 100644 (file)
@@ -1,14 +1,13 @@
 <?php
+
 /**
  * Message Details plugin - bottom frame with message structure and rfc822 body
  *
  * Plugin to view the RFC822 raw message output and the bodystructure of a message
  *
- * Licensed under the GNU GPL. For full terms see the file COPYING.
- *
  * @author Marc Groot Koerkamp
- * @copyright Copyright &copy; 2002 Marc Groot Koerkamp, The Netherlands
- * @copyright Copyright &copy; 2004-2005 The SquirrelMail Project Team
+ * @copyright &copy; 2002 Marc Groot Koerkamp, The Netherlands
+ * @copyright &copy; 2002-2006 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package plugins
@@ -26,6 +25,13 @@ require_once(SM_PATH . 'functions/mime.php');
 
 sqgetGlobalVar('get_message_details', $md_action, SQ_GET);
 
+/**
+ * Controls display of 8bit symbols in message source
+ * @global boolean $msgd_8bit_in_hex;
+ */
+global $msgd_8bit_in_hex;
+$msgd_8bit_in_hex=false;
+
 if (!empty($md_action))
 {
     sqgetGlobalVar('passed_id', $passed_id, SQ_GET);
@@ -36,6 +42,19 @@ if (!empty($md_action))
 
 // ---------- function definitions ----------
 
+/**
+ * Converts 8bit string to hex
+ *
+ * Replaces 8bit symbols with their hex strings,
+ * encloses them in curly brackets and uses different color.
+ * @param string $string text
+ * @return string
+ * @since 1.5.1
+ */
+function msgd_convert_to_hex($string) {
+     global $color;
+     return preg_replace("/([\200-\377])/e","'<font color=\"$color[2]\">{'.dechex(ord('\\1')).'}</font>'",$string);
+}
 
 /**
  * Calculates id of MIME entity
@@ -95,15 +114,15 @@ function returnTime($start) {
  * Returns actual message details
  * @param string $mailbox
  * @param string $passed_id
- * @param boolean $stripHTML If TRUE, only plain text is returned, 
- *                           default is FALSE, wherein output contains 
+ * @param boolean $stripHTML If TRUE, only plain text is returned,
+ *                           default is FALSE, wherein output contains
  *                           pretty-HTMLification of message body
  * @return string The formatted message details
  * @access public
  */
 function get_message_details($mailbox, $passed_id, $stripHTML=FALSE) {
 
-global $imapServerAddress, $imapPort, $color;
+global $imapServerAddress, $imapPort, $color,$msgd_8bit_in_hex;
 
 $returnValue = '';
 
@@ -287,13 +306,15 @@ for ($i=1; $i < $count; $i++) {
         $message_body .= $line . "\r\n";
     } else {
         $line = htmlspecialchars($line);
+        if ($msgd_8bit_in_hex) $line = msgd_convert_to_hex($line);
         $message_body .= "$pre"."$line"."$end".'<br />'."\r\n";
     }
 }
+
 //$returnValue .= returnTime($start).'<br />';
 $xtra = <<<ECHO
 
-<style>
+<style type="text/css">
 
 <!--
 .ent_body {
@@ -380,11 +401,11 @@ if (!$stripHTML) {
 
 $returnValue .= $message_body;
 
-if (!$stripHTML) 
+if (!$stripHTML)
     $returnValue .= '</div></div></font></code></body></html>';
 
 return $returnValue;
 
 }
 
-?>
+?>
\ No newline at end of file