summaryrefslogtreecommitdiff
path: root/src/application/mystic/forum/utils/RequestUtils.php
diff options
context:
space:
mode:
authorJonas Kohl2024-10-17 10:56:01 +0200
committerJonas Kohl2024-10-17 10:56:01 +0200
commitfe0f414dc0211a4014581dc03fcfd514ed7ed02d (patch)
treecd86fc00cd9b7a97eabb9668e0a39e2b4b3e5357 /src/application/mystic/forum/utils/RequestUtils.php
parente0e89b9fdbf301e0ead944636023947a67aca57d (diff)
Transition templating to Twig
Diffstat (limited to 'src/application/mystic/forum/utils/RequestUtils.php')
-rw-r--r--src/application/mystic/forum/utils/RequestUtils.php13
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 {