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'])) {
|
if (isset($config['mod']['ip_recentposts'])) {
|
||||||
$log = $ctx->get(LogDriver::class);
|
$log = $ctx->get(LogDriver::class);
|
||||||
$log->log(LogDriver::NOTICE, "'ip_recentposts' has been deprecated. Please use 'recent_user_posts' instead");
|
$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 {
|
} 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'])) {
|
if ($config['mod']['dns_lookup'] && empty($config['ipcrypt_key'])) {
|
||||||
@ -1000,40 +1000,46 @@ function mod_user_posts_by_ip(Context $ctx, string $cip, ?string $encoded_cursor
|
|||||||
$boards = listBoards();
|
$boards = listBoards();
|
||||||
|
|
||||||
$queryable_uris = [];
|
$queryable_uris = [];
|
||||||
|
$queryable_boards = [];
|
||||||
foreach ($boards as $board) {
|
foreach ($boards as $board) {
|
||||||
$uri = $board['uri'];
|
$uri = $board['uri'];
|
||||||
if (hasPermission($config['mod']['show_ip'], $uri)) {
|
if (hasPermission($config['mod']['show_ip'], $uri)) {
|
||||||
$queryable_uris[] = $uri;
|
$queryable_uris[] = $uri;
|
||||||
|
$queryable_boards[] = $board;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$queries = $ctx->get(UserPostQueries::class);
|
if (\count($queryable_boards) > 0) {
|
||||||
$result = $queries->fetchPaginatedByIp($queryable_uris, $ip, $page_size, $encoded_cursor);
|
$page_size = \max(\intdiv($recent_user_posts, \count($queryable_boards)), 1);
|
||||||
|
|
||||||
$args['cursor_prev'] = $result->cursor_prev;
|
$queries = $ctx->get(UserPostQueries::class);
|
||||||
$args['cursor_next'] = $result->cursor_next;
|
$result = $queries->fetchPaginatedByIp($queryable_uris, $ip, $page_size, $encoded_cursor);
|
||||||
|
|
||||||
foreach($boards as $board) {
|
$args['cursor_prev'] = $result->cursor_prev;
|
||||||
$uri = $board['uri'];
|
$args['cursor_next'] = $result->cursor_next;
|
||||||
// The Thread and Post classes rely on some implicit board parameter set by openBoard.
|
|
||||||
openBoard($uri);
|
|
||||||
|
|
||||||
// Finally load the post contents and build them.
|
foreach($boards as $board) {
|
||||||
foreach ($result->by_uri[$uri] as $post) {
|
$uri = $board['uri'];
|
||||||
if (!$post['thread']) {
|
// The Thread and Post classes rely on some implicit board parameter set by openBoard.
|
||||||
$po = new Thread($post, '?/', $mod, false);
|
openBoard($uri);
|
||||||
} else {
|
|
||||||
$po = new Post($post, '?/', $mod);
|
// Finally load the post contents and build them.
|
||||||
|
foreach ($result->by_uri[$uri] as $post) {
|
||||||
|
if (!$post['thread']) {
|
||||||
|
$po = new Thread($post, '?/', $mod, false);
|
||||||
|
} else {
|
||||||
|
$po = new Post($post, '?/', $mod);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($args['posts'][$uri])) {
|
||||||
|
$args['posts'][$uri] = [ 'board' => $board, 'posts' => [] ];
|
||||||
|
}
|
||||||
|
$args['posts'][$uri]['posts'][] = $po->build(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($args['posts'][$uri])) {
|
|
||||||
$args['posts'][$uri] = [ 'board' => $board, 'posts' => [] ];
|
|
||||||
}
|
|
||||||
$args['posts'][$uri]['posts'][] = $po->build(true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$args['boards'] = $boards;
|
$args['boards'] = $queryable_boards;
|
||||||
// Needed to create new bans.
|
// Needed to create new bans.
|
||||||
$args['token'] = make_secure_link_token('ban');
|
$args['token'] = make_secure_link_token('ban');
|
||||||
|
|
||||||
@ -1061,48 +1067,56 @@ function mod_user_posts_by_passwd(Context $ctx, string $passwd, ?string $encoded
|
|||||||
if (isset($config['mod']['ip_recentposts'])) {
|
if (isset($config['mod']['ip_recentposts'])) {
|
||||||
$log = $ctx->get(LogDriver::class);
|
$log = $ctx->get(LogDriver::class);
|
||||||
$log->log(LogDriver::NOTICE, "'ip_recentposts' has been deprecated. Please use 'recent_user_posts' instead");
|
$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 {
|
} else {
|
||||||
$page_size = $config['mod']['recent_user_posts'];
|
$recent_user_posts = $config['mod']['recent_user_posts'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$boards = listBoards();
|
$boards = listBoards();
|
||||||
|
|
||||||
$queryable_uris = [];
|
$queryable_uris = [];
|
||||||
|
$queryable_boards = [];
|
||||||
foreach ($boards as $board) {
|
foreach ($boards as $board) {
|
||||||
$uri = $board['uri'];
|
$uri = $board['uri'];
|
||||||
if (hasPermission($config['mod']['show_ip'], $uri)) {
|
if (hasPermission($config['mod']['show_ip'], $uri)) {
|
||||||
$queryable_uris[] = $uri;
|
$queryable_uris[] = $uri;
|
||||||
|
$queryable_boards[] = $board;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$queries = $ctx->get(UserPostQueries::class);
|
if (\count($queryable_boards) > 0) {
|
||||||
$result = $queries->fetchPaginateByPassword($queryable_uris, $passwd, $page_size, $encoded_cursor);
|
$page_size = \max(\intdiv($recent_user_posts, \count($queryable_boards)), 1);
|
||||||
|
|
||||||
$args['cursor_prev'] = $result->cursor_prev;
|
$queries = $ctx->get(UserPostQueries::class);
|
||||||
$args['cursor_next'] = $result->cursor_next;
|
$result = $queries->fetchPaginateByPassword($queryable_uris, $passwd, $page_size, $encoded_cursor);
|
||||||
|
|
||||||
foreach($boards as $board) {
|
$args['cursor_prev'] = $result->cursor_prev;
|
||||||
$uri = $board['uri'];
|
$args['cursor_next'] = $result->cursor_next;
|
||||||
// The Thread and Post classes rely on some implicit board parameter set by openBoard.
|
|
||||||
openBoard($uri);
|
|
||||||
|
|
||||||
// Finally load the post contents and build them.
|
foreach($boards as $board) {
|
||||||
foreach ($result->by_uri[$uri] as $post) {
|
$uri = $board['uri'];
|
||||||
if (!$post['thread']) {
|
// The Thread and Post classes rely on some implicit board parameter set by openBoard.
|
||||||
$po = new Thread($post, '?/', $mod, false);
|
openBoard($uri);
|
||||||
} else {
|
|
||||||
$po = new Post($post, '?/', $mod);
|
// Finally load the post contents and build them.
|
||||||
|
foreach ($result->by_uri[$uri] as $post) {
|
||||||
|
if (!$post['thread']) {
|
||||||
|
$po = new Thread($post, '?/', $mod, false);
|
||||||
|
} else {
|
||||||
|
$po = new Post($post, '?/', $mod);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($args['posts'][$uri])) {
|
||||||
|
$args['posts'][$uri] = [ 'board' => $board, 'posts' => [] ];
|
||||||
|
}
|
||||||
|
$args['posts'][$uri]['posts'][] = $po->build(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($args['posts'][$uri])) {
|
|
||||||
$args['posts'][$uri] = [ 'board' => $board, 'posts' => [] ];
|
|
||||||
}
|
|
||||||
$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);
|
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