X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Faddrbook_search.php;h=b9bedc0221d5c62de30a0302002ffd44db6cd6fe;hb=cb850f18ebe1712284fdd77dbad78f4e0c059193;hp=a8dd816ae8cfb43bd36bc5628b6e8030c2d525b4;hpb=6ee631f7b92f6a205e0841ac40e6b0e763a5a734;p=squirrelmail.git
diff --git a/src/addrbook_search.php b/src/addrbook_search.php
index a8dd816a..b9bedc02 100644
--- a/src/addrbook_search.php
+++ b/src/addrbook_search.php
@@ -1,248 +1,259 @@
-
+' .
+ '
' .
+ ' | ' . _("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 = ''; }
+
+/* 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);
+ }
-function bcc_address($addr) {
- var prefix = "";
- var pwintype = typeof parent.opener.document.compose;
-
- $addr = $addr.replace(/ {1,35}$/, "");
-
- 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