This repository was archived by the owner on Aug 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
87 lines (67 loc) · 3.46 KB
/
index.php
File metadata and controls
87 lines (67 loc) · 3.46 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
<?php
/**
* @package KN
* @author halillusion <halillusion@gmail.com>
**/
declare(strict_types=1);
require __DIR__.'/vendor/autoload.php';
require __DIR__.'/app/bootstrap.php';
try {
$app = (new KN\Core\Factory);
// Multi route group
$app->routes([
['GET,POST', '/sandbox', 'AppController@sandbox'],
['GET,POST', '/sandbox/:action', 'AppController@sandbox']
]);
// Root-bound route group
$app->routeGroup(['GET,POST', '/auth', 'UserController@account', ['Auth@with']], function () {
return [
['GET,POST', '/login', 'UserController@login', ['Auth@withOut', 'CSRF@validate']],
['GET,POST', '/register', 'UserController@register', ['Auth@withOut', 'CSRF@validate']],
['GET,POST', '/recovery', 'UserController@recovery', ['Auth@withOut', 'CSRF@validate']],
['GET,POST', '/logout', 'UserController@logout', ['Auth@with']],
['GET,POST', '/:action', 'UserController@account', ['Auth@with', 'CSRF@validate']],
];
});
$app->routeGroup(['GET,POST', '/management', 'AdminController@dashboard', ['Auth@with']], function () {
return [
// Users
['GET,POST', '/users', 'AdminController@users', ['Auth@with']],
['GET,POST', '/users/list', 'AdminController@userList', ['Auth@with']],
['GET,POST', '/users/add', 'AdminController@userAdd', ['Auth@with']],
['GET,POST', '/users/:id', 'AdminController@userDetail', ['Auth@with']],
['GET,POST', '/users/:id/delete', 'AdminController@userDelete', ['Auth@with']],
['GET,POST', '/users/:id/update', 'AdminController@userUpdate', ['Auth@with']],
// Roles
['GET,POST', '/roles', 'AdminController@roles', ['Auth@with']],
['GET,POST', '/roles/list', 'AdminController@roleList', ['Auth@with']],
['GET,POST', '/roles/add', 'AdminController@roleAdd', ['Auth@with']],
['GET,POST', '/roles/:id', 'AdminController@roleDetail', ['Auth@with']],
['GET,POST', '/roles/:id/delete', 'AdminController@roleDelete', ['Auth@with']],
['GET,POST', '/roles/:id/update', 'AdminController@roleUpdate', ['Auth@with']],
// Sessions
['GET,POST', '/sessions', 'AdminController@sessions', ['Auth@with']],
['GET,POST', '/sessions/list', 'AdminController@sessionList', ['Auth@with']],
['GET,POST', '/sessions/:id/delete', 'AdminController@sessionDelete', ['Auth@with']],
// Logs & Security
['GET,POST', '/logs', 'AdminController@logs', ['Auth@with']],
['GET,POST', '/logs/list', 'AdminController@logList', ['Auth@with']],
['GET,POST', '/logs/:ip/block', 'AdminController@logIpBlock', ['Auth@with']],
// Settings
['GET,POST', '/settings', 'AdminController@settings', ['Auth@with']],
['GET,POST', '/settings/update', 'AdminController@settingsUpdate', ['Auth@with']],
];
});
// Single route
$app->route('GET', '/', 'AppController@index', ['Auth@verifyAccount']);
// Do not remove this route for the KN script library.
$app->route('GET,POST', '/cron', 'AppController@cronJobs');
$app->route('GET,POST', '/sandbox', 'AppController@sandbox');
$app->route('GET,POST', '/sandbox/:action', 'AppController@sandbox');
$app->excludeWhileInMaintenance([
'auth/login'
]);
$app->run();
} catch (Exception $e) {
KN\Core\Exception::exceptionHandler($e);
}