diff options
author | friendica <info@friendica.com> | 2012-07-28 17:39:26 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2012-07-28 17:39:26 -0700 |
commit | eae7522bc99cc3af0074c189560a66181d2b70a0 (patch) | |
tree | 81022ec2be254fff0e57a1f47727e0607761d373 /mod | |
parent | 2ae0076ae2f08a0f88ad96db4cac0d1b303260ce (diff) | |
download | volse-hubzilla-eae7522bc99cc3af0074c189560a66181d2b70a0.tar.gz volse-hubzilla-eae7522bc99cc3af0074c189560a66181d2b70a0.tar.bz2 volse-hubzilla-eae7522bc99cc3af0074c189560a66181d2b70a0.zip |
also notify count of events today
Diffstat (limited to 'mod')
-rw-r--r-- | mod/ping.php | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/mod/ping.php b/mod/ping.php index 99ff48aa7..d37824645 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -15,6 +15,7 @@ function ping_init(&$a) { $result['mail'] = 0; $result['register'] = 0; $result['events'] = 0; + $result['events_today'] = 0; $result['notice'] = array(); $result['info'] = array(); @@ -154,18 +155,26 @@ function ping_init(&$a) { $t5 = dba_timer(); - - $events = q("SELECT count(`event`.`id`) as total FROM `event` + $events = q("SELECT count(`event`.`id`) as total, start, convert FROM `event` WHERE `event`.`uid` = %d AND `start` < '%s' AND `finish` > '%s' ORDER BY `start` ASC ", intval(local_user()), - dbesc(datetime_convert('UTC','UTC','now + 1 days')), + dbesc(datetime_convert('UTC','UTC','now + 7 days')), dbesc(datetime_convert('UTC','UTC','now')) ); - if($events) + if($events && count($events)) { $result['events'] = intval($events[0]['total']); + if($result['events']) { + $str_now = datetime_convert('UTC',$a->timezone,'now','Y-m-d'); + foreach($events as $x) { + if(datetime_convert('UTC',((intval($x['convert'])) ? $a->timezone : 'UTC'), $x['start'],'Y-m-d') === $str_now) + $result['events_today'] ++; + } + } + } + $x = json_encode($result); $t6 = dba_timer(); |