removed debugging info
[squirrelmail.git] / src / addrbook_search_html.php
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
38 $body = stripslashes($body);
39 $send_to = stripslashes($send_to);
40 $send_to_cc = stripslashes($send_to_cc);
41 $send_to_bcc = stripslashes($send_to_bcc);
42 $subject = stripslashes($subject);
43
44 echo "<center>";
45 echo "<form method=post action=\"compose.php?html_addr_search=true\">";
46 echo " <input type=text value=\"$query\"name=query>";
47 echo " <input type=submit value=Submit>";
48 echo " <input type=hidden value=\"$body\" name=body>";
49 echo " <input type=hidden value=\"$subject\" name=subject>";
50 echo " <input type=hidden value=\"$send_to\" name=send_to>";
51 echo " <input type=hidden value=\"$send_to_cc\" name=send_to_cc>";
52 echo " <input type=hidden value=\"$send_to_bcc\" name=send_to_bcc>";
53 echo "</form>";
54 echo "</center>";
55
56 if(!empty($query)) {
57 $abook = addressbook_init();
58 $res = $abook->s_search($query);
59
60 if(!is_array($res)) {
61 printf("<P ALIGN=center><BR>%s:<br>%s</P>\n</BODY></HTML>\n",
62 _("Your search failed with the following error(s)"),
63 $abook->error);
64 exit;
65 }
66
67 if(sizeof($res) == 0) {
68 printf("<P ALIGN=center><BR>%s.</P>\n</BODY></HTML>\n",
69 _("No persons matching your search was found"));
70 exit;
71 }
72
73 // List search results
74 $line = 0;
75 print "<table border=0 width=\"98%\" align=center>";
76 printf("<tr bgcolor=\"$color[9]\"><TH align=left>&nbsp;".
77 "<TH align=left>&nbsp;%s<TH align=left>&nbsp;%s".
78 "<TH align=left>&nbsp;%s<TH align=left width=\"10%%\">".
79 "&nbsp;%s</tr>\n",
80 _("Name"), _("E-mail"), _("Info"), _("Source"));
81
82 ?>
83 <form method=post action"compose.php?html_addr_search_done=true">
84 <?
85 echo " <input type=hidden value=\"$body\" name=body>";
86 echo " <input type=hidden value=\"$subject\" name=subject>";
87 echo " <input type=hidden value=\"$send_to\" name=send_to>";
88 echo " <input type=hidden value=\"$send_to_cc\" name=send_to_cc>";
89 echo " <input type=hidden value=\"$send_to_bcc\" name=send_to_bcc>";
90
91 while(list($key, $row) = each($res)) {
92 printf("<tr%s nowrap><td nowrap align=center width=\"5%%\">".
93 "<input type=checkbox name=send_to_search[] value=\"%s\">&nbsp;To".
94 "<input type=checkbox name=send_to_cc_search[] value=\"%s\">&nbsp;Cc&nbsp;".
95 "<td nowrap>&nbsp;%s&nbsp;<td nowrap>&nbsp;".
96 "%s".
97 "<td nowrap>&nbsp;%s&nbsp;<td nowrap>&nbsp;%s</tr>\n",
98 ($line % 2) ? " bgcolor=\"$color[0]\"" : "", $row["email"],
99 $row["email"], $row["name"], $row["email"],
100 $row["label"], $row["source"]);
101 $line++;
102 }
103 print "</TABLE>";
104 echo "<input type=hidden value=1 name=html_addr_search_done>";
105 echo "<center><input type=submit value=addr_search_done name=\"Use Addresses\"></center>";
106 echo "</form>";
107 }
108
109 ?>