Fixed imap search bug.
authorphilippe_mingo <philippe_mingo@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 12 Oct 2001 10:50:19 +0000 (10:50 +0000)
committerphilippe_mingo <philippe_mingo@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 12 Oct 2001 10:50:19 +0000 (10:50 +0000)
Updated Spanish strings.

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1565 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/imap_messages.php
functions/imap_search.php

index 38dd15e4ae9014ad08fa17ad9af7f8e4ccf5dc87..bcc94e38e899252a67548c64e7e4aacd674d9606 100755 (executable)
@@ -67,6 +67,7 @@
    // Sort the message list and crunch to be as small as possible
    // (overflow could happen, so make it small if possible)
    function sqimap_message_list_squisher($messages_array) {
+      if( !is_array( $messages_array ) ) return;
       sort($messages_array, SORT_NUMERIC);
       $msgs_str = '';
       while ($messages_array) {
index 6180c46732e0988c09246638d85115cb3757af6c..b5eb0e3e18137bf178ba51f8a8d47aac27e79627 100644 (file)
@@ -1,4 +1,4 @@
-<?php 
+<?php
    /******************************************************************
     ** IMAP SEARCH ROUTIES
     ** $Id$
 
 function sqimap_search($imapConnection,$search_where,$search_what,$mailbox,$color) {
    global $msgs, $message_highlight_list, $squirrelmail_language, $languages, $index_order;
+
    $urlMailbox = urlencode($mailbox);
-   
-   # Construct the Search QuERY
-   $ss = sqimap_session_id();
-   if (isset($languages[$squirrelmail_language]["CHARSET"]) && $languages[$squirrelmail_language]["CHARSET"]) {
-      $ss = " SEARCH CHARSET ".$languages[$squirrelmail_language]["CHARSET"]." ALL $search_where \"$search_what\"\r\n";
+   $isid = sqimap_session_id();
+
+   /* Construct the Search QuERY */
+   $ss = $isid;
+   if (isset($languages[$squirrelmail_language]['CHARSET']) &&
+       $languages[$squirrelmail_language]['CHARSET']) {
+      $ss .= " SEARCH CHARSET ".$languages[$squirrelmail_language]['CHARSET']." ALL $search_where \"$search_what\"\r\n";
    } else {
-      $ss = " SEARCH ALL $search_where \"$search_what\"\r\n";
+      $ss .= " SEARCH ALL $search_where \"$search_what\"\r\n";
    }
    fputs($imapConnection,$ss);
 
    # Read Data Back From IMAP
-   $readin = sqimap_read_data ($imapConnection, sqimap_session_id(), false, $result, $message);
-   if (isset($languages[$squirrelmail_language]["CHARSET"]) && strtolower($result) == "no") { 
-      $ss = sqimap_session_id() . " SEARCH CHARSET \"US-ASCII\" ALL $search_where \"$search_what\"\r\n";
+   $readin = sqimap_read_data ($imapConnection, $isid, false, $result, $message);
+   if (isset($languages[$squirrelmail_language]['CHARSET']) && strtolower($result) == 'no') {
+      $ss = $isid . " SEARCH CHARSET \"US-ASCII\" ALL $search_where \"$search_what\"\r\n";
       fputs ($imapConnection, $ss);
-      $readin = sqimap_read_data ($imapConnection, sqimap_session_id(), true, $result, $message);
+      $readin = sqimap_read_data ($imapConnection, $isid, true, $result, $message);
    }
+
    unset($messagelist); $msgs=""; $c = 0;
 
-   #Keep going till we find the SEARCH responce
-   while ($c < count($readin)) {
+   /* Keep going till we find the SEARCH responce */
+   while ($c < count( $readin )) {
 
-      #Check to see if a SEARCH Responce was recived
+      /* Check to see if a SEARCH Responce was recived */
       if (substr($readin[$c],0,9) == "* SEARCH ")
          $messagelist = explode(" ",substr($readin[$c],9));
       else if (isset($errors))
@@ -152,4 +156,4 @@ function sqimap_search($imapConnection,$search_where,$search_what,$mailbox,$colo
       }
    }
 
-?>
\ No newline at end of file
+?>