ChangeLog
[squirrelmail.git] / src / search.php
index 894b89c1247996df338e5feae64c27e1180baa31..b99fff9c81635bcd117ece3537cb8922e02c9d75 100644 (file)
@@ -3,14 +3,14 @@
 /**
  * search.php
  *
- * Copyright (c) 1999-2003 The SquirrelMail Project Team
+ * Copyright (c) 1999-2004 The SquirrelMail Project Team
  * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
  * IMAP search page
  *
  * $Id$
  * @package squirrelmail
- * @link ftp://ftp.rfc-editor.org/in-notes/rfc3501.txt
+ * @link http://www.ietf.org/rfc/rfc3501.txt
  * @author Alex Lemaresquier - Brainstorm - alex at brainstorm.fr
  *
  * Subfolder search idea from Patch #806075 by Thomas Pohl xraven at users.sourceforge.net. Thanks Thomas!
@@ -303,7 +303,7 @@ function asearch_push_recent($data_dir, $username, $mailbox_array, $biop_array,
 
 /**
  * Edit a recent search
- * @global array $mailbox_array
+ * @global array mailbox_array searched mailboxes
  */
 function asearch_edit_recent($data_dir, $username, $index)
 {
@@ -663,15 +663,14 @@ function asearch_print_mailbox_msgs($imapConnection, $mailbox, $msgs, $cnt, $sor
                        $real_sort = $sort;
                }
                $mailbox_display = asearch_get_mailbox_display($mailbox);
-               echo html_tag('div', '<b><big>' . _("Folder:") . ' '. $mailbox_display . '</big></b>','center') . "\n";
 
                $msg_cnt_str = get_msgcnt_str(1, $cnt, $cnt);
-               $toggle_all = get_selectall_link(1, $real_sort);
+               $paginator_str = '<b><big>' . _("Folder:") . ' '. $mailbox_display . '</big></b>';
 
-               echo '<table border="0" width="100%" cellpadding="0" cellspacing="0">';
+               echo '<br><table border="0" width="100%" cellpadding="0" cellspacing="0">';
 
                echo '<tr><td>';
-               mail_message_listing_beginning($imapConnection, $mailbox, $real_sort, $msg_cnt_str, $toggle_all, 1);
+               mail_message_listing_beginning($imapConnection, NULL, $mailbox, $real_sort, $msg_cnt_str, $paginator_str, 1, 1);
                echo '</td></tr>';
 
                echo '<tr><td HEIGHT="5" BGCOLOR="'.$color[4].'"></td></tr>';  
@@ -785,26 +784,29 @@ $imap_asearch_biops = array(
        'OR' => _("Or")
 );
 
-/*
-       unset : Enter key, or called from outside (eg read_body)
-       $search_button_text : Search button
-       'Search_no_update' : Search but don't update recent
-       'Search_last' : Same as no_update but reload and search last
-       'Search_silent' : Same as no_update but only display results
-       $add_criteria_button_text : Add New Criteria button
-       $del_excluded_button_text : Remove Excluded Criteria button
-       $del_all_button_text : Remove All Criteria button
-       'save_recent'
-       'search_recent'
-       'forget_recent'
-       'edit_saved'
-       'search_saved'
-       'delete_saved'
-*/
+/** How we did enter the form
+ * - unset : Enter key, or called from outside (eg read_body)
+ * - $search_button_text : Search button
+ * - 'Search_no_update' : Search but don't update recent
+ * - 'Search_last' : Same as no_update but reload and search last
+ * - 'Search_silent' : Same as no_update but only display results
+ * - $add_criteria_button_text : Add New Criteria button
+ * - $del_excluded_button_text : Remove Excluded Criteria button
+ * - $del_all_button_text : Remove All Criteria button
+ * - 'save_recent'
+ * - 'search_recent'
+ * - 'forget_recent'
+ * - 'edit_saved'
+ * - 'search_saved'
+ * - 'delete_saved'
+ * @global string $submit
+ */
 if (isset($_GET['submit']))
        $submit = strip_tags($_GET['submit']);
 
-/* Used by search */
+/** Searched mailboxes
+ * @global array $mailbox_array
+ */
 if (isset($_GET['mailbox'])) {
        $mailbox_array = $_GET['mailbox'];
        if (!is_array($mailbox_array))
@@ -813,6 +815,9 @@ if (isset($_GET['mailbox'])) {
 else
        $mailbox_array = array();
 
+/** Binary operators
+ * @global array $biop_array
+ */
 if (isset($_GET['biop'])) {
        $biop_array = $_GET['biop'];
        if (!is_array($biop_array))
@@ -821,6 +826,9 @@ if (isset($_GET['biop'])) {
 else
        $biop_array = array();
 
+/** Unary operators
+ * @global array $unop_array
+ */
 if (isset($_GET['unop'])) {
        $unop_array = $_GET['unop'];
        if (!is_array($unop_array))
@@ -829,6 +837,9 @@ if (isset($_GET['unop'])) {
 else
        $unop_array = array();
 
+/** Where to search
+ * @global array $where_array
+ */
 if (isset($_GET['where'])) {
        $where_array = $_GET['where'];
        if (!is_array($where_array))
@@ -837,6 +848,9 @@ if (isset($_GET['where'])) {
 else
        $where_array = array();
 
+/** What to search
+ * @global array $what_array
+ */
 if (isset($_GET['what'])) {
        $what_array = $_GET['what'];
        if (!is_array($what_array))
@@ -845,21 +859,29 @@ if (isset($_GET['what'])) {
 else
        $what_array = array();
 
+/** Whether to exclude this criteria from search
+ * @global array $exclude_array
+ */
 if (isset($_GET['exclude']))
        $exclude_array = $_GET['exclude'];
 else
        $exclude_array = array();
 
+/** Search within subfolders
+ * @global array $sub_array
+ */
 if (isset($_GET['sub']))
        $sub_array = $_GET['sub'];
 else
        $sub_array = array();
 
-/* Used by recent and saved stuff */
+/** Row number used by recent and saved stuff
+ */
 if (isset($_GET['rownum']))
     $submit_rownum = strip_tags($_GET['rownum']);
 
-/* Change global sort */
+/** Change global sort
+ */
 if (sqgetGlobalVar('newsort', $newsort, SQ_GET)) {
        setPref($data_dir, $username, 'sort', $newsort);
        $sort = $newsort;
@@ -867,7 +889,8 @@ if (sqgetGlobalVar('newsort', $newsort, SQ_GET)) {
        asearch_edit_last($data_dir, $username);
 }
 
-/* Change mailbox threading */
+/** Change mailbox threading
+ */
 if (sqgetGlobalVar('set_thread', $set_thread, SQ_GET)) {
        setPref($data_dir, $username, 'thread_' . $mailbox_array[0], ($set_thread == 1) ? 1 : 0 );
        asearch_edit_last($data_dir, $username);
@@ -1023,7 +1046,9 @@ if ($submit == $search_button_text) {
        echo html_tag('table', '', 'center', $color[9], 'width="100%" cellpadding="1" cellspacing="0" border="0"');
        echo html_tag('tr', html_tag('td', asearch_get_title_display($color, _("Search Results")), 'center', $color[5]));
        echo html_tag('tr', html_tag('td', asearch_get_query_display($color, $mailbox_array, $biop_array, $unop_array, $where_array, $what_array, $exclude_array, $sub_array), 'center', $color[4]));
-       echo '</table><br>' . "\n";
+       echo '</table>' . "\n";
+
+       flush();
 
        $query_error = asearch_check_query($where_array, $what_array, $exclude_array);
        if ($query_error != '')