Testing code removed.
[squirrelmail.git] / src / addrbook_search.php
index dbaff000dfccb656f827fde9803f5b920344c8c6..fca02aff45349c7f7a9da7f6426acfc4aa2ad7ad 100644 (file)
@@ -16,6 +16,7 @@
  */
 
 require_once('../src/validate.php');
+require_once('../functions/strings.php');
 
 /* Function to include JavaScript code */
 function insert_javascript() {
@@ -105,7 +106,7 @@ function display_result($res, $includesource = true) {
     
     while (list($undef, $row) = each($res)) {
         echo '<tr';
-        if ($line % 2) { echo ' bgcolor="' . $color[0] . '"' }
+        if ($line % 2) { echo ' bgcolor="' . $color[0] . '"'; }
         echo ' nowrap><td valign=top nowrap align=center width="5%">' .
              '<small><a href="javascript:to_address(' . 
                                        "'" . $row['email'] . "');\">To</A> | " .
@@ -196,7 +197,7 @@ if ($show == 'form') {
 } else {
 
     /* Show personal addressbook */
-    if ($show == 'blank' || !empty($listall)) {
+    if ($show == 'blank' && empty($listall)) {
 
         if($backend != -1 || $show == 'blank') {
             if ($show == 'blank') {
@@ -205,6 +206,7 @@ if ($show == 'form') {
             $res = $abook->list_addr($backend);
 
             if(is_array($res)) {
+                usort($res,'alistcmp');
                 display_result($res, false);
             } else {
                 echo '<P ALIGN=center><STRONG>' .
@@ -214,13 +216,17 @@ if ($show == 'form') {
             }
         } else {
             $res = $abook->list_addr();
+            usort($res,'alistcmp');
             display_result($res, true);
         }
 
     } else {
+        if( !empty( $listall ) ){
+          $query = '*';
+        }
 
         /* Do the search */
-        if (!empty($query) && empty($listall)) {
+        if (!empty($query)) {
     
             if($backend == -1) {
                 $res = $abook->s_search($query);