pages.php: fix redirection on mod_page_ip

This commit is contained in:
Zankaria 2024-10-15 00:08:35 +02:00
parent 4be1873538
commit e3b89dcc9d

View file

@ -883,7 +883,11 @@ function mod_page_ip($ip, string $encoded_cursor = '') {
Bans::delete($_POST['ban_id'], true, $mod['boards']);
header('Location: ?/IP/' . $ip . '#bans', true, $config['redirect_http']);
if (empty($encoded_cursor)) {
header("Location: ?/IP/$ip#bans", true, $config['redirect_http']);
} else {
header("Location: ?/IP/$ip/cursor/$encoded_cursor#bans", true, $config['redirect_http']);
}
return;
}
@ -904,7 +908,11 @@ function mod_page_ip($ip, string $encoded_cursor = '') {
modLog("Added a note for <a href=\"?/IP/{$ip}\">{$ip}</a>");
header('Location: ?/IP/' . $ip . '#notes', true, $config['redirect_http']);
if (empty($encoded_cursor)) {
header("Location: ?/IP/$ip#notes", true, $config['redirect_http']);
} else {
header("Location: ?/IP/$ip/cursor/$encoded_cursor#notes", true, $config['redirect_http']);
}
return;
}
@ -1043,7 +1051,11 @@ function mod_page_ip($ip, string $encoded_cursor = '') {
$args['logs'] = [];
}
$args['security_token'] = make_secure_link_token('IP/' . $ip);
if (empty($encoded_cursor)) {
$args['security_token'] = make_secure_link_token("IP/$ip");
} else {
$args['security_token'] = make_secure_link_token("IP/$ip/cursor/$encoded_cursor");
}
mod_page(sprintf('%s: %s', _('IP'), htmlspecialchars($ip)), 'mod/view_ip.html', $args, $args['hostname']);
}