From eb3cc73bce57b189265d8a808bcdee07f1372651 Mon Sep 17 00:00:00 2001 From: Shish Date: Fri, 19 Jul 2019 10:24:17 +0100 Subject: [PATCH] make pages >500 visible to logged-in users --- ext/index/main.php | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/ext/index/main.php b/ext/index/main.php index 3ae5700f..eab9d7b3 100644 --- a/ext/index/main.php +++ b/ext/index/main.php @@ -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,16 +260,19 @@ class Index extends Extension $images = []; if (SPEED_HAX) { - $fast_page_limit = 500; - if ($total_pages > $fast_page_limit) $total_pages = $fast_page_limit; - if ($page_number > $fast_page_limit) { - $this->theme->display_error( - 404, "Search limit hit", - "Only $fast_page_limit pages of results are searchable - " . - "if you want to find older results, use more specific search terms" - ); - return; - } elseif ($count_search_terms === 0 && ($page_number < 10)) { + 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) { + $this->theme->display_error( + 404, "Search limit hit", + "Only $fast_page_limit pages of results are searchable - " . + "if you want to find older results, use more specific search terms" + ); + return; + } + } + 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) {