diff options
Diffstat (limited to 'mod/ping.php')
-rw-r--r-- | mod/ping.php | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/mod/ping.php b/mod/ping.php index e8d5636b8..e13dc5de2 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -43,9 +43,9 @@ function ping_init(&$a) { $vnotify = false; - if(local_user()) { - $vnotify = get_pconfig(local_user(),'system','vnotify'); - $evdays = intval(get_pconfig(local_user(),'system','evdays')); + if(local_channel()) { + $vnotify = get_pconfig(local_channel(),'system','vnotify'); + $evdays = intval(get_pconfig(local_channel(),'system','evdays')); $ob_hash = get_observer_hash(); } @@ -64,7 +64,7 @@ function ping_init(&$a) { * of the now current channel. */ - $result['invalid'] = ((intval($_GET['uid'])) && (intval($_GET['uid']) != local_user()) ? 1 : 0); + $result['invalid'] = ((intval($_GET['uid'])) && (intval($_GET['uid']) != local_channel()) ? 1 : 0); /** * Send all system messages (alerts) to the browser. @@ -133,7 +133,7 @@ function ping_init(&$a) { db_utcnow(), db_quoteinterval('3 MINUTE') ); - if((! local_user()) || ($result['invalid'])) { + if((! local_channel()) || ($result['invalid'])) { echo json_encode($result); killme(); } @@ -148,33 +148,33 @@ function ping_init(&$a) { */ // mark all items read - if(x($_REQUEST, 'markRead') && local_user()) { + if(x($_REQUEST, 'markRead') && local_channel()) { switch($_REQUEST['markRead']) { case 'network': $r = q("update item set item_unseen = 0 where item_unseen = 1 and uid = %d", - intval(local_user()) + intval(local_channel()) ); break; case 'home': $r = q("update item set item_unseen = 0 where item_unseen = 1 and item_wall = 1 and uid = %d", - intval(local_user()) + intval(channel()) ); break; case 'messages': $r = q("update mail set mail_flags = ( mail_flags | %d ) where channel_id = %d and not (mail_flags & %d) > 0", intval(MAIL_SEEN), - intval(local_user()), + intval(local_channel()), intval(MAIL_SEEN) ); break; case 'all_events': $r = q("update event set `ignore` = 1 where `ignore` = 0 and uid = %d", - intval(local_user()) + intval(local_channel()) ); break; case 'notify': $r = q("update notify set seen = 1 where uid = %d", - intval(local_user()) + intval(local_channel()) ); break; default: @@ -182,10 +182,10 @@ function ping_init(&$a) { } } - if(x($_REQUEST, 'markItemRead') && local_user()) { + if(x($_REQUEST, 'markItemRead') && local_channel()) { $r = q("update item set item_unseen = 0 where parent = %d and uid = %d", intval($_REQUEST['markItemRead']), - intval(local_user()) + intval(local_channel()) ); } @@ -198,22 +198,22 @@ function ping_init(&$a) { if(argc() > 1 && argv(1) === 'notify') { $t = q("select count(*) as total from notify where uid = %d and seen = 0", - intval(local_user()) + intval(local_channel()) ); if($t && intval($t[0]['total']) > 49) { $z = q("select * from notify where uid = %d and seen = 0 order by date desc limit 50", - intval(local_user()) + intval(local_channel()) ); } else { $z1 = q("select * from notify where uid = %d and seen = 0 order by date desc limit 50", - intval(local_user()) + intval(local_channel()) ); $z2 = q("select * from notify where uid = %d and seen = 1 order by date desc limit %d", - intval(local_user()), + intval(local_channel()), intval(50 - intval($t[0]['total'])) ); $z = array_merge($z1,$z2); @@ -242,7 +242,7 @@ function ping_init(&$a) { $t = q("select mail.*, xchan.* from mail left join xchan on xchan_hash = from_xchan where channel_id = %d and not ( mail_flags & %d ) > 0 and not (mail_flags & %d ) > 0 and from_xchan != '%s' order by created desc limit 50", - intval(local_user()), + intval(local_channel()), intval(MAIL_SEEN), intval(MAIL_DELETED), dbesc($channel['channel_hash']) @@ -273,7 +273,7 @@ function ping_init(&$a) { WHERE item_restrict = %d and item_unseen = 1 and uid = %d and author_xchan != '%s' ORDER BY created DESC", intval(ITEM_VISIBLE), - intval(local_user()), + intval(local_channel()), dbesc($ob_hash) ); @@ -294,7 +294,7 @@ function ping_init(&$a) { $result = array(); $r = q("SELECT * FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash where abook_channel = %d and (abook_flags & %d) > 0 and not ((abook_flags & %d) > 0 or xchan_deleted = 1 or xchan_orphan = 1) ORDER BY abook_created DESC", - intval(local_user()), + intval(local_channel()), intval(ABOOK_FLAG_PENDING), intval(ABOOK_FLAG_SELF|ABOOK_FLAG_IGNORED) ); @@ -325,7 +325,7 @@ function ping_init(&$a) { $r = q("SELECT * FROM event left join xchan on event_xchan = xchan_hash WHERE `event`.`uid` = %d AND start < '%s' AND start > '%s' and `ignore` = 0 ORDER BY `start` DESC ", - intval(local_user()), + intval(local_channel()), dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now + ' . intval($evdays) . ' days')), dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now - 1 days')) ); @@ -366,7 +366,7 @@ function ping_init(&$a) { if($vnotify & VNOTIFY_SYSTEM) { $t = q("select count(*) as total from notify where uid = %d and seen = 0", - intval(local_user()) + intval(local_channel()) ); if($t) $result['notify'] = intval($t[0]['total']); @@ -379,7 +379,7 @@ function ping_init(&$a) { WHERE (item_restrict = %d) and item_unseen = 1 and uid = %d and author_xchan != '%s'", intval(ITEM_VISIBLE), - intval(local_user()), + intval(local_channel()), dbesc($ob_hash) ); @@ -405,7 +405,7 @@ function ping_init(&$a) { if($vnotify & VNOTIFY_INTRO) { $intr = q("SELECT COUNT(abook.abook_id) AS total FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash where abook_channel = %d and (abook_flags & %d) > 0 and not ((abook_flags & %d) > 0 or xchan_deleted = 1 or xchan_orphan = 1)", - intval(local_user()), + intval(local_channel()), intval(ABOOK_FLAG_PENDING), intval(ABOOK_FLAG_SELF|ABOOK_FLAG_IGNORED) ); @@ -422,7 +422,7 @@ function ping_init(&$a) { if($vnotify & VNOTIFY_MAIL) { $mails = q("SELECT count(id) as total from mail WHERE channel_id = %d AND not (mail_flags & %d) > 0 and from_xchan != '%s' ", - intval(local_user()), + intval(local_channel()), intval(MAIL_SEEN), dbesc($channel['channel_hash']) ); @@ -446,7 +446,7 @@ function ping_init(&$a) { $events = q("SELECT type, start, adjust FROM `event` WHERE `event`.`uid` = %d AND start < '%s' AND start > '%s' and `ignore` = 0 ORDER BY `start` ASC ", - intval(local_user()), + intval(local_channel()), dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now + ' . intval($evdays) . ' days')), dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now - 1 days')) ); |