aboutsummaryrefslogtreecommitdiffstats
path: root/mod/search_ac.php
diff options
context:
space:
mode:
authorHaakon Meland Eriksen <haakon.eriksen@far.no>2014-06-24 19:34:36 +0200
committerHaakon Meland Eriksen <haakon.eriksen@far.no>2014-06-24 19:34:36 +0200
commitb8dc9e855af2d30f33d0f90dc13d8cad0a7b3e70 (patch)
tree718df6305bcb82c8dcb4b287a7132422e748cdfb /mod/search_ac.php
parentc2d520f1be115fb3cb5da2a35eb10146cecee8aa (diff)
parenta92fb0b04c3e6474ec48faf8e4cc65c382e89d66 (diff)
downloadvolse-hubzilla-b8dc9e855af2d30f33d0f90dc13d8cad0a7b3e70.tar.gz
volse-hubzilla-b8dc9e855af2d30f33d0f90dc13d8cad0a7b3e70.tar.bz2
volse-hubzilla-b8dc9e855af2d30f33d0f90dc13d8cad0a7b3e70.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'mod/search_ac.php')
-rw-r--r--mod/search_ac.php36
1 files changed, 10 insertions, 26 deletions
diff --git a/mod/search_ac.php b/mod/search_ac.php
index 5bc3c1c0b..36da21376 100644
--- a/mod/search_ac.php
+++ b/mod/search_ac.php
@@ -27,43 +27,27 @@ function search_ac_init(&$a){
// Priority to people searches
if ($search) {
- $people_sql_extra = protect_sprintf(" AND `name` LIKE '%". dbesc($search) . "%' ");
+ $people_sql_extra = protect_sprintf(" AND `xchan_name` LIKE '%". dbesc($search) . "%' ");
$tag_sql_extra = protect_sprintf(" AND term LIKE '%". dbesc($search) . "%' ");
}
- $r = q("SELECT `id`, `name`, `micro`, `url` FROM `contact`
- WHERE `uid` = %d AND `pending` = 0
+
+ $r = q("SELECT `abook_id`, `xchan_name`, `xchan_photo_s`, `xchan_url` FROM `abook` left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d
$people_sql_extra
- ORDER BY `name` ASC ",
+ ORDER BY `xchan_name` ASC ",
intval(local_user())
);
- if(count($r)) {
+ if($r) {
foreach($r as $g) {
- $x['photos'][] = $g['micro'];
- $x['links'][] = $g['url'];
- $x['suggestions'][] = '@' . $g['name'];
- $x['data'][] = intval($g['id']);
- }
- }
- else {
-
- $r = q("SELECT `id`, `name`, `photo`, `url` FROM `gcontact` where 1
- $people_sql_extra
- ORDER BY `name` ASC "
- );
-
- if(count($r)) {
- foreach($r as $g) {
- $x['photos'][] = $g['photo'];
- $x['links'][] = $g['url'];
- $x['suggestions'][] = '@' . $g['name'];
- $x['data'][] = intval($g['id']);
- }
+ $x['photos'][] = $g['xchan_photo_s'];
+ $x['links'][] = $g['xchan_url'];
+ $x['suggestions'][] = '@' . $g['xchan_name'];
+ $x['data'][] = 'cid=' . intval($g['abook_id']);
}
}
- $r = q("select tid, term, url from term where type = %d $tag_sql_extra order by term asc",
+ $r = q("select distinct term, tid, url from term where type = %d $tag_sql_extra group by term order by term asc",
intval(TERM_HASHTAG)
);