[Pkg-owncloud-commits] [owncloud] 27/273: search term for users and groups may occur anywhere in the name or displayname, not just in the beginning

David Prévot taffit at moszumanska.debian.org
Fri Jul 4 03:12:54 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit 01a012980afa1bed5b2db1006a9d6443f19e3d5f
Author: Arthur Schiwon <blizzz at owncloud.com>
Date:   Mon Jun 23 12:03:09 2014 +0200

    search term for users and groups may occur anywhere in the name or displayname, not just in the beginning
---
 lib/private/group/database.php | 6 +++---
 lib/private/user/database.php  | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/private/group/database.php b/lib/private/group/database.php
index baaf2cf..852b55d 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 d9263f6..e9844f0 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'];

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list