diff options
author | Qingping Hou <dave2008713@gmail.com> | 2013-02-18 18:05:58 -0500 |
---|---|---|
committer | Qingping Hou <dave2008713@gmail.com> | 2013-02-18 18:05:58 -0500 |
commit | 2c78c5ccab763a74210ec8684f4582d0972e694e (patch) | |
tree | 7b3f97f44f2cfbe249256ddc4f9b38ffacc2f1a4 /lib | |
parent | c8e02060c1259760a18b9c9b0ac609088fd3015c (diff) | |
download | nextcloud-server-2c78c5ccab763a74210ec8684f4582d0972e694e.tar.gz nextcloud-server-2c78c5ccab763a74210ec8684f4582d0972e694e.zip |
bug fix for issue 1739, two changes included:
* fix typo in OC_Group_Database::DisplayNamesInGroup's SQL clause
* check array_diff return value in OC_Group::displayNamesInGroups,
when there is no difference between two arrays, it will return
NULL, so we have to take care of it.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/group.php | 15 | ||||
-rw-r--r-- | lib/group/database.php | 2 |
2 files changed, 9 insertions, 8 deletions
diff --git a/lib/group.php b/lib/group.php index 6afe1440030..8c06ddc0fd0 100644 --- a/lib/group.php +++ b/lib/group.php @@ -308,15 +308,16 @@ class OC_Group { * @return array with display names (Key) user ids (value)
*/
public static function displayNamesInGroups($gids, $search = '', $limit = -1, $offset = 0) {
- $displayNames = array();
+ $displayNames = array(); foreach ($gids as $gid) {
// TODO Need to apply limits to groups as total
- $displayNames = array_merge( - array_diff( - self::displayNamesInGroup($gid, $search, $limit, $offset), - $displayNames - ), - $displayNames); + $diff = array_diff( + self::displayNamesInGroup($gid, $search, $limit, $offset), + $displayNames + ); + if ($diff) { + $displayNames = array_merge($diff, $displayNames); + } }
return $displayNames;
} diff --git a/lib/group/database.php b/lib/group/database.php index 8816dd8169c..93dc05c53a1 100644 --- a/lib/group/database.php +++ b/lib/group/database.php @@ -225,7 +225,7 @@ class OC_Group_Database extends OC_Group_Backend { $stmt = OC_DB::prepare('SELECT `*PREFIX*users`.`uid`, `*PREFIX*users`.`displayname`' .' FROM `*PREFIX*users`' .' INNER JOIN `*PREFIX*group_user` ON `*PREFIX*group_user`.`uid` = `*PREFIX*users`.`uid`' - .' WHERE `gid` = ? AND `*PREFIX*group_user.uid` LIKE ?', + .' WHERE `gid` = ? AND `*PREFIX*group_user`.`uid` LIKE ?', $limit, $offset); $result = $stmt->execute(array($gid, $search.'%'));
|