summaryrefslogtreecommitdiff
path: root/src/web/lib/hooks.php
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/web/lib/hooks.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/web/lib/hooks.php b/src/web/lib/hooks.php
new file mode 100644
index 0000000..45316ec
--- /dev/null
+++ b/src/web/lib/hooks.php
@@ -0,0 +1,31 @@
+<?php /* Copyright (c) 2024 Freya Murphy */
+
+function XSSBOOK_begin_session(): void {
+ session_start();
+ setcookie(
+ session_name(),
+ session_id(),
+ array(
+ 'expires' => time() + 60*60*24*7,
+ 'path' => '/',
+ 'domain' => NULL,
+ 'secure' => FALSE,
+ 'httponly' => FALSE,
+ 'samesite' => 'Lax'
+ )
+ );
+}
+
+function CRIMSON_init_hook(): void {
+ //date_default_timezone_set('America/New_York');
+ XSSBOOK_begin_session();
+}
+
+function CRIMSON_pre_route_hook(Router $router): void {
+}
+
+function CRIMSON_error_hook(?array $req, int $code): never {
+ $error_controller = ROUTER->load_controller('error');
+ $error_controller->code($code);
+ CRIMSON_DIE();
+}