From 75392cc4926b8a5cf8593b84662cf2c5e15be679 Mon Sep 17 00:00:00 2001 From: "Aleksander Machniak (Kolab Systems)" Date: Thu, 28 Jul 2011 12:39:05 +0200 Subject: [PATCH] Make contacts sorting unicode-safe and locale-dependent --- .../kolab_addressbook/lib/rcube_kolab_contacts.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php b/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php index d62a7f3b..0d3b01a4 100644 --- a/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php +++ b/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php @@ -281,7 +281,9 @@ class rcube_kolab_contacts extends rcube_addressbook // sort data arrays according to desired list sorting if ($count = count($ids)) { +$aa = rcube_timer(); uasort($this->contacts, array($this, '_sort_contacts_comp')); +rcube_print_time($aa); // get sorted IDs if ($count != count($this->contacts)) $ids = array_intersect(array_keys($this->contacts), $ids); @@ -1000,7 +1002,14 @@ class rcube_kolab_contacts extends rcube_addressbook } } - return strcasecmp($a_name, $b_name); + // return strcasecmp($a_name, $b_name); + // make sorting unicode-safe and locale-dependent + if ($a_name == $b_name) + return 0; + + $arr = array($a_name, $b_name); + sort($arr, SORT_LOCALE_STRING); + return $a_name == $arr[0] ? -1 : 1; } /**