1
0
Fork 0

common friends

This commit is contained in:
Friendika 2011-11-01 19:16:33 -07:00
commit 3d9a9614e2
7 changed files with 125 additions and 2 deletions

View file

@ -123,4 +123,40 @@ function poco_load($cid,$uid = 0,$url = null) {
intval($uid)
);
}
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 ) ",
intval($cid),
intval($uid),
intval($uid),
intval($cid)
);
if(count($r))
return $r[0]['total'];
return 0;
}
function common_friends($uid,$cid) {
$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 ) ",
intval($cid),
intval($uid),
intval($uid),
intval($cid)
);
return $r;
}