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