added icelandic translation
[squirrelmail.git] / src / search.php
CommitLineData
c61bb006 1<?php
245a6892 2
3 /* $Id$ */
4
c61bb006 5 session_start();
6
7 if(!isset($logged_in)) {
441f2d33 8 set_up_language($squirrelmail_language, true);
c61bb006 9 echo _("You must login first.");
10 exit;
11 }
12 if(!isset($username) || !isset($key)) {
10455998 13 include ("../themes/default_theme.php");
14 include ("../functions/display_messages.php");
15 printf('<html><BODY TEXT="%s" BGCOLOR="%s" LINK="%s" VLINK="%s" ALINK="%s">',
16 $color[8], $color[4], $color[7], $color[7], $color[7]);
17 plain_error_message(_("You need a valid user and password to access this page!")
18 . "<br><a href=\"../src/login.php\">"
19 . _("Click here to log back in.") . "</a>.", $color);
20 echo "</body></html>";
c61bb006 21 exit;
22 }
23
245a6892 24 if (!isset($strings_php))
25 include("../functions/strings.php");
a3432f47 26 if (!isset($i18n_php))
27 include("../functions/i18n.php");
c61bb006 28 if (!isset($config_php))
29 include("../config/config.php");
c61bb006 30 if (!isset($page_header_php))
31 include("../functions/page_header.php");
32 if (!isset($imap_php))
33 include("../functions/imap.php");
1809bad8 34 if (!isset($imap_search_php))
c61bb006 35 include("../functions/imap_search.php");
36 if (!isset($array_php))
37 include("../functions/array.php");
38
39 include("../src/load_prefs.php");
40
41 displayPageHeader($color, $mailbox);
1809bad8 42 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
c61bb006 43
06ad27a2 44 do_hook("search_before_form");
74a7d5b0 45 echo "<br>\n";
46 echo " <table width=95% align=center cellpadding=2 cellspacing=0 border=0>\n";
47 echo " <tr><td bgcolor=\"$color[0]\">\n";
48 echo " <center><b>"._("Search")."</b></center>\n";
49 echo " </td></tr>\n";
50 echo " <tr><td align=center>";
c61bb006 51
d7d3c4d4 52 echo "<FORM ACTION=\"search.php\" NAME=s>\n";
1809bad8 53 echo " <TABLE WIDTH=75%>\n";
54 echo " <TR>\n";
55 echo " <TD WIDTH=33%>\n";
56 echo " <TT><SMALL><SELECT NAME=\"mailbox\">";
c61bb006 57
1809bad8 58 $boxes = sqimap_mailbox_list($imapConnection);
59 for ($i = 0; $i < count($boxes); $i++) {
61423189 60 if (!in_array("noselect", $boxes[$i]["flags"])) {
1809bad8 61 $box = $boxes[$i]["unformatted"];
62 $box2 = replace_spaces($boxes[$i]["formatted"]);
63 if ($mailbox == $box)
64 echo " <OPTION VALUE=\"$box\" SELECTED>$box2\n";
65 else
66 echo " <OPTION VALUE=\"$box\">$box2\n";
c61bb006 67 }
1809bad8 68 }
69 echo " </SELECT></SMALL></TT>";
70 echo " </TD>\n";
71 echo " <TD ALIGN=\"CENTER\" WIDTH=33%>\n";
245a6892 72 if (!isset($what))
73 $what = "";
acb61cb4 74 $what_disp = ereg_replace(",", " ", $what);
75 $what_disp = str_replace("\\\\", "\\", $what_disp);
76 $what_disp = str_replace("\\\"", "\"", $what_disp);
77 $what_disp = str_replace("\"", "&quot;", $what_disp);
78 echo " <INPUT TYPE=\"TEXT\" SIZE=\"20\" NAME=\"what\" VALUE=\"$what_disp\">\n";
1809bad8 79 echo " </TD>";
80 echo " <TD ALIGN=\"RIGHT\" WIDTH=33%>\n";
81 echo " <SELECT NAME=\"where\">";
82
61423189 83 if (isset($where) && $where == "BODY") echo " <OPTION VALUE=\"BODY\" SELECTED>"._("Body")."\n";
35678c48 84 else echo " <OPTION VALUE=\"BODY\">"._("Body")."\n";
85
61423189 86 if (isset($where) && $where == "TEXT") echo " <OPTION VALUE=\"TEXT\" SELECTED>"._("Everywhere")."\n";
1809bad8 87 else echo " <OPTION VALUE=\"TEXT\">"._("Everywhere")."\n";
88
61423189 89 if (isset($where) && $where == "SUBJECT") echo " <OPTION VALUE=\"SUBJECT\" SELECTED>"._("Subject")."\n";
1809bad8 90 else echo " <OPTION VALUE=\"SUBJECT\">"._("Subject")."\n";
91
61423189 92 if (isset($where) && $where == "FROM") echo " <OPTION VALUE=\"FROM\" SELECTED>"._("From")."\n";
1809bad8 93 else echo " <OPTION VALUE=\"FROM\">"._("From")."\n";
94
61423189 95 if (isset($where) && $where == "CC") echo " <OPTION VALUE=\"Cc\" SELECTED>"._("Cc")."\n";
35678c48 96 else echo " <OPTION VALUE=\"CC\">"._("Cc")."\n";
97
61423189 98 if (isset($where) && $where == "TO") echo " <OPTION VALUE=\"TO\" SELECTED>"._("To")."\n";
1809bad8 99 else echo " <OPTION VALUE=\"TO\">"._("To")."\n";
100
101 echo " </SELECT>\n";
102 echo " </TD>\n";
103 echo " <TD COLSPAN=\"3\" ALIGN=\"CENTER\">\n";
104 echo " <INPUT TYPE=\"submit\" VALUE=\""._("Search")."\">\n";
105 echo " </TD>\n";
106 echo " </TR>\n";
107 echo " </TABLE>\n";
108 echo "</FORM>";
109 echo "</td></tr></table>";
06ad27a2 110 do_hook("search_after_form");
245a6892 111 if (isset($where) && $where && isset($what) && $what) {
1809bad8 112 sqimap_mailbox_select($imapConnection, $mailbox);
113 sqimap_search($imapConnection, $where, $what, $mailbox, $color);
114 }
06ad27a2 115 do_hook("search_bottom");
1809bad8 116 sqimap_logout ($imapConnection);
c61bb006 117?>
a1401db6 118</body></html>