<?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 © 2002 Marc Groot Koerkamp, The Netherlands
- * @copyright Copyright © 2004-2005 The SquirrelMail Project Team
+ * @copyright © 2002 Marc Groot Koerkamp, The Netherlands
+ * @copyright © 2002-2006 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
* @package plugins
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);
// ---------- 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
* 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 = '';
$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 {
$returnValue .= $message_body;
-if (!$stripHTML)
+if (!$stripHTML)
$returnValue .= '</div></div></font></code></body></html>';
return $returnValue;
}
-?>
+?>
\ No newline at end of file