mirror of
https://gitlab.com/ruany/litebans-php.git
synced 2025-07-09 23:37:32 +00:00
Fixed pager with simple_urls disabled
This commit is contained in:
parent
e7598dee7e
commit
3a959a8d15
19
inc/page.php
19
inc/page.php
@ -82,7 +82,7 @@ class Page {
|
||||
$page = $_GET['page']; // user input
|
||||
} else {
|
||||
if ($argc > 1) {
|
||||
$page = $this->args[$argc-2];
|
||||
$page = $this->args[$argc - 2];
|
||||
}
|
||||
}
|
||||
if (filter_var($page, FILTER_VALIDATE_INT)) {
|
||||
@ -552,7 +552,7 @@ class Page {
|
||||
';
|
||||
}
|
||||
|
||||
function print_pager($total = -1, $args = "", $prevargs = "", $page = null, $simple=true) {
|
||||
function print_pager($total = -1, $args = "", $prevargs = "", $page = null, $simple = true) {
|
||||
if (!$this->settings->show_pager) return;
|
||||
$table = $this->table;
|
||||
if ($page === null) {
|
||||
@ -585,11 +585,11 @@ class Page {
|
||||
$pager_next = "<div class=\"litebans-pager litebans-pager-right $next_class\">»</div>";
|
||||
|
||||
if ($simple) {
|
||||
$pager_prev_href = $this->link("$page{$prevargs}&page={$prev}");
|
||||
$pager_next_href = $this->link("$page{$args}&page={$next}");
|
||||
$pager_prev_href = $this->append_param($this->link("$page{$prevargs}"), "page={$prev}");
|
||||
$pager_next_href = $this->append_param($this->link("$page{$args}"), "page={$next}");
|
||||
} else {
|
||||
$pager_prev_href = $this->link("$page") . "{$prevargs}&page={$prev}";
|
||||
$pager_next_href = $this->link("$page") . "{$args}&page={$next}";
|
||||
$pager_prev_href = $this->append_param(($this->link("$page") . "{$prevargs}"), "page={$prev}");
|
||||
$pager_next_href = $this->append_param(($this->link("$page") . "{$args}"), "page={$next}");
|
||||
}
|
||||
|
||||
if ($prev_active) {
|
||||
@ -612,6 +612,13 @@ class Page {
|
||||
include_once './inc/footer.php';
|
||||
}
|
||||
|
||||
function append_param($url, $param) {
|
||||
if (preg_match("/\?[a-z]+=/", $url)) {
|
||||
return "${url}&${param}";
|
||||
}
|
||||
return "${url}?${param}";
|
||||
}
|
||||
|
||||
function link($url) {
|
||||
if ($this->settings->simple_urls && $this->is_index) {
|
||||
$url = preg_replace("/\.php/", "", $url, 1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user