From afdc639f17f0f5e12f291b512ccc12b3df6b2acf Mon Sep 17 00:00:00 2001 From: fabrixxm Date: Wed, 17 Aug 2011 21:59:06 +0200 Subject: fix friend request query in ping --- mod/ping.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/mod/ping.php b/mod/ping.php index 973ecb03f..40ce5be0b 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -20,13 +20,25 @@ function ping_init(&$a) { ); $home = $r[0]['total']; - $intros = q("SELECT COUNT(`intro`.`id`) AS `total`, `intro`.`id`, `intro`.`datetime`, + $intros1 = q("SELECT COUNT(`intro`.`id`) AS `total`, `intro`.`id`, `intro`.`datetime`, `fcontact`.`name`, `fcontact`.`url`, `fcontact`.`photo` FROM `intro` LEFT JOIN `fcontact` ON `intro`.`fid` = `fcontact`.`id` - WHERE `intro`.`uid` = %d AND `intro`.`blocked` = 0 AND `intro`.`ignore` = 0 ", + WHERE `intro`.`uid` = %d AND `intro`.`blocked` = 0 AND `intro`.`ignore` = 0 AND `intro`.`fid`!=0", intval(local_user()) ); - $intro = $intros[0]['total']; + $intros2 = q("SELECT COUNT(`intro`.`id`) AS `total`, `intro`.`id`, `intro`.`datetime`, + `contact`.`name`, `contact`.`url`, `contact`.`photo` + FROM `intro` LEFT JOIN `contact` ON `intro`.`contact-id` = `contact`.`id` + WHERE `intro`.`uid` = %d AND `intro`.`blocked` = 0 AND `intro`.`ignore` = 0 AND `intro`.`contact-id`!=0", + intval(local_user()) + ); + + $intro = $intros1[0]['total'] + $intros2[0]['total']; + if ($intros1[0]['total']==0) $intros1=Array(); + if ($intros2[0]['total']==0) $intros2=Array(); + $intros = $intros1+$intros2; + + $myurl = $a->get_baseurl() . '/profile/' . $a->user['nickname'] ; $mails = q("SELECT *, COUNT(*) AS `total` FROM `mail` @@ -61,7 +73,7 @@ function ping_init(&$a) { if ($intro>0){ foreach ($intros as $i) { echo sprintf ( $notsxml, - $a->get_baseurl().'/notification/'.$i['id'], $i['name'], $i['url'], $i['photo'], relative_date($i['datetime']), t("{0} wants to be your friend") + $a->get_baseurl().'/notifications/'.$i['id'], $i['name'], $i['url'], $i['photo'], relative_date($i['datetime']), t("{0} wants to be your friend") ); }; } -- cgit v1.2.3