c1e15177 |
1 | <?php |
2 | /** |
3 | ** addrbook_search.php |
4 | ** |
5 | ** Handle addressbook searching with pure html. This file is included from compose.php |
6 | ** |
7 | **/ |
8 | |
9 | session_start(); |
10 | |
11 | if (!isset($config_php)) |
12 | include("../config/config.php"); |
13 | if (!isset($strings_php)) |
14 | include("../functions/strings.php"); |
15 | if (!isset($page_header_php)) |
16 | include("../functions/page_header.php"); |
17 | if (!isset($imap_php)) |
18 | include("../functions/imap.php"); |
19 | if (!isset($date_php)) |
20 | include("../functions/date.php"); |
21 | if (!isset($mime_php)) |
22 | include("../functions/mime.php"); |
23 | if (!isset($smtp_php)) |
24 | include("../functions/smtp.php"); |
25 | if (!isset($display_messages_php)) |
26 | include("../functions/display_messages.php"); |
27 | if (!isset($addressbook_php)) |
28 | include("../functions/addressbook.php"); |
29 | |
30 | include("../src/load_prefs.php"); |
31 | |
32 | |
33 | echo "<HTML><BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n"; |
34 | displayPageHeader($color, "None"); |
35 | //<form method=post action="compose.php?html_addr_search=true"> |
36 | |
37 | echo "<center>"; |
38 | echo "<form method=post action=\"addrbook_search_html.php\">"; |
39 | echo " <input type=text value=\"$query\"name=query>"; |
40 | echo " <input type=submit value=Submit>"; |
41 | echo "</form>"; |
42 | echo "</center>"; |
43 | |
44 | if(!empty($query)) { |
45 | $abook = addressbook_init(); |
46 | $res = $abook->s_search($query); |
47 | |
48 | if(!is_array($res)) { |
49 | printf("<P ALIGN=center><BR>%s:<br>%s</P>\n</BODY></HTML>\n", |
50 | _("Your search failed with the following error(s)"), |
51 | $abook->error); |
52 | exit; |
53 | } |
54 | |
55 | if(sizeof($res) == 0) { |
56 | printf("<P ALIGN=center><BR>%s.</P>\n</BODY></HTML>\n", |
57 | _("No persons matching your search was found")); |
58 | exit; |
59 | } |
60 | |
61 | // List search results |
62 | $line = 0; |
63 | print "<table border=0 width=\"98%\" align=center>"; |
64 | printf("<tr bgcolor=\"$color[9]\"><TH align=left> ". |
65 | "<TH align=left> %s<TH align=left> %s". |
66 | "<TH align=left> %s<TH align=left width=\"10%%\">". |
67 | " %s</tr>\n", |
68 | _("Name"), _("E-mail"), _("Info"), _("Source")); |
69 | |
70 | while(list($key, $row) = each($res)) { |
71 | printf("<tr%s nowrap><td nowrap align=center width=\"5%%\">". |
72 | "<a href=\"compose.php?send_to=%s\">To</A> | ". |
73 | "<a href=\"compose.php?send_to_cc=%s\">Cc</A>". |
74 | "<td nowrap> %s <td nowrap> ". |
75 | "<a href=\"compose.php?send_to=%s\">%s</A> ". |
76 | "<td nowrap> %s <td nowrap> %s</tr>\n", |
77 | ($line % 2) ? " bgcolor=\"$color[0]\"" : "", $row["email"], |
78 | $row["email"], $row["name"], $row["email"], $row["email"], |
79 | $row["label"], $row["source"]); |
80 | $line++; |
81 | } |
82 | print "</TABLE>"; |
83 | } |
84 | |
85 | ?> |