forked from GithubBackups/vichan
pages.php: interpret recent_user_posts as total
This commit is contained in:
parent
26c6cb0330
commit
ed9eb1759a
@ -965,9 +965,9 @@ function mod_user_posts_by_ip(Context $ctx, string $cip, ?string $encoded_cursor
|
||||
if (isset($config['mod']['ip_recentposts'])) {
|
||||
$log = $ctx->get(LogDriver::class);
|
||||
$log->log(LogDriver::NOTICE, "'ip_recentposts' has been deprecated. Please use 'recent_user_posts' instead");
|
||||
$page_size = $config['mod']['ip_recentposts'];
|
||||
$recent_user_posts = $config['mod']['ip_recentposts'];
|
||||
} else {
|
||||
$page_size = $config['mod']['recent_user_posts'];
|
||||
$recent_user_posts = $config['mod']['recent_user_posts'];
|
||||
}
|
||||
|
||||
if ($config['mod']['dns_lookup'] && empty($config['ipcrypt_key'])) {
|
||||
@ -1000,13 +1000,18 @@ function mod_user_posts_by_ip(Context $ctx, string $cip, ?string $encoded_cursor
|
||||
$boards = listBoards();
|
||||
|
||||
$queryable_uris = [];
|
||||
$queryable_boards = [];
|
||||
foreach ($boards as $board) {
|
||||
$uri = $board['uri'];
|
||||
if (hasPermission($config['mod']['show_ip'], $uri)) {
|
||||
$queryable_uris[] = $uri;
|
||||
$queryable_boards[] = $board;
|
||||
}
|
||||
}
|
||||
|
||||
if (\count($queryable_boards) > 0) {
|
||||
$page_size = \max(\intdiv($recent_user_posts, \count($queryable_boards)), 1);
|
||||
|
||||
$queries = $ctx->get(UserPostQueries::class);
|
||||
$result = $queries->fetchPaginatedByIp($queryable_uris, $ip, $page_size, $encoded_cursor);
|
||||
|
||||
@ -1032,8 +1037,9 @@ function mod_user_posts_by_ip(Context $ctx, string $cip, ?string $encoded_cursor
|
||||
$args['posts'][$uri]['posts'][] = $po->build(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$args['boards'] = $boards;
|
||||
$args['boards'] = $queryable_boards;
|
||||
// Needed to create new bans.
|
||||
$args['token'] = make_secure_link_token('ban');
|
||||
|
||||
@ -1061,21 +1067,26 @@ function mod_user_posts_by_passwd(Context $ctx, string $passwd, ?string $encoded
|
||||
if (isset($config['mod']['ip_recentposts'])) {
|
||||
$log = $ctx->get(LogDriver::class);
|
||||
$log->log(LogDriver::NOTICE, "'ip_recentposts' has been deprecated. Please use 'recent_user_posts' instead");
|
||||
$page_size = $config['mod']['ip_recentposts'];
|
||||
$recent_user_posts = $config['mod']['ip_recentposts'];
|
||||
} else {
|
||||
$page_size = $config['mod']['recent_user_posts'];
|
||||
$recent_user_posts = $config['mod']['recent_user_posts'];
|
||||
}
|
||||
|
||||
$boards = listBoards();
|
||||
|
||||
$queryable_uris = [];
|
||||
$queryable_boards = [];
|
||||
foreach ($boards as $board) {
|
||||
$uri = $board['uri'];
|
||||
if (hasPermission($config['mod']['show_ip'], $uri)) {
|
||||
$queryable_uris[] = $uri;
|
||||
$queryable_boards[] = $board;
|
||||
}
|
||||
}
|
||||
|
||||
if (\count($queryable_boards) > 0) {
|
||||
$page_size = \max(\intdiv($recent_user_posts, \count($queryable_boards)), 1);
|
||||
|
||||
$queries = $ctx->get(UserPostQueries::class);
|
||||
$result = $queries->fetchPaginateByPassword($queryable_uris, $passwd, $page_size, $encoded_cursor);
|
||||
|
||||
@ -1101,8 +1112,11 @@ function mod_user_posts_by_passwd(Context $ctx, string $passwd, ?string $encoded
|
||||
$args['posts'][$uri]['posts'][] = $po->build(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$args['boards'] = $boards;
|
||||
$args['boards'] = $queryable_boards;
|
||||
// Needed to create new bans.
|
||||
$args['token'] = make_secure_link_token('ban');
|
||||
|
||||
mod_page(\sprintf('%s: %s', _('Password'), \htmlspecialchars(substr($passwd, 0, 15))), 'mod/view_passwd.html', $args, $mod);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user