bugfixes
authorlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 28 Apr 2000 21:03:01 +0000 (21:03 +0000)
committerlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 28 Apr 2000 21:03:01 +0000 (21:03 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@475 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/imap_messages.php
functions/mailbox_display.php
src/folders.php
src/left_main.php

index 612ef5f..e44424c 100755 (executable)
                var $from, $subject, $date;
        }
         
-   function sqimap_get_small_header ($imap_stream, $start, $end, $sent) {
+   function sqimap_get_small_header ($imap_stream, $id, $sent) {
       //fputs ($imap_stream, "a001 FETCH $id BODY[HEADER.FIELDS (DATE FROM SUBJECT)]\r\n");
       //fputs ($imap_stream, "a001 FETCH $start:$end RFC822.HEADER\r\n");
-      fputs ($imap_stream, "a001 FETCH $start:$end BODY.PEEK[HEADER.FIELDS (Date To From Subject)]\r\n");
+      fputs ($imap_stream, "a001 FETCH $id BODY.PEEK[HEADER.FIELDS (Date From Subject)]\r\n");
       $read = sqimap_read_data ($imap_stream, "a001", true, $response, $message);
 
       $subject = _("(no subject)");
       $from = _("Unknown Sender");
+               $g = 0;
       for ($i = 0; $i < count($read); $i++) {
-                       while (substr($read[$i], 0, 1) != ")") {
-                               if ($sent == true) {
-                       if (eregi ("^to:", $read[$i])) {
-                       $from = sqimap_find_displayable_name(substr($read[$i], 3));
-                                       }       
-                               } else { 
-                       if (eregi ("^from:", $read[$i])) {
-                       $from = sqimap_find_displayable_name(substr($read[$i], 5));
-                                       }       
-                               }
-       
-                if (eregi ("^date:", $read[$i])) {
-                   $date = substr($read[$i], 5);
-                } else if (eregi ("^subject:", $read[$i])) {
-                   $subject = htmlspecialchars(eregi_replace ("^subject: ", "", $read[$i]));
-                   if (strlen($subject) == 0)
-                      $subject = _("(no subject)");
-                }
-                               $i++;
-       }
-                       $header = new small_header;
-                       $header->from = $from;
-                       $header->date = $date;
-                       $header->subject = $subject;
-                       $ary[$g] = $header;
-                       $g++;
-               }
-               return $ary;
+                       if ($sent == true) {
+               if (eregi ("^to:", $read[$i])) {
+               $from = sqimap_find_displayable_name(substr($read[$i], 3));
+                               }       
+                       } else { 
+               if (eregi ("^from:", $read[$i])) {
+               $from = sqimap_find_displayable_name(substr($read[$i], 5));
+                               }       
+                       }
+
+         if (eregi ("^date:", $read[$i])) {
+            $date = substr($read[$i], 5);
+         } else if (eregi ("^subject:", $read[$i])) {
+            $subject = htmlspecialchars(eregi_replace ("^subject: ", "", $read[$i]));
+            if (strlen($subject) == 0)
+               $subject = _("(no subject)");
+         }
+               }       
+
+               $header = new small_header;
+               $header->from = $from;
+               $header->date = $date;
+               $header->subject = $subject;
+
+               return $header;
    }
 
    /******************************************************************************
index ab348b9..c5b304b 100644 (file)
 
       if (!$use_cache) {
          if ($numMessages >= 1) {
-                               if ($mailbox == $sent_folder)
-               $ary = sqimap_get_small_header ($imapConnection, 1, $numMessages, true);
-                               else
-               $ary = sqimap_get_small_header ($imapConnection, 1, $numMessages, false);
-                                               
             for ($q = 0; $q < $numMessages; $q++) {
-                                       $from[$q] = $ary[$q]->from;
-                                       $date[$q] = $ary[$q]->date;
-                                       $subject[$q] = $ary[$q]->subject;
+                                       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);
             }
index 2a8889f..5fb7a6c 100644 (file)
    echo "<TR><TD BGCOLOR=\"$color[4]\" ALIGN=CENTER>";
 
    $count_special_folders = 0;
-   for ($p = 0; $p < count($boxes); $p++) {
+       $num_max = 1;
+       if ($move_to_trash)
+               $num_max++;
+       if ($move_to_sent)
+               $num_max++;
+
+   for ($p = 0; $p < count($boxes) && $count_special_folders < $num_max; $p++) {
+               echo "$count_special_folders - $p<br>";
       if (strtolower($boxes[$i]["unformatted"]) == "inbox")
          $count_special_folders++;
       else if ($boxes[$i]["unformatted"] == $trash_folder)
index ca89b09..c8bc624 100644 (file)
@@ -35,8 +35,9 @@
                global $color, $move_to_sent, $move_to_trash;
 
       $mailboxURL = urlencode($real_box);
-//      sqimap_mailbox_select ($imapConnection, $real_box);
-      $unseen = sqimap_unseen_messages($imapConnection, $numUnseen, $real_box);
+               if($real_box=="INBOX") {
+             $unseen = sqimap_unseen_messages($imapConnection, $numUnseen, $real_box);
+               }
 
       echo "<NOBR>";
       if ($unseen > 0)