<?php $app->get('/login/', function ($request, $response) { $session = new \RKA\Session(); if ($session->loggedin === '1') { return $response->withStatus(301)->withHeader('Location', '/Dashboard/index/'); } $c = new App\Controller\Login($request, $response, $this->renderer); $c->showlogin(); }); $app->post('/login/', function ($request, $response) { return $response->withStatus(301)->withHeader('Location', '/Dashboard/index/'); })->add(new App\SimpleAuth()); $app->get('/logout/', function ($request, $response) { return $response->withStatus(301)->withHeader('Location', '/login/'); })->add(new App\Logout()); $app->get('/{class:Dashboard|settings}/index/', function ($request, $response, $args) { $className = 'App\\Controller\\' . ucfirst($args['class']); $c = new $className($request, $response, $this->db, $this->renderer); $c->index(); })->add(new App\CheckAuth()); $app->get('/system/{action:index|logging}/', function ($request, $response, $args) { $c = new App\Controller\System($request, $response, $this->db, $this->renderer); $action = $args['action']; $c->{$action}(); })->add(new App\CheckAuth()); $app->get('/summary/{action:ranking|competition|keywords|value|positions|valueindex}/', function ($request, $response, $args) { $c = new App\Controller\Summary($request, $response, $this->db, $this->renderer); $action = $args['action']; $c->{$action}(); })->add(new App\CheckAuth());