<?php /* This is the main file to be included on every page. It will act as a front controller of our application. _____ / \ | () () | \ ^ / ||||| ||||| Tread carefully */ // Disable type coercion declare(strict_types=1); // Autoloader spl_autoload_register(function ($class_name) { require __DIR__ . '/core/' . $class_name . '.php'; }); /* === App Setup === */ // Displays a custom page on error or exception new ErrorHandler; // Grab configuration file $config = ( new Config(__DIR__ . '/config.php') )->config; // Start database connection $database = new Database($config['database']); // Session wrapper $session = new Session; // Handles current user session $user = new User($session, $database); // Decides if the user is allowed to view current page new AccessControl($user, $config['root_url']); $app = new App( $config, $database, $session, $user ); // We will use $app instead unset( $config, $database, $session, $user ); return $app;