summaryrefslogtreecommitdiff
path: root/src/application/views/nav_guest.php
diff options
context:
space:
mode:
authorJonas Kohl2024-10-07 16:51:16 +0200
committerJonas Kohl2024-10-07 16:51:16 +0200
commit7b7666a9d12076da640c6a28fc6e4f0535f2e606 (patch)
tree401af6cf3ee119a609cc2ef2114f9a508e831393 /src/application/views/nav_guest.php
parentd58f16fc9a927f6c2e75be1de6d7b80922c57853 (diff)
Fix endless chaining of next parameter on login and register pages
Diffstat (limited to 'src/application/views/nav_guest.php')
-rw-r--r--src/application/views/nav_guest.php20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/application/views/nav_guest.php b/src/application/views/nav_guest.php
index 88c551b..88a7015 100644
--- a/src/application/views/nav_guest.php
+++ b/src/application/views/nav_guest.php
@@ -1,7 +1,23 @@
+<?php
+
+$nextParam = "";
+
+switch ($GLOBALS["action"]) {
+ case "auth":
+ case "register":
+ $nextParam = $_GET["next"] ?? "";
+ break;
+ default:
+ $nextParam = $_SERVER["REQUEST_URI"];
+}
+
+if ($GLOBALS["action"] === "login")
+
+?>
<ul class="nav navbar-nav navbar-right">
<li<?= $GLOBALS["action"] === "search" ? ' class="active"' : '' ?>><a href="?_action=search"><span class="glyphicon glyphicon-search" aria-hidden="true"></span><span class="sr-only"><?= __("Search") ?></span></a></li>
-<li<?= $GLOBALS["action"] === "auth" ? ' class="active"' : '' ?>><a href="?_action=auth&amp;next=<?= htmlentities(urlencode($_SERVER["REQUEST_URI"])) ?>"><?= __("Log in") ?></a></li>
+<li<?= $GLOBALS["action"] === "auth" ? ' class="active"' : '' ?>><a href="?_action=auth&amp;next=<?= htmlentities(urlencode($nextParam)) ?>"><?= __("Log in") ?></a></li>
<?php if (REGISTRATION_ENABLED): ?>
-<li<?= $GLOBALS["action"] === "register" ? ' class="active"' : '' ?>><a href="?_action=register&amp;next=<?= htmlentities(urlencode($_SERVER["REQUEST_URI"])) ?>"><?= __("Register") ?></a></li>
+<li<?= $GLOBALS["action"] === "register" ? ' class="active"' : '' ?>><a href="?_action=register&amp;next=<?= htmlentities(urlencode($nextParam)) ?>"><?= __("Register") ?></a></li>
<?php endif; ?>
</ul> \ No newline at end of file