3 function qsearch_init(App &$a) {
9 $limit = (get_config('system','qsearch_limit') ? intval(get_config('system','qsearch_limit')) : 100);
11 $search = ((x($_GET,'s')) ? notags(trim(urldecode($_GET['s']))) : '');
18 $search = dbesc($search);
22 $r = q("SELECT * FROM `group` WHERE `name` REGEXP '$search' AND `deleted` = 0 AND `uid` = %d LIMIT 0, %d ",
27 if (dbm::is_result($r)) {
30 $results[] = array( 0, (int) $rr['id'], $rr['name'], '', '');
33 $sql_extra = ((strlen($search)) ? " AND (`name` REGEXP '$search' OR `nick` REGEXP '$search') " : "");
36 $r = q("SELECT * FROM `contact` WHERE `uid` = %d $sql_extra ORDER BY `name` ASC LIMIT 0, %d ",
42 if (dbm::is_result($r)) {
45 $results[] = array( (int) $rr['id'], 0, $rr['name'],$rr['url'],$rr['photo']);
48 echo json_encode((object) $results);