make pages >500 visible to logged-in users
This commit is contained in:
parent
c5aba18470
commit
eb3cc73bce
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user