<?php
-/******************************************************************
- ** IMAP SEARCH ROUTIES
- ** $Id$
- *****************************************************************/
- if (!isset($imap_php))
- include("../functions/imap.php");
- if (!isset($date_php))
- include("../functions/date.php");
- if (!isset($array_php))
- include("../functions/array.php");
- if (!isset($mailbox_display_php))
- include("../functions/mailbox_display.php");
- if (!isset($mime_php))
- include("../functions/mime.php");
-
- $imap_search_php = true;
+ /******************************************************************
+ ** IMAP SEARCH ROUTIES
+ ** $Id$
+ *****************************************************************/
+
+ if (defined ('imap_search_php'))
+ return;
+ define ('imap_search_php', true);
+
+ include("../functions/imap.php");
+ include("../functions/date.php");
+ include("../functions/array.php");
+ include("../functions/mailbox_display.php");
+ include("../functions/mime.php");
+
function sqimap_search($imapConnection,$search_where,$search_what,$mailbox,$color) {
global $msgs, $message_highlight_list, $squirrelmail_language, $languages, $index_order;
fputs($imapConnection,$ss);
# Read Data Back From IMAP
- $readin = sqimap_read_data ($imapConnection, "a001", true, $result, $message);
+ $readin = sqimap_read_data ($imapConnection, "a001", false, $result, $message);
+ if (isset($languages[$squirrelmail_language]["CHARSET"]) && strtolower($result) == "no") {
+ $ss = "a001 SEARCH CHARSET \"US-ASCII\" ALL $search_where \"$search_what\"\r\n";
+ fputs ($imapConnection, $ss);
+ $readin = sqimap_read_data ($imapConnection, "a001", true, $result, $message);
+ }
unset($messagelist); $msgs=""; $c = 0;
#Keep going till we find the SEARCH responce
$j = 0;
while ($j < count($messagelist)) {
- $date[$j] = ereg_replace(" ", " ", $date[$j]);
+ $date[$j] = ereg_replace(' ', ' ', $date[$j]);
$tmpdate = explode(" ", trim($date[$j]));
$messages[$j]["TIME_STAMP"] = getTimeStamp($tmpdate);