Changed sqimap_get_sort_order call to take three variables
[squirrelmail.git] / src / view_header.php
CommitLineData
a777439a 1<?php
2
3/**
4 * view_header.php
5 *
6 * Copyright (c) 1999-2002 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
8 *
9 * This is the code to view the message header.
10 *
11 * $Id$
12 */
13
14
15function parse_viewheader($imapConnection,$id,$template_vars) {
16 global $uid_support;
17
18 $header_full = array();
19
20 $read=sqimap_run_command ($imapConnection, "FETCH $id BODY[HEADER]",
21 true, $a, $b, $uid_support);
22
23 $cnum = 0;
24 for ($i=1; $i < count($read); $i++) {
25 $line = htmlspecialchars($read[$i]);
26 if (eregi("^&gt;", $line)) {
27 $second[$i] = $line;
28 $first[$i] = '&nbsp;';
29 $cnum++;
30 } else if (eregi("^[ |\t]", $line)) {
31 $second[$i] = $line;
32 $first[$i] = '';
33 } else if (eregi("^([^:]+):(.+)", $line, $regs)) {
34 $first[$i] = $regs[1] . ':';
35 $second[$i] = $regs[2];
36 $cnum++;
37 } else {
38 $second[$i] = trim($line);
39 $first[$i] = '';
40 }
41 }
42 for ($i=0; $i < count($second); $i = $j) {
43 if (isset($first[$i])) {
44 $f = $first[$i];
45 }
46 if (isset($second[$i])) {
47 $s = nl2br($second[$i]);
48 }
49 $j = $i + 1;
50 while (($first[$j] == '') && ($j < count($first))) {
51 $s .= '&nbsp;&nbsp;&nbsp;&nbsp;' . nl2br($second[$j]);
52 $j++;
53 }
54 parseEmail($s);
55 if (isset($f)) {
56 $header_output[] = array($s,$f);
57 }
58 }
59
60 sqimap_logout($imapConnection);
61
62 $template_vars['full_header'] = $header_output;
63
64 return $template_vars;
65}
66
67function view_header($template_vars, $pageheader='', $pagefooter='') {
68
69global $color;
70
71 echo $pageheader;
72 echo '<BR>' .
73 '<TABLE WIDTH="100%" CELLPADDING="2" CELLSPACING="0" BORDER="0"'.
74 ' ALIGN="CENTER">' . "\n" .
75 " <TR><TD BGCOLOR=\"$color[9]\" WIDTH=\"100%\" ALIGN=\"CENTER\"><B>".
76 _("Viewing Full Header") . '</B> - '.
77 '<a href="';
78 echo_template_var($template_vars['return_address']);
79 echo '">' ._("View message") . "</a></b></td></tr></table>\n";
80
81 echo_template_var($template_vars['full_header'],
82 array(
83 "<table width='99%' cellpadding='2' cellspacing='0' border='0'".
84 "align=center>\n".
85'<tr><td>',
86 '<nobr><tt><b>',
87 '</b>',
88 '</tt></nobr>',
89 '</td></tr></table>'."\n"
90 ) );
91 echo $pagefooter;
92}
93
94?>