~xibo-maintainers/xibo/tempel

« back to all changes in this revision

Viewing changes to web/api.php

  • Committer: Dan Garner
  • Date: 2015-03-26 14:08:33 UTC
  • Revision ID: git-v1:70d14044444f8dc5d602b99890d59dea46d9470c
Moved web servable files to web folder

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/*
 
3
 * Xibo - Digital Signage - http://www.xibo.org.uk
 
4
 * Copyright (C) 2015 Spring Signage Ltd
 
5
 *
 
6
 * This file (api.php) is part of Xibo.
 
7
 *
 
8
 * Xibo is free software: you can redistribute it and/or modify
 
9
 * it under the terms of the GNU Affero General Public License as published by
 
10
 * the Free Software Foundation, either version 3 of the License, or
 
11
 * any later version.
 
12
 *
 
13
 * Xibo is distributed in the hope that it will be useful,
 
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
 * GNU Affero General Public License for more details.
 
17
 *
 
18
 * You should have received a copy of the GNU Affero General Public License
 
19
 * along with Xibo.  If not, see <http://www.gnu.org/licenses/>.
 
20
 */
 
21
 
 
22
DEFINE('XIBO', true);
 
23
require 'lib/autoload.php';
 
24
require 'vendor/autoload.php';
 
25
 
 
26
// Classes we need to deprecate
 
27
require 'lib/app/kit.class.php';
 
28
require 'config/config.class.php';
 
29
require 'lib/app/translationengine.class.php';
 
30
require 'lib/app/session.class.php';
 
31
// END
 
32
 
 
33
if (!file_exists('settings.php'))
 
34
    die('Not configured');
 
35
 
 
36
Config::Load();
 
37
 
 
38
$app = new \Slim\Slim(array(
 
39
    'debug' => true
 
40
));
 
41
$app->setName('api');
 
42
$app->add(new \Xibo\Middleware\Storage());
 
43
$app->add(new \Xibo\Middleware\State());
 
44
 
 
45
// oAuth Resource
 
46
/*$sessionStorage = new Storage\SessionStorage();
 
47
$accessTokenStorage = new Storage\AccessTokenStorage();
 
48
$clientStorage = new Storage\ClientStorage();
 
49
$scopeStorage = new Storage\ScopeStorage();
 
50
 
 
51
$server = new \League\OAuth2\Server\ResourceServer(
 
52
    $sessionStorage,
 
53
    $accessTokenStorage,
 
54
    $clientStorage,
 
55
    $scopeStorage
 
56
);
 
57
 
 
58
$app->add(new \Xibo\Middleware\ApiAuthenticationOAuth($server));*/
 
59
 
 
60
$app->view(new JsonApiView());
 
61
$app->add(new JsonApiMiddleware());
 
62
 
 
63
// The current user
 
64
// this should be injected by the ApiAuthenticationOAuth middleware
 
65
$app->user = \Xibo\Factory\UserFactory::getById(1);
 
66
 
 
67
// All routes
 
68
require 'lib/routes.php';
 
69
 
 
70
// Run app
 
71
$app->run();
 
 
b'\\ No newline at end of file'