diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2014-01-15 18:19:20 +0100 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2014-02-11 10:49:41 +0100 |
commit | 82716ced48c256ef5e2f8ca9b7a4e3ab20e146cd (patch) | |
tree | 7b13529874d9886c2c89c7f29ead553109f13b62 | |
parent | 41e8d44cf7261e05a40842ab56d4d4c3f61cf083 (diff) | |
download | nextcloud-server-82716ced48c256ef5e2f8ca9b7a4e3ab20e146cd.tar.gz nextcloud-server-82716ced48c256ef5e2f8ca9b7a4e3ab20e146cd.zip |
sort following entries in alphabetical order
-rw-r--r-- | lib/private/share/searchresultsorter.php | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/private/share/searchresultsorter.php b/lib/private/share/searchresultsorter.php index 27f94a694ac..f64a4766ade 100644 --- a/lib/private/share/searchresultsorter.php +++ b/lib/private/share/searchresultsorter.php @@ -27,7 +27,7 @@ class SearchResultSorter { /** * User and Group names matching the search term at the beginning shall appear - * on top of the share dialog. + * on top of the share dialog. Following entries in alphabetical order. * Callback function for usort. http://php.net/usort */ public function sort($a, $b) { @@ -41,8 +41,9 @@ class SearchResultSorter { $i = mb_strpos($nameA, $this->search, 0, $this->encoding); $j = mb_strpos($nameB, $this->search, 0, $this->encoding); - if($i === $j) { - return 0; + if($i === $j || $i > 0 && $j > 0) { + return strcmp(mb_strtolower($nameA, $this->encoding), + mb_strtolower($nameB, $this->encoding)); } elseif ($i === 0) { return -1; } else { |