Notes / snooze, update data migration

- WIP on finishing out request list
This commit is contained in:
2024-06-22 20:23:37 -04:00
parent 3ebb03d470
commit 2369827033
11 changed files with 189 additions and 24 deletions

View File

@@ -18,6 +18,8 @@ if (php_sapi_name() != 'cli') {
if (!is_null($auth0_user)) {
$_SESSION['user_id'] = $auth0_user['sub'];
}
$_REQUEST['time_zone'] = $_SERVER['HTTP_X_TIME_ZONE'] ?? 'Etc/UTC';
}
Configuration::$pdoDSN = 'sqlite:' . implode(DIRECTORY_SEPARATOR, [__DIR__, 'data', 'mpj.db']);
@@ -35,3 +37,25 @@ function not_found(): never
http_response_code(404);
die('Not found');
}
/**
* Return a 303 redirect ("see other" - redirects to a GET)
*
* @param string $url The URL to which the browser should be redirected
*/
function see_other(string $url): never
{
header('Location: ' . (str_starts_with($url, 'http') ? '/' : $url));
http_response_code(303);
exit;
}
/**
* Add a header that instructs the browser to close an open modal dialog
*
* @param string $name The name of the dialog to be closed
*/
function hide_modal(string $name): void
{
header("X-Hide-Modal: $name");
}