fixing common friends

This commit is contained in:
friendica 2012-05-02 16:15:59 -07:00
parent a292629215
commit 8e1437ca8b

View file

@ -99,11 +99,12 @@ function poco_load($cid,$uid = 0,$zcid = 0,$url = null) {
$gcid = $x[0]['id']; $gcid = $x[0]['id'];
if($x[0]['name'] != $name || $x[0]['photo'] != $profile_photo) { 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", where `nurl` = '%s' limit 1",
dbesc($name), dbesc($name),
dbesc($profile_photo), dbesc($profile_photo),
dbesc($connect_url), dbesc($connect_url),
dbesc($profile_url),
dbesc(normalise_link($profile_url)) dbesc(normalise_link($profile_url))
); );
} }
@ -168,7 +169,7 @@ function count_common_friends($uid,$cid) {
$r = q("SELECT count(*) as `total` $r = q("SELECT count(*) as `total`
FROM `glink` left join `gcontact` on `glink`.`gcid` = `gcontact`.`id` FROM `glink` left join `gcontact` on `glink`.`gcid` = `gcontact`.`id`
where `glink`.`cid` = %d and `glink`.`uid` = %d 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($cid),
intval($uid), intval($uid),
intval($uid), intval($uid),
@ -192,8 +193,8 @@ function common_friends($uid,$cid,$limit=9999,$shuffle = false) {
$r = q("SELECT `gcontact`.* $r = q("SELECT `gcontact`.*
FROM `glink` left join `gcontact` on `glink`.`gcid` = `gcontact`.`id` FROM `glink` left join `gcontact` on `glink`.`gcid` = `gcontact`.`id`
where `glink`.`cid` = %d and `glink`.`uid` = %d 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 )
sql_extra limit 0, %d", $sql_extra limit 0, %d",
intval($cid), intval($cid),
intval($uid), intval($uid),
intval($uid), intval($uid),
@ -211,7 +212,7 @@ function count_common_friends_zcid($uid,$zcid) {
$r = q("SELECT count(*) as `total` $r = q("SELECT count(*) as `total`
FROM `glink` left join `gcontact` on `glink`.`gcid` = `gcontact`.`id` FROM `glink` left join `gcontact` on `glink`.`gcid` = `gcontact`.`id`
where `glink`.`zcid` = %d 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($zcid),
intval($uid) intval($uid)
); );
@ -232,7 +233,7 @@ function common_friends_zcid($uid,$zcid,$limit = 9999,$shuffle) {
$r = q("SELECT `gcontact`.* $r = q("SELECT `gcontact`.*
FROM `glink` left join `gcontact` on `glink`.`gcid` = `gcontact`.`id` FROM `glink` left join `gcontact` on `glink`.`gcid` = `gcontact`.`id`
where `glink`.`zcid` = %d 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", $sql_extra limit 0, %d",
intval($zcid), intval($zcid),
intval($uid), intval($uid),