/**
* addrbook_search.php
*
- * Copyright (c) 1999-2002 The SquirrelMail Project Team
+ * Copyright (c) 1999-2004 The SquirrelMail Project Team
* Licensed under the GNU GPL. For full terms see the file COPYING.
*
* Handle addressbook searching in the popup window.
* addrbook_search_html.html -- If you change one,
* change the other one too!
*
- * $Id$
+ * @version $Id$
+ * @package squirrelmail
*/
-/* Path for SquirrelMail required files. */
+/**
+ * Path for SquirrelMail required files.
+ * @ignore
+ */
define('SM_PATH','../');
-/* SquirrelMail required files. */
+/** 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 */
+/**
+ * Function to include JavaScript code
+ * @return void
+ */
function insert_javascript() {
?>
<SCRIPT LANGUAGE="Javascript"><!--
} /* End of included JavaScript */
-/* List search results */
+/**
+ * List search results
+ * @param array $res Array of search results
+ * @param bool $includesource [Default=true]
+ * @return void
+ */
function display_result($res, $includesource = true) {
global $color;
/* ================= End of functions ================= */
-require_once('../functions/array.php');
require_once('../functions/strings.php');
require_once('../functions/addressbook.php');
/* Empty search */
if (empty($query) && empty($show) && empty($listall)) {
echo html_tag( 'p', '<br>' .
- _("No persons matching your search was found"),
+ _("No persons matching your search were found"),
'center' ) .
"\n</BODY></HTML>\n",
exit;
html_tag( 'tr' ) .
html_tag( 'td', ' <strong>' . _("Search for") . "</strong>\n", 'left', '', 'nowrap valign="middle" width="10%"' ) .
html_tag( 'td', '', 'left', '', '' ) .
- '<INPUT TYPE=text NAME=query VALUE="' . htmlspecialchars($query) .
- "\" SIZE=28>\n";
+ addInput('query', $query, 28);
/* List all backends to allow the user to choose where to search */
if ($abook->numbackends > 1) {
- echo '<STRONG>' . _("in") . '</STRONG> <SELECT NAME=backend>'."\n".
- '<OPTION VALUE=-1 SELECTED>' . _("All address books") . "\n";
+ echo '<STRONG>' . _("in") . '</STRONG> '."\n".
+ $selopts['-1'] = _("All address books");
+
$ret = $abook->get_backend_list();
while (list($undef,$v) = each($ret)) {
- echo '<OPTION VALUE=' . $v->bnum . '>' . $v->sname . "\n";
+ $selopts[$v->bnum] = $v->sname;
}
- echo "</SELECT>\n";
+ echo addSelect('backend', $selopts, '-1', TRUE);
} else {
- echo '<INPUT TYPE=hidden NAME=backend VALUE=-1>' . "\n";
+ echo addHidden('backend', '-1');
}
echo '</td></tr>' .
if (sizeof($res) == 0) {
echo html_tag( 'p', '<br><b>' .
- _("No persons matching your search was found") . "</b>\n" ,
+ _("No persons matching your search were found") . "</b>\n" ,
'center' ) .
"\n</BODY></HTML>\n";
exit;