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