File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -4,3 +4,5 @@ include/config.php
44nbproject /
55lang /French
66.htaccess
7+ vendor
8+ composer.lock
Original file line number Diff line number Diff line change 77 * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
88 */
99
10+ /**
11+ * middleware to check if user is admin, if it's not redirect to homepage.
12+ */
13+ $ isAdmin = function () use ($ feather ) {
14+ if ($ feather ->user ->g_id != $ feather ->forum_env ['FEATHER_ADMIN ' ]) {
15+ redirect (get_link ('/ ' ), __ ('No permission ' ));
16+ }
17+ };
1018
1119// Index
1220$ feather ->get ('/ ' , '\controller\index:display ' );
8896});
8997
9098// Admin routes
91- $ feather ->group ('/admin ' , function () use ($ feather ) {
99+ $ feather ->group ('/admin ' , $ isAdmin , function () use ($ feather ) {
92100
93101 // Admin index
94102 $ feather ->get ('(/action/:action)(/) ' , '\controller\admin\index:display ' );
163171// 404 not found
164172$ feather ->notFound (function () {
165173 message (__ ('Bad request ' ), '404 ' );
166- });
174+ });
You can’t perform that action at this time.
0 commit comments