summaryrefslogtreecommitdiff
path: root/src/web/lib/hooks.php
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2024-12-23 11:13:27 -0500
committerFreya Murphy <freya@freyacat.org>2024-12-23 11:13:27 -0500
commit5a2ba9c2e7605bb788bc406184547d22c6436867 (patch)
treecbd988d534e8a8593a31d70571222443f80da0b3 /src/web/lib/hooks.php
parentfix about modal (diff)
downloadxssbook2-5a2ba9c2e7605bb788bc406184547d22c6436867.tar.gz
xssbook2-5a2ba9c2e7605bb788bc406184547d22c6436867.tar.bz2
xssbook2-5a2ba9c2e7605bb788bc406184547d22c6436867.zip
v2.1.0, refactor w/ crimson
Diffstat (limited to 'src/web/lib/hooks.php')
-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();
+}