mirror of
https://github.com/kvazar-network/webapp.git
synced 2025-09-03 10:31:59 +00:00
fix pagination on search action
This commit is contained in:
parent
3fb244e4d3
commit
86cc0f6317
@ -116,7 +116,9 @@ class MySQL {
|
|||||||
AND `data`.`ns` = "0"
|
AND `data`.`ns` = "0"
|
||||||
AND `data`.`deleted` = "0"
|
AND `data`.`deleted` = "0"
|
||||||
|
|
||||||
ORDER BY `block`.`blockId` DESC');
|
ORDER BY `block`.`blockId` DESC
|
||||||
|
|
||||||
|
LIMIT ' . (int) $start . ',' . (int) $limit);
|
||||||
|
|
||||||
$query->bindValue(':search', '%' . $search . '%', PDO::PARAM_STR);
|
$query->bindValue(':search', '%' . $search . '%', PDO::PARAM_STR);
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ require_once('../config.php');
|
|||||||
require_once('../library/icon.php');
|
require_once('../library/icon.php');
|
||||||
require_once('../library/mysql.php');
|
require_once('../library/mysql.php');
|
||||||
|
|
||||||
$query = isset($_GET['q']) && mb_strlen($_GET['q']) > 2 ? $_GET['q'] : false;
|
$query = isset($_GET['q']) ? $_GET['q'] : false;
|
||||||
$ns = isset($_GET['ns']) ? preg_replace('/[^a-zA-Z0-9]+/', '', $_GET['ns']) : false;
|
$ns = isset($_GET['ns']) ? preg_replace('/[^a-zA-Z0-9]+/', '', $_GET['ns']) : false;
|
||||||
$tx = isset($_GET['tx']) ? preg_replace('/[^a-zA-Z0-9]+/', '', $_GET['tx']) : false;
|
$tx = isset($_GET['tx']) ? preg_replace('/[^a-zA-Z0-9]+/', '', $_GET['tx']) : false;
|
||||||
$page = (int) isset($_GET['page']) ? $_GET['page'] : 0;
|
$page = (int) isset($_GET['page']) ? $_GET['page'] : 0;
|
||||||
@ -82,17 +82,17 @@ if (SEF_MODE) {
|
|||||||
$newer = false;
|
$newer = false;
|
||||||
} else {
|
} else {
|
||||||
if ($page == 2) {
|
if ($page == 2) {
|
||||||
$newer = ($ns ? '?ns=' . $ns : '');
|
$newer = ($ns ? '?ns=' . $ns : ($query ? '?q=' . $query : ''));
|
||||||
} else {
|
} else {
|
||||||
$newer = ($ns ? '?ns=' . $ns . '&page=' . ($page - 1) : '?page=' . ($page - 1));
|
$newer = ($ns ? '?ns=' . $ns . '&page=' . ($page - 1) : '?page=' . ($page - 1) . ($query ? '&q=' . $query : ''));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($data) {
|
if ($data) {
|
||||||
if (in_array($page, [0, 1])) {
|
if (in_array($page, [0, 1])) {
|
||||||
$older = ($ns ? '?ns=' . $ns . '&page=2' : '?page=2');
|
$older = ($ns ? '?ns=' . $ns . '&page=2' : '?page=2' . ($query ? '&q=' . $query : ''));
|
||||||
} else {
|
} else {
|
||||||
$older = ($ns ? '?ns=' . $ns . '&page=' . ($page + 1) : '?page=' . ($page + 1));
|
$older = ($ns ? '?ns=' . $ns . '&page=' . ($page + 1) : '?page=' . ($page + 1) . ($query ? '&q=' . $query : ''));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$older = false;
|
$older = false;
|
||||||
|
@ -86,7 +86,7 @@
|
|||||||
<?php } ?>
|
<?php } ?>
|
||||||
<div class="t-center px-16 pb-27">
|
<div class="t-center px-16 pb-27">
|
||||||
<form name="namespace" action="/" method="GET">
|
<form name="namespace" action="/" method="GET">
|
||||||
<input class="p-8" type="text" name="q" value="" placeholder="key, value, block, ns, txid" autocomplete="off" />
|
<input class="p-8" type="text" name="q" value="<?php echo ($query ? $query : ''); ?>" placeholder="key, value, block, ns, txid" autocomplete="off" />
|
||||||
<button class="p-8 cursor-pointer" type="submit">Search</button>
|
<button class="p-8 cursor-pointer" type="submit">Search</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user