settings.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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/plugin', function ($request, $response, $args) {
  13. $Organizr = ($request->getAttribute('Organizr')) ?? new Organizr();
  14. if ($Organizr->qualifyRequest(1, true)) {
  15. $GLOBALS['api']['response']['data'] = $Organizr->getPluginSettings();
  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/theme', function ($request, $response, $args) {
  23. $Organizr = ($request->getAttribute('Organizr')) ?? new Organizr();
  24. if ($Organizr->qualifyRequest(1, true)) {
  25. $GLOBALS['api']['response']['data'] = $Organizr->getThemeSettings();
  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/main', function ($request, $response, $args) {
  33. $Organizr = ($request->getAttribute('Organizr')) ?? new Organizr();
  34. if ($Organizr->qualifyRequest(1, true)) {
  35. $GLOBALS['api']['response']['data'] = $Organizr->getSettingsMain();
  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/sso', function ($request, $response, $args) {
  43. $Organizr = ($request->getAttribute('Organizr')) ?? new Organizr();
  44. if ($Organizr->qualifyRequest(1, true)) {
  45. $GLOBALS['api']['response']['data'] = $Organizr->getSettingsSSO();
  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', function ($request, $response, $args) {
  53. $Organizr = ($request->getAttribute('Organizr')) ?? new Organizr();
  54. if ($Organizr->qualifyRequest(1, true)) {
  55. $GLOBALS['api']['response']['data'] = $Organizr->getSettingsHomepage();
  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. });
  62. $app->get('/settings/homepage/{item}', function ($request, $response, $args) {
  63. $Organizr = ($request->getAttribute('Organizr')) ?? new Organizr();
  64. if ($Organizr->qualifyRequest(1, true)) {
  65. $GLOBALS['api']['response']['data'] = $Organizr->getSettingsHomepageItem($args['item']);
  66. }
  67. $response->getBody()->write(jsonE($GLOBALS['api']));
  68. return $response
  69. ->withHeader('Content-Type', 'application/json;charset=UTF-8')
  70. ->withStatus($GLOBALS['responseCode']);
  71. });
  72. $app->get('/settings/homepage/{item}/debug', function ($request, $response, $args) {
  73. $Organizr = ($request->getAttribute('Organizr')) ?? new Organizr();
  74. if ($Organizr->qualifyRequest(1, true)) {
  75. $GLOBALS['api']['response']['data'] = $Organizr->getSettingsHomepageItemDebug($args['item']);
  76. }
  77. $response->getBody()->write(jsonE($GLOBALS['api']));
  78. return $response
  79. ->withHeader('Content-Type', 'application/json;charset=UTF-8')
  80. ->withStatus($GLOBALS['responseCode']);
  81. });