/** * Class App * @package Mariana\Framework * @desc Bootstrap for the frameworkz */ public static function run() { # Session start Session::start(); # Setup Environment::setup(); # Load dependencys require_once ROOT . DS . 'app' . DS . 'routes.php'; require_once ROOT . DS . 'app' . DS . 'config.php'; # Set Language and import translation files (LANG) self::setLanguage(); # Connect Database::$connection; # Route Router::route(); }
Router::post('/user/diet/adapt/', array('controller' => 'DietController', 'method' => 'adaptRecipe', 'middleware' => array(array('AuthMiddleware', 'checkAuth', array()), array('AccountConfigurationMiddleware', 'check_first_report_not_exists', array())))); //TODO: Acabar estas routes # Forum Routes Router::get('/forum/', array('controller' => 'ForumController', 'method' => 'index')); Router::get('/forum/new/', array('controller' => 'ForumController', 'method' => 'add')); Router::get('/forum/topic/{id}/', array('controller' => 'ForumController', 'method' => 'view')); Router::get('/forum/edit/{id}/', array('controller' => 'ForumController', 'method' => 'add')); Router::get('/forum/my-questions/', array('controller' => 'ForumController', 'method' => 'mine')); Router::post('/forum/edit/reply/', array('controller' => 'ForumController', 'method' => 'editReply')); Router::post('/forum/reply/', array('controller' => 'ForumController', 'method' => 'reply')); Router::post('/forum/answer/', array('controller' => 'ForumController', 'method' => 'answer')); Router::post('/forum/love/', array('controller' => 'ForumController', 'method' => 'love')); Router::post('/forum/search/', array('controller' => 'ForumController', 'method' => 'ajaxSearch')); Router::post('/forum/new/', array('controller' => 'ForumController', 'method' => 'newTopic')); Router::post('/forum/delete/', array('controller' => 'ForumController', 'method' => 'delete')); # Server Routes Router::get('/server/chat/', array('controller' => 'ServerController', 'method' => 'index', 'middleware' => array(array('AuthMiddleware', 'checkAuth', array())))); # Valid Post Requests Router::post('/', array('controller' => 'ViewsController', 'method' => 'invalid_request', 'middleware' => array(array('FormValidationMiddleware', 'csrf')))); Router::post('/login/', array('controller' => 'AuthController', 'method' => 'login', 'middleware' => array(array('FormValidationMiddleware', 'csrf')))); Router::post('/logout/', array('controller' => 'AuthController', 'method' => 'logout', 'middleware' => array(array('FormValidationMiddleware', 'csrf')))); Router::post('/signup/', array('controller' => 'AuthController', 'method' => 'signup', 'middleware' => array(array('FormValidationMiddleware', 'csrf')))); Router::post('/user/report/', array('controller' => 'UserController', 'method' => 'report', 'middleware' => array(array('AuthMiddleware', 'checkAuth', array()), array('AccountConfigurationMiddleware', 'check_first_report_not_exists', array()), array('FormValidationMiddleware', 'csrf')))); Router::post('/user/first-report/', array('controller' => 'UserController', 'method' => 'first_report', 'middleware' => array(array('AuthMiddleware', 'checkAuth', array()), array('AccountConfigurationMiddleware', 'check_first_report_not_exists', array()), array('FormValidationMiddleware', 'csrf')))); Router::post('/find-file/', array('controller' => 'UserController', 'method' => 'getFile', 'middleware' => array(array('AuthMiddleware', 'checkAuth', array())))); Router::post('/workout-tracking/', array('controller' => 'WorkoutController', 'method' => 'tracking', 'middleware' => array(array('AuthMiddleware', 'checkAuth', array())))); # Chat Routes Router::post('/messages/get-conversations/', array('controller' => 'ChatController', 'method' => 'checkConversations', 'middleware' => array(array('AuthMiddleware', 'checkAuth', array())))); Router::post('/messages/get-messages/', array('controller' => 'ChatController', 'method' => 'loadConversation', 'middleware' => array(array('AuthMiddleware', 'checkAuth', array())))); Router::post('/messages/send-message/', array('controller' => 'ChatController', 'method' => 'sendMessage', 'middleware' => array(array('AuthMiddleware', 'checkAuth', array()))));
<?php /** * Created by PhpStorm. * User: filipe_2 * Date: 12/18/2015 * Time: 9:41 PM */ use Mariana\Framework\Router; # VALID GET REQUESTS Router::get("/", array("controller" => "TestController", "method" => "index", 'middleware' => array(array('AuthMiddleware', 'check_if_logged_in', array('a', 'b'))))); Router::post("/login", array("controller" => "AuthController", "method" => "login")); Router::get("/home/", array("controller" => "TestController", "method" => "index_2")); Router::get("/home/user/", array("controller" => "TestController", "method" => "index_3")); Router::get("/home/{userid}/", array("controller" => "TestController", "method" => "index_4")); Router::get("/home/user/{userid}/", array("controller" => "TestController", "method" => "index_5", "middleware" => array("before" => array("method 1"), "after" => array("methods")))); # VALID POST REQUESTS Router::post("/", array("controller" => "TestController", "method" => "post_test")); # DEFAULT REQUEST - 1 ALLOWED EACH Router::$defaultGet = "/"; Router::$defaultPost = "/";