Removal of %> for those with asp on.
[squirrelmail.git] / src / search.php
CommitLineData
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
18 displayPageHeader($color, $mailbox);
1809bad8 19 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
c61bb006 20
91dc6e4e 21 do_hook('search_before_form');
74a7d5b0 22 echo "<br>\n";
23 echo " <table width=95% align=center cellpadding=2 cellspacing=0 border=0>\n";
24 echo " <tr><td bgcolor=\"$color[0]\">\n";
25 echo " <center><b>"._("Search")."</b></center>\n";
26 echo " </td></tr>\n";
91dc6e4e 27 echo ' <tr><td align=center>';
c61bb006 28
d7d3c4d4 29 echo "<FORM ACTION=\"search.php\" NAME=s>\n";
6dc0e464 30 echo " <TABLE WIDTH=\"75%\">\n";
1809bad8 31 echo " <TR>\n";
6dc0e464 32 echo " <TD WIDTH=\"33%\">\n";
91dc6e4e 33 echo ' <TT><SMALL><SELECT NAME="mailbox">';
c61bb006 34
1809bad8 35 $boxes = sqimap_mailbox_list($imapConnection);
36 for ($i = 0; $i < count($boxes); $i++) {
6dc0e464 37 if (!in_array('noselect', $boxes[$i]['flags'])) {
91dc6e4e 38 $box = $boxes[$i]['unformatted'];
6dc0e464 39 $box2 = str_replace(' ', '&nbsp;', $boxes[$i]['unformatted-disp']);
1809bad8 40 if ($mailbox == $box)
6dc0e464 41 echo " <OPTION VALUE=\"$box\" SELECTED>$box2</OPTION>\n";
1809bad8 42 else
6dc0e464 43 echo " <OPTION VALUE=\"$box\">$box2</OPTION>\n";
c61bb006 44 }
1809bad8 45 }
91dc6e4e 46 echo ' </SELECT></SMALL></TT>';
1809bad8 47 echo " </TD>\n";
6dc0e464 48 echo " <TD ALIGN=\"CENTER\" WIDTH=\"33%\">\n";
245a6892 49 if (!isset($what))
91dc6e4e 50 $what = '';
51 $what_disp = ereg_replace(',', ' ', $what);
6553723c 52 $what_disp = str_replace('\\\\', '\\', $what_disp);
53 $what_disp = str_replace('\\"', '"', $what_disp);
91dc6e4e 54 $what_disp = str_replace('"', '&quot;', $what_disp);
acb61cb4 55 echo " <INPUT TYPE=\"TEXT\" SIZE=\"20\" NAME=\"what\" VALUE=\"$what_disp\">\n";
91dc6e4e 56 echo ' </TD>';
6dc0e464 57 echo " <TD ALIGN=\"RIGHT\" WIDTH=\"33%\">\n";
91dc6e4e 58 echo ' <SELECT NAME="where">';
1809bad8 59
91dc6e4e 60 if (isset($where) && $where == 'BODY') echo ' <OPTION VALUE="BODY" SELECTED>'._("Body")."\n";
61 else echo ' <OPTION VALUE="BODY">'._("Body")."\n";
35678c48 62
91dc6e4e 63 if (isset($where) && $where == 'TEXT') echo ' <OPTION VALUE="TEXT" SELECTED>'._("Everywhere")."\n";
64 else echo ' <OPTION VALUE="TEXT">'._("Everywhere")."\n";
1809bad8 65
91dc6e4e 66 if (isset($where) && $where == 'SUBJECT') echo ' <OPTION VALUE="SUBJECT" SELECTED>'._("Subject")."\n";
67 else echo ' <OPTION VALUE="SUBJECT">'._("Subject")."\n";
1809bad8 68
91dc6e4e 69 if (isset($where) && $where == 'FROM') echo ' <OPTION VALUE="FROM" SELECTED>'._("From")."\n";
70 else echo ' <OPTION VALUE="FROM">'._("From")."\n";
1809bad8 71
91dc6e4e 72 if (isset($where) && $where == 'CC') echo ' <OPTION VALUE="Cc" SELECTED>'._("Cc")."\n";
73 else echo ' <OPTION VALUE="CC">'._("Cc")."\n";
35678c48 74
91dc6e4e 75 if (isset($where) && $where == 'TO') echo ' <OPTION VALUE="TO" SELECTED>'._("To")."\n";
76 else echo ' <OPTION VALUE="TO">'._("To")."\n";
1809bad8 77
78 echo " </SELECT>\n";
79 echo " </TD>\n";
80 echo " <TD COLSPAN=\"3\" ALIGN=\"CENTER\">\n";
81 echo " <INPUT TYPE=\"submit\" VALUE=\""._("Search")."\">\n";
82 echo " </TD>\n";
83 echo " </TR>\n";
84 echo " </TABLE>\n";
85 echo "</FORM>";
86 echo "</td></tr></table>";
06ad27a2 87 do_hook("search_after_form");
245a6892 88 if (isset($where) && $where && isset($what) && $what) {
1809bad8 89 sqimap_mailbox_select($imapConnection, $mailbox);
90 sqimap_search($imapConnection, $where, $what, $mailbox, $color);
91 }
06ad27a2 92 do_hook("search_bottom");
1809bad8 93 sqimap_logout ($imapConnection);
c61bb006 94?>
ff8a98e7 95</body></html>