mirror of
https://gitlab.com/ruany/litebans-php.git
synced 2025-05-23 16:32:45 +00:00
Use table prefixes in history.php
This commit is contained in:
parent
a93ec400c9
commit
0c2001a75c
@ -14,15 +14,16 @@ class History {
|
|||||||
* then appends all rows from $table matching $uuid to $array
|
* then appends all rows from $table matching $uuid to $array
|
||||||
* @param Page $page
|
* @param Page $page
|
||||||
* @param array $array
|
* @param array $array
|
||||||
* @param string $table
|
* @param string $type
|
||||||
* @param string $uuid
|
* @param string $uuid
|
||||||
* @param array $counts
|
* @param array $counts
|
||||||
*/
|
*/
|
||||||
static function push($page, &$array, $table, $uuid, &$counts) {
|
static function push($page, &$array, $type, $uuid, &$counts) {
|
||||||
|
$table = $page->settings->table[$type];
|
||||||
$count_st = $page->conn->prepare("SELECT COUNT(*) AS count FROM $table WHERE uuid=:uuid");
|
$count_st = $page->conn->prepare("SELECT COUNT(*) AS count FROM $table WHERE uuid=:uuid");
|
||||||
$count_st->bindParam(":uuid", $uuid, PDO::PARAM_STR);
|
$count_st->bindParam(":uuid", $uuid, PDO::PARAM_STR);
|
||||||
if ($count_st->execute() && ($row = $count_st->fetch()) !== null) {
|
if ($count_st->execute() && ($row = $count_st->fetch()) !== null) {
|
||||||
$counts[$table] = $row['count'];
|
$counts[$type] = $row['count'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$st = $page->conn->prepare("SELECT * FROM $table WHERE uuid=:uuid ORDER BY time");
|
$st = $page->conn->prepare("SELECT * FROM $table WHERE uuid=:uuid ORDER BY time");
|
||||||
@ -33,7 +34,7 @@ class History {
|
|||||||
|
|
||||||
if ($st->execute()) {
|
if ($st->execute()) {
|
||||||
while ($row = $st->fetch(PDO::FETCH_ASSOC)) {
|
while ($row = $st->fetch(PDO::FETCH_ASSOC)) {
|
||||||
$row['__table__'] = $table;
|
$row['__table__'] = $type;
|
||||||
array_push($array, $row);
|
array_push($array, $row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user