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) {
18 $header_full = array();
20 $read=sqimap_run_command ($imapConnection, "FETCH $id BODY[HEADER]",
21 true, $a, $b, $uid_support);
24 for ($i=1; $i < count($read); $i++
) {
25 $line = htmlspecialchars($read[$i]);
26 if (eregi("^>", $line)) {
28 $first[$i] = ' ';
30 } else if (eregi("^[ |\t]", $line)) {
33 } else if (eregi("^([^:]+):(.+)", $line, $regs)) {
34 $first[$i] = $regs[1] . ':';
35 $second[$i] = $regs[2];
38 $second[$i] = trim($line);
42 for ($i=0; $i < count($second); $i = $j) {
43 if (isset($first[$i])) {
46 if (isset($second[$i])) {
47 $s = nl2br($second[$i]);
50 while (($first[$j] == '') && ($j < count($first))) {
51 $s .= ' ' . nl2br($second[$j]);
56 $header_output[] = array($f,$s);
59 sqimap_logout($imapConnection);
60 return $header_output;
63 function view_header($template_vars, $pageheader='', $pagefooter='') {
68 '<TABLE WIDTH="100%" CELLPADDING="2" CELLSPACING="0" BORDER="0"'.
69 ' ALIGN="CENTER">' . "\n" .
70 " <TR><TD BGCOLOR=\"$color[9]\" WIDTH=\"100%\" ALIGN=\"CENTER\"><B>".
71 _("Viewing Full Header") . '</B> - '.
73 echo_template_var($template_vars['return_address']);
74 echo '">' ._("View message") . "</a></b></td></tr></table>\n";
76 echo_template_var($template_vars['full_header'],
78 "<table width='99%' cellpadding='2' cellspacing='0' border='0'".
79 "align=center>\n".'<tr><td>',
83 '</td></tr></table>'."\n"