addRoute("/maintenanceinfo/current", "getCurrentMaintenance", "GET"); } protected function authenticated() { if($this->me->username != "xinon-at-maintenance-api-user") { return \mfResponse::Forbidden(); } } protected function getCurrentMaintenance() { $results = []; foreach(\MaintenanceNotification::searchOpen([]) as $notification) { $item = []; $from = new DateTime("@".$notification->from); $from->setTimezone(new DateTimeZone("Europe/Vienna")); $to = new DateTime("@".$notification->to); $to->setTimezone(new DateTimeZone("Europe/Vienna")); $item["from"] = $from->format("c"); $item["to"] = $to->format("c"); $item["from_ts"] = $notification->from; $item["to_ts"] = $notification->to; $item["subject"] = $notification->subject->subject; $item["text"] = $notification->getReplacedBody(); $item["plz_list"] = $notification->plzs; $results[] = $item; } return \mfResponse::Ok($results); } }