From 8e1437ca8bebcc3ef684192833c7a9ee10755608 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 2 May 2012 16:15:59 -0700 Subject: [PATCH] fixing common friends --- include/socgraph.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/include/socgraph.php b/include/socgraph.php index 35d754cadc..a67b3d9e34 100644 --- a/include/socgraph.php +++ b/include/socgraph.php @@ -99,11 +99,12 @@ function poco_load($cid,$uid = 0,$zcid = 0,$url = null) { $gcid = $x[0]['id']; if($x[0]['name'] != $name || $x[0]['photo'] != $profile_photo) { - q("update gcontact set `name` = '%s', `photo` = '%s', `connect` = '%s' + q("update gcontact set `name` = '%s', `photo` = '%s', `connect` = '%s', `url` = '%s' where `nurl` = '%s' limit 1", dbesc($name), dbesc($profile_photo), dbesc($connect_url), + dbesc($profile_url), dbesc(normalise_link($profile_url)) ); } @@ -168,7 +169,7 @@ function count_common_friends($uid,$cid) { $r = q("SELECT count(*) as `total` FROM `glink` left join `gcontact` on `glink`.`gcid` = `gcontact`.`id` where `glink`.`cid` = %d and `glink`.`uid` = %d - and `gcontact`.`nurl` in (select nurl from contact where uid = %d and self = 0 and id != %d ) ", + and `gcontact`.`nurl` in (select nurl from contact where uid = %d and self = 0 and blocked = 0 and hidden = 0 and id != %d ) ", intval($cid), intval($uid), intval($uid), @@ -192,8 +193,8 @@ function common_friends($uid,$cid,$limit=9999,$shuffle = false) { $r = q("SELECT `gcontact`.* FROM `glink` left join `gcontact` on `glink`.`gcid` = `gcontact`.`id` where `glink`.`cid` = %d and `glink`.`uid` = %d - and `gcontact`.`nurl` in (select nurl from contact where uid = %d and self = 0 and id != %d ) - sql_extra limit 0, %d", + and `gcontact`.`nurl` in (select nurl from contact where uid = %d and self = 0 and blocked = 0 and hidden = 0 and id != %d ) + $sql_extra limit 0, %d", intval($cid), intval($uid), intval($uid), @@ -211,7 +212,7 @@ function count_common_friends_zcid($uid,$zcid) { $r = q("SELECT count(*) as `total` FROM `glink` left join `gcontact` on `glink`.`gcid` = `gcontact`.`id` where `glink`.`zcid` = %d - and `gcontact`.`nurl` in (select nurl from contact where uid = %d and self = 0 ) ", + and `gcontact`.`nurl` in (select nurl from contact where uid = %d and self = 0 and blocked = 0 and hidden = 0 ) ", intval($zcid), intval($uid) ); @@ -232,7 +233,7 @@ function common_friends_zcid($uid,$zcid,$limit = 9999,$shuffle) { $r = q("SELECT `gcontact`.* FROM `glink` left join `gcontact` on `glink`.`gcid` = `gcontact`.`id` where `glink`.`zcid` = %d - and `gcontact`.`nurl` in (select nurl from contact where uid = %d and self = 0 ) + and `gcontact`.`nurl` in (select nurl from contact where uid = %d and self = 0 and blocked = 0 and hidden = 0 ) $sql_extra limit 0, %d", intval($zcid), intval($uid),