fixing common friends

This commit is contained in:
friendica 2012-05-02 16:15:59 -07:00
parent a292629215
commit 8e1437ca8b
1 changed files with 7 additions and 6 deletions

View File

@ -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),