예제 #1
0
if ($cfg->ACTIVE_DB) {
    $f3->set('DB', DBHandler::instance()->get($cfg->ACTIVE_DB));
} else {
    $f3->error(500, 'Sorry, but there is no active DB setup.');
}
///////////////
//  frontend //
///////////////
$f3->route(array('GET /', 'GET /@page', 'GET /payloads', 'GET /page/@page'), 'Controller\\Payload->getList');
// view single
$f3->route(array('GET /payload/@id'), 'Controller\\Payload->viewSingle');
$f3->route(array('GET /payload/search'), 'Controller\\Payload->search_frontend');
///////////////
//  backend  //
///////////////
if (\Controller\Auth::isLoggedIn()) {
    // general CRUD operations
    $f3->route('GET|POST /cnc/@module', 'Controller\\Backend->getList');
    $f3->route('GET|POST /cnc/@module/@page', 'Controller\\Backend->getList');
    $f3->route('GET|POST /cnc/@module/@action/@id', 'Controller\\Backend->@action');
    // some method reroutes
    $f3->route('GET /cnc/@module/create', 'Controller\\Backend->getSingle');
    $f3->route('POST /cnc/@module/create', 'Controller\\Backend->post');
    $f3->route('GET /cnc/@module/edit/@id', 'Controller\\Backend->getSingle');
    $f3->route('POST /cnc/@module/edit/@id', 'Controller\\Backend->post');
    $f3->route('GET /cnc/@module/view/@id', 'Controller\\Backend->viewSingle');
    $f3->route('POST /cnc/@module/view/@id', 'Controller\\Backend->viewSingle');
    //Search
    $f3->route('GET /cnc/@module/search', 'Controller\\Backend->getSearchResults');
    $f3->route('POST /cnc/@module/search', 'Controller\\Backend->getSearchResults');
    $f3->route('GET /cnc', 'Controller\\Dashboard->main');