diff options
author | friendica <info@friendica.com> | 2013-03-05 21:00:25 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2013-03-05 21:00:25 -0800 |
commit | 4062be28699eb5fba93ff43ffb4d3e9ed7c4af6c (patch) | |
tree | 0b5a625703008a7dd7c4dda2590b6585b3380384 /include/socgraph.php | |
parent | fbda9ababc76c103d82118a8f3cf24e619bfb80d (diff) | |
download | volse-hubzilla-4062be28699eb5fba93ff43ffb4d3e9ed7c4af6c.tar.gz volse-hubzilla-4062be28699eb5fba93ff43ffb4d3e9ed7c4af6c.tar.bz2 volse-hubzilla-4062be28699eb5fba93ff43ffb4d3e9ed7c4af6c.zip |
basic friend suggestions (but not "new to the network and have no friends at all" suggestions)
Diffstat (limited to 'include/socgraph.php')
-rw-r--r-- | include/socgraph.php | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/include/socgraph.php b/include/socgraph.php index 3c77a59a1..678d13d11 100644 --- a/include/socgraph.php +++ b/include/socgraph.php @@ -254,12 +254,26 @@ function all_friends($uid,$cid,$start = 0, $limit = 80) { -function suggestion_query($uid, $start = 0, $limit = 80) { +function suggestion_query($uid, $myxchan, $start = 0, $limit = 80) { - if(! $uid) + if((! $uid) || (! $myxchan)) return array(); - $r = q("SELECT count(glink.gcid) as `total`, gcontact.* from gcontact + $r = q("SELECT count(xlink_xchan) as `total`, xchan.* from xchan + left join xlink on xlink_link = xchan_hash + where not xchan_hash in ( select abook_xchan from abook where abook_channel = %d ) + and not xchan_hash in ( select xchan from xign where uid = %d ) + and xchan_hash != '%s' + group by xchan_hash order by total desc limit %d, %d ", + intval($uid), + intval($uid), + dbesc($myxchan), + intval($start), + intval($limit) + ); + +/* + $r = q("SELECT count(xlink.xchan) as `total`, gcontact.* from gcontact left join glink on glink.gcid = gcontact.id where uid = %d and not gcontact.nurl in ( select nurl from contact where uid = %d ) and not gcontact.name in ( select name from contact where uid = %d ) @@ -272,7 +286,12 @@ function suggestion_query($uid, $start = 0, $limit = 80) { intval($start), intval($limit) ); +*/ + + if($r) + return $r; +/* if(count($r) && count($r) >= ($limit -1)) return $r; @@ -291,7 +310,7 @@ function suggestion_query($uid, $start = 0, $limit = 80) { return array_merge($r,$r2); - +*/ } function update_suggestions() { |