This commit is contained in:
nikolark committed 2014-08-04 22:36:35 +02:00
1 parent e25bb1e82b
commit 62e0ad18f0
1 file changed
+7 -1
+7 -1
View File
@@ -69,12 +69,17 @@ if(isset($_GET['filter_groups']) && strlen($_GET['filter_groups']) > 0 ) {
}
}
// TODO
// - define a set of admin-groups (admin=1) and use in group filter
// - allow new param is_member
if( strlen($_GET['q']) <= 2 && count($groups) == 0 ) {
set_response_code(400);
echo json_encode(array('error' => "Search param must be longer than 2 chars"));
die();
}
$query = $_GET['q'];
// Add wildcards around and between words
@@ -88,11 +93,12 @@ $user_search_query = "CONCAT(UPPER(u.firstname), ' ', UPPER(u.lastname)) LIKE $q
OR UPPER(u.username) LIKE $query
OR UPPER(u.email) LIKE $query";
// Default
$sql = "SELECT DISTINCT u.id
FROM din_user u
WHERE $user_search_query";
// Search query with groups
// Overrid query with groups
if(count($groups) > 0) {
$sql = "SELECT DISTINCT u.id
FROM din_user u