database.php 829 B

123456789101112131415161718192021
  1. <?php
  2. $app->get('/database/journal', function ($request, $response, $args) {
  3. $Organizr = ($request->getAttribute('Organizr')) ?? new Organizr();
  4. if ($Organizr->qualifyRequest(1, true)) {
  5. $Organizr->getJournalMode();
  6. }
  7. $response->getBody()->write(jsonE($GLOBALS['api']));
  8. return $response
  9. ->withHeader('Content-Type', 'application/json;charset=UTF-8')
  10. ->withStatus($GLOBALS['responseCode']);
  11. });
  12. $app->put('/database/journal/{option}', function ($request, $response, $args) {
  13. $Organizr = ($request->getAttribute('Organizr')) ?? new Organizr();
  14. if ($Organizr->qualifyRequest(1, true)) {
  15. $Organizr->setJournalMode($args['option']);
  16. }
  17. $response->getBody()->write(jsonE($GLOBALS['api']));
  18. return $response
  19. ->withHeader('Content-Type', 'application/json;charset=UTF-8')
  20. ->withStatus($GLOBALS['responseCode']);
  21. });