sorting of addressbook_search fixed, thanks to the patch of Cor Bosman (xs4all)
authorteepe <teepe@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 25 Dec 2001 23:16:34 +0000 (23:16 +0000)
committerteepe <teepe@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 25 Dec 2001 23:16:34 +0000 (23:16 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1950 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/addressbook.php
src/addrbook_search.php
src/addrbook_search_html.php
src/addressbook.php

index 92f298c2bea5cad7849604e45a60c490394cfeb5..4432751b2fa0ba4a2b61e43fa1353a13e007c878 100644 (file)
@@ -314,7 +314,6 @@ class AddressBook {
         return $ret;
     }
 
-
     /*
      * Create a new address from $userdata, in backend $bnum.
      * Return the backend number that the/ address was added
@@ -511,4 +510,16 @@ class addressbook_backend {
 
 }
 
+/* Sort array by the key "name" */
+function alistcmp($a,$b) {
+    if ($a['backend'] > $b['backend']) {
+        return 1;
+    } else {
+        if ($a['backend'] < $b['backend']) {
+            return -1;
+        }
+    }
+    return (strtolower($a['name']) > strtolower($b['name'])) ? 1 : -1;
+}
+
 ?>
index 2adb5ad5a1802616fb0c749af59e9b04912c5ded..46e6cdc743cd6473ae0a565f6f44b026cb8ad367 100644 (file)
@@ -205,6 +205,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,6 +215,7 @@ if ($show == 'form') {
             }
         } else {
             $res = $abook->list_addr();
+            usort($res,'alistcmp');
             display_result($res, true);
         }
 
index a1604e6de2da0a84338d10846d0b471601d7c65f..49fd3b63aafdfb47e3aaaa0923b30d66ae9df94c 100644 (file)
@@ -168,6 +168,7 @@ if ($addrquery == '' || !empty($listall)) {
         $res = $abook->list_addr($backend);
 
         if (is_array($res)) {
+            usort($res,'alistcmp');
             addr_display_result($res, false);
         } else {
             echo '<P ALIGN=center><STRONG>' .
@@ -178,6 +179,7 @@ if ($addrquery == '' || !empty($listall)) {
 
     } else {
         $res = $abook->list_addr();
+        usort($res,'alistcmp');
         addr_display_result($res, true);
     }
     exit;
index 64baea9626746a916230b6c4a8a646a945ab05e8..550b430eded0605ccf19e649581caa0a2ad07698 100644 (file)
@@ -16,18 +16,6 @@ require_once('../functions/array.php');
 require_once('../functions/display_messages.php');
 require_once('../functions/addressbook.php');
 
-/* Sort array by the key "name" */
-function alistcmp($a,$b) {
-    if($a['backend'] > $b['backend']) {
-        return 1;
-    } else {
-        if($a['backend'] < $b['backend']) {
-            return -1;
-        }
-    }
-    return (strtolower($a['name']) > strtolower($b['name'])) ? 1 : -1;
-}
-
 /* Make an input field */
 function adressbook_inp_field($label, $field, $name, $size, $values, $add) {
     global $color;