|
@@ -78,14 +78,16 @@ function redirUrl($pageId) {
|
|
return CONF['common']['prefix'] . '/' . $pageId . '?redir=' . PAGE_URL;
|
|
return CONF['common']['prefix'] . '/' . $pageId . '?redir=' . PAGE_URL;
|
|
}
|
|
}
|
|
|
|
|
|
-function redir() {
|
|
|
|
- if (isset($_GET['redir'])) {
|
|
|
|
- if (preg_match('/^[0-9a-z\/-]{0,128}$/D', $_GET['redir']) !== 1)
|
|
|
|
- output(403, 'Wrong character in <code>redir</code>.');
|
|
|
|
- header('Location: ' . CONF['common']['prefix'] . '/' . $_GET['redir']);
|
|
|
|
- } else {
|
|
|
|
|
|
+function redir($redir_to = NULL) {
|
|
|
|
+ $redir_to ??= $_GET['redir'] ?? NULL;
|
|
|
|
+
|
|
|
|
+ if ($redir_to === NULL) {
|
|
header('Location: ' . CONF['common']['prefix'] . '/');
|
|
header('Location: ' . CONF['common']['prefix'] . '/');
|
|
|
|
+ exit();
|
|
}
|
|
}
|
|
|
|
+ if (preg_match('/^[0-9a-z\/-]{0,128}$/D', $redir_to) !== 1)
|
|
|
|
+ output(403, 'Wrong character in <code>redir</code>.');
|
|
|
|
+ header('Location: ' . CONF['common']['prefix'] . '/' . $redir_to);
|
|
exit();
|
|
exit();
|
|
}
|
|
}
|
|
|
|
|