make pages >500 visible to logged-in users

This commit is contained in:
Shish 2019-07-19 10:24:17 +01:00
parent c5aba18470
commit eb3cc73bce

View File

@ -233,7 +233,7 @@ class Index extends Extension
public function onPageRequest(PageRequestEvent $event)
{
global $database, $page;
global $database, $page, $user;
if ($event->page_matches("post/list")) {
if (isset($_GET['search'])) {
// implode(explode()) to resolve aliases and sanitise
@ -260,6 +260,7 @@ class Index extends Extension
$images = [];
if (SPEED_HAX) {
if (!$user->can("big_search")) {
$fast_page_limit = 500;
if ($total_pages > $fast_page_limit) $total_pages = $fast_page_limit;
if ($page_number > $fast_page_limit) {
@ -269,7 +270,9 @@ class Index extends Extension
"if you want to find older results, use more specific search terms"
);
return;
} elseif ($count_search_terms === 0 && ($page_number < 10)) {
}
}
if ($count_search_terms === 0 && ($page_number < 10)) {
// extra caching for the first few post/list pages
$images = $database->cache->get("post-list:$page_number");
if (!$images) {