diff --git a/includes/page.php b/includes/page.php
index 522e6ea..6aba6d1 100644
--- a/includes/page.php
+++ b/includes/page.php
@@ -6,6 +6,7 @@ use PDOException;
class Page {
public function __construct($name, $header = true) {
+ $this->time = microtime(true);
if ($header) {
require_once './includes/header.php';
}
@@ -14,7 +15,6 @@ class Page {
$this->conn = $settings->conn;
$this->settings = $settings;
$this->uuid_name_cache = array();
- $this->time = microtime(true);
$this->page = 1;
if (isset($_GET['page'])) {
$page = $_GET['page']; // user input
@@ -240,12 +240,16 @@ class Page {
} else {
$until = $this->millis_to_date($row['until']);
}
- if ($this->settings->show_inactive_bans && $row['active'] === "0") {
+ if ($this->settings->show_inactive_bans && $this->active($row) === false) {
$until .= ' ' . $this->expired[$this->type];
}
return $until;
}
+ function active($row, $field = 'active') {
+ return (((int)$row[$field]) !== 0);
+ }
+
function title() {
return ucfirst($this->name);
}
@@ -376,9 +380,4 @@ class Page {
$this->table = $info['table'];
$this->title = $info['title'];
}
-
- public function active($row, $column = "active") {
- $active = $row[$column];
- return $active === "1" || $active === 1 || $active === true;
- }
}
diff --git a/info.php b/info.php
index 07825fd..54dcc44 100644
--- a/info.php
+++ b/info.php
@@ -35,7 +35,7 @@ abstract class Info {
}
function permanent() {
- return $this->row['until'] <= 0;
+ return ((int)$this->row['until']) <= 0;
}
function history_link($player_name, $uuid, $args = "") {
@@ -149,7 +149,8 @@ if ($st->execute(array($id))) {
if (!($info instanceof KickInfo)) {
$style = 'style="margin-left: 13px; font-size: 16px;"';
- if ($row['active'] === "1") {
+ $active = $page->active($row);
+ if ($active === true) {
$page->name .= "Active";
} else {
$page->name .= "Inactive";
diff --git a/warnings.php b/warnings.php
index d201232..0992a5a 100644
--- a/warnings.php
+++ b/warnings.php
@@ -25,7 +25,7 @@ while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
'Warned By' => $page->get_avatar($page->get_banner_name($row), $row['banned_by_uuid']),
'Reason' => $page->clean($row['reason']),
'Warned Until' => $page->expiry($row),
- 'Received Warning' => ($row['warned'] === "1") ? "Yes" : "No",
+ 'Received Warning' => (($page->active($row, 'warned') === true) ? "Yes" : "No"),
));
}
$page->table_end();