diff --git a/gatherling/api.php b/gatherling/api.php index 2aca53026..938cabede 100644 --- a/gatherling/api.php +++ b/gatherling/api.php @@ -104,6 +104,22 @@ } break; + case 'upcoming_events': + $events = []; + $db = Database::getConnection(); + $query = $db->query('SELECT e.name as name FROM events e + WHERE e.start > NOW() + ORDER BY e.start ASC'); + while ($row = $query->fetch_assoc()) { + $events[] = $row['name']; + } + $query->close(); + foreach ($events as $eventname) { + $event = new Event($eventname); + $result[$event->name] = repr_json_event($event); + } + break; + case 'create_series': $series = $_REQUEST['series']; $active = true;