public static function StartApp() { ob_start('ob_gzhandler'); session_start(); // Defines define('BASEURL', substr((empty($_SERVER['HTTPS']) ? 'http://' : 'https://' ) . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'],0,-10)); define('BASEPATH', substr($_SERVER['SCRIPT_FILENAME'],0,-10)); // Helper Boot Loader require(BASEPATH.'/core/bootloader.php'); // Initialize Helpers BootLoader::loadHelpers(); Registry::getInstance(); // Handle Errors Registry::setDebugMode(true); set_error_handler('Template::handleError'); set_exception_handler('Template::handleException'); // Initialize Database Model::$db = DBO::getInstance('sqlite:example.sqldb'); // Init Autoloads spl_autoload_register('Autoload::controllers'); spl_autoload_register('Autoload::models'); // Determine Controllers and Methods Routes::getRoute(); // Run Application Routes::run(); }
/** * Created by PhpStorm. * User: babenoff * Date: 03.12.2015 * Time: 15:20 */ if (isset($_COOKIE["LD"])) { if (isset($_SESSION["aid"])) { if ($G->locations->count() < 1) { require_once ROOT_DIR . "/data/blank.php"; } $player = $G->players->findOne(["_id" => new MongoId($_SESSION["aid"])]); if (!is_null($player)) { $action = $_GET["game"]; if (file_exists(ROOT_DIR . "/game/g_" . $action . ".php")) { require ROOT_DIR . "/game/g_" . $action . ".php"; } else { require ROOT_DIR . "/site/404.php"; } $player["last_action"] = microtime(); $G->players->update(["_id" => new MongoId($player["_id"])], $player); } else { $_SESSION = []; header("Location: " . Routes::getRoute("CABINET")); } } else { header("Location: " . Routes::getRoute("CABINET")); } } else { header("Location: " . Routes::getRoute("MAIN_PAGE")); }