From 4062be28699eb5fba93ff43ffb4d3e9ed7c4af6c Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 5 Mar 2013 21:00:25 -0800 Subject: basic friend suggestions (but not "new to the network and have no friends at all" suggestions) --- include/socgraph.php | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'include') 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() { -- cgit v1.2.3