Luke Ehresman 25 年之前
父節點
當前提交
a67da6a07f
共有 4 個文件被更改,包括 47 次插入41 次删除
  1. 28 30
      functions/imap_messages.php
  2. 8 8
      functions/mailbox_display.php
  3. 8 1
      src/folders.php
  4. 3 2
      src/left_main.php

+ 28 - 30
functions/imap_messages.php

@@ -42,43 +42,41 @@
 		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;
    }
 
    /******************************************************************************

+ 8 - 8
functions/mailbox_display.php

@@ -44,15 +44,15 @@
 
       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);
             }

+ 8 - 1
src/folders.php

@@ -77,7 +77,14 @@
    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)

+ 3 - 2
src/left_main.php

@@ -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)