- /**
- ** addrbook_search.php
- **
- ** Handle addressbook searching in the popup window.
- **
- **/
-
- session_start();
-
- if(!isset($logged_in)) {
- echo _("You must login first.");
- exit;
- }
- if(!isset($username) || !isset($key)) {
- echo _("You need a valid user and password to access this page!");
- exit;
- }
-
- if (!isset($config_php))
- include("../config/config.php");
- if (!isset($array_php))
- include("../functions/array.php");
- if (!isset($strings_php))
- include("../functions/strings.php");
- if (!isset($imap_php))
- include("../functions/imap.php");
- if (!isset($page_header_php))
- include("../functions/page_header.php");
- if (!isset($addressbook_php))
- include("../functions/addressbook.php");
-
- // Authenticate user and load prefs
- $imapConnection = sqimap_login($username, $key,
- $imapServerAddress, $imapPort, 10);
- include("../src/load_prefs.php");
- sqimap_logout ($imapConnection);
-
- displayHtmlHeader();
-
- // Choose correct colors for top and bottom frame
- if($show == "form") {
- echo "<BODY BGCOLOR=\"$color[3]\" TEXT=\"$color[6]\" ";
- echo "LINK=\"$color[6]\" VLINK=\"$color[6]\" ALINK=\"$color[6]\" ";
- echo "OnLoad=\"document.sform.query.focus();\">";
- } else {
- echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" ";
- echo "LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
- }
-
- // Just make a blank page and exit
- if(($show == "blank") || (empty($query) && empty($show))) {
- printf("<P ALIGN=center><BR>%s</P>\n</BODY></HTML>\n",
- _("Search results will display here"));
- exit;
- }
-
- // Create search form
- if($show == "form") {
- printf("<FORM NAME=sform TARGET=abookres ACTION=\"%s\" METHOD=\"POST\">\n",
- $PHP_SELF);
- printf("<TABLE BORDER=0 WIDTH=\"100%%\" HEIGHT=\"100%%\">");
- printf("<TR><TD NOWRAP VALIGN=middle>\n");
- printf(" <STRONG>%s:</STRONG>\n</TD><TD VALIGN=middle>\n",
- _("Search for"));
- printf(" <INPUT TYPE=text NAME=query VALUE=\"%s\" SIZE=30>\n",
- htmlspecialchars($query));
- printf("</TD><TD VALIGN=middle>\n");
- printf(" <INPUT TYPE=submit VALUE=\"%s\">",
- _("Search"));
- printf("</TD><TD WIDTH=\"50%%\" VALIGN=middle ALIGN=right>\n");
- printf("<INPUT TYPE=button VALUE=\"%s\" onclick=\"parent.close();\">\n",
- _("Close window"));
- printf("</TD></TR></TABLE></FORM>\n");
- }
-
- // Include JavaScript code if this is search results
- if(!empty($query)) {
-?>
-<SCRIPT LANGUAGE="Javascript"><!--