summaryrefslogtreecommitdiff
path: root/src/web/lib/hooks.php
blob: 45316ec2e421d1a6c27ea05ade91ed4dc2899cda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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();
}