forked from smillie/gas-client
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
executable file
·120 lines (104 loc) · 3.9 KB
/
index.php
File metadata and controls
executable file
·120 lines (104 loc) · 3.9 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php
session_start();
session_regenerate_id();
require 'vendor/autoload.php';
require_once 'model/User.php';
require_once 'model/Group.php';
require_once 'model/NewMember.php';
require_once 'model/AuditLog.php';
require_once 'controllers/DashboardController.php';
require_once 'controllers/LoginController.php';
require_once 'controllers/AdminController.php';
require_once 'controllers/ElectionsController.php';
$app = new \Slim\Slim();
$loader = new Twig_Loader_Filesystem('views');
$twig = new Twig_Environment($loader, array(
'cache' => 'views/cache',
));
$twig->addFilter('md5', new Twig_Filter_Function('md5'));
$twig->addGlobal('config', $conf);
$app->get('/', function() use ($app, $twig) {
LoginController::display($app, $twig);
});
$app->post('/auth/login', function() use ($app, $twig) {
LoginController::login($app, $twig);
});
$app->get('/auth/logout', function() use ($app, $twig) {
LoginController::logout($app);
});
$app->get('/register', function() use ($app, $twig) {
LoginController::displayRegister($twig);
});
$app->post('/register', function() use ($app, $twig) {
LoginController::handleRegister($twig);
});
$app->get('/dashboard', function() use ($app, $twig) {
DashboardController::displayDetails($app, $twig);
});
$app->post('/dashboard', function() use ($app, $twig) {
DashboardController::updateDetails($app, $twig);
});
$app->get('/changepassword', function() use ($app, $twig) {
DashboardController::displayPasswordChange($app, $twig);
});
$app->post('/changepassword', function() use ($app, $twig) {
DashboardController::handlePasswordChange($app, $twig);
});
$app->get('/managekeys', function() use ($app, $twig) {
DashboardController::displayManageKeys($app, $twig);
});
$app->post('/managekeys', function() use ($app, $twig) {
DashboardController::handleManageKeys($app, $twig);
});
//Admin routes
//TODO CSV export?
$app->get('/admin/search', function() use ($app, $twig) {
AdminController::handleSearch($app, $twig);
});
$app->get('/admin/listusers', function() use ($app, $twig) {
AdminController::listUsers($app, $twig);
});
$app->get('/admin/edit', function() use ($app, $twig) {
AdminController::displaySearch($app, $twig);
});
$app->get('/admin/edit/:username', function($username) use ($app, $twig) {
AdminController::editUser($app, $twig, $username);
});
$app->post('/admin/edit/:username', function($username) use ($app, $twig) {
AdminController::handleEditUser($app, $twig, $username);
});
$app->get('/admin/adduser', function() use ($app, $twig) {
AdminController::addUser($app, $twig);
});
$app->post('/admin/adduser', function() use ($app, $twig) {
AdminController::handleAddUser($app, $twig);
});
$app->get('/admin/newusers', function() use ($app, $twig) {
AdminController::displayNewUsers($app, $twig);
});
$app->post('/admin/newusers', function() use ($app, $twig) {
AdminController::handleNewUsers($app, $twig);
});
$app->get('/admin/groups', function() use ($app, $twig) {
AdminController::listGroups($app, $twig);
});
$app->post('/admin/groups', function() use ($app, $twig) {
AdminController::handleAddGroup($app, $twig);
});
$app->get('/admin/groups/:name', function($name) use ($app, $twig) {
AdminController::editGroup($app, $twig, $name);
});
$app->post('/admin/groups/:name', function($name) use ($app, $twig) {
AdminController::handleEditGroup($app, $twig, $name);
});
$app->get('/elections/nominate/', function() use ($app, $twig) {
ElectionsController::nominateForm($app, $twig);
});
$app->post('/elections/nominate/', function() use ($app, $twig) {
ElectionsController::handleNomination($app, $twig);
});
$app->get('/admin/audit', function() use ($app, $twig) {
AdminController::displayAuditLog($app, $twig);
});
$app->run();
?>