X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Faddrbook_search.php;h=8051122a078662e024720d27c9cc4c510559218e;hb=34a6b7c2cede50f12a9ce43fef49e28ce324d3b6;hp=df487f719613bbcf80b4387dcadbd52e6c019d40;hpb=fb16d2197c20586635e987c44f97683e7c8d9b88;p=squirrelmail.git
diff --git a/src/addrbook_search.php b/src/addrbook_search.php
index df487f71..8051122a 100644
--- a/src/addrbook_search.php
+++ b/src/addrbook_search.php
@@ -1,261 +1,260 @@
-
+' .
+ '
' .
+ ' | ' . _("Name") .
+ ' | ' . _("E-mail") .
+ ' | ' . _("Info");
+
+ if ($includesource) {
+ echo ' | ' . _("Source");
+ }
+ echo " |
\n";
+
+ while (list($undef, $row) = each($res)) {
+ echo '' .
+ 'To | " .
+ 'Cc | " .
+ 'Bcc" .
+ ' | ' .
+ $row['name'] . ' | ' .
+ '" . $row['email'] . '' .
+ ' | ' . $row['label'];
+ if ($includesource) {
+ echo ' | ' . $row['source'];
+ }
+
+ echo " |
\n";
+ $line++;
}
- }
+ echo '';
}
-function cc_address($addr) {
- var prefix = "";
- var pwintype = typeof parent.opener.document.compose;
+/* ================= End of functions ================= */
+
+require_once('../functions/array.php');
+require_once('../functions/strings.php');
+require_once('../functions/addressbook.php');
+
+displayHtmlHeader();
+
+/* Initialize vars */
+if (!isset($query)) { $query = ''; }
+if (!isset($show)) { $show = ''; }
+if (!isset($backend)) { $backend = ''; }
+
+/* Choose correct colors for top and bottom frame */
+if ($show == 'form' && !isset($listall)) {
+ echo '';
+} else {
+ echo '\n";
+}
- $addr = $addr.replace(/ {1,35}$/, "");
+/* Empty search */
+if (empty($query) && empty($show) && empty($listall)) {
+ echo '
' .
+ _("No persons matching your search was found") .
+ "
\n\n",
+ exit;
+}
- if(pwintype != "undefined" ) {
- if ( parent.opener.document.compose.send_to_cc.value ) {
- prefix = ", ";
- parent.opener.document.compose.send_to_cc.value =
- parent.opener.document.compose.send_to_cc.value + ", " + $addr;
+/* Initialize addressbook */
+$abook = addressbook_init();
+
+/* Create search form */
+if ($show == 'form' && empty($listall)) {
+ echo '' . "\n";
+} else {
+
+ /* Show personal addressbook */
+ if ($show == 'blank' && empty($listall)) {
+
+ if($backend != -1 || $show == 'blank') {
+ if ($show == 'blank') {
+ $backend = $abook->localbackend;
+ }
+ $res = $abook->list_addr($backend);
+
+ if(is_array($res)) {
+ usort($res,'alistcmp');
+ display_result($res, false);
+ } else {
+ echo '' .
+ sprintf(_("Unable to list addresses from %s"),
+ $abook->backends[$backend]->sname) .
+ '
' . "\n";
+ }
+ } else {
+ $res = $abook->list_addr();
+ usort($res,'alistcmp');
+ display_result($res, true);
+ }
- if(pwintype != "undefined" ) {
- if ( parent.opener.document.compose.send_to_bcc.value ) {
- prefix = ", ";
- parent.opener.document.compose.send_to_bcc.value =
- parent.opener.document.compose.send_to_bcc.value + ", " + $addr;
} else {
- parent.opener.document.compose.send_to_bcc.value = $addr;
+ if( !empty( $listall ) ){
+ $query = '*';
+ }
+
+ /* Do the search */
+ if (!empty($query)) {
+
+ if($backend == -1) {
+ $res = $abook->s_search($query);
+ } else {
+ $res = $abook->s_search($query, $backend);
+ }
+
+ if (!is_array($res)) {
+ echo '
' .
+ _("Your search failed with the following error(s)") .
+ ':
' . $abook->error . "
\n