diff options
Diffstat (limited to 'mod/ping.php')
-rw-r--r--[-rwxr-xr-x] | mod/ping.php | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/mod/ping.php b/mod/ping.php index db68332bd..2898042a3 100755..100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -5,12 +5,20 @@ require_once("include/datetime.php"); function ping_init(&$a) { header("Content-type: text/xml"); + echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> <result>"; $xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">"; if(local_user()){ + $z = q("select * from notify where seen = 0 and uid = %d + order by date desc", + intval(local_user()) + ); + + + $tags = array(); $comments = array(); $likes = array(); @@ -90,22 +98,20 @@ function ping_init(&$a) { } - $intros1 = q("SELECT COUNT(`intro`.`id`) AS `total`, `intro`.`id`, `intro`.`datetime`, + $intros1 = q("SELECT `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 AND `intro`.`fid`!=0", intval(local_user()) ); - $intros2 = q("SELECT COUNT(`intro`.`id`) AS `total`, `intro`.`id`, `intro`.`datetime`, + $intros2 = q("SELECT `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(); + $intro = count($intros1) + count($intros2); $intros = $intros1+$intros2; @@ -143,6 +149,22 @@ function ping_init(&$a) { $tot = $mail+$intro+$register+count($comments)+count($likes)+count($dislikes)+count($friends)+count($posts)+count($tags); echo ' <notif count="'.$tot.'">'; + + require_once('include/bbcode.php'); + + if(count($z)) { + foreach($z as $zz) { + echo xmlize($a->get_baseurl() . '/notify/' . $zz['id'], $zz['name'],$zz['url'],$zz['photo'],relative_date($zz['date']), bbcode($zz['msg'])); + + } + } + + + + + +/* + if ($intro>0){ foreach ($intros as $i) { echo xmlize( $a->get_baseurl().'/notifications/intros/'.$i['id'], $i['name'], $i['url'], $i['photo'], relative_date($i['datetime']), t("{0} wants to be your friend") ); @@ -196,6 +218,8 @@ function ping_init(&$a) { }; } +*/ + echo " </notif>"; } echo " <sysmsgs>"; |