diff options
-rw-r--r-- | install/update.php | 2 | ||||
-rw-r--r-- | mod/ping.php | 31 | ||||
-rw-r--r-- | view/tpl/nav.tpl | 10 |
3 files changed, 37 insertions, 6 deletions
diff --git a/install/update.php b/install/update.php index a6fecbef5..0459df817 100644 --- a/install/update.php +++ b/install/update.php @@ -280,7 +280,7 @@ ADD INDEX ( `event_hash` )"); function update_r1019() { - $r = q"ALTER TABLE `event` DROP `message_id` "); + $r = q("ALTER TABLE `event` DROP `message_id` "); if($r) return UPDATE_SUCCESS; return UPDATE_FAILED; diff --git a/mod/ping.php b/mod/ping.php index 34de31340..347b26eb3 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -181,6 +181,37 @@ function ping_init(&$a) { } + if(argc() > 1 && (argv(1) === 'all_events')) { + + $result = array(); + + $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()), + dbesc(datetime_convert('UTC',date_default_timezone_get(),'now + 7 days')), + dbesc(datetime_convert('UTC',date_default_timezone_get(),'now - 1 days')) + ); + + if($r) { + foreach($r as $rr) { + $result[] = array( + 'notify_link' => $a->get_baseurl() . '/events/' . $rr['event_hash'], + 'name' => $rr['xchan_name'], + 'url' => $rr['xchan_url'], + 'photo' => $rr['xchan_photo_s'], + 'when' => relative_date($rr['start']), + 'class' => ('notify-unseen'), + 'message' => t('posted an event') + ); + } + } + logger('ping: ' . print_r($result,true)); + echo json_encode(array('notify' => $result)); + killme(); + + } + // Normal ping - just the counts diff --git a/view/tpl/nav.tpl b/view/tpl/nav.tpl index 19635e6a0..dc4e50e33 100644 --- a/view/tpl/nav.tpl +++ b/view/tpl/nav.tpl @@ -48,12 +48,12 @@ {{ endif }} {{ if $nav.all_events }} - <li id="nav-all-events-link" class="nav-menu $sel.all_events"> + <li id="nav-all_events-link" class="nav-menu $sel.all_events"> <a class="$nav.all_events.2" href="$nav.all_events.0" title="$nav.all_events.3" ><span class="icon events">$nav.all_events.1</span></a> - <span id="all-events-update" class="nav-notify fakelink" rel="#nav-events-menu"></span> - <ul id="nav-events-menu" class="menu-popup notify-menus" rel="events"> - <li id="nav-events-see-all"><a href="$nav.events.all.0">$nav.events.all.1</a></li> - <li id="nav-events-mark-all"><a href="#" onclick="/*fixme*/ return false;">$nav.events.mark.1</a></li> + <span id="all-all_events-update" class="nav-notify fakelink" rel="#nav-all_events-menu"></span> + <ul id="nav-all_events-menu" class="menu-popup notify-menus" rel="all_events"> + <li id="nav-all_events-see-all"><a href="$nav.all_events.all.0">$nav.all_events.all.1</a></li> + <li id="nav-all_events-mark-all"><a href="#" onclick="/*fixme*/ return false;">$nav.all_events.mark.1</a></li> <li class="empty">$emptynotifications</li> </ul> </li> |