Increment year in copyright notice.
[squirrelmail.git] / plugins / message_details / message_details_bottom.php
index a1d661cb75300715bf1f31c1c9be7b0ad66e44ed..b89767798d6f72deb7997136619dadf59f2ca8a7 100644 (file)
@@ -5,10 +5,10 @@
  * 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
@@ -22,8 +22,6 @@ define('SM_PATH','../../');
 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;
 
@@ -34,6 +32,13 @@ sqgetGlobalVar('username', $username, SQ_SESSION);
 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) {
@@ -47,7 +52,7 @@ function CalcEntity($entString, $direction) {
             if ($pos === false) {
                 $entString++;
                 $result= $entString;
-            } 
+            }
             else {
                 $level = substr($entString,0,$pos);
                 $sublevel = substr($entString,$pos+1);
@@ -64,15 +69,19 @@ function CalcEntity($entString, $direction) {
     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();
@@ -107,7 +116,7 @@ for ($i=1; $i < $count; $i++) {
         } 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;
@@ -119,11 +128,11 @@ for ($i=1; $i < $count; $i++) {
         } 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 {
@@ -133,7 +142,7 @@ for ($i=1; $i < $count; $i++) {
                 $pre = '<i><font color ="'.$color[1].'">';
                 $end = '</i></font>';
             }
-        }     
+        }
         if (!$messageheader && !$header ) {
             $mimepart=true;
         }  else {
@@ -144,7 +153,7 @@ for ($i=1; $i < $count; $i++) {
     }
     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);
@@ -164,18 +173,18 @@ for ($i=1; $i < $count; $i++) {
             $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) {
@@ -194,7 +203,8 @@ for ($i=1; $i < $count; $i++) {
                 $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;
@@ -212,7 +222,7 @@ for ($i=1; $i < $count; $i++) {
                         $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);
@@ -324,4 +334,4 @@ echo '<h2>'._("RFC822 Message body")."</h2>\n\n";
 echo '<div><div class="header">'."\n\n";
 echo $message_body;
 echo '</div></div></font></code></body></html>';
-?>
+?>
\ No newline at end of file