3 function qsearch_init(&$a) {
8 $limit = (get_config('system','qsearch_limit') ? intval(get_config('system','qsearch_limit')) : 100);
10 $search = ((x($_GET,'s')) ? notags(trim(urldecode($_GET['s']))) : '');
17 $search = dbesc($search);
21 $r = q("SELECT * FROM `group` WHERE `name` REGEXP '$search' AND `deleted` = 0 AND `uid` = %d LIMIT 0, %d ",
29 $results[] = array( 0, (int) $rr['id'], $rr['name'], '', '');
32 $sql_extra = ((strlen($search)) ? " AND (`name` REGEXP '$search' OR `nick` REGEXP '$search') " : "");
35 $r = q("SELECT * FROM `contact` WHERE `uid` = %d $sql_extra ORDER BY `name` ASC LIMIT 0, %d ",
44 $results[] = array( (int) $rr['id'], 0, $rr['name'],$rr['url'],$rr['photo']);
47 echo str_replace('\\/','/',json_encode((object) $results));