-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
52 lines (41 loc) · 1.32 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
require 'vendor/autoload.php';
require 'models/Config.php';
require 'models/Files.php';
require 'helpers/App.php';
require 'controllers/ManualController.php';
require 'controllers/LibraryController.php';
$configuration = [
'settings' => [
'displayErrorDetails' => true
]
];
$container = new \Slim\Container($configuration);
$app = new \Slim\App($container);
$container['config'] = new \Models\Config;
$container['helper'] = new \Helpers\App($container);
$container['view'] = function ($container) {
$view = new \Slim\Views\Twig('templates', [
'cache' => false
]);
$view->addExtension(new \Slim\Views\TwigExtension(
$container['router'],
$container['request']->getUri()
));
return $view;
};
$areas = [
'manual', 'library'
];
foreach ($areas as $area) {
$properName = ucfirst($area);
$app->get("/{$area}", "Controllers\\{$properName}Controller:index")
->setName('Homepage');
$app->get("/{$area}/auth", "Controllers\\{$properName}Controller:authenticate")
->setName('Authenticate');
$app->get("/{$area}/callback", "Controllers\\{$properName}Controller:authenticateCallback")
->setName('Authentication Callback');
$app->get("/{$area}/logout", "Controllers\\{$properName}Controller:logout")
->setName('Logout');
}
$app->run();