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
128 lines (101 loc) · 6.1 KB
/
index.php
File metadata and controls
128 lines (101 loc) · 6.1 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
121
122
123
124
125
126
127
128
<?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);
// 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']],
// Files
['GET,POST', '/media', 'FileController@medias', ['Auth@with']],
['GET,POST', '/media/list', 'FileController@mediaList', ['Auth@with']],
['GET,POST', '/media/add', 'FileController@mediaAdd', ['Auth@with']],
['GET,POST', '/media/:id', 'FileController@mediaDetail', ['Auth@with']],
['GET,POST', '/media/:id/delete', 'FileController@mediaDelete', ['Auth@with']],
['GET,POST', '/media/:id/update', 'FileController@mediaUpdate', ['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']],
// Contents
['GET,POST', '/icon-picker', 'ContentController@iconPicker', ['Auth@with']],
['GET,POST', '/:module', 'ContentController@contents', ['Auth@with']],
['GET,POST', '/:module/list', 'ContentController@contentList', ['Auth@with']],
['GET,POST', '/:module/add', 'ContentController@contentAdd', ['Auth@with']],
['GET,POST', '/:module/:id', 'ContentController@contentDetail', ['Auth@with']],
['GET,POST', '/:module/:id/delete', 'ContentController@contentDelete', ['Auth@with']],
['GET,POST', '/:module/:id/update', 'ContentController@contentUpdate', ['Auth@with']],
// Content Autocomplete Field
['GET,POST', '/:module/autocomplete', 'ContentController@contentAutoCompleteInquiry', ['Auth@with']],
// Content Image Upload in Editor(quill)
['POST', '/content/:module/upload-file', 'ContentController@uploadAFile', ['Auth@with']],
// Content Slug Check
['GET,POST', '/:module/slug', 'ContentController@contentSlugInquiry', ['Auth@with']],
// Forms
['GET,POST', '/forms/:form', 'FormController@forms', ['Auth@with']],
['GET,POST', '/forms/:form/list', 'FormController@formList', ['Auth@with']],
['GET,POST', '/forms/:form/:id', 'FormController@formDetail', ['Auth@with']],
['GET,POST', '/forms/:form/:id/delete', 'FormController@formDelete', ['Auth@with']],
['GET,POST', '/forms/:form/:id/update', 'FormController@formUpdate', ['Auth@with']],
// Menus
['GET,POST', '/menus', 'MenuController@menus', ['Auth@with']],
['GET,POST', '/menus/list', 'MenuController@menuList', ['Auth@with']],
['GET,POST', '/menus/add', 'MenuController@menuAdd', ['Auth@with']],
['GET,POST', '/menus/:id', 'MenuController@menuDetail', ['Auth@with']],
['GET,POST', '/menus/:id/delete', 'MenuController@menuDelete', ['Auth@with']],
['GET,POST', '/menus/:id/update', 'MenuController@menuUpdate', ['Auth@with']],
['GET,POST', '/menus/get-menu-params', 'MenuController@getMenuParameters', ['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']);
$app->route('GET', '/app/cookie-consent', 'AppController@cookieConsent', []);
// Please do not remove for KN to work properly.
$app->route('GET,POST', '/cron', 'AppController@cronJobs');
// Multi route group
$app->routes([
['GET,POST', '/sandbox', 'AppController@sandbox'],
['GET,POST', '/sandbox/:action', 'AppController@sandbox']
]);
$app->excludeWhileInMaintenance([
'auth/login'
]);
$app->run();
} catch (Exception $e) {
KN\Core\Exception::exceptionHandler($e);
}