Removed the view header routines out of read_body.php
authorstekkel <stekkel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 5 Jul 2002 11:53:31 +0000 (11:53 +0000)
committerstekkel <stekkel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 5 Jul 2002 11:53:31 +0000 (11:53 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@3034 7612ce4b-ef26-0410-bec9-ea0150e637f0

src/view_header.php [new file with mode: 0644]

diff --git a/src/view_header.php b/src/view_header.php
new file mode 100644 (file)
index 0000000..2416306
--- /dev/null
@@ -0,0 +1,94 @@
+<?php
+
+/**
+ * view_header.php
+ *
+ * Copyright (c) 1999-2002 The SquirrelMail Project Team
+ * Licensed under the GNU GPL. For full terms see the file COPYING.
+ *
+ * This is the code to view the message header.
+ *
+ * $Id$
+ */
+
+
+function  parse_viewheader($imapConnection,$id,$template_vars) {
+   global $uid_support;
+
+   $header_full = array();
+
+   $read=sqimap_run_command ($imapConnection, "FETCH $id BODY[HEADER]", 
+                              true, $a, $b, $uid_support);
+    
+    $cnum = 0;
+    for ($i=1; $i < count($read); $i++) {
+        $line = htmlspecialchars($read[$i]);
+        if (eregi("^&gt;", $line)) {
+            $second[$i] = $line;
+            $first[$i] = '&nbsp;';
+            $cnum++;
+        } else if (eregi("^[ |\t]", $line)) {
+            $second[$i] = $line;
+            $first[$i] = '';
+        } else if (eregi("^([^:]+):(.+)", $line, $regs)) {
+            $first[$i] = $regs[1] . ':';
+            $second[$i] = $regs[2];
+            $cnum++;
+        } else {
+            $second[$i] = trim($line);
+            $first[$i] = '';
+        }
+    }
+    for ($i=0; $i < count($second); $i = $j) {
+        if (isset($first[$i])) {
+            $f = $first[$i];
+        }
+        if (isset($second[$i])) {
+            $s = nl2br($second[$i]);
+        }
+        $j = $i + 1;
+        while (($first[$j] == '') && ($j < count($first))) {
+            $s .= '&nbsp;&nbsp;&nbsp;&nbsp;' . nl2br($second[$j]);
+            $j++;
+        }
+        parseEmail($s);
+        if (isset($f)) {
+            $header_output[] = array($s,$f);               
+        }
+    }
+
+    sqimap_logout($imapConnection);
+
+    $template_vars['full_header'] = $header_output;
+
+    return $template_vars;
+}
+
+function view_header($template_vars, $pageheader='', $pagefooter='') {
+    
+global $color;
+    
+    echo $pageheader;
+    echo '<BR>' .
+         '<TABLE WIDTH="100%" CELLPADDING="2" CELLSPACING="0" BORDER="0"'.
+         ' ALIGN="CENTER">' . "\n" .
+         "   <TR><TD BGCOLOR=\"$color[9]\" WIDTH=\"100%\" ALIGN=\"CENTER\"><B>".
+         _("Viewing Full Header") . '</B> - '.
+         '<a href="'; 
+    echo_template_var($template_vars['return_address']);
+    echo '">' ._("View message") . "</a></b></td></tr></table>\n";
+
+    echo_template_var($template_vars['full_header'], 
+         array(
+           "<table width='99%' cellpadding='2' cellspacing='0' border='0'".
+             "align=center>\n".
+'<tr><td>',
+           '<nobr><tt><b>',
+           '</b>',
+           '</tt></nobr>',
+           '</td></tr></table>'."\n" 
+         ) );
+    echo $pagefooter;
+}
+
+?>