aboutsummaryrefslogtreecommitdiffstats
path: root/mod/search_ac.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-10-01 19:54:22 -0700
committerfriendica <info@friendica.com>2013-10-01 19:54:22 -0700
commitf3d351621d8f098524ccbfcad82863beafab5393 (patch)
tree269fe7b03b7bc9b8f0ab7aab5a98be30137fc4d9 /mod/search_ac.php
parent1f965f1b701ab3850e0914e4333ff23b82274109 (diff)
downloadvolse-hubzilla-f3d351621d8f098524ccbfcad82863beafab5393.tar.gz
volse-hubzilla-f3d351621d8f098524ccbfcad82863beafab5393.tar.bz2
volse-hubzilla-f3d351621d8f098524ccbfcad82863beafab5393.zip
Saved searches on the matrix/network page just got a lot more interesting. Hint: it's all about autocomplete
Diffstat (limited to 'mod/search_ac.php')
-rw-r--r--mod/search_ac.php51
1 files changed, 17 insertions, 34 deletions
diff --git a/mod/search_ac.php b/mod/search_ac.php
index 8e87f8449..36da21376 100644
--- a/mod/search_ac.php
+++ b/mod/search_ac.php
@@ -27,42 +27,25 @@ 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) . "%' ");
}
-// FIXME - this is whacked
-// $r = q("SELECT `id`, `name`, `micro`, `url` FROM `contact`
-// WHERE `uid` = %d AND `pending` = 0
-// $people_sql_extra
-// ORDER BY `name` ASC ",
-// intval(local_user())
-// );
-
-// if($r) {
-// foreach($r as $g) {
-// $x['photos'][] = $g['micro'];
-// $x['links'][] = $g['url'];
-// $x['suggestions'][] = '@' . $g['name'];
-// $x['data'][] = intval($g['id']);
-// }
-// }
-// FIXME - extend search to non-connnections if you couldn't find any connections with that name, use poco or directory
-// 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']);
-// }
-// }
-// }
+
+
+ $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 `xchan_name` ASC ",
+ intval(local_user())
+ );
+
+ if($r) {
+ foreach($r as $g) {
+ $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 distinct term, tid, url from term where type = %d $tag_sql_extra group by term order by term asc",
intval(TERM_HASHTAG)