mirror of
https://gitlab.com/ruany/litebans-php.git
synced 2025-05-24 08:52:45 +00:00
Fixed ghost pages again
This commit is contained in:
parent
1d9c7d9a5d
commit
3e7c7f8163
24
inc/page.php
24
inc/page.php
@ -114,7 +114,6 @@ class Page {
|
|||||||
function run_query() {
|
function run_query() {
|
||||||
try {
|
try {
|
||||||
$table = $this->table;
|
$table = $this->table;
|
||||||
$where = $this->settings->active_query;
|
|
||||||
$limit = $this->settings->limit_per_page;
|
$limit = $this->settings->limit_per_page;
|
||||||
|
|
||||||
$offset = 0;
|
$offset = 0;
|
||||||
@ -125,11 +124,7 @@ class Page {
|
|||||||
|
|
||||||
$sel = $this->get_selection($table);
|
$sel = $this->get_selection($table);
|
||||||
|
|
||||||
if ($where !== "") {
|
$where = $this->where_append($this->settings->active_query);
|
||||||
$where .= " AND ";
|
|
||||||
} else {
|
|
||||||
$where = "WHERE ";
|
|
||||||
}
|
|
||||||
$where .= "(uuid <> '#offline#' AND uuid IS NOT NULL)";
|
$where .= "(uuid <> '#offline#' AND uuid IS NOT NULL)";
|
||||||
|
|
||||||
$query = "SELECT $sel FROM $table $where GROUP BY $table.id ORDER BY time DESC LIMIT :limit OFFSET :offset";
|
$query = "SELECT $sel FROM $table $where GROUP BY $table.id ORDER BY time DESC LIMIT :limit OFFSET :offset";
|
||||||
@ -391,7 +386,10 @@ class Page {
|
|||||||
$page = $this->name . ".php";
|
$page = $this->name . ".php";
|
||||||
|
|
||||||
if ($total === -1) {
|
if ($total === -1) {
|
||||||
$result = $this->conn->query("SELECT COUNT(*) AS count FROM $table WHERE uuid <> '#offline#' AND uuid IS NOT NULL")->fetch(PDO::FETCH_ASSOC);
|
$where = $this->where_append($this->settings->active_query);
|
||||||
|
$where .= "(uuid <> '#offline#' AND uuid IS NOT NULL)";
|
||||||
|
|
||||||
|
$result = $this->conn->query("SELECT COUNT(*) AS count FROM $table $where")->fetch(PDO::FETCH_ASSOC);
|
||||||
$total = $result['count'];
|
$total = $result['count'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -450,4 +448,16 @@ class Page {
|
|||||||
$str[0] = strtolower($str[0]);
|
$str[0] = strtolower($str[0]);
|
||||||
return (string)$str;
|
return (string)$str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $where
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function where_append($where) {
|
||||||
|
if ($where !== "") {
|
||||||
|
return $where . " AND ";
|
||||||
|
} else {
|
||||||
|
return "WHERE ";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user