X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Faddrbook_search_html.php;h=54de9f8ff27c002704a2beb7c7e6e63ce4b83ae1;hb=c8d6aef3297916d765b00c96a6c31e5a359dbce4;hp=7a683a4800fd5ebfca7b4152cd8e7cd24e55b6ec;hpb=5a6f29a69178cd63f5ba552a8561f18d555b4af6;p=squirrelmail.git
diff --git a/src/addrbook_search_html.php b/src/addrbook_search_html.php
index 7a683a48..54de9f8f 100644
--- a/src/addrbook_search_html.php
+++ b/src/addrbook_search_html.php
@@ -1,219 +1,273 @@
' . "\n";
- echo '' . "\n";
- echo '' . "\n";
- echo "' . "\n";
- echo "' . "\n";
- echo "' . "\n";
- echo "\n";
- echo "\n";
- }
+/**
+ * addrbook_search_html.php
+ *
+ * Copyright (c) 1999-2002 The SquirrelMail Project Team
+ * Licensed under the GNU GPL. For full terms see the file COPYING.
+ *
+ * Handle addressbook searching with pure html.
+ *
+ * This file is included from compose.php
+ *
+ * NOTE: A lot of this code is similar to the code in
+ * addrbook_search.html -- If you change one, change
+ * the other one too!
+ *
+ * $Id$
+ */
+
+require_once('../src/validate.php');
+require_once('../functions/date.php');
+require_once('../functions/smtp.php');
+require_once('../functions/display_messages.php');
+require_once('../functions/addressbook.php');
+require_once('../functions/plugin.php');
+require_once('../functions/strings.php');
+require_once('../functions/html.php');
- // List search results
- function addr_display_result($res, $includesource = true) {
- global $color, $PHP_SELF;
-
- if(sizeof($res) <= 0) return;
-
- echo '
';
+/* Insert hidden data */
+function addr_insert_hidden() {
+ global $body, $subject, $send_to, $send_to_cc, $send_to_bcc, $mailbox,
+ $identity, $session;
+
+ echo '' . "\n" .
+ '' . "\n" .
+ '' . "\n" .
+ '' . "\n" .
+ '' . "\n" .
+ '' . "\n" .
+ '' . "\n" .
+ '\n" . '' .
+ "\n";
}
- // --- End functions ---
- global $mailbox;
- displayPageHeader($color, $mailbox);
-
- // Initialize addressbook
- $abook = addressbook_init();
+/* List search results */
+function addr_display_result($res, $includesource = true) {
+ global $color, $javascript_on, $PHP_SELF;
-?>
+ if (sizeof($res) <= 0) return;
-
-
+ echo '';
+}
+
+/* --- End functions --- */
+
+global $mailbox;
+if ($compose_new_win == '1') {
+ compose_Header($color, $mailbox);
+}
+else {
+ displayPageHeader($color, $mailbox);
+}
+/* Initialize addressbook */
+$abook = addressbook_init();
+
+
+echo '
' .
+html_tag( 'table',
+ html_tag( 'tr',
+ html_tag( 'td', '' . _("Address Book Search") . '', 'center', $color[0] )
+ ) ,
+'center', '', 'width="95%" cellpadding="2" cellspacing="2" border="0"' );
+
+
+/* Search form */
+echo '' .
+ html_tag( 'table', '', 'center', '', 'border="0"' ) .
+ html_tag( 'tr' ) .
+ html_tag( 'td', '', 'left', '', 'nowrap valign="middle"' ) . "\n" .
+ '' . "\n";
+addr_insert_hidden();
+echo '';
+do_hook('addrbook_html_search_below');
+/* End search form */
+
+/* Show personal addressbook */
+
+if ( !empty( $listall ) ){
+ $addrquery = '*';
+}
+
+if ($addrquery == '' && empty($listall)) {
+
+ if (! isset($backend) || $backend != -1 || $addrquery == '') {
+ if ($addrquery == '') {
$backend = $abook->localbackend;
+ }
- //printf("%s
\n", $abook->backends[$backend]->sname);
+ /* echo '' . $abook->backends[$backend]->sname) . "
\n"; */
- $res = $abook->list_addr($backend);
+ $res = $abook->list_addr($backend);
- if(is_array($res)) {
+ if (is_array($res)) {
+ usort($res,'alistcmp');
addr_display_result($res, false);
- } else {
- printf(""._("Unable to list addresses from %s").
- "
\n", $abook->backends[$backend]->sname);
- }
+ } else {
+ echo html_tag( 'p', '
' .
+ sprintf(_("Unable to list addresses from %s"),
+ $abook->backends[$backend]->sname) . "\n" ,
+ 'center' );
+ }
- } else {
- $res = $abook->list_addr();
- addr_display_result($res, true);
- }
- exit;
-
- } else
-
- // Do the search
- if(!empty($addrquery) && empty($listall)) {
-
- if($backend == -1) {
- $res = $abook->s_search($addrquery);
- } else {
- $res = $abook->s_search($addrquery, $backend);
- }
-
- if(!is_array($res)) {
- printf("
%s:
%s
\n