8081f0c2178372c076d7923eee42bfdd3d3828da
6 * Copyright (c) 1999-2002 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
12 require_once('../src/validate.php');
13 require_once('../functions/imap.php');
14 require_once('../functions/imap_search.php');
15 require_once('../functions/array.php');
17 function s_opt( $val, $sel, $tit ) {
18 echo " <option value=\"$val\"";
22 echo ">$tit</option>\n";
25 displayPageHeader($color, $mailbox);
26 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
28 do_hook('search_before_form');
30 " <table width=\"95%\" align=center cellpadding=2 cellspacing=0 border=0>\n".
31 " <tr><td bgcolor=\"$color[0]\">\n".
32 " <center><b>"._("Search")."</b></center>\n".
34 ' <tr><td align=center>'.
36 "<FORM ACTION=\"$PHP_SELF\" NAME=s>\n".
37 " <TABLE WIDTH=\"75%\">\n".
39 " <TD WIDTH=\"33%\">\n".
40 ' <TT><SMALL><SELECT NAME="mailbox">';
42 $boxes = sqimap_mailbox_list($imapConnection);
43 for ($i = 0; $i < count($boxes); $i++
) {
44 if (!in_array('noselect', $boxes[$i]['flags'])) {
45 $box = $boxes[$i]['unformatted'];
46 $box2 = str_replace(' ', ' ', $boxes[$i]['unformatted-disp']);
47 if ($mailbox == $box) {
48 echo " <OPTION VALUE=\"$box\" SELECTED>$box2</OPTION>\n";
50 echo " <OPTION VALUE=\"$box\">$box2</OPTION>\n";
54 echo ' </SELECT></SMALL></TT>'.
56 " <TD ALIGN=\"CENTER\" WIDTH=\"33%\">\n";
60 $what_disp = ereg_replace(',', ' ', $what);
61 $what_disp = str_replace('\\\\', '\\', $what_disp);
62 $what_disp = str_replace('\\"', '"', $what_disp);
63 $what_disp = str_replace('"', '"', $what_disp);
64 echo " <INPUT TYPE=\"TEXT\" SIZE=\"20\" NAME=\"what\" VALUE=\"$what_disp\">\n".
66 "<TD ALIGN=\"RIGHT\" WIDTH=\"33%\">\n".
67 '<SELECT NAME="where">';
69 s_opt( 'BODY', ($where == 'BODY'), _("Body") );
70 s_opt( 'TEXT', ($where == 'TEXT'), _("Everywhere") );
71 s_opt( 'SUBJECT', ($where == 'SUBJECT'), _("Subject") );
72 s_opt( 'FROM', ($where == 'FROM'), _("From") );
73 s_opt( 'CC', ($where == 'CC'), _("Cc") );
74 s_opt( 'TO', ($where == 'TO'), _("To") );
78 " <TD COLSPAN=\"3\" ALIGN=\"CENTER\">\n".
79 " <INPUT TYPE=\"submit\" VALUE=\""._("Search")."\">\n".
85 do_hook("search_after_form");
86 if (isset($where) && $where && isset($what) && $what) {
87 sqimap_mailbox_select($imapConnection, $mailbox);
88 sqimap_search($imapConnection, $where, $what, $mailbox, $color);
90 do_hook("search_bottom");
91 sqimap_logout ($imapConnection);
93 echo '</body></html>';