-
- /**
- * return xml from notification array
- *
- * @param array $n Notification array:
- * 'href' => notification link
- * 'name' => subject name
- * 'url' => subject url
- * 'photo' => subject photo
- * 'date' => notification date
- * 'seen' => bool true/false
- * 'message' => notification message. "{0}" will be replaced by subject name
- **/
- function xmlize($n){
- $n['photo'] = proxy_url($n['photo'], false, PROXY_SIZE_MICRO);
-
- $n['message'] = html_entity_decode($n['message'], ENT_COMPAT | ENT_HTML401, "UTF-8");
- $n['name'] = html_entity_decode($n['name'], ENT_COMPAT | ENT_HTML401, "UTF-8");
-
- // Are the nofications calles from the regular process or via the friendica app?
- $regularnotifications = (intval($_GET['uid']) AND intval($_GET['_']));
-
- $a = get_app();
-
- if ($a->is_friendica_app() OR !$regularnotifications)
- $n['message'] = str_replace("{0}", $n['name'], $n['message']);
-
- $local_time = datetime_convert('UTC',date_default_timezone_get(),$n['date']);
-
- call_hooks('ping_xmlize', $n);
- $notsxml = '<note id="%d" href="%s" name="%s" url="%s" photo="%s" date="%s" seen="%s" timestamp="%s" >%s</note>'."\n";
- return sprintf ( $notsxml, intval($n['id']),
- xmlify($n['href']), xmlify($n['name']), xmlify($n['url']), xmlify($n['photo']),
- xmlify(relative_date($n['date'])), xmlify($n['seen']), xmlify(strtotime($local_time)),
- xmlify($n['message'])
- );
- }
-
- echo "<intro>$intro</intro>
- <mail>$mail</mail>
- <net>$network</net>
- <home>$home</home>\r\n";
- if ($register!=0) echo "<register>$register</register>";
-
- if ( count($groups_unseen) ) {
- echo '<groups>';
- foreach ($groups_unseen as $it) {
- echo '<group id="' . $it['id'] . '">' . $it['count'] . "</group>";
- }
- echo "</groups>";
- }
-
- if ( count($forums_unseen) ) {
- echo '<forums>';
- foreach ($forums_unseen as $it) {
- echo '<forum id="' . $it['id'] . '">' . $it['count'] . "</forum>";
- }
- echo "</forums>";
- }
-
- echo "<all-events>$all_events</all-events>
- <all-events-today>$all_events_today</all-events-today>
- <events>$events</events>
- <events-today>$events_today</events-today>
- <birthdays>$birthdays</birthdays>
- <birthdays-today>$birthdays_today</birthdays-today>\r\n";
-
-
- if(count($notifs) && (! $sysnotify)) {
- foreach($notifs as $zz) {
- if($zz['seen'] == 0)
- $sysnotify ++;
+ $data = array();
+ $data['intro'] = $intro_count;
+ $data['mail'] = $mail_count;
+ $data['net'] = $network_count;
+ $data['home'] = $home_count;
+ $data['register'] = $register_count;
+
+ $data['all-events'] = $all_events;
+ $data['all-events-today'] = $all_events_today;
+ $data['events'] = $events;
+ $data['events-today'] = $events_today;
+ $data['birthdays'] = $birthdays;
+ $data['birthdays-today'] = $birthdays_today;
+
+ if (dbm::is_result($notifs)) {
+ foreach ($notifs as $notif) {
+ if ($notif['seen'] == 0) {
+ $sysnotify_count ++;
+ }