bugfixes
[squirrelmail.git] / functions / mailbox_display.php
index f19f1f50089faf34a0e88cb89f1f0dc7c594d841..c5b304b1747dbdce161a30ed21a09b61c7b49093 100644 (file)
@@ -12,6 +12,8 @@
 
    function printMessageInfo($imapConnection, $t, $i, $key, $mailbox, $sort, $startMessage) {
       global $color, $msgs, $msort;
+               global $sent_folder;
+
                $msg = $msgs[$key];
 
       $senderName = $msg["FROM"];
       
       if ($msg["FLAG_FLAGGED"] == true) { $flag = "<font color=$color[2]>"; $flag_end = "</font>"; }
       if ($msg["FLAG_SEEN"] == false) { $bold = "<b>"; $bold_end = "</b>"; }
-      if ($msg["FLAG_ANSWERED"] == true) { $ans = "&nbsp;[A]"; }
+               if ($mailbox == $sent_folder) { $italic = "<i>"; $italic_end = "</i>"; }
       
       echo "   <td width=1% align=center><input type=checkbox name=\"msg[$t]\" value=".$msg["ID"]."></TD>\n";
-      echo "   <td>$bold$flag$senderName$flag_end$bold_end</td>\n";
+      echo "   <td width=30%>$italic$bold$flag$senderName$flag_end$bold_end$italic_end</td>\n";
       echo "   <td nowrap width=1%><center>$bold$flag".$msg["DATE_STRING"]."$flag_end$bold_end</center></td>\n";
-      echo "   <td>$bold<a href=\"read_body.php?mailbox=$urlMailbox&passed_id=".$msg["ID"]."&startMessage=$startMessage&show_more=0\">$flag$subject$flag_end</a>$ans$bold_end</td>\n";
+               if ($msg["FLAG_ANSWERED"] == true) echo "   <td width=1%><b><small>A</small></b></td>";
+               else    echo "   <td width=1%>&nbsp;</td>";
+      echo "   <td width=%>$bold<a href=\"read_body.php?mailbox=$urlMailbox&passed_id=".$msg["ID"]."&startMessage=$startMessage&show_more=0\">$flag$subject$flag_end</a>$bold_end</td>\n";
 
       echo "</tr>\n";
    }
     **/
    function showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color,$show_num, $use_cache) {
       global $msgs, $msort;
-      include ("../config/config.php");
+               global $sent_folder;
 
       if (!$use_cache) {
          if ($numMessages >= 1) {
             for ($q = 0; $q < $numMessages; $q++) {
-               sqimap_get_small_header ($imapConnection, $q+1, $f, $s, $d);
-               $from[$q] = $f;
-               $date[$q] = $d;
-               $subject[$q] = $s;
+                                       if ($mailbox == $sent_folder)
+                       $hdr = sqimap_get_small_header ($imapConnection, $q+1, true);
+                                       else
+                       $hdr = sqimap_get_small_header ($imapConnection, $q+1, false);
+                                               
+                                       $from[$q] = $hdr->from;
+                                       $date[$q] = $hdr->date;
+                                       $subject[$q] = $hdr->subject;
+
                $flags[$q] = sqimap_get_flags ($imapConnection, $q+1);
             }
          }
 
    // generic function to convert the msgs array into an HTML table
    function displayMessageArray($imapConnection, $numMessages, $startMessage, &$msgs, $msort, $mailbox, $sort, $color,$show_num) {
-      global $folder_prefix;
+      global $folder_prefix, $sent_folder;
+               global $imapServerAddress;
 
       // do a check to see if the config stuff has already been included or not
-      if (!isset($imapServerAddress))
-         include("../config/config.php");
+//      if (!isset($imapServerAddress))
+//         include("../config/config.php");
 
       // if cache isn't already set, do it now
       if (!session_is_registered("msgs"))
          echo "<CENTER>". _("Viewing messages ") ."<B>$startMessage</B>". _(" to ") ."<B>$endMessage</B> ($numMessages total)</CENTER>\n";
          echo "</TD></TR>\n";
       } else if ($startMessage == $endMessage) {
-         echo "<TR BGCOLOR=\"$color[4]>\"TD>";
+         echo "<TR BGCOLOR=\"$color[4]\"><TD>";
          echo "<CENTER>". _("Viewing message ") ."<B>$startMessage</B> ($numMessages ". _("total") .")</CENTER>\n";
          echo "</TD></TR>\n";
       }
       echo "<TR><TD BGCOLOR=\"$color[0]\">";
       echo "<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=1 BGCOLOR=\"$color[4]\">";
       echo "<TR BGCOLOR=\"$color[5]\" ALIGN=\"center\">";
-      echo "   <TD WIDTH=5%><B>&nbsp;</B></TD>";
+      echo "   <TD WIDTH=1%><B>&nbsp;</B></TD>";
       /** FROM HEADER **/
-      echo "   <TD WIDTH=25%><B>". _("From") ."</B>";
+               if ($mailbox == $sent_folder)
+       echo "   <TD WIDTH=30%><B>". _("To") ."</B>";
+               else
+       echo "   <TD WIDTH=30%><B>". _("From") ."</B>";
+
       if ($sort == 2)
          echo "   <A HREF=\"right_main.php?newsort=3&startMessage=1&mailbox=$urlMailbox\" TARGET=\"right\"><IMG SRC=\"../images/up_pointer.gif\" BORDER=0></A></TD>\n";
       else if ($sort == 3)
       else
          echo "   <A HREF=\"right_main.php?newsort=3&startMessage=1&mailbox=$urlMailbox\" TARGET=\"right\"><IMG SRC=\"../images/sort_none.gif\" BORDER=0></A></TD>\n";
       /** DATE HEADER **/
-      echo "   <TD WIDTH=15%><B>". _("Date") ."</B>";
+      echo "   <TD nowrap WIDTH=1%><B>". _("Date") ."</B>";
       if ($sort == 0)
          echo "   <A HREF=\"right_main.php?newsort=1&startMessage=1&mailbox=$urlMailbox\" TARGET=\"right\"><IMG SRC=\"../images/up_pointer.gif\" BORDER=0></A></TD>\n";
       else if ($sort == 1)
          echo "   <A HREF=\"right_main.php?newsort=0&startMessage=1&mailbox=$urlMailbox\" TARGET=\"right\"><IMG SRC=\"../images/down_pointer.gif\" BORDER=0></A></TD>\n";
       else
          echo "   <A HREF=\"right_main.php?newsort=0&startMessage=1&mailbox=$urlMailbox\" TARGET=\"right\"><IMG SRC=\"../images/sort_none.gif\" BORDER=0></A></TD>\n";
+      echo "   <TD WIDTH=1%>&nbsp;</TD>\n";
       /** SUBJECT HEADER **/
       echo "   <TD WIDTH=%><B>". _("Subject") ."</B>\n";
       if ($sort == 4)
          echo "   <A HREF=\"right_main.php?newsort=4&startMessage=1&mailbox=$urlMailbox\" TARGET=\"right\"><IMG SRC=\"../images/down_pointer.gif\" BORDER=0></A></TD>\n";
       else
          echo "   <A HREF=\"right_main.php?newsort=5&startMessage=1&mailbox=$urlMailbox\" TARGET=\"right\"><IMG SRC=\"../images/sort_none.gif\" BORDER=0></A></TD>\n";
+
       echo "</TR>";
 
       
       // loop through and display the info for each message.
       $t = 0; // $t is used for the checkbox number
       if ($numMessages == 0) { // if there's no messages in this folder
-         echo "<TR><TD BGCOLOR=\"$color[4]\" COLSPAN=4><CENTER><BR><B>". _("THIS FOLDER IS EMPTY") ."</B><BR>&nbsp</CENTER></TD></TR>";
+         echo "<TR><TD BGCOLOR=\"$color[4]\" COLSPAN=5><CENTER><BR><B>". _("THIS FOLDER IS EMPTY") ."</B><BR>&nbsp</CENTER></TD></TR>";
       } else if ($startMessage == $endMessage) { // if there's only one message in the box, handle it different.
          $i = $startMessage - 1;
          reset($msort);