2024-09-03 16:29:44 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use app\controllers\MainController;
|
|
|
|
use kernel\App;
|
|
|
|
use kernel\modules\admin_themes\controllers\AdminThemeController;
|
|
|
|
use Phroute\Phroute\RouteCollector;
|
|
|
|
|
2024-09-24 17:22:09 +03:00
|
|
|
App::$collector->filter("auth", function (){
|
|
|
|
if(!isset($_COOKIE['user_id']))
|
|
|
|
{
|
|
|
|
header('Location: /admin/login');
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
2024-09-03 16:29:44 +03:00
|
|
|
|
|
|
|
App::$collector->group(["prefix" => "admin"], function (RouteCollector $router){
|
2024-09-24 17:22:09 +03:00
|
|
|
App::$collector->group(["before" => "auth"], function (RouteCollector $router){
|
2024-09-12 16:01:04 +03:00
|
|
|
App::$collector->get('/', [\kernel\controllers\ModuleController::class, 'actionIndex']);
|
|
|
|
});
|
2024-09-24 17:22:09 +03:00
|
|
|
App::$collector->get('/login', [\kernel\controllers\SecureController::class, 'actionLogin']);
|
|
|
|
App::$collector->get('/logout', [\kernel\controllers\SecureController::class, 'actionLogout']);
|
|
|
|
App::$collector->post('/auth', [\kernel\controllers\SecureController::class, 'actionAuth']);
|
|
|
|
App::$collector->group(["before" => "auth"], function (RouteCollector $router){
|
|
|
|
App::$collector->group(["prefix" => "module"], function (RouteCollector $router){
|
|
|
|
App::$collector->get('/', [\kernel\controllers\ModuleController::class, 'actionIndex']);
|
|
|
|
App::$collector->get('/activate', [\kernel\controllers\ModuleController::class, 'actionActivate']);
|
|
|
|
});
|
|
|
|
});
|
2024-09-03 16:29:44 +03:00
|
|
|
});
|