support for viewing headers of message/rfc822 attachments
[squirrelmail.git] / src / view_header.php
index 6204b09cde4d3c61750c823da62e1050dbc92285..9fcf8f1dac21446d25650a94edf368b6ed9c28eb 100644 (file)
  */
 
 
  */
 
 
-function  parse_viewheader($imapConnection,$id,$template_vars) {
+function  parse_viewheader($imapConnection,$id, $passed_ent_id) {
    global $uid_support;
 
    $header_full = array();
    global $uid_support;
 
    $header_full = array();
-
-   $read=sqimap_run_command ($imapConnection, "FETCH $id BODY[HEADER]", 
+   if (!$passed_ent_id) {
+       $read=sqimap_run_command ($imapConnection, "FETCH $id BODY[HEADER]", 
                               true, $a, $b, $uid_support);
                               true, $a, $b, $uid_support);
-    
+   } else {
+       $query = "FETCH $id BODY[".$passed_ent_id.'.HEADER]';
+       $read=sqimap_run_command ($imapConnection, $query, 
+                              true, $a, $b, $uid_support);
+   }    
     $cnum = 0;
     for ($i=1; $i < count($read); $i++) {
         $line = htmlspecialchars($read[$i]);
     $cnum = 0;
     for ($i=1; $i < count($read); $i++) {
         $line = htmlspecialchars($read[$i]);
@@ -53,15 +57,11 @@ function  parse_viewheader($imapConnection,$id,$template_vars) {
         }
         parseEmail($s);
         if (isset($f)) {
         }
         parseEmail($s);
         if (isset($f)) {
-            $header_output[] = array($s,$f);               
+            $header_output[] = array($f,$s);
         }
     }
         }
     }
-
     sqimap_logout($imapConnection);
     sqimap_logout($imapConnection);
-
-    $template_vars['full_header'] = $header_output;
-
-    return $template_vars;
+    return $header_output;
 }
 
 function view_header($template_vars, $pageheader='', $pagefooter='') {
 }
 
 function view_header($template_vars, $pageheader='', $pagefooter='') {