X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Faddrbook_search.php;h=8051122a078662e024720d27c9cc4c510559218e;hb=acc28bac454795b76c712bd9fd20b38d973be9e4;hp=9557065cf1f74af43075cf0a90a5c0c613912141;hpb=9487c2ff3a9d36af3dc93bd231a6f85fe7a6f762;p=squirrelmail.git
diff --git a/src/addrbook_search.php b/src/addrbook_search.php
index 9557065c..8051122a 100644
--- a/src/addrbook_search.php
+++ b/src/addrbook_search.php
@@ -1,244 +1,260 @@
-
-
';
- printf("
".
- " | %s | %s".
- " | %s",
- _("Name"), _("E-mail"), _("Info"));
-
- if($includesource)
- printf(" | %s", _("Source"));
-
- echo " |
\n";
-
- while(list($undef, $row) = each($res)) {
- printf("".
- "To | ".
- "Cc | ".
- "Bcc".
- " | %s | ".
- " %s ".
- " | %s ",
- ($line % 2) ? " bgcolor=\"$color[0]\"" : "",
- $row["email"], $row["email"], $row["email"],
- $row["name"], $row["email"], $row["email"],
- $row["label"]);
-
- if($includesource)
- printf(" | %s", $row["source"]);
+ $line = 0;
+ echo '' .
+ ' ' .
+ ' | ' . _("Name") .
+ ' | ' . _("E-mail") .
+ ' | ' . _("Info");
+
+ if ($includesource) {
+ echo ' | ' . _("Source");
+ }
+ echo " | \n";
- echo "\n";
- $line++;
+ while (list($undef, $row) = each($res)) {
+ echo '' .
+ 'To | " .
+ 'Cc | " .
+ 'Bcc" .
+ ' | ' .
+ $row['name'] . ' | ' .
+ '" . $row['email'] . '' .
+ ' | ' . $row['label'];
+ if ($includesource) {
+ echo ' | ' . $row['source'];
}
- echo ' | ';
+
+ echo " |
\n";
+ $line++;
}
+ echo '';
+}
- /* ================= End of functions ================= */
+/* ================= End of functions ================= */
- require_once('../functions/array.php');
- require_once('../functions/strings.php');
- require_once('../functions/addressbook.php');
+require_once('../functions/array.php');
+require_once('../functions/strings.php');
+require_once('../functions/addressbook.php');
- displayHtmlHeader();
+displayHtmlHeader();
- // Initialize vars
- if(!isset($query)) $query = "";
- if(!isset($show)) $show = "";
-
- // Choose correct colors for top and bottom frame
- if($show == 'form') {
- echo "';
- } else {
- echo "\n";
- }
+/* Initialize vars */
+if (!isset($query)) { $query = ''; }
+if (!isset($show)) { $show = ''; }
+if (!isset($backend)) { $backend = ''; }
- // Empty search
- if(empty($query) && empty($show) && empty($listall)) {
- printf("
%s
\n\n",
- _("No persons matching your search was found"));
- exit;
- }
+/* Choose correct colors for top and bottom frame */
+if ($show == 'form' && !isset($listall)) {
+ echo '';
+} else {
+ echo '\n";
+}
- // Initialize addressbook
- $abook = addressbook_init();
-
- // Create search form
- if($show == 'form') {
- echo "' . "\n";
+} else {
+
+ /* Show personal addressbook */
+ if ($show == 'blank' && empty($listall)) {
if($backend != -1 || $show == 'blank') {
- if($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 {
- printf(""._("Unable to list addresses from %s").
- "
\n", $abook->backends[$backend]->sname);
+ echo '' .
+ sprintf(_("Unable to list addresses from %s"),
+ $abook->backends[$backend]->sname) .
+ '
' . "\n";
}
-
} else {
- $res = $abook->list_addr();
- display_result($res, true);
+ $res = $abook->list_addr();
+ usort($res,'alistcmp');
+ display_result($res, true);
}
- } else
+ } else {
+ if( !empty( $listall ) ){
+ $query = '*';
+ }
- // Do the search
- if(!empty($query) && empty($listall)) {
+ /* Do the search */
+ if (!empty($query)) {
- if($backend == -1) {
- $res = $abook->s_search($query);
- } else {
- $res = $abook->s_search($query, $backend);
- }
+ if($backend == -1) {
+ $res = $abook->s_search($query);
+ } else {
+ $res = $abook->s_search($query, $backend);
+ }
- if(!is_array($res)) {
- printf("
%s:
%s
\n