* 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 The SquirrelMail Project Team
+ * @copyright Copyright © 2004-2005 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
* @package plugins
require_once(SM_PATH . 'include/validate.php');
require_once(SM_PATH . 'functions/imap.php');
require_once(SM_PATH . 'functions/mime.php');
-require_once(SM_PATH . 'config/config.php');
-require_once(SM_PATH . 'functions/prefs.php');
global $color;
sqgetGlobalVar('key', $key, SQ_COOKIE);
sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION);
+/**
+ * Calculates id of MIME entity
+ * @param string $entString
+ * @param integer $direction
+ * @return string
+ * @access private
+ */
function CalcEntity($entString, $direction) {
$result = $entString;
if ($direction == -1) {
if ($pos === false) {
$entString++;
$result= $entString;
- }
+ }
else {
$level = substr($entString,0,$pos);
$sublevel = substr($entString,$pos+1);
return ($result);
}
+/**
+ * Returns time in microseconds between selected and current timestamp
+ *
+ * @param array $start see details about array format at http://www.php.net/gettimeofday
+ * @return integer time in microseconds
+ * @access private
+ */
function returnTime($start) {
$stop = gettimeofday();
$timepassed = 1000000 * ($stop['sec'] - $start['sec']) + $stop['usec'] - $start['usec'];
return $timepassed;
}
-function GetMimeProperties($header) {
-}
-
$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
$read = sqimap_mailbox_select($imapConnection, $mailbox);
$start = gettimeofday();
} else if ($messageheader) {
if ($header) {
$header=false;
- $end = "\n \n".'</div>'."\n \n".'<div class="ent_body" id="'.$entStr.'B">'."\n \n";
+ $end = "\n \n".'</div>'."\n \n".'<div class="ent_body" id="'.$entStr.'B">'."\n \n";
}
$mimepart = -$header;
$bnd_end = false;
} else {
if ($header) {
$pre = '';
- $end = "\n \n".'</div>'."\n \n".'<div class="ent_body" id="'.$entStr.'B">'."\n \n";
+ $end = "\n \n".'</div>'."\n \n".'<div class="ent_body" id="'.$entStr.'B">'."\n \n";
}
$header = false;
$mimepart=true;
- }
+ }
$contentset = false;
$nameset = false;
} else {
$pre = '<i><font color ="'.$color[1].'">';
$end = '</i></font>';
}
- }
+ }
if (!$messageheader && !$header ) {
$mimepart=true;
} else {
}
if ( ( $header || $messageheader) && (preg_match("/^.*boundary=\"?(.+(?=\")|.+).*/i",$line,$reg)) ) {
$bnd = $reg[1];
- $bndreg = $bnd;
+ $bndreg = $bnd;
$bndreg = str_replace("\\","\\\\",$bndreg);
$bndreg = str_replace("?","\\?",$bndreg);
$bndreg = str_replace("+","\\+",$bndreg);
$entStr = CalcEntity("$entStr",1);
}
}
-
+
if (($line != '' && $line{0} == '-' || $header) && isset($boundaries[0])) {
$cnt=count($boundaries)-1;
$bnd = $boundaries[$cnt]['bnd'];
$bndreg = $boundaries[$cnt]['bndreg'];
-
+
$regstr = '/^--'."($bndreg)".".*".'/';
if (preg_match($regstr,$line,$reg) ) {
$bndlen = strlen($reg[1]);
- $bndend = false;
+ $bndend = false;
if (strlen($line) > ($bndlen + 3)) {
- if ($line{$bndlen+2} == '-' && $line{$bndlen+3} == '-')
+ if ($line{$bndlen+2} == '-' && $line{$bndlen+3} == '-')
$bndend = true;
}
if ($bndend) {
$content_indx++;
$content[$content_indx]=array();
$content[$content_indx]['ent'] = '<a href="#'."$entStr \">$entStr".'</a>';
- $pre .= "\n \n".'</div>'."\n \n".'<div class="entheader" id="'.$entStr.'H"><a name="'."$entStr".'"><b><font color="'.$color[2].'">';
+ $pre .= "\n \n".'</div>'."\n \n".'<div class="entheader" id="'.
+ $entStr.'H"><a name="'."$entStr".'"><b><font color="'.$color[2].'">';
$end .= '</font></b>'."\n";
$header = true;
$mimepart = false;
$entities["$entStr"] = array();
$entities["$entStr"]['entity'] = $entStr;
$entities["$entStr"]['contenttype']=$reg[2].'/'.$reg[3];
- }
+ }
} else if (!$nameset && preg_match("/^.*(name=\s*)\"(.*)\".*/i",$line,$reg)) {
$name = htmlspecialchars($reg[2]);
$content[$content_indx]['name'] = decodeHeader($name);
echo '<div><div class="header">'."\n\n";
echo $message_body;
echo '</div></div></font></code></body></html>';
-?>
+?>
\ No newline at end of file