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) public function onPageRequest(PageRequestEvent $event)
{ {
global $database, $page; global $database, $page, $user;
if ($event->page_matches("post/list")) { if ($event->page_matches("post/list")) {
if (isset($_GET['search'])) { if (isset($_GET['search'])) {
// implode(explode()) to resolve aliases and sanitise // implode(explode()) to resolve aliases and sanitise
@ -260,16 +260,19 @@ class Index extends Extension
$images = []; $images = [];
if (SPEED_HAX) { if (SPEED_HAX) {
$fast_page_limit = 500; if (!$user->can("big_search")) {
if ($total_pages > $fast_page_limit) $total_pages = $fast_page_limit; $fast_page_limit = 500;
if ($page_number > $fast_page_limit) { if ($total_pages > $fast_page_limit) $total_pages = $fast_page_limit;
$this->theme->display_error( if ($page_number > $fast_page_limit) {
404, "Search limit hit", $this->theme->display_error(
"Only $fast_page_limit pages of results are searchable - " . 404, "Search limit hit",
"if you want to find older results, use more specific search terms" "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)) { return;
}
}
if ($count_search_terms === 0 && ($page_number < 10)) {
// extra caching for the first few post/list pages // extra caching for the first few post/list pages
$images = $database->cache->get("post-list:$page_number"); $images = $database->cache->get("post-list:$page_number");
if (!$images) { if (!$images) {