flash.moe/public/index.php
2023-10-13 23:56:33 +00:00

32 lines
753 B
PHP

<?php
namespace Makai;
require_once __DIR__ . '/../makai.php';
set_exception_handler(function(\Throwable $ex) {
http_response_code(500);
ob_clean();
if(MKI_DEBUG) {
header('Content-Type: text/plain; charset=utf-8');
echo (string)$ex;
exit;
}
header('Content-Type: text/html; charset=utf-8');
echo file_get_contents(MKI_DIR_TEMPLATES . '/errors/500.html');
exit;
});
if(file_exists(MKI_ROOT . '/.migrating')) {
http_response_code(503);
echo file_get_contents(MKI_DIR_TEMPLATES . '/errors/503.html');
exit;
}
$makai->startCSRFP(
$cfg['csrfp'] ?? 'meow',
(string)filter_input(INPUT_SERVER, 'REMOTE_ADDR')
);
$makai->createRouting()->dispatch();