From ee4800a4d3eb3c1f11e1dc33a8d6902cf97c2c1f Mon Sep 17 00:00:00 2001 From: Friendika Date: Fri, 25 Feb 2011 15:28:07 -0800 Subject: [PATCH] auto-complete contact/group endpoint --- mod/qsearch.php | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 mod/qsearch.php diff --git a/mod/qsearch.php b/mod/qsearch.php new file mode 100644 index 0000000000..e61915c758 --- /dev/null +++ b/mod/qsearch.php @@ -0,0 +1,49 @@ +',''); + } + + $sql_extra = ((strlen($search)) ? " AND (`name` REGEXP '$search' OR `nick` REGEXP '$search') " : ""); + + + $r = q("SELECT * FROM `contact` WHERE `uid` = %d $sql_extra ORDER BY `name` ASC LIMIT 0, %d ", + intval(local_user()), + intval($limit) + ); + + + if(count($r)) { + + foreach($r as $rr) + $results[] = array($rr['name'],$rr['url'],$rr['photo']); + } + + echo str_replace('\\/','/',json_encode((object) $results)); + killme(); +} \ No newline at end of file