diff options
Diffstat (limited to 'src/application/mystic')
-rw-r--r-- | src/application/mystic/forum/utils/RequestUtils.php | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/application/mystic/forum/utils/RequestUtils.php b/src/application/mystic/forum/utils/RequestUtils.php index 5c6a485..11253aa 100644 --- a/src/application/mystic/forum/utils/RequestUtils.php +++ b/src/application/mystic/forum/utils/RequestUtils.php @@ -40,9 +40,10 @@ final class RequestUtils { return $fieldValue; } - public static function storeForm(): void { + public static function storeForm(string $formId): void { $_SESSION["lastForm"] = $_POST ?? []; $_SESSION["lastForm_uri"] = $_SERVER["REQUEST_URI"]; + $_SESSION["lastForm_id"] = $formId; } public static function setFormErrorDestination(?string $dest): ?string { @@ -55,7 +56,7 @@ final class RequestUtils { $next ??= self::$formErrorDestination ?? $_SERVER["REQUEST_URI"]; $_SESSION["formError/$formId"] = $message; // store last form submission - self::storeForm(); + self::storeForm($formId); header("Location: $next"); exit; } @@ -66,14 +67,20 @@ final class RequestUtils { return $err; } - public static function getLastForm(string &$lastFormUri): ?array { + public static function getLastForm_legacy(string &$lastFormUri): ?array { $lastFormUri = $_SESSION["lastForm_uri"] ?? ""; return $_SESSION["lastForm"] ?? null; } + public static function getLastForm(string &$lastFormId): ?array { + $lastFormId = $_SESSION["lastForm_id"] ?? ""; + return $_SESSION["lastForm"] ?? null; + } + public static function clearLastForm(): void { unset($_SESSION["lastForm"]); unset($_SESSION["lastForm_uri"]); + unset($_SESSION["lastForm_id"]); } public static function getAuthorizedUser(Database &$db): ?User { |