X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Faddrbook_search.php;h=e7947ab79b8ec448e24a9fdceaf87a20d323e419;hb=d04cab4213efb37756cced1d8dcbb8bd22280ac2;hp=1c172079dcc0ed3c81eee8f52dbdd097b060a74e;hpb=dfadb5533df0c17fa7737d4aaf5738064b55429e;p=squirrelmail.git diff --git a/src/addrbook_search.php b/src/addrbook_search.php index 1c172079..e7947ab7 100644 --- a/src/addrbook_search.php +++ b/src/addrbook_search.php @@ -1,188 +1,310 @@ - +/** + * addrbook_search.php + * + * Copyright (c) 1999-2005 The SquirrelMail Project Team + * Licensed under the GNU GPL. For full terms see the file COPYING. + * + * Handle addressbook searching in the popup window. + * + * NOTE: A lot of this code is similar to the code in + * addrbook_search_html.html -- If you change one, + * change the other one too! + * + * @version $Id$ + * @package squirrelmail + * @subpackage addressbook + */ + +/** + * Path for SquirrelMail required files. + * @ignore + */ +define('SM_PATH','../'); + +/** SquirrelMail required files. */ +require_once(SM_PATH . 'include/validate.php'); +require_once(SM_PATH . 'functions/strings.php'); +require_once(SM_PATH . 'functions/global.php'); +require_once(SM_PATH . 'functions/html.php'); +require_once(SM_PATH . 'functions/forms.php'); + +/** lets get the global vars we may need */ +sqgetGlobalVar('key', $key, SQ_COOKIE); +sqgetGlobalVar('username', $username, SQ_SESSION); +sqgetGlobalVar('onetimepad',$onetimepad, SQ_SESSION); +sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION); + +sqgetGlobalVar('show' , $show); +sqgetGlobalVar('query', $query, SQ_POST); +sqgetGlobalVar('listall', $listall, SQ_POST); +sqgetGlobalVar('backend', $backend, SQ_POST); + +/** + * Function to include JavaScript code + * @return void + */ +function insert_javascript() { + ?> + "; - } else { - echo "\n"; - } - - // Just make a blank page and exit - if(($show == "blank") || (empty($query) && empty($show))) { - printf("


%s

\n\n", - _("Search results will display here")); - exit; - } - - // Create search form - if($show == "form") { - printf("
\n", - $PHP_SELF); - printf(""); - printf("
\n"); - printf(" %s:\n\n", - _("Search for")); - printf(" \n", - htmlspecialchars($query)); - printf("\n"); - printf(" ", - _("Search")); - printf("\n"); - printf("\n", - _("Close window")); - printf("
\n"); - } - - // Include JavaScript code if this is search results - if(!empty($query)) { -?> - - -s_search($query); - - if(!is_array($res)) { - printf("


%s:
%s

\n\n", - _("Your search failed with the following error(s)"), - $abook->error); - exit; - } - - if(sizeof($res) == 0) { - printf("


%s.

\n\n", - _("No persons matching your search was found")); - exit; - } - - // List search results - $line = 0; - print ""; - printf("\n", - _("Name"), _("E-mail"), _("Info"), _("Source")); - - while(list($key, $row) = each($res)) { - printf("\n", - ($line % 2) ? " bgcolor=\"$color[0]\"" : "", $row["email"], - $row["email"], $row["name"], $row["email"], $row["label"], - $row["source"]); - $line++; - } - print "
 ". - " %s %s". - " %s". - " %s
". - "To | ". - "Cc". - " %s  %s ". - " %s  %s
"; - } +} ?> - - + \ No newline at end of file