summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2014-06-23 12:03:09 +0200
committerArthur Schiwon <blizzz@owncloud.com>2014-06-23 12:03:09 +0200
commit01a012980afa1bed5b2db1006a9d6443f19e3d5f (patch)
treea23cc92c34b29e565bb650de8f9527b5aecebe03
parent81ecbbb0614ecfe9953d813f92424f299a1e2834 (diff)
downloadnextcloud-server-01a012980afa1bed5b2db1006a9d6443f19e3d5f.tar.gz
nextcloud-server-01a012980afa1bed5b2db1006a9d6443f19e3d5f.zip
search term for users and groups may occur anywhere in the name or displayname, not just in the beginning
-rw-r--r--lib/private/group/database.php6
-rw-r--r--lib/private/user/database.php4
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/private/group/database.php b/lib/private/group/database.php
index baaf2cf2739..852b55d770d 100644
--- a/lib/private/group/database.php
+++ b/lib/private/group/database.php
@@ -169,7 +169,7 @@ class OC_Group_Database extends OC_Group_Backend {
*/
public function getGroups($search = '', $limit = null, $offset = null) {
$stmt = OC_DB::prepare('SELECT `gid` FROM `*PREFIX*groups` WHERE `gid` LIKE ?', $limit, $offset);
- $result = $stmt->execute(array($search.'%'));
+ $result = $stmt->execute(array('%' . $search . '%'));
$groups = array();
while ($row = $result->fetchRow()) {
$groups[] = $row['gid'];
@@ -203,7 +203,7 @@ class OC_Group_Database extends OC_Group_Backend {
$stmt = OC_DB::prepare('SELECT `uid` FROM `*PREFIX*group_user` WHERE `gid` = ? AND `uid` LIKE ?',
$limit,
$offset);
- $result = $stmt->execute(array($gid, $search.'%'));
+ $result = $stmt->execute(array($gid, '%'.$search.'%'));
$users = array();
while ($row = $result->fetchRow()) {
$users[] = $row['uid'];
@@ -220,7 +220,7 @@ class OC_Group_Database extends OC_Group_Backend {
*/
public function countUsersInGroup($gid, $search = '') {
$stmt = OC_DB::prepare('SELECT COUNT(`uid`) AS `count` FROM `*PREFIX*group_user` WHERE `gid` = ? AND `uid` LIKE ?');
- $result = $stmt->execute(array($gid, $search.'%'));
+ $result = $stmt->execute(array($gid, '%' . $search . '%'));
return $result->fetchOne();
}
diff --git a/lib/private/user/database.php b/lib/private/user/database.php
index d9263f6b5de..e9844f0f79c 100644
--- a/lib/private/user/database.php
+++ b/lib/private/user/database.php
@@ -158,7 +158,7 @@ class OC_User_Database extends OC_User_Backend {
$query = OC_DB::prepare('SELECT `uid`, `displayname` FROM `*PREFIX*users`'
. ' WHERE LOWER(`displayname`) LIKE LOWER(?) OR '
. 'LOWER(`uid`) LIKE LOWER(?)', $limit, $offset);
- $result = $query->execute(array($search . '%', $search . '%'));
+ $result = $query->execute(array('%' . $search . '%', '%' . $search . '%'));
$users = array();
while ($row = $result->fetchRow()) {
$displayNames[$row['uid']] = $row['displayname'];
@@ -232,7 +232,7 @@ class OC_User_Database extends OC_User_Backend {
*/
public function getUsers($search = '', $limit = null, $offset = null) {
$query = OC_DB::prepare('SELECT `uid` FROM `*PREFIX*users` WHERE LOWER(`uid`) LIKE LOWER(?)', $limit, $offset);
- $result = $query->execute(array($search . '%'));
+ $result = $query->execute(array('%' . $search . '%'));
$users = array();
while ($row = $result->fetchRow()) {
$users[] = $row['uid'];