settings.php 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. $app->get('/settings/appearance', function ($request, $response, $args) {
  3. $Organizr = ($request->getAttribute('Organizr')) ?? new Organizr();
  4. if ($Organizr->qualifyRequest(1, true)) {
  5. $GLOBALS['api']['response']['data'] = $Organizr->getCustomizeAppearance();
  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->get('/settings/main', function ($request, $response, $args) {
  13. $Organizr = ($request->getAttribute('Organizr')) ?? new Organizr();
  14. if ($Organizr->qualifyRequest(1, true)) {
  15. $GLOBALS['api']['response']['data'] = $Organizr->getSettingsMain();
  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. });
  22. $app->get('/settings/sso', function ($request, $response, $args) {
  23. $Organizr = ($request->getAttribute('Organizr')) ?? new Organizr();
  24. if ($Organizr->qualifyRequest(1, true)) {
  25. $GLOBALS['api']['response']['data'] = $Organizr->getSettingsSSO();
  26. }
  27. $response->getBody()->write(jsonE($GLOBALS['api']));
  28. return $response
  29. ->withHeader('Content-Type', 'application/json;charset=UTF-8')
  30. ->withStatus($GLOBALS['responseCode']);
  31. });
  32. $app->get('/settings/homepage', function ($request, $response, $args) {
  33. $Organizr = ($request->getAttribute('Organizr')) ?? new Organizr();
  34. if ($Organizr->qualifyRequest(1, true)) {
  35. $GLOBALS['api']['response']['data'] = $Organizr->getSettingsHomepage();
  36. }
  37. $response->getBody()->write(jsonE($GLOBALS['api']));
  38. return $response
  39. ->withHeader('Content-Type', 'application/json;charset=UTF-8')
  40. ->withStatus($GLOBALS['responseCode']);
  41. });
  42. $app->get('/settings/homepage/{item}', function ($request, $response, $args) {
  43. $Organizr = ($request->getAttribute('Organizr')) ?? new Organizr();
  44. if ($Organizr->qualifyRequest(1, true)) {
  45. $GLOBALS['api']['response']['data'] = $Organizr->getSettingsHomepageItem($args['item']);
  46. }
  47. $response->getBody()->write(jsonE($GLOBALS['api']));
  48. return $response
  49. ->withHeader('Content-Type', 'application/json;charset=UTF-8')
  50. ->withStatus($GLOBALS['responseCode']);
  51. });
  52. $app->get('/settings/homepage/{item}/debug', function ($request, $response, $args) {
  53. $Organizr = ($request->getAttribute('Organizr')) ?? new Organizr();
  54. if ($Organizr->qualifyRequest(1, true)) {
  55. $GLOBALS['api']['response']['data'] = $Organizr->getSettingsHomepageItemDebug($args['item']);
  56. }
  57. $response->getBody()->write(jsonE($GLOBALS['api']));
  58. return $response
  59. ->withHeader('Content-Type', 'application/json;charset=UTF-8')
  60. ->withStatus($GLOBALS['responseCode']);
  61. });