flash.moe/public/index.php

35 lines
808 B
PHP
Raw Normal View History

2020-07-30 00:55:37 +00:00
<?php
2022-02-04 20:30:52 +00:00
namespace Makai;
require_once __DIR__ . '/../makai.php';
2023-10-13 18:01:07 +00:00
set_exception_handler(function(\Throwable $ex) {
2023-12-15 01:24:15 +00:00
\Sentry\captureException($ex);
2023-10-13 18:01:07 +00:00
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');
2023-10-14 23:05:49 +00:00
echo file_get_contents(MKI_DIR_PUBLIC . '/error-500.html');
2023-10-13 18:01:07 +00:00
exit;
});
2023-10-13 23:56:33 +00:00
if(file_exists(MKI_ROOT . '/.migrating')) {
http_response_code(503);
2023-10-14 23:05:49 +00:00
echo file_get_contents(MKI_DIR_PUBLIC . '/error-503.html');
2023-10-13 23:56:33 +00:00
exit;
}
2023-10-14 23:05:49 +00:00
$makai->getCSRFP()->setInfo(
2023-12-15 01:20:57 +00:00
$cfg->getString('csrfp:secret', 'meow'),
2023-10-13 20:33:17 +00:00
(string)filter_input(INPUT_SERVER, 'REMOTE_ADDR')
);
2023-10-12 22:09:04 +00:00
$makai->createRouting()->dispatch();