| 12345678910111213141516171819202122232425 |
- <?php
- $app->get('/news', function ($request, $response, $args) {
- $Organizr = ($request->getAttribute('Organizr')) ?? new Organizr();
- if ($Organizr->checkRoute($request)) {
- if ($Organizr->qualifyRequest(1, true)) {
- $Organizr->getNewsIds();
- }
- }
- $response->getBody()->write(jsonE($GLOBALS['api']));
- return $response
- ->withHeader('Content-Type', 'application/json')
- ->withStatus($GLOBALS['responseCode']);
- });
- $app->post('/news/{id}', function ($request, $response, $args) {
- $Organizr = ($request->getAttribute('Organizr')) ?? new Organizr();
- if ($Organizr->checkRoute($request)) {
- if ($Organizr->qualifyRequest(1, true)) {
- $Organizr->ignoreNewsId($args['id']);
- }
- }
- $response->getBody()->write(jsonE($GLOBALS['api']));
- return $response
- ->withHeader('Content-Type', 'application/json')
- ->withStatus($GLOBALS['responseCode']);
- });
|