1
1
Fork 0

Merge pull request #2002 from annando/1511-cid

Return the contact id at "all_friends" and "common_contacts"
This commit is contained in:
Tobias Diekershoff 2015-11-01 09:02:09 +01:00
commit 3317d7a288

View file

@ -1062,11 +1062,14 @@ function common_friends($uid,$cid,$start = 0,$limit=9999,$shuffle = false) {
else else
$sql_extra = " order by `gcontact`.`name` asc "; $sql_extra = " order by `gcontact`.`name` asc ";
$r = q("SELECT `gcontact`.* $r = q("SELECT `gcontact`.*, `contact`.`id` AS `cid`
FROM `glink` INNER JOIN `gcontact` on `glink`.`gcid` = `gcontact`.`id` FROM `glink`
where `glink`.`cid` = %d and `glink`.`uid` = %d INNER JOIN `gcontact` ON `glink`.`gcid` = `gcontact`.`id`
and `gcontact`.`nurl` in (select nurl from contact where uid = %d and self = 0 and blocked = 0 and hidden = 0 and id != %d ) INNER JOIN `contact` ON `gcontact`.`nurl` = `contact`.`nurl`
$sql_extra limit %d, %d", WHERE `glink`.`cid` = %d and `glink`.`uid` = %d
AND `contact`.`uid` = %d AND `contact`.`self` = 0 AND `contact`.`blocked` = 0
AND `contact`.`hidden` = 0 AND `contact`.`id` != %d
$sql_extra LIMIT %d, %d",
intval($cid), intval($cid),
intval($uid), intval($uid),
intval($uid), intval($uid),
@ -1137,10 +1140,13 @@ function count_all_friends($uid,$cid) {
function all_friends($uid,$cid,$start = 0, $limit = 80) { function all_friends($uid,$cid,$start = 0, $limit = 80) {
$r = q("SELECT `gcontact`.* $r = q("SELECT `gcontact`.*, `contact`.`id` AS `cid`
FROM `glink` INNER JOIN `gcontact` on `glink`.`gcid` = `gcontact`.`id` FROM `glink`
where `glink`.`cid` = %d and `glink`.`uid` = %d INNER JOIN `gcontact` on `glink`.`gcid` = `gcontact`.`id`
order by `gcontact`.`name` asc LIMIT %d, %d ", LEFT JOIN `contact` ON `contact`.`nurl` = `gcontact`.`nurl` AND `contact`.`uid` = %d
WHERE `glink`.`cid` = %d AND `glink`.`uid` = %d
ORDER BY `gcontact`.`name` ASC LIMIT %d, %d ",
intval($uid),
intval($cid), intval($cid),
intval($uid), intval($uid),
intval($start), intval($start),