diff options
author | friendica <info@friendica.com> | 2012-10-27 04:43:39 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2012-10-27 04:43:39 -0700 |
commit | 96c8e74438d4f7c324c96893720fd4018925de4f (patch) | |
tree | e2df3cbda40cbe8004a04b7300cb0637dd06b5f3 /mod/ping.php | |
parent | 4d974322145258c0dc464c6c8eb0085d25e36d9d (diff) | |
download | volse-hubzilla-96c8e74438d4f7c324c96893720fd4018925de4f.tar.gz volse-hubzilla-96c8e74438d4f7c324c96893720fd4018925de4f.tar.bz2 volse-hubzilla-96c8e74438d4f7c324c96893720fd4018925de4f.zip |
start on network/home notification refactor
Diffstat (limited to 'mod/ping.php')
-rw-r--r-- | mod/ping.php | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/mod/ping.php b/mod/ping.php index ff8d977dc..60ca7f734 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -2,6 +2,7 @@ require_once('include/bbcode.php'); +require_once('include/notify.php'); function ping_init(&$a) { @@ -88,7 +89,33 @@ function ping_init(&$a) { killme(); } - + + if(argc() > 1 && (argv(1) === 'network' || argv(1) === 'home')) { + + $result = array(); + + $r = q("SELECT id, item_restrict, item_flags FROM item + WHERE item_restrict = %d and item_flags & %d and `item`.`uid` = %d", + intval(ITEM_VISIBLE), + intval(ITEM_UNSEEN), + intval(local_user()) + ); + + if($r) { + foreach($r as $item) { + if((argv(1) === 'home') && (! ($item['item_flags'] & ITEM_HOME))) + continue; + $result[] = format_notification($item); + } + } + + echo json_encode(array( argv(1) => $result)); + killme(); + + } + + + // Normal ping - just the counts $t = q("select count(*) as total from notify where uid = %d and seen = 0", intval(local_user()) |