X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Fimap_search.php;h=7efff2d8c2ed56622f16a1b0a97cfaf2aba44755;hb=0fc2aca076a604fae5aa24b231288b4054a26fa2;hp=d765c65f31c627260a52e56d3d87ce3401988c94;hpb=6a109962730487f0fcd33d55280f7da00c6f02a8;p=squirrelmail.git diff --git a/functions/imap_search.php b/functions/imap_search.php index d765c65f..7efff2d8 100644 --- a/functions/imap_search.php +++ b/functions/imap_search.php @@ -1,19 +1,19 @@ -
No Messages Found
"; return; - } else { + } else if (isset($errors)) { echo ""; } @@ -57,26 +64,25 @@ function sqimap_search($imapConnection,$search_where,$search_what,$mailbox,$colo global $sent_folder; for ($q = 0; $q < count($messagelist); $q++) { - $messagelist[$q] = trim($messagelist[$q]); - if ($mailbox == $sent_folder) - $hdr = sqimap_get_small_header ($imapConnection, $messagelist[$q], true); - else - $hdr = sqimap_get_small_header ($imapConnection, $messagelist[$q], false); - - $from[$q] = $hdr->from; - $date[$q] = $hdr->date; - $subject[$q] = $hdr->subject; - $to[$q] = $hdr->to; - $priority[$q] = $hdr->priority; - $cc[$q] = $hdr->cc; - $id[$q] = $messagelist[$q]; - - $flags[$q] = sqimap_get_flags ($imapConnection, $messagelist[$q]); - } - - $j = 0; - while ($j < count($messagelist)) { - $date[$j] = ereg_replace(" ", " ", $date[$j]); + $id[$q] = trim($messagelist[$q]); + } + $issent = ($mailbox == $sent_folder); + $hdr_list = sqimap_get_small_header_list($imapConnection, $id, $issent); + $flags = sqimap_get_flags_list($imapConnection, $id, $issent); + foreach ($hdr_list as $hdr) { + $from[] = $hdr->from; + $date[] = $hdr->date; + $subject[] = $hdr->subject; + $to[] = $hdr->to; + $priority[] = $hdr->priority; + $cc[] = $hdr->cc; + $size[] = $hdr->size; + $type[] = $hdr->type0; + } + + $j = 0; + while ($j < count($messagelist)) { + $date[$j] = ereg_replace(' ', ' ', $date[$j]); $tmpdate = explode(" ", trim($date[$j])); $messages[$j]["TIME_STAMP"] = getTimeStamp($tmpdate); @@ -87,8 +93,10 @@ function sqimap_search($imapConnection,$search_where,$search_what,$mailbox,$colo $messages[$j]["SUBJECT"] = decodeHeader($subject[$j]); $messages[$j]["SUBJECT-SORT"] = strtolower(decodeHeader($subject[$j])); $messages[$j]["TO"] = decodeHeader($to[$j]); - $messages[$j]["PRIORITY"] = $priority[$j]; + $messages[$j]["PRIORITY"] = $priority[$j]; $messages[$j]["CC"] = $cc[$j]; + $messages[$j]["SIZE"] = $size[$j]; + $messages[$j]["TYPE0"] = $type[$j]; $num = 0; while ($num < count($flags[$j])) { @@ -107,13 +115,13 @@ function sqimap_search($imapConnection,$search_where,$search_what,$mailbox,$colo $num++; } $j++; - } + } /** Find and remove the ones that are deleted */ $i = 0; $j = 0; while ($j < count($messagelist)) { - if ($messages[$j]["FLAG_DELETED"] == true) { + if (isset($messages[$j]["FLAG_DELETED"]) && $messages[$j]["FLAG_DELETED"] == true) { $j++; continue; } @@ -128,6 +136,7 @@ function sqimap_search($imapConnection,$search_where,$search_what,$mailbox,$colo if (count($messagelist) > 0) { $j=0; + if (!isset ($msg)) { $msg = ""; } mail_message_listing_beginning($imapConnection, "move_messages.php?msg=$msg&mailbox=$urlMailbox&where=".urlencode($search_where)."&what=".urlencode($search_what), '', -1, '' . _("Found") . ' ' . count($messagelist) . ' ' . _("messages") . '', @@ -143,4 +152,4 @@ function sqimap_search($imapConnection,$search_where,$search_what,$mailbox,$colo } } -?> +?> \ No newline at end of file