duhduh
[squirrelmail.git] / src / read_body.php
index 5ae9b032c3ac71df3ff8fdf2e439d8c2bf214727..866422d54163c0119445eaa163172c725d95fbb6 100644 (file)
@@ -17,7 +17,7 @@ require_once('../functions/imap.php');
 require_once('../functions/mime.php');
 require_once('../functions/date.php');
 require_once('../functions/url_parser.php');
-   
+
 /**
 * Given an IMAP message id number, this will look it up in the cached
 * and sorted msgs array and return the index. Used for finding the next
@@ -147,8 +147,7 @@ do_hook('html_top');
 displayPageHeader($color, $mailbox);
 
 if (isset($view_hdr)) {
-    fputs ($imapConnection, sqimap_session_id() . " FETCH $passed_id BODY[HEADER]\r\n");
-    $read = sqimap_read_data ($imapConnection, sqimap_session_id(), true, $a, $b);
+    $read = sqimap_run_command ($imapConnection, "FETCH $passed_id BODY[HEADER]", true, $a, $b);
 
     echo '<BR>' .
         '<TABLE WIDTH="100%" CELLPADDING="2" CELLSPACING="0" BORDER="0" ALIGN="CENTER">' . "\n" .
@@ -421,23 +420,23 @@ if ($default_use_priority) {
     switch($priority_level) {
         /* check for a higher then normal priority. */
         case '1':
-        case '2': 
-            $priority_string = _("High"); 
+        case '2':
+            $priority_string = _("High");
             break;
 
         /* check for a lower then normal priority. */
         case '4':
-        case '5': 
-            $priority_string = _("Low"); 
+        case '5':
+            $priority_string = _("Low");
             break;
-            
+
         /* check for a normal priority. */
-        case '3': 
+        case '3':
         default:
             $priority_level = '3';
-            $priority_string = _("Normal"); 
+            $priority_string = _("Normal");
             break;
-            
+
     }
 }
 
@@ -461,7 +460,7 @@ if ($where && $what) {
     }
     echo "search.php?where$pos=".urlencode($where)."&pos=$pos&what$pos=".urlencode($what)."&mailbox=$urlMailbox\">";
 } else {
-    echo "right_main.php?use_mailbox_cache=1&sort=$sort&startMessage=$startMessage&mailbox=$urlMailbox\">";
+    echo "right_main.php?sort=$sort&startMessage=$startMessage&mailbox=$urlMailbox\">";
 }
 echo _("Message List") .
      '</A>&nbsp;|&nbsp;' .
@@ -510,17 +509,17 @@ echo '               </SMALL>' . "\n" .
     '            </TD><TD WIDTH="33%" ALIGN="RIGHT">' .
     '               <SMALL>' .
     '               <A HREF="' . $base_uri . "src/compose.php?forward_id=$passed_id&forward_subj=$url_subj&".
-                    (isset($default_use_priority)?"mailprio=$priority_level&":"")
+                    ($default_use_priority?"mailprio=$priority_level&":"")
                     ."mailbox=$urlMailbox&ent_num=$ent_num\">" .
     _("Forward") .
     '</A>&nbsp;|&nbsp;' .
     '               <A HREF="' . $base_uri . "src/compose.php?send_to=$url_replyto&reply_subj=$url_subj&".
-                    (isset($default_use_priority)?"mailprio=$priority_level&":"").
+                    ($default_use_priority?"mailprio=$priority_level&":"").
                     "reply_id=$passed_id&mailbox=$urlMailbox&ent_num=$ent_num\">" .
     _("Reply") .
     '</A>&nbsp;|&nbsp;' .
     '               <A HREF="' . $base_uri . "src/compose.php?send_to=$url_replytoall&send_to_cc=$url_replytoallcc&reply_subj=$url_subj&".
-                    (isset($default_use_priority)?"mailprio=$priority_level&":"").
+                    ($default_use_priority?"mailprio=$priority_level&":"").
                     "reply_id=$passed_id&mailbox=$urlMailbox&ent_num=$ent_num\">" .
     _("Reply All") .
     '</A>&nbsp;&nbsp;' .
@@ -620,9 +619,7 @@ if ($default_use_priority) {
 }
 
 if ($show_xmailer_default) {
-    fputs ($imapConnection, sqimap_session_id() .
-        " FETCH $passed_id BODY.PEEK[HEADER.FIELDS (X-Mailer User-Agent)]\r\n");
-    $read = sqimap_read_data ($imapConnection, sqimap_session_id(), true,
+    $read = sqimap_run_command ($imapConnection, "FETCH $passed_id BODY.PEEK[HEADER.FIELDS (X-Mailer User-Agent)]", true,
                             $response, $readmessage);
     $mailer = substr($read[1], strpos($read[1], " "));
     if (trim($mailer)) {
@@ -641,11 +638,12 @@ if (!$pf_subtle_link) {
     echo printer_friendly_link(true);
 }
 
-do_hook("read_body_header");
+do_hook('read_body_header');
 echo '</TABLE>' .
     '   </TD></TR>' .
     '</TABLE>';
 flush();
+
 echo "<TABLE CELLSPACING=0 WIDTH=\"97%\" BORDER=0 ALIGN=CENTER CELLPADDING=0>\n" .
     "   <TR><TD BGCOLOR=\"$color[4]\" WIDTH=\"100%\">\n" .
     '<BR>'.
@@ -656,23 +654,29 @@ echo "<TABLE CELLSPACING=0 WIDTH=\"97%\" BORDER=0 ALIGN=CENTER CELLPADDING=0>\n"
     '</TABLE>' . "\n";
 
 /* show attached images inline -- if pref'fed so */
-if (($attachment_common_show_images) and
+if (($attachment_common_show_images) &&
     is_array($attachment_common_show_images_list)) {
+
     foreach ($attachment_common_show_images_list as $img) {
+        $imgurl = '../src/download.php' .
+                '?' . 
+                'passed_id='     . urlencode($img['passed_id']) .
+                '&mailbox='       . urlencode($mailbox) .
+                '&passed_ent_id=' . urlencode($img['ent_id']) .
+                '&absolute_dl=true';
+
         echo "<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 ALIGN=CENTER>\n" .
             "  <TR>\n" .
             "    <TD>\n" .
-            '      <img src="../src/download.php' .
-                '?passed_id='     . urlencode($img['passed_id']) .
-                '&mailbox='       . urlencode($img['mailbox']) .
-                '&passed_ent_id=' . urlencode($img['ent_id']) .
-                '&absolute_dl=true">' . "\n" .
+            "      <img src=\"$imgurl\">\n" .
             "    </TD>\n" .
             "  </TR>\n" .
             "</TABLE>\n";
+
     }
 }
 
+
 do_hook('read_body_bottom');
 do_hook('html_bottom');
 sqimap_logout($imapConnection);