$checked => $exclude
[squirrelmail.git] / src / search.php
index c3dd1001cd135bf54d4d014fabf2e6d8aa6486b3..16aa65ef5fc9ee924fac404354544ad36559e7a5 100644 (file)
@@ -8,15 +8,18 @@
  *
  * IMAP search page
  *
- * $Id$
+ * Subfolder search idea from Patch #806075 by Thomas Pohl xraven at users.sourceforge.net. Thanks Thomas!
+ *
+ * @version $Id$
  * @package squirrelmail
  * @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!
  */
 
-/** Path for SquirrelMail required files. */
+/**
+ * Path for SquirrelMail required files.
+ * @ignore
+ */
 define('SM_PATH','../');
 
 /** SquirrelMail required files. */
@@ -536,7 +539,7 @@ function asearch_print_recent($data_dir, $username)
 /** Build an <option> statement */
 function asearch_opt($val, $sel, $tit)
 {
-    return '<option value="' . $val . '"' . ($sel == $val ? ' selected' : '') . '>' . $tit . '</option>' . "\n";
+       return '<option value="' . $val . '"' . ($sel == $val ? ' selected' : '') . '>' . $tit . '</option>' . "\n";
 }
 
 /** Build a <select> statement from an array */
@@ -585,7 +588,8 @@ function asearch_print_form_row($imapConnection, $boxes, $mailbox, $biop, $unop,
        echo '</select>' . "\n";
 
 /* Include Subfolders */
-       echo _("and&nbsp;subfolders:") . '<input type=checkbox name="sub[' . $row_num .']"' . ($sub ? ' CHECKED' : '') . '></td>' . "\n";
+       echo _("and&nbsp;subfolders:") . 
+           addCheckBox('sub[' . $row_num .']', $sub) . '</td>' . "\n";
 
 /* Unary operator and Search location */
        echo html_tag('td',
@@ -594,12 +598,12 @@ function asearch_print_form_row($imapConnection, $boxes, $mailbox, $biop, $unop,
                'center');
 
 /* Text input */
-       $what_disp = htmlspecialchars($what);
-       echo html_tag('td', '<input type="text" size="35" name="what[' . $row_num . ']" value="' . $what_disp . '">', 'center') . "\n";
+       echo html_tag('td', addInput('what['.$row_num.']', $what, '35'), 'center') . "\n";
 
 /* Exclude criteria */
        echo html_tag('td',
-               _("Exclude Criteria:") . '<input type=checkbox name="exclude[' . $row_num .']"' . ($exclude ? ' CHECKED' : '') . '>', 'center', '') . "\n";
+               _("Exclude Criteria:") . sm_print_r($exclude) . 
+               addCheckBox('exclude['.$row_num.']', $exclude), 'center', '') . "\n";
 
        echo "</tr>\n";
 }
@@ -665,12 +669,12 @@ function asearch_print_mailbox_msgs($imapConnection, $mailbox, $msgs, $cnt, $sor
                $mailbox_display = asearch_get_mailbox_display($mailbox);
 
                $msg_cnt_str = get_msgcnt_str(1, $cnt, $cnt);
-               $paginator_str = '<b><big>' . _("Folder:") . ' '. $mailbox_display . '</big></b>';
+               $paginator_str = '<b><big>' . _("Folder:") . ' '. $mailbox_display . '&nbsp;</big></b>';
 
                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, $paginator_str, 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>';  
@@ -1048,6 +1052,8 @@ if ($submit == $search_button_text) {
        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>' . "\n";
 
+       flush();
+
        $query_error = asearch_check_query($where_array, $what_array, $exclude_array);
        if ($query_error != '')
                echo '<br>' . html_tag('div', asearch_get_error_display($color, $query_error), 'center') . "\n";