summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2018-11-20 18:55:56 +0100
committermsquare <msquare@notrademark.de>2019-06-12 10:20:08 +0200
commite948091066e4893b1b823fc80db1c1ebba174b53 (patch)
tree1bc34bf1f476abcafe536336955916ac9d929a68 /src
parent93e578e555b6e40c1e26d85e4f32b87577f54def (diff)
Replaced old /api endpoint with ApiController
Diffstat (limited to 'src')
-rw-r--r--src/Controllers/ApiController.php30
-rw-r--r--src/Middleware/LegacyMiddleware.php5
2 files changed, 30 insertions, 5 deletions
diff --git a/src/Controllers/ApiController.php b/src/Controllers/ApiController.php
new file mode 100644
index 00000000..a9c0be98
--- /dev/null
+++ b/src/Controllers/ApiController.php
@@ -0,0 +1,30 @@
+<?php
+
+namespace Engelsystem\Controllers;
+
+use Engelsystem\Http\Response;
+
+class ApiController extends BaseController
+{
+ /** @var Response */
+ protected $response;
+
+ /**
+ * @param Response $response
+ */
+ public function __construct(Response $response)
+ {
+ $this->response = $response;
+ }
+
+ /**
+ * @return Response
+ */
+ public function index()
+ {
+ return $this->response
+ ->setStatusCode(501)
+ ->withHeader('content-type', 'application/json')
+ ->withContent(json_encode(['error' => 'Not implemented']));
+ }
+}
diff --git a/src/Middleware/LegacyMiddleware.php b/src/Middleware/LegacyMiddleware.php
index 2467f25c..de16e557 100644
--- a/src/Middleware/LegacyMiddleware.php
+++ b/src/Middleware/LegacyMiddleware.php
@@ -17,7 +17,6 @@ class LegacyMiddleware implements MiddlewareInterface
protected $free_pages = [
'admin_event_config',
'angeltypes',
- 'api',
'atom',
'ical',
'login',
@@ -106,10 +105,6 @@ class LegacyMiddleware implements MiddlewareInterface
$title = ucfirst($page);
switch ($page) {
/** @noinspection PhpMissingBreakStatementInspection */
- case 'api':
- error('Api disabled temporarily.');
- redirect(page_link_to());
- /** @noinspection PhpMissingBreakStatementInspection */
case 'ical':
require_once realpath(__DIR__ . '/../../includes/pages/user_ical.php');
user_ical();