aboutsummaryrefslogtreecommitdiffstats
path: root/mod/ping.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-01-28 20:56:04 -0800
committerfriendica <info@friendica.com>2015-01-28 20:56:04 -0800
commita4960360669daa0a0c842427185ce1ada3b4ab97 (patch)
tree53feb1009266a77ee5338cc49919e45cca4b5ca6 /mod/ping.php
parent54fd8b21db2d8f3841cf590f88611a1d4f44ce48 (diff)
downloadvolse-hubzilla-a4960360669daa0a0c842427185ce1ada3b4ab97.tar.gz
volse-hubzilla-a4960360669daa0a0c842427185ce1ada3b4ab97.tar.bz2
volse-hubzilla-a4960360669daa0a0c842427185ce1ada3b4ab97.zip
local_user => local_channel
Diffstat (limited to 'mod/ping.php')
-rw-r--r--mod/ping.php52
1 files changed, 26 insertions, 26 deletions
diff --git a/mod/ping.php b/mod/ping.php
index 1cebd152d..c69f42a6f 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,13 +148,13 @@ 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_flags = ( item_flags & ~%d ) where (item_flags & %d) > 0 and uid = %d",
intval(ITEM_UNSEEN),
intval(ITEM_UNSEEN),
- intval(local_user())
+ intval(local_channel())
);
break;
case 'home':
@@ -162,24 +162,24 @@ function ping_init(&$a) {
intval(ITEM_UNSEEN),
intval(ITEM_UNSEEN),
intval(ITEM_WALL),
- intval(local_user())
+ intval(local_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:
@@ -187,11 +187,11 @@ function ping_init(&$a) {
}
}
- if(x($_REQUEST, 'markItemRead') && local_user()) {
+ if(x($_REQUEST, 'markItemRead') && local_channel()) {
$r = q("update item set item_flags = ( item_flags & ~%d ) where parent = %d and uid = %d",
intval(ITEM_UNSEEN),
intval($_REQUEST['markItemRead']),
- intval(local_user())
+ intval(local_channel())
);
}
@@ -204,22 +204,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);
@@ -248,7 +248,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'])
@@ -280,7 +280,7 @@ function ping_init(&$a) {
and author_xchan != '%s' ORDER BY created DESC",
intval(ITEM_VISIBLE),
intval(ITEM_UNSEEN),
- intval(local_user()),
+ intval(local_channel()),
dbesc($ob_hash)
);
@@ -301,7 +301,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_flags & %d) > 0) ORDER BY abook_created DESC",
- intval(local_user()),
+ intval(local_channel()),
intval(ABOOK_FLAG_PENDING),
intval(ABOOK_FLAG_SELF|ABOOK_FLAG_IGNORED),
intval(XCHAN_FLAGS_DELETED|XCHAN_FLAGS_ORPHAN)
@@ -333,7 +333,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'))
);
@@ -374,7 +374,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']);
@@ -388,7 +388,7 @@ function ping_init(&$a) {
and author_xchan != '%s'",
intval(ITEM_VISIBLE),
intval(ITEM_UNSEEN),
- intval(local_user()),
+ intval(local_channel()),
dbesc($ob_hash)
);
@@ -414,7 +414,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_flags & %d) > 0)",
- intval(local_user()),
+ intval(local_channel()),
intval(ABOOK_FLAG_PENDING),
intval(ABOOK_FLAG_SELF|ABOOK_FLAG_IGNORED),
intval(XCHAN_FLAGS_DELETED|XCHAN_FLAGS_ORPHAN)
@@ -432,7 +432,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'])
);
@@ -456,7 +456,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'))
);