| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- $app->post('/themes/manage/{theme}', function ($request, $response, $args) {
- $Organizr = ($request->getAttribute('Organizr')) ?? new Organizr();
- if ($Organizr->qualifyRequest(1, true)) {
- $Organizr->installTheme($args['theme']);
- }
- $response->getBody()->write(jsonE($GLOBALS['api']));
- return $response
- ->withHeader('Content-Type', 'application/json;charset=UTF-8')
- ->withStatus($GLOBALS['responseCode']);
- });
- $app->delete('/themes/manage/{theme}', function ($request, $response, $args) {
- $Organizr = ($request->getAttribute('Organizr')) ?? new Organizr();
- if ($Organizr->qualifyRequest(1, true)) {
- $Organizr->removeTheme($args['theme']);
- }
- $response->getBody()->write(jsonE($GLOBALS['api']));
- return $response
- ->withHeader('Content-Type', 'application/json;charset=UTF-8')
- ->withStatus($GLOBALS['responseCode']);
- });
- $app->get('/themes/marketplace', function ($request, $response, $args) {
- $Organizr = ($request->getAttribute('Organizr')) ?? new Organizr();
- if ($Organizr->checkRoute($request)) {
- if ($Organizr->qualifyRequest(1, true)) {
- $GLOBALS['api']['response']['data'] = $Organizr->getThemesMarketplace();
- }
- }
- $response->getBody()->write(jsonE($GLOBALS['api']));
- return $response
- ->withHeader('Content-Type', 'application/json;charset=UTF-8')
- ->withStatus($GLOBALS['responseCode']);
- });
- $app->get('/themes', function ($request, $response, $args) {
- $Organizr = ($request->getAttribute('Organizr')) ?? new Organizr();
- if ($Organizr->checkRoute($request)) {
- if ($Organizr->qualifyRequest(1, true)) {
- $GLOBALS['api']['response']['data'] = $Organizr->getAllThemesInformation();
- }
- }
- $response->getBody()->write(jsonE($GLOBALS['api']));
- return $response
- ->withHeader('Content-Type', 'application/json;charset=UTF-8')
- ->withStatus($GLOBALS['responseCode']);
- });
|