aboutsummaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
authorwinter Sparkles2026-08-08 23:01:51 +0100
committerwinter Sparkles2026-08-08 23:01:51 +0100
commitb422b6ded608807c7d3bb8b965b3797ca513610b (patch)
tree7925fa972efbfff2a9bf8648334d49e3fd6b5df1 /index.php
parent880a274e1ecbed42c76d3dc4a81161b3ae372726 (diff)
implement a large chunk of the auth system itself :D
Diffstat (limited to 'index.php')
-rw-r--r--index.php50
1 files changed, 0 insertions, 50 deletions
diff --git a/index.php b/index.php
deleted file mode 100644
index 3dee8eb..0000000
--- a/index.php
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-
-spl_autoload_register(function ($class) {
- $sep = DIRECTORY_SEPARATOR;
- $cname = str_replace('\\', $sep, $class);
- include __DIR__ . "$sep$cname.php";
-});
-
-$path = $_SERVER['PATH_INFO'] ?? $_SERVER['REQUEST_URI'] ?? null;
-
-if (!isset($path)) {
- http_response_code(500);
- echo "<p>Server misconfiguration! couldn't figure out the request path</p>";
- exit;
-}
-
-$path = explode('?', $path, 2)[0];
-
-$config = parse_ini_file(__DIR__ . '/config.ini', true, INI_SCANNER_TYPED);
-
-App\XMLResponse::addStylesheet('templates/index.xsl');
-App\XMLResponse::addPreamble(function ($doc) use ($config) {
- $doc->addAttribute('site-name', $config['site']['name']);
- $doc->addAttribute('source', $config['site']['source-location']);
-});
-
-$router = new App\Router('routes', $config);
-
-$router->registerStatusHandler(404, function ($path) {
- $resp = new App\XMLResponse;
- $resp->doc->addAttribute('title', 'Not found');
- $resp->doc->addChild(
- 'error',
- "The requested page ($path) does not exist."
- );
- $resp->send();
-});
-
-$router->registerStatusHandler(405, function ($path) {
- $method = $_SERVER['REQUEST_METHOD'];
- $resp = new App\XMLResponse;
- $resp->doc->addAttribute('title', 'Wrong method');
- $resp->doc->addChild(
- 'error',
- "Your request method ($method) is not valid for this path."
- );
- $resp->send();
-});
-
-$router->dispatch($path);