diff --git a/functions/imap_search.php b/functions/imap_search.php
index 300beaad5..e1cc1de27 100644
--- a/functions/imap_search.php
+++ b/functions/imap_search.php
@@ -11,165 +11,152 @@
* $Id$
*/
-/*****************************************************************/
-/*** THIS FILE NEEDS TO HAVE ITS FORMATTING FIXED!!! ***/
-/*** PLEASE DO SO AND REMOVE THIS COMMENT SECTION. ***/
-/*** + Base level indent should begin at left margin, as ***/
-/*** the require_once below. ***/
-/*** + All identation should consist of four space blocks ***/
-/*** + Tab characters are evil. ***/
-/*** + all comments should use "slash-star ... star-slash" ***/
-/*** style -- no pound characters, no slash-slash style ***/
-/*** + FLOW CONTROL STATEMENTS (if, while, etc) SHOULD ***/
-/*** ALWAYS USE { AND } CHARACTERS!!! ***/
-/*** + Please use ' instead of ", when possible. Note " ***/
-/*** should always be used in _( ) function calls. ***/
-/*** Thank you for your help making the SM code more readable. ***/
-/*****************************************************************/
-
require_once('../functions/imap.php');
require_once('../functions/date.php');
require_once('../functions/array.php');
require_once('../functions/mailbox_display.php');
require_once('../functions/mime.php');
+function sqimap_search($imapConnection,$search_where,$search_what,$mailbox,$color) {
- function sqimap_search($imapConnection,$search_where,$search_what,$mailbox,$color) {
+ global $msgs, $message_highlight_list, $squirrelmail_language, $languages, $index_order;
- global $msgs, $message_highlight_list, $squirrelmail_language, $languages, $index_order;
+ $urlMailbox = urlencode($mailbox);
+ $isid = sqimap_session_id();
- $urlMailbox = urlencode($mailbox);
- $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";
+ }
+ fputs($imapConnection,$ss);
- /* 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";
- }
- fputs($imapConnection,$ss);
-
- # Read Data Back From IMAP
- $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, $isid, true, $result, $message);
- }
-
- unset($messagelist); $msgs=""; $c = 0;
-
- /* Keep going till we find the SEARCH responce */
- while ($c < count( $readin )) {
-
- /* 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))
- $errors = $errors.$readin[$c];
- else
- $errors = $readin[$c];
- $c++;
- }
-
- #If nothing is found * SEARCH should be the first error else echo errors
- if (isset($errors) && strstr($errors,"* SEARCH")) {
- echo '
\n".
- " | ||
'.
+do_hook('search_before_form');
+echo " \n". + "
|