purify($input); $md = \Parsedown::instance(); $md->setSafeMode(true); $f3->config('../app/.env.cfg'); $f3->set('DEBUG', 3); // development debug $f3->set('CACHE', FALSE); $f3->set('EXT', [new ParsedownHelper, new BulmaFormHelper]); $f3->set('DB', new \DB\SQL( 'mysql:host=localhost;port=3306;dbname=' . $f3->get('database.db_name'), $f3->get('database.username'), $f3->get('database.password') )); new \DB\SQL\Session($f3->get('DB')); $f3->set('SESSION.status', 'running'); // Routing and Controller Setup // home $f3->route('GET /', 'HomeController->display'); // auth $f3->route('GET /login', 'AuthController->showLoginForm'); $f3->route('POST /login', 'AuthController->login'); $f3->route('GET /logout', 'AuthController->logout'); // Example protected route $f3->route('GET /dashboard', function($f3){ if(!$f3->exists('SESSION.user')){ $f3->reroute('/login'); } echo 'Welcome to the dashboard' . $f3->get('SESSION.username'); echo 'logout'; }); // tickets - CRUD (CREATE, READ, UPDATE, DELETE) $f3->route('GET /tickets', 'TicketController->index'); // view all tickets $f3->route('GET /ticket/@id', 'TicketController->view'); // view ticket details $f3->route('GET /ticket/create', 'TicketController->createForm'); // show form to create $f3->route('POST /ticket/create', 'TicketController->create'); // save $f3->route('GET /ticket/@id/edit', 'TicketController->editForm'); // edit ticket $f3->route('POST /ticket/@id/update', 'TicketController->update'); // // additional routes - comments $f3->route('POST /ticket/@id/comment', 'CommentController->create'); $f3->route('GET /ticket/@id/comment/@comment_id/delete', 'CommentController->delete'); $f3->route('GET /ticket/@id/comments', 'CommentController->index'); // route for linking a child to a parent $f3->route('POST /ticket/@id/add-subtask', 'TicketController->addSubtask'); // attachments $f3->route('GET /ticket/@id/attachments', 'AttachmentController->index'); $f3->route('POST /ticket/@id/attachments/upload', 'AttachmentController->upload'); $f3->route('GET /attachment/@id/download', 'AttachmentController->download'); $f3->route('GET /attachment/@id/delete', 'AttachmentController->delete'); // knowledgebase $f3->route('GET /kb', 'KBController->index'); $f3->route('GET /kb/@id', 'KBController->view'); $f3->route('GET /kb/create', 'KBController->createForm'); $f3->route('POST /kb/create', 'KBController->create'); $f3->route('GET /kb/@id/edit', 'KBController->editForm'); $f3->route('POST /kb/@id/update', 'KBController->update'); // should this be update - "crud"? // tags $f3->route('GET /tags', 'TagController->index'); $f3->route('GET /tag/create', 'TagController->createForm'); $f3->route('POST /tag/create', 'TagController->create'); // parsedown preview $f3->route('POST /parsedown/preview', 'ParsedownPreview->view'); // dashboard $f3->route('GET /dashboard', 'DashboardController->index'); // additional routes $f3->route('GET /users', 'UserController->index'); $f3->route('GET /user/@id/edit', 'UserController->editForm'); $f3->route('POST /user/@id/update', 'UserController->update'); $f3->run();