X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Faddrbook_search_html.php;h=4ff7aca37b8c926608b22954adb539a9bf028398;hb=0e8c1c9a1191a7dfae532c959e30a8a846a131e7;hp=6f8259ffd89dc3c5e5b85ff4e74e448026bcabea;hpb=d7d3c4d435ff1820555e557fcccc9a9d52bf9e93;p=squirrelmail.git diff --git a/src/addrbook_search_html.php b/src/addrbook_search_html.php index 6f8259ff..4ff7aca3 100644 --- a/src/addrbook_search_html.php +++ b/src/addrbook_search_html.php @@ -12,44 +12,38 @@ ** 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$ **/ - session_start(); - - if (!isset($config_php)) - include("../config/config.php"); - if (!isset($strings_php)) - include("../functions/strings.php"); - if (!isset($auth_php)) - include("../functions/auth.php"); - if (!isset($page_header_php)) - include("../functions/page_header.php"); - if (!isset($date_php)) - include("../functions/date.php"); - if (!isset($smtp_php)) - include("../functions/smtp.php"); - if (!isset($display_messages_php)) - include("../functions/display_messages.php"); - if (!isset($addressbook_php)) - include("../functions/addressbook.php"); - if (!isset($plugin_php)) - include("../functions/plugin.php"); - - include("../src/load_prefs.php"); + include('../src/validate.php'); + include('../functions/strings.php'); + include('../config/config.php'); + include('../functions/page_header.php'); + include('../functions/date.php'); + include('../functions/smtp.php'); + include('../functions/display_messages.php'); + include('../functions/addressbook.php'); + include('../functions/plugin.php'); + include('../src/load_prefs.php'); // Insert hidden data function addr_insert_hidden() { global $body, $subject, $send_to, $send_to_cc, $send_to_bcc; - printf("\n", - htmlspecialchars($body)); - printf("\n", - htmlspecialchars($subject)); - printf("\n", - htmlspecialchars($send_to)); - printf("\n", - htmlspecialchars($send_to_cc)); - printf("\n", - htmlspecialchars($send_to_bcc)); + + echo '' . "\n"; + echo '' . "\n"; + echo '' . "\n"; + echo "' . "\n"; + echo "' . "\n"; + echo "\n"; } @@ -59,127 +53,132 @@ if(sizeof($res) <= 0) return; - printf('
'."\n", - $PHP_SELF); + echo '\n"; + echo ''; + echo "\n"; addr_insert_hidden(); $line = 0; print ""; printf("\n"; - while(list($key, $row) = each($res)) { - printf("\n"; - $line++; + foreach ($res as $row) { + echo ''; + echo ''; + echo ''; + if($includesource) + echo ''; + echo "\n"; + $line ++; } printf('', - 4 + ($includesource ? 1 : 0), - _("Use Addresses")); - print "
 ". - " %s %s". - " %s", - _("Name"), _("E-mail"), _("Info")); + " %s %s". + " %s", + _("Name"), _("E-mail"), _("Info")); if($includesource) - printf(" %s", _("Source")); + printf(" %s", _("Source")); print "
". - " To". - " Cc ". - " %s  ". - "%s". - " %s ", - ($line % 2) ? " bgcolor=\"$color[0]\"" : "", - htmlspecialchars($row["email"]), htmlspecialchars($row["email"]), - $row["name"], $row["email"], $row["label"]); - if($includesource) - printf(" %s", $row["source"]); - - print "
'; + echo ' To '; + echo ' Cc '; + echo ' Bcc '; + echo ' ' . $row['name'] . '  ' . $row['email'] . '  ' . $row['label'] . '  ' . $row['source'] . ' 
"; + 'NAME="addr_search_done" VALUE="%s">', + 4 + ($includesource ? 1 : 0), + _("Use Addresses")); + print ''; print ''; - print "
"; + print ''; } // --- End functions --- - displayPageHeader($color, "None"); - + displayPageHeader($color, 'None'); + // Initialize addressbook $abook = addressbook_init(); - $body = stripslashes($body); - $send_to = stripslashes($send_to); - $send_to_cc = stripslashes($send_to_cc); - $send_to_bcc = stripslashes($send_to_bcc); - $subject = stripslashes($subject); - +?> - // Header - print "\n"; - printf('', - $color[0], _("Address Book Search")); - print "
%s
\n"; +
+ +
+
+
+\n"; - printf('
'."\n", - $PHP_SELF); print "\n"; - printf("
\n"); - printf(" %s\n", _("Search for")); + print "
\n"; + printf(''."\n", $PHP_SELF); + print "
\n"; + printf(" %s\n", _("Search for")); + addr_insert_hidden(); + if (! isset($addrquery)) + $addrquery = ''; printf(" \n", - htmlspecialchars($addrquery)); + htmlspecialchars($addrquery)); // List all backends to allow the user to choose where to search + if(!isset($backend)) $backend = ""; if($abook->numbackends > 1) { printf("%s \n"); + while(list($undef,$v) = each($ret)) + printf("
\n"); + _("List all")); + print '
'; + + print "\n"; addr_insert_hidden(); - print ""; print ""; - do_hook("addrbook_html_search_below"); + do_hook('addrbook_html_search_below'); // End search form // Show personal addressbook - if(!isset($addrquery) || !empty($listall)) { + if($addrquery == '' || !empty($listall)) { - if($backend != -1 || !isset($addrquery)) { - if(!isset($addrquery)) - $backend = $abook->localbackend; + if(! isset($backend) || $backend != -1 || $addrquery == '') { + if($addrquery == '') + $backend = $abook->localbackend; - //printf("

%s

\n", $abook->backends[$backend]->sname); + //printf("

%s

\n", $abook->backends[$backend]->sname); - $res = $abook->list_addr($backend); + $res = $abook->list_addr($backend); - if(is_array($res)) { - addr_display_result($res, false); - } else { - printf("

"._("Unable to list addresses from %s"). - "

\n", $abook->backends[$backend]->sname); - } + if(is_array($res)) { + addr_display_result($res, false); + } else { + printf("

"._("Unable to list addresses from %s"). + "

\n", $abook->backends[$backend]->sname); + } } else { - $res = $abook->list_addr(); - addr_display_result($res, true); + $res = $abook->list_addr(); + addr_display_result($res, true); } + exit; } else @@ -187,26 +186,30 @@ if(!empty($addrquery) && empty($listall)) { if($backend == -1) { - $res = $abook->s_search($addrquery); + $res = $abook->s_search($addrquery); } else { - $res = $abook->s_search($addrquery, $backend); + $res = $abook->s_search($addrquery, $backend); } 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; + printf("


%s:
%s

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


%s.

\n\n", + _("No persons matching your search was found")); + } else { + addr_display_result($res); } - - addr_display_result($res); } + if ($addrquery == '' || sizeof($res) == 0) { + printf('
'."\n", $PHP_SELF); + addr_insert_hidden(); + printf("\n", _("Return")); + print '
'; + print '
'; + } + ?>