Source for file view_header.php

Documentation is available at view_header.php

  1. <?php
  2.  
  3. /**
  4.  * view_header.php
  5.  *
  6.  * This is the code to view the message header.
  7.  *
  8.  * @copyright &copy; 1999-2006 The SquirrelMail Project Team
  9.  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  10.  * @version $Id: view_header.php,v 1.16.2.11 2006/04/14 22:27:08 jervfors Exp $
  11.  * @package squirrelmail
  12.  */
  13.  
  14. /**
  15.  * Path for SquirrelMail required files.
  16.  * @ignore
  17.  */
  18. define('SM_PATH','../');
  19.  
  20. /* SquirrelMail required files. */
  21. require_once(SM_PATH 'include/validate.php');
  22. require_once(SM_PATH 'functions/global.php');
  23. require_once(SM_PATH 'functions/imap.php');
  24. require_once(SM_PATH 'functions/html.php');
  25. require_once(SM_PATH 'functions/url_parser.php');
  26.  
  27. function parse_viewheader($imapConnection,$id$passed_ent_id{
  28.     global $uid_support;
  29.  
  30.     $header_full array();
  31.     $header_output array();
  32.     $second array();
  33.     $first array();
  34.  
  35.     if (!$passed_ent_id{
  36.         $read=sqimap_run_command ($imapConnection"FETCH $id BODY[HEADER]"
  37.                               true$a$b$uid_support);
  38.     else {
  39.         $query "FETCH $id BODY[".$passed_ent_id.'.HEADER]';
  40.         $read=sqimap_run_command ($imapConnection$query
  41.                               true$a$b$uid_support);
  42.     }    
  43.     $cnum 0;
  44.  
  45.     for ($i=1$i count($read)$i++{
  46.         $line htmlspecialchars($read[$i]);
  47.         switch (true{
  48.             case (eregi("^&gt;"$line)):
  49.                 $second[$i$line;
  50.                 $first[$i'&nbsp;';
  51.                 $cnum++;
  52.                 break;
  53.             case (eregi("^[ |\t]"$line)):
  54.                 $second[$i$line;
  55.                 $first[$i'';
  56.                 break;
  57.             case (eregi("^([^:]+):(.+)"$line$regs)):
  58.                 $first[$i$regs[1':';
  59.                 $second[$i$regs[2];
  60.                 $cnum++;
  61.                 break;
  62.             default:
  63.                 $second[$itrim($line);
  64.                 $first[$i'';
  65.                 break;
  66.         }
  67.     }
  68.  
  69.     for ($i=0$i count($second)$i $j{
  70.         $f (isset($first[$i]$first[$i'');
  71.         $s (isset($second[$i]nl2br($second[$i]'')
  72.         $j $i 1;
  73.         while (($first[$j== ''&& ($j count($first))) {
  74.             $s .= '&nbsp;&nbsp;&nbsp;&nbsp;' nl2br($second[$j]);
  75.             $j++;
  76.         }
  77.         $lowf=strtolower($f);
  78.         /* do not mark these headers as emailaddresses */
  79.         if($lowf != 'message-id:' && $lowf != 'in-reply-to:' && $lowf != 'references:'{
  80.             parseEmail($s);
  81.         }
  82.         if ($f{
  83.             $header_output[array($f,$s);
  84.         }
  85.     }
  86.     return $header_output;
  87. }
  88.  
  89. function view_header($header$mailbox$color{
  90.     sqgetGlobalVar('QUERY_STRING'$queryStrSQ_SERVER);
  91.     $ret_addr SM_PATH 'src/read_body.php?'.$queryStr;
  92.  
  93.     displayPageHeader($color$mailbox);
  94.  
  95.     echo '<br />' .
  96.          '<table width="100%" cellpadding="2" cellspacing="0" border="0" '.
  97.             'align="center">' "\n" .
  98.          '<tr><td bgcolor="'.$color[9].'" width="100%" align="center"><b>'.
  99.          _("Viewing Full Header"'</b> - '.
  100.          '<a href="'
  101.     echo_template_var($ret_addr);
  102.     echo '">' ._("View message""</a></b></td></tr></table>\n";
  103.  
  104.     echo_template_var($header
  105.         array(
  106.             '<table width="99%" cellpadding="2" cellspacing="0" border="0" '.
  107.                 "align=center>\n".'<tr><td>',
  108.             '<nobr><tt><b>',
  109.             '</b>',
  110.             '</tt></nobr>',
  111.             '</td></tr></table>'."\n" 
  112.          )
  113.     );
  114.     echo '</body></html>';
  115. }
  116.  
  117. /* get global vars */
  118. if sqgetGlobalVar('passed_id'$tempSQ_GET) ) {
  119.   $passed_id = (int) $temp;
  120. }
  121. if sqgetGlobalVar('mailbox'$tempSQ_GET) ) {
  122.   $mailbox $temp;
  123. }
  124. if !sqgetGlobalVar('passed_ent_id'$passed_ent_idSQ_GET) ) {
  125.   $passed_ent_id '';
  126. sqgetGlobalVar('key',        $key,          SQ_COOKIE);
  127. sqgetGlobalVar('username',   $username,     SQ_SESSION);
  128. sqgetGlobalVar('onetimepad'$onetimepad,   SQ_SESSION);
  129. sqgetGlobalVar('delimiter',  $delimiter,    SQ_SESSION);
  130.  
  131. $imapConnection sqimap_login($username$key$imapServerAddress
  132.                                $imapPort0);
  133. $mbx_response sqimap_mailbox_select($imapConnection$mailboxfalsefalsetrue);
  134.  
  135. $header parse_viewheader($imapConnection,$passed_id$passed_ent_id)
  136. view_header($header$mailbox$color);
  137. sqimap_logout($imapConnection);
  138. ?>

Documentation generated on Sat, 07 Oct 2006 16:34:04 +0300 by phpDocumentor 1.3.0RC6