c61bb006 |
1 | <?php |
245a6892 |
2 | |
2d367c68 |
3 | /** |
895905c0 |
4 | ** right_main.php |
5 | ** |
6 | ** Copyright (c) 1999-2001 The Squirrelmail Development Team |
7 | ** Licensed under the GNU GPL. For full terms see the file COPYING. |
8 | ** |
9 | ** $Id$ |
10 | **/ |
2d367c68 |
11 | |
245a6892 |
12 | |
ff8a98e7 |
13 | require_once('../src/validate.php'); |
14 | require_once('../functions/imap.php'); |
15 | require_once('../functions/imap_search.php'); |
16 | require_once('../functions/array.php'); |
c61bb006 |
17 | |
99d2a184 |
18 | function s_opt( $val, $sel, $tit ) { |
19 | echo " <option value=\"$val\""; |
20 | if ( $sel ) |
21 | echo 'selected'; |
22 | echo ">$tit</option>\n"; |
23 | } |
24 | |
c61bb006 |
25 | displayPageHeader($color, $mailbox); |
1809bad8 |
26 | $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); |
c61bb006 |
27 | |
91dc6e4e |
28 | do_hook('search_before_form'); |
99d2a184 |
29 | echo "<br>\n". |
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". |
33 | " </td></tr>\n". |
34 | ' <tr><td align=center>'. |
c61bb006 |
35 | |
99d2a184 |
36 | "<FORM ACTION=\"search.php\" NAME=s>\n". |
37 | " <TABLE WIDTH=\"75%\">\n". |
38 | " <TR>\n". |
39 | " <TD WIDTH=\"33%\">\n". |
40 | ' <TT><SMALL><SELECT NAME="mailbox">'; |
c61bb006 |
41 | |
1809bad8 |
42 | $boxes = sqimap_mailbox_list($imapConnection); |
43 | for ($i = 0; $i < count($boxes); $i++) { |
6dc0e464 |
44 | if (!in_array('noselect', $boxes[$i]['flags'])) { |
91dc6e4e |
45 | $box = $boxes[$i]['unformatted']; |
6dc0e464 |
46 | $box2 = str_replace(' ', ' ', $boxes[$i]['unformatted-disp']); |
1809bad8 |
47 | if ($mailbox == $box) |
6dc0e464 |
48 | echo " <OPTION VALUE=\"$box\" SELECTED>$box2</OPTION>\n"; |
1809bad8 |
49 | else |
6dc0e464 |
50 | echo " <OPTION VALUE=\"$box\">$box2</OPTION>\n"; |
c61bb006 |
51 | } |
1809bad8 |
52 | } |
99d2a184 |
53 | echo ' </SELECT></SMALL></TT>'. |
54 | " </TD>\n". |
55 | " <TD ALIGN=\"CENTER\" WIDTH=\"33%\">\n"; |
245a6892 |
56 | if (!isset($what)) |
91dc6e4e |
57 | $what = ''; |
58 | $what_disp = ereg_replace(',', ' ', $what); |
6553723c |
59 | $what_disp = str_replace('\\\\', '\\', $what_disp); |
60 | $what_disp = str_replace('\\"', '"', $what_disp); |
91dc6e4e |
61 | $what_disp = str_replace('"', '"', $what_disp); |
99d2a184 |
62 | echo " <INPUT TYPE=\"TEXT\" SIZE=\"20\" NAME=\"what\" VALUE=\"$what_disp\">\n". |
63 | '</TD>'. |
64 | "<TD ALIGN=\"RIGHT\" WIDTH=\"33%\">\n". |
65 | '<SELECT NAME="where">'; |
66 | |
67 | s_opt( 'BODY', ($where == 'BODY'), _("Body") ); |
68 | s_opt( 'TEXT', ($where == 'TEXT'), _("Everywhere") ); |
69 | s_opt( 'SUBJECT', ($where == 'SUBJECT'), _("Subject") ); |
70 | s_opt( 'FROM', ($where == 'FROM'), _("From") ); |
71 | s_opt( 'CC', ($where == 'CC'), _("Cc") ); |
72 | s_opt( 'TO', ($where == 'TO'), _("To") ); |
73 | |
74 | echo " </SELECT>\n" . |
75 | " </TD>\n". |
76 | " <TD COLSPAN=\"3\" ALIGN=\"CENTER\">\n". |
77 | " <INPUT TYPE=\"submit\" VALUE=\""._("Search")."\">\n". |
78 | " </TD>\n". |
79 | " </TR>\n". |
80 | " </TABLE>\n". |
81 | "</FORM>". |
82 | "</td></tr></table>"; |
06ad27a2 |
83 | do_hook("search_after_form"); |
245a6892 |
84 | if (isset($where) && $where && isset($what) && $what) { |
1809bad8 |
85 | sqimap_mailbox_select($imapConnection, $mailbox); |
86 | sqimap_search($imapConnection, $where, $what, $mailbox, $color); |
87 | } |
06ad27a2 |
88 | do_hook("search_bottom"); |
1809bad8 |
89 | sqimap_logout ($imapConnection); |
c61bb006 |
90 | ?> |
ff8a98e7 |
91 | </body></html> |