diff options
author | friendica <info@friendica.com> | 2013-09-02 20:53:52 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2013-09-02 20:53:52 -0700 |
commit | 9d262a186f4d7532d74f2eced4959372a9b7f392 (patch) | |
tree | 10619c22a724e133fc39fbbf24959641205dea79 /mod | |
parent | c646388cd974e8f5128ec6d191301029a13db5e2 (diff) | |
download | volse-hubzilla-9d262a186f4d7532d74f2eced4959372a9b7f392.tar.gz volse-hubzilla-9d262a186f4d7532d74f2eced4959372a9b7f392.tar.bz2 volse-hubzilla-9d262a186f4d7532d74f2eced4959372a9b7f392.zip |
the rest of the fix
Diffstat (limited to 'mod')
-rw-r--r-- | mod/search_ac.php | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/mod/search_ac.php b/mod/search_ac.php index 308f42f76..21ff1c9f3 100644 --- a/mod/search_ac.php +++ b/mod/search_ac.php @@ -27,19 +27,18 @@ function search_ac_init(&$a){ // Priority to people searches if ($search) { - $people_sql_extra = protect_sprintf(" AND `xchan_name` LIKE '%". dbesc($search) . "%' "); + $people_sql_extra = protect_sprintf(" AND `name` LIKE '%". dbesc($search) . "%' "); $tag_sql_extra = protect_sprintf(" AND term LIKE '%". dbesc($search) . "%' "); } - - $r = q("SELECT abook_id as id, xchan_hash as hash, xchan_name as name, xchan_photo_s as micro, xchan_url as url, xchan_addr as nick, abook_their_perms - FROM abook left join xchan on abook_xchan = xchan_hash - WHERE abook_channel = %d AND not ( abook_flags & %d ) $people_sql_extra order by xchan_name asc" , - intval(local_user()), - intval(ABOOK_FLAG_SELF|ABOOK_FLAG_BLOCKED|ABOOK_FLAG_PENDING|ABOOK_FLAG_ARCHIVED) + $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) { + if(count($r)) { foreach($r as $g) { $x['photos'][] = $g['micro']; $x['links'][] = $g['url']; @@ -47,22 +46,23 @@ function search_ac_init(&$a){ $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']); - } - } - } +// 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 tid, term, url from term where type = %d $tag_sql_extra order by term asc", intval(TERM_HASHTAG) |