From 4bbba0d8cf096277dc7375cfb54193be092b83e5 Mon Sep 17 00:00:00 2001 From: lkehresman Date: Fri, 28 Apr 2000 21:03:01 +0000 Subject: [PATCH] bugfixes git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@475 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/imap_messages.php | 58 +++++++++++++++++------------------ functions/mailbox_display.php | 16 +++++----- src/folders.php | 9 +++++- src/left_main.php | 5 +-- 4 files changed, 47 insertions(+), 41 deletions(-) diff --git a/functions/imap_messages.php b/functions/imap_messages.php index 612ef5fc..e44424c0 100755 --- a/functions/imap_messages.php +++ b/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; } /****************************************************************************** diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php index ab348b92..c5b304b1 100644 --- a/functions/mailbox_display.php +++ b/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); } diff --git a/src/folders.php b/src/folders.php index 2a8889f7..5fb7a6c5 100644 --- a/src/folders.php +++ b/src/folders.php @@ -77,7 +77,14 @@ echo ""; $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
"; if (strtolower($boxes[$i]["unformatted"]) == "inbox") $count_special_folders++; else if ($boxes[$i]["unformatted"] == $trash_folder) diff --git a/src/left_main.php b/src/left_main.php index ca89b09f..c8bc624a 100644 --- a/src/left_main.php +++ b/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 ""; if ($unseen > 0) -- 2.25.1