use UserFrosting as UF; // Front page $app->get('/', function () use($app) { // This if-block detects if mod_rewrite is enabled. // This is just an anti-noob device, remove it if you know how to read the docs and/or breathe through your nose. if (isset($_SERVER['SERVER_TYPE']) && $_SERVER['SERVER_TYPE'] == "Apache" && !isset($_SERVER['HTTP_MOD_REWRITE'])) { $app->render('errors/bad-config.twig'); exit; } // Check that we can connect to the DB. Again, you can remove this if you know what you're doing. if (!UF\Database::testConnection()) { // In case the error is because someone is trying to reinstall with new db info while still logged in, log them out session_destroy(); // TODO: log out from remember me as well. $controller = new UF\AccountController($app); return $controller->pageDatabaseError(); } // Forward to installation if not complete // TODO: Is there any way to detect that installation was complete, but the DB is malfunctioning? if (!isset($app->site->install_status) || $app->site->install_status == "pending") { $app->redirect($app->urlFor('uri_install')); } // Forward to the user's landing page (if logged in), otherwise take them to the home page // This is probably where you, the developer, would start making changes if you need to change the default behavior. if ($app->user->isGuest()) { $controller = new UF\AccountController($app); $controller->pageHome(); // If this is the first the root user is logging in, take them to site settings } else { if ($app->user->id == $app->config('user_id_master') && $app->site->install_status == "new") { $app->site->install_status = "complete";