6 * Copyright (c) 1999-2002 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 * This is the code to view the message header.
15 function parse_viewheader($imapConnection,$id, $passed_ent_id) {
18 $header_full = array();
19 if (!$passed_ent_id) {
20 $read=sqimap_run_command ($imapConnection, "FETCH $id BODY[HEADER]",
21 true, $a, $b, $uid_support);
23 $query = "FETCH $id BODY[".$passed_ent_id.'.HEADER]';
24 $read=sqimap_run_command ($imapConnection, $query,
25 true, $a, $b, $uid_support);
28 for ($i=1; $i < count($read); $i++
) {
29 $line = htmlspecialchars($read[$i]);
30 if (eregi("^>", $line)) {
32 $first[$i] = ' ';
34 } else if (eregi("^[ |\t]", $line)) {
37 } else if (eregi("^([^:]+):(.+)", $line, $regs)) {
38 $first[$i] = $regs[1] . ':';
39 $second[$i] = $regs[2];
42 $second[$i] = trim($line);
46 for ($i=0; $i < count($second); $i = $j) {
47 if (isset($first[$i])) {
50 if (isset($second[$i])) {
51 $s = nl2br($second[$i]);
54 while (($first[$j] == '') && ($j < count($first))) {
55 $s .= ' ' . nl2br($second[$j]);
60 $header_output[] = array($f,$s);
63 sqimap_logout($imapConnection);
64 return $header_output;
67 function view_header($template_vars, $pageheader='', $pagefooter='') {
72 '<TABLE WIDTH="100%" CELLPADDING="2" CELLSPACING="0" BORDER="0"'.
73 ' ALIGN="CENTER">' . "\n" .
74 " <TR><TD BGCOLOR=\"$color[9]\" WIDTH=\"100%\" ALIGN=\"CENTER\"><B>".
75 _("Viewing Full Header") . '</B> - '.
77 echo_template_var($template_vars['return_address']);
78 echo '">' ._("View message") . "</a></b></td></tr></table>\n";
80 echo_template_var($template_vars['full_header'],
82 "<table width='99%' cellpadding='2' cellspacing='0' border='0'".
83 "align=center>\n".'<tr><td>',
87 '</td></tr></table>'."\n"