diff options
author | Devlon Duthie <duthied@gmail.com> | 2011-10-08 23:24:16 -0500 |
---|---|---|
committer | Devlon Duthie <duthied@gmail.com> | 2011-10-08 23:24:16 -0500 |
commit | fd6220fb7e27233b83f1813798a1aec0c4d7d5a8 (patch) | |
tree | 370b02da26da6bc6e39ef29e1d9e2dc1035a82d2 | |
parent | 096347040491081164857f51e13852b3e05983d7 (diff) | |
download | volse-hubzilla-fd6220fb7e27233b83f1813798a1aec0c4d7d5a8.tar.gz volse-hubzilla-fd6220fb7e27233b83f1813798a1aec0c4d7d5a8.tar.bz2 volse-hubzilla-fd6220fb7e27233b83f1813798a1aec0c4d7d5a8.zip |
added sorting to drop-down notifications list, added posts to this list as well (now the counts match the items) fixed up a couple of typos
-rw-r--r-- | mod/ping.php | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/mod/ping.php b/mod/ping.php index 544a42e14..239dd93e7 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -15,13 +15,14 @@ function ping_init(&$a) { $likes = array(); $dislikes = array(); $friends = array(); + $posts = array(); $r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`, `item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object`, `pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink` FROM `item` INNER JOIN `item` as `pitem` ON `pitem`.`id`=`item`.`parent` WHERE `item`.`unseen` = 1 AND `item`.`visible` = 1 AND - `item`.`deleted` = 0 AND `item`.`uid` = %d AND `item`.`wall` = 0", + `item`.`deleted` = 0 AND `item`.`uid` = %d AND `item`.`wall` = 0 ORDER BY `item`.`created` DESC", intval(local_user()) ); @@ -34,6 +35,9 @@ function ping_init(&$a) { case ACTIVITY_DISLIKE: $dislikes[] = $it; break; + case ACTIVITY_POST; + $posts[] = $it; + break; case ACTIVITY_FRIEND: $xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">"; $obj = parse_xml_string($xmlhead.$it['object']); @@ -114,7 +118,7 @@ function ping_init(&$a) { function xmlize($href, $name, $url, $photo, $date, $message){ $notsxml = '<note href="%s" name="%s" url="%s" photo="%s" date="%s">%s</note>'; return sprintf ( $notsxml, - xmlify($href), xmlify($name), xmlify($url), xmlify($photo), xmlify($date), xmlify($message) + $href, $name, $url, $photo, $date, $message ); } @@ -151,20 +155,24 @@ function ping_init(&$a) { } if (count($likes)){ foreach ($likes as $i) { - echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), sprintf( t("{0} like %s's post"), $i['pname'] ) ); + echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), sprintf( t("{0} liked %s's post"), $i['pname'] ) ); }; } if (count($dislikes)){ foreach ($dislikes as $i) { - echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), sprintf( t("{0} dislike %s's post"), $i['pname'] ) ); + echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), sprintf( t("{0} disliked %s's post"), $i['pname'] ) ); }; } if (count($friends)){ foreach ($friends as $i) { - echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), sprintf( t("{0} is now friend with %s"), $i['fname'] ) ); + echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), sprintf( t("{0} is now friends with %s"), $i['fname'] ) ); + }; + } + if (count($posts)){ + foreach ($posts as $i) { + echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), sprintf( t("{0} posted") ) ); }; } - echo " </notif>"; } |