mirror of
https://gitlab.com/ruany/litebans-php.git
synced 2025-05-23 16:32:45 +00:00
Update
This commit is contained in:
parent
e870a85a86
commit
7253b08960
59
bans.php
59
bans.php
@ -1,43 +1,38 @@
|
||||
<?php
|
||||
namespace litebans;
|
||||
use PDO;
|
||||
|
||||
require_once './includes/page.php';
|
||||
$page = new Page();
|
||||
$page = new Page("bans");
|
||||
$page->print_title();
|
||||
$headers = array("Name", "Banned By", "Reason", "Banned On", "Banned Until");
|
||||
?>
|
||||
<title>Bans - <?php echo $page->settings->name; ?></title>
|
||||
<div class="container">
|
||||
<?php
|
||||
$page->print_page_header("Bans");
|
||||
$page->print_check_form("bans");
|
||||
$page->print_page_header();
|
||||
$page->print_check_form();
|
||||
?>
|
||||
<div class="row" style="margin-bottom:60px;">
|
||||
<div class="col-lg-12">
|
||||
<table class="table table-hover table-bordered table-condensed">
|
||||
<?php
|
||||
$page->print_table_headers(array("Name", "Banned By", "Reason", "Banned On", "Banned Until"));
|
||||
$result = $page->run_query($page->settings->table_bans);
|
||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
$player_name = $page->get_name($row['uuid']);
|
||||
if ($player_name === null) continue;
|
||||
$until = $page->millis_to_date($row['until']);
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $page->get_avatar($player_name); ?></td>
|
||||
<td><?php echo $page->get_avatar($page->get_banner_name($row)); ?></td>
|
||||
<td style="width: 30%;"><?php echo $page->clean($row['reason']); ?></td>
|
||||
<td><?php echo $page->millis_to_date($row['time']); ?></td>
|
||||
<td>
|
||||
<?php if ($row['until'] <= 0) {
|
||||
$until = 'Permanent Ban';
|
||||
}
|
||||
if ($page->settings->show_inactive_bans && !$row['active']) {
|
||||
$until .= ' (Unbanned)';
|
||||
}
|
||||
echo $until;
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</table>
|
||||
<?php $page->print_pager("bans.php", $page->settings->table_bans); ?>
|
||||
<?php
|
||||
$page->table_begin();
|
||||
$page->table_print_headers($headers);
|
||||
$result = $page->run_query();
|
||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
$player_name = $page->get_name($row['uuid']);
|
||||
if ($player_name === null) continue;
|
||||
|
||||
$page->print_table_rows($row, array(
|
||||
'Name' => $page->get_avatar($player_name),
|
||||
'Banned By' => $page->get_avatar($page->get_banner_name($row)),
|
||||
'Reason' => $page->clean($row['reason']),
|
||||
'Banned On' => $page->millis_to_date($row['time']),
|
||||
'Banned Until' => $page->expiry($row),
|
||||
));
|
||||
}
|
||||
$page->table_end();
|
||||
$page->print_pager();
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php $page->print_footer(); ?>
|
||||
|
10
check.php
10
check.php
@ -1,4 +1,8 @@
|
||||
<?php
|
||||
namespace litebans;
|
||||
|
||||
use PDOException;
|
||||
|
||||
require_once './includes/page.php';
|
||||
|
||||
class Check {
|
||||
@ -8,8 +12,8 @@ class Check {
|
||||
$this->println("Invalid name.");
|
||||
return;
|
||||
}
|
||||
$page = new Page(false);
|
||||
$history = $page->settings->table_history;
|
||||
$page = new Page("check", false);
|
||||
$history = $page->settings->table['history'];
|
||||
|
||||
try {
|
||||
$stmt = $page->conn->prepare("SELECT name,uuid FROM $history WHERE name=? ORDER BY date LIMIT 1");
|
||||
@ -24,7 +28,7 @@ class Check {
|
||||
$this->println("$name has not joined before.");
|
||||
return;
|
||||
}
|
||||
$table = $page->settings->table_bans;
|
||||
$table = $page->settings->table['bans'];
|
||||
|
||||
$stmt = $page->conn->prepare("SELECT * FROM $table WHERE (uuid=? AND active=" . Settings::$TRUE . ") LIMIT 1");
|
||||
if ($stmt->execute(array($uuid))) {
|
||||
|
8819
includes/css/bootstrap.css
vendored
8819
includes/css/bootstrap.css
vendored
File diff suppressed because it is too large
Load Diff
@ -16,3 +16,29 @@ body {
|
||||
margin-right: 5px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
table tr td a {
|
||||
display: block;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
table tr td {
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
}
|
||||
|
||||
/* table links */
|
||||
a,
|
||||
a:hover,
|
||||
a:focus {
|
||||
text-decoration: none !important;
|
||||
}
|
||||
|
||||
.pager-active {
|
||||
color: darkcyan;
|
||||
}
|
||||
|
||||
.pager-inactive {
|
||||
color: transparent;
|
||||
}
|
||||
|
@ -5,8 +5,3 @@
|
||||
<link rel="shortcut icon" href="includes/img/minecraft.ico">
|
||||
<link href="includes/css/bootstrap.css" rel="stylesheet">
|
||||
<link href="includes/css/custom.css" rel="stylesheet">
|
||||
<style>
|
||||
html {
|
||||
background-image: url('includes/img/377759.png');
|
||||
}
|
||||
</style>
|
||||
|
@ -1,4 +1,6 @@
|
||||
<?php
|
||||
namespace litebans;
|
||||
|
||||
require_once './includes/settings.php';
|
||||
$settings = new Settings(false);
|
||||
?>
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 353 B |
2323
includes/js/bootstrap.js
vendored
2323
includes/js/bootstrap.js
vendored
File diff suppressed because it is too large
Load Diff
968
includes/js/bootstrap.min.js
vendored
968
includes/js/bootstrap.min.js
vendored
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,11 @@
|
||||
<?php
|
||||
namespace litebans;
|
||||
|
||||
use PDO;
|
||||
use PDOException;
|
||||
|
||||
class Page {
|
||||
public function __construct($header = true) {
|
||||
public function __construct($name, $header = true) {
|
||||
if ($header) {
|
||||
require_once './includes/head.php';
|
||||
require_once './includes/header.php';
|
||||
@ -19,10 +23,46 @@ class Page {
|
||||
$this->page = (int)$page;
|
||||
}
|
||||
}
|
||||
$this->name = $name;
|
||||
switch ($name) {
|
||||
case "ban":
|
||||
case "bans":
|
||||
$this->type = "ban";
|
||||
$this->table = $settings->table['bans'];
|
||||
break;
|
||||
case "mute":
|
||||
case "mutes":
|
||||
$this->type = "mute";
|
||||
$this->table = $settings->table['mutes'];
|
||||
break;
|
||||
case "warn":
|
||||
case "warnings":
|
||||
$this->type = "warn";
|
||||
$this->table = $settings->table['warnings'];
|
||||
break;
|
||||
case "kick":
|
||||
case "kicks":
|
||||
$this->type = "kick";
|
||||
$this->table = $settings->table['kicks'];
|
||||
break;
|
||||
}
|
||||
$this->permanent = array(
|
||||
'ban' => 'Permanent Ban',
|
||||
'mute' => 'Permanent Mute',
|
||||
'warn' => 'Permanent',
|
||||
'kick' => null,
|
||||
);
|
||||
$this->expired = array(
|
||||
'ban' => '(Unbanned)',
|
||||
'mute' => '(Unmuted)',
|
||||
'warn' => '(Expired)',
|
||||
'kick' => null,
|
||||
);
|
||||
}
|
||||
|
||||
function run_query($table) {
|
||||
function run_query() {
|
||||
try {
|
||||
$table = $this->table;
|
||||
$active_query = $this->settings->active_query;
|
||||
$limit = $this->settings->limit_per_page;
|
||||
|
||||
@ -61,7 +101,7 @@ class Page {
|
||||
*/
|
||||
function get_name($uuid) {
|
||||
if (array_key_exists($uuid, $this->uuid_name_cache)) return $this->uuid_name_cache[$uuid];
|
||||
$history = $this->settings->table_history;
|
||||
$history = $this->settings->table['history'];
|
||||
$stmt = $this->conn->prepare("SELECT name FROM $history WHERE uuid=? ORDER BY date DESC LIMIT 1");
|
||||
if ($stmt->execute(array($uuid)) && $row = $stmt->fetch()) {
|
||||
$banner = $row['name'];
|
||||
@ -105,28 +145,71 @@ class Page {
|
||||
*/
|
||||
function clean($text) {
|
||||
if (strstr($text, "\xa7") || strstr($text, "&")) {
|
||||
$regex = "/(?i)(\xa7|&)[0-9A-FK-OR]/";
|
||||
$text = preg_replace($regex, "", $text);
|
||||
$text = preg_replace("/(?i)(\xa7|&)[0-9A-FK-OR]/", "", $text);
|
||||
}
|
||||
$text = htmlspecialchars($text, ENT_QUOTES, 'UTF-8');
|
||||
$text = htmlspecialchars($text, ENT_QUOTES, "UTF-8");
|
||||
if (strstr($text, "\n")) {
|
||||
$text = preg_replace("/\n/", "<br>", $text);
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
||||
function print_page_header($title) {
|
||||
$type = ($title === "Bans") ? "modal" : "navbar";
|
||||
/**
|
||||
* Returns a string that shows the expiry date of a punishment.
|
||||
* If the punishment does not expire, it will be shown as permanent.
|
||||
* If the punishment has already expired, it will show as expired.
|
||||
* @param row
|
||||
* @return string
|
||||
*/
|
||||
public function expiry($row) {
|
||||
if ($row['until'] <= 0) {
|
||||
return $this->permanent[$this->type];
|
||||
}
|
||||
$until = $this->millis_to_date($row['until']);
|
||||
if ($this->settings->show_inactive_bans && !$row['active']) {
|
||||
$until .= ' ' . $this->expired[$this->type];
|
||||
}
|
||||
return $until;
|
||||
}
|
||||
|
||||
function title() {
|
||||
return ucfirst($this->name);
|
||||
}
|
||||
|
||||
function print_title() {
|
||||
$title = $this->title();
|
||||
$name = $this->settings->name;
|
||||
echo "<title>$title - $name</title>";
|
||||
}
|
||||
|
||||
function print_table_rows($row, $array) {
|
||||
$id = $row['id'];
|
||||
$type = $this->type;
|
||||
echo "<tr>";
|
||||
foreach ($array as $header => $text) {
|
||||
$style = "";
|
||||
if ($header === "Reason") {
|
||||
$style = "style=\"width: 30%;\"";
|
||||
}
|
||||
echo "<td $style><a style=\"color: #fcfcfc;\" href=\"info.php?type=$type&id=$id\">$text</a></td>";
|
||||
}
|
||||
echo "</tr>";
|
||||
}
|
||||
|
||||
function print_page_header() {
|
||||
$title = $this->title();
|
||||
//$type = ($title === "Bans") ? "modal-header" : "navbar-header";
|
||||
$type = "modal-header";
|
||||
echo("
|
||||
<div class=\"row\">
|
||||
<div class=\"col-lg-12\">
|
||||
<h1 class=\"$type-header\">$title</h1>
|
||||
<div style=\"text-align: center;\" class=\"col-lg-12\">
|
||||
<h1 class=\"$type\">$title</h1>
|
||||
</div>
|
||||
</div>
|
||||
");
|
||||
}
|
||||
|
||||
function print_table_headers($headers) {
|
||||
function table_print_headers($headers) {
|
||||
echo("<thead><tr>");
|
||||
foreach ($headers as $header) {
|
||||
echo "<th><div style=\"text-align: center;\">$header</div></th>";
|
||||
@ -134,9 +217,10 @@ class Page {
|
||||
echo("<tbody>");
|
||||
}
|
||||
|
||||
function print_check_form($table) {
|
||||
function print_check_form() {
|
||||
$table = $this->name;
|
||||
echo('
|
||||
<div class="row">
|
||||
<div style="text-align: left;" class="row">
|
||||
<div style="margin-left: 15px;">
|
||||
<form onsubmit="captureForm(event);" class="form-inline"><div class="form-group"><input type="text" class="form-control" id="user" placeholder="Player"></div><button type="submit" class="btn btn-default" style="margin-left: 5px;">Check</button></form>
|
||||
</div>
|
||||
@ -146,7 +230,10 @@ class Page {
|
||||
');
|
||||
}
|
||||
|
||||
function print_pager($page, $table) {
|
||||
function print_pager() {
|
||||
$table = $this->table;
|
||||
$page = $this->name . ".php";
|
||||
|
||||
if (!$this->settings->show_pager) return;
|
||||
$result = $this->conn->query("SELECT COUNT(*) AS count FROM $table")->fetch(PDO::FETCH_ASSOC);
|
||||
$total = $result['count'];
|
||||
@ -157,12 +244,18 @@ class Page {
|
||||
$prev = $cur - 1;
|
||||
$next = $this->page + 1;
|
||||
|
||||
$pager_prev = "<div style=\"float:left; font-size:30px;\">«</div>";
|
||||
$prev_active = ($cur > 1);
|
||||
$next_active = ($cur < $pages);
|
||||
|
||||
$prev_class = $prev_active ? "pager-active" : "pager-inactive";
|
||||
$next_class = $next_active ? "pager-active" : "pager-inactive";
|
||||
|
||||
$pager_prev = "<div class=\"$prev_class\" style=\"float:left; font-size:30px;\">«</div>";
|
||||
if ($cur > 1) {
|
||||
$pager_prev = "<a href=\"$page?page=$prev\">$pager_prev</a>";
|
||||
}
|
||||
|
||||
$pager_next = "<div style=\"float: right; font-size:30px;\">»</div>";
|
||||
$pager_next = "<div class=\"$next_class\" style=\"float: right; font-size:30px;\">»</div>";
|
||||
if ($cur < $pages) {
|
||||
$pager_next = "<a href=\"$page?page=$next\">$pager_next</a>";
|
||||
}
|
||||
@ -175,4 +268,12 @@ class Page {
|
||||
$time = microtime(true) - $this->time;
|
||||
echo "<!-- Page generated in $time seconds. -->";
|
||||
}
|
||||
|
||||
public function table_begin() {
|
||||
echo '<table class="table table-striped table-bordered table-condensed">';
|
||||
}
|
||||
|
||||
public function table_end() {
|
||||
echo '</table>';
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,7 @@
|
||||
<?php
|
||||
namespace litebans;
|
||||
|
||||
use PDO, PDOException;
|
||||
|
||||
final class Settings {
|
||||
public static $TRUE = "1", $FALSE = "0";
|
||||
@ -28,13 +31,13 @@ final class Settings {
|
||||
// Amount of bans/mutes/warnings to show on each page
|
||||
$this->limit_per_page = 10;
|
||||
|
||||
// If you set a table prefix in config.yml, put it here too
|
||||
// If you set a table prefix in config.yml, set it here as well
|
||||
$table_prefix = "";
|
||||
|
||||
// The date format can be changed here.
|
||||
// https://secure.php.net/manual/en/function.date.php
|
||||
// Example of default: July 2, 2015, 9:19 pm
|
||||
$this->date_format = 'F j, Y, g:i a';
|
||||
// Example of default: July 2, 2015, 9:19 PM
|
||||
$this->date_format = 'F j, Y, g:i A';
|
||||
date_default_timezone_set("UTC");
|
||||
|
||||
// Supported drivers: mysql, pgsql
|
||||
@ -42,11 +45,13 @@ final class Settings {
|
||||
|
||||
/*** End of configuration ***/
|
||||
|
||||
$this->table_bans = "{$table_prefix}bans";
|
||||
$this->table_mutes = "{$table_prefix}mutes";
|
||||
$this->table_warnings = "{$table_prefix}warnings";
|
||||
$this->table_kicks = "${table_prefix}kicks";
|
||||
$this->table_history = "{$table_prefix}history";
|
||||
$this->table = array(
|
||||
'bans' => "${table_prefix}bans",
|
||||
'mutes' => "${table_prefix}mutes",
|
||||
'warnings' => "${table_prefix}warnings",
|
||||
'kicks' => "${table_prefix}kicks",
|
||||
'history' => "${table_prefix}history",
|
||||
);
|
||||
|
||||
$this->active_query = "";
|
||||
|
||||
@ -67,10 +72,10 @@ final class Settings {
|
||||
|
||||
try {
|
||||
$this->conn = new PDO($dsn, $username, $password);
|
||||
$this->conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
} catch (PDOException $e) {
|
||||
die('Connection failed: ' . $e->getMessage());
|
||||
}
|
||||
$this->conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
if ($driver === 'pgsql') {
|
||||
$this->conn->query("SET NAMES 'UTF8';");
|
||||
}
|
||||
|
@ -1,7 +1,10 @@
|
||||
<?php
|
||||
namespace litebans;
|
||||
|
||||
include './includes/head.php';
|
||||
include './includes/header.php';
|
||||
include_once './includes/settings.php';
|
||||
$settings = new Settings(false);
|
||||
?>
|
||||
<title>Index - <?php echo $settings->name; ?></title>
|
||||
<div class="container">
|
||||
@ -10,6 +13,5 @@ include_once './includes/settings.php';
|
||||
|
||||
<div style="text-align: center;"><p>Here is where our Bans, Mutes, and Warnings are listed.</p></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?php include './includes/footer.php'; ?>
|
||||
|
172
info.php
Normal file
172
info.php
Normal file
@ -0,0 +1,172 @@
|
||||
<?php
|
||||
namespace litebans;
|
||||
|
||||
use PDO;
|
||||
|
||||
require_once './includes/page.php';
|
||||
|
||||
abstract class Info {
|
||||
/**
|
||||
* @param $row PDO::PDORow
|
||||
* @param $page Page
|
||||
*/
|
||||
public function __construct($row, $page) {
|
||||
$this->row = $row;
|
||||
$this->page = $page;
|
||||
$this->table = $page->table;
|
||||
}
|
||||
|
||||
function name() {
|
||||
return ucfirst($this->page->type);
|
||||
}
|
||||
|
||||
function permanent() {
|
||||
return $this->row['until'] <= 0;
|
||||
}
|
||||
|
||||
abstract function basic_info($row, $player_name);
|
||||
|
||||
static function create($row, $page, $type) {
|
||||
switch ($type) {
|
||||
case "ban":
|
||||
return new BanInfo($row, $page);
|
||||
case "mute":
|
||||
return new MuteInfo($row, $page);
|
||||
case "warn":
|
||||
return new WarnInfo($row, $page);
|
||||
case "kick":
|
||||
return new KickInfo($row, $page);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class BanInfo extends Info {
|
||||
function basic_info($row, $player_name) {
|
||||
$page = $this->page;
|
||||
return array(
|
||||
'Banned Player' => $page->get_avatar($player_name),
|
||||
'Banned By' => $page->get_avatar($page->get_banner_name($row)),
|
||||
'Ban Reason' => $page->clean($row['reason']),
|
||||
'Ban Placed' => $page->millis_to_date($row['time']),
|
||||
'Expires' => $page->expiry($row),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class MuteInfo extends Info {
|
||||
function basic_info($row, $player_name) {
|
||||
$page = $this->page;
|
||||
return array(
|
||||
'Muted Player' => $page->get_avatar($player_name),
|
||||
'Muted By' => $page->get_avatar($page->get_banner_name($row)),
|
||||
'Mute Reason' => $page->clean($row['reason']),
|
||||
'Mute Placed' => $page->millis_to_date($row['time']),
|
||||
'Expires' => $page->expiry($row),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class WarnInfo extends Info {
|
||||
function name() {
|
||||
return "Warning";
|
||||
}
|
||||
|
||||
function basic_info($row, $player_name) {
|
||||
$page = $this->page;
|
||||
return array(
|
||||
'Warned Player' => $page->get_avatar($player_name),
|
||||
'Warned By' => $page->get_avatar($page->get_banner_name($row)),
|
||||
'Warning Reason' => $page->clean($row['reason']),
|
||||
'Warning Placed' => $page->millis_to_date($row['time']),
|
||||
'Expires' => $page->expiry($row),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class KickInfo extends Info {
|
||||
function basic_info($row, $player_name) {
|
||||
$page = $this->page;
|
||||
return array(
|
||||
'Kicked Player' => $page->get_avatar($player_name),
|
||||
'Kicked By' => $page->get_avatar($page->get_banner_name($row)),
|
||||
'Kick Reason' => $page->clean($row['reason']),
|
||||
'Kick Date' => $page->millis_to_date($row['time']),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$type = $_GET['type'];
|
||||
$id = $_GET['id'];
|
||||
$page = new Page($type);
|
||||
|
||||
if ($page->type === null) {
|
||||
die("Unknown page type requested.");
|
||||
}
|
||||
|
||||
if (!filter_var($id, FILTER_VALIDATE_INT)) {
|
||||
die("Invalid ID.");
|
||||
}
|
||||
$id = (int)$id;
|
||||
|
||||
$type = $page->type;
|
||||
$table = $page->table;
|
||||
$query = "SELECT * FROM $table WHERE id=? LIMIT 1";
|
||||
|
||||
$st = $page->conn->prepare($query);
|
||||
|
||||
if ($st->execute(array($id))) {
|
||||
if (!($row = $st->fetch())) {
|
||||
die("Error: $type not found in database.");
|
||||
}
|
||||
$player_name = $page->get_name($row['uuid']);
|
||||
if ($player_name == null) {
|
||||
die("Error: Player name not found.");
|
||||
}
|
||||
|
||||
$info = Info::create($row, $page, $type);
|
||||
|
||||
$name = $info->name();
|
||||
$permanent = $info->permanent();
|
||||
$active = $row['active'];
|
||||
|
||||
$page->name = "$name #$id";
|
||||
$page->print_title();
|
||||
|
||||
if (!($info instanceof KickInfo)) {
|
||||
$style = 'style="margin-left: 13px; font-size: 16px;"';
|
||||
if ($active) {
|
||||
$page->name .= "<span $style class='label label-danger'>Active</span>";
|
||||
} else {
|
||||
$page->name .= "<span $style class='label label-warning'>Inactive</span>";
|
||||
}
|
||||
if ($permanent) {
|
||||
$page->name .= "<span $style class='label label-danger'>Permanent</span>";
|
||||
}
|
||||
}
|
||||
|
||||
$page->print_page_header();
|
||||
?>
|
||||
<div class="container">
|
||||
<div class="row" style="margin-bottom:60px;">
|
||||
<div style="text-align: center;" class="col-lg-12">
|
||||
<table class="table st-light table-bordered table-condensed">
|
||||
<?php
|
||||
$map = $info->basic_info($row, $player_name);
|
||||
$permanent_val = $info->page->permanent[$type];
|
||||
foreach ($map as $key => $val) {
|
||||
if ($permanent && $key === "Expires" && $val === $permanent_val) {
|
||||
continue;
|
||||
}
|
||||
echo "<tr><td>$key</td><td>$val</td></tr>";
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
$page->print_footer();
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
45
kicks.php
45
kicks.php
@ -1,31 +1,36 @@
|
||||
<?php
|
||||
namespace litebans;
|
||||
use PDO;
|
||||
|
||||
require_once './includes/page.php';
|
||||
$page = new Page();
|
||||
$page = new Page("kicks");
|
||||
$page->print_title();
|
||||
$headers = array("Name", "Kicked By", "Reason", "Date");
|
||||
?>
|
||||
<title>Kicks - <?php echo $page->settings->name; ?></title>
|
||||
<div class="container">
|
||||
<?php
|
||||
$page->print_page_header("Kicks");
|
||||
$page->print_page_header();
|
||||
?>
|
||||
<div class="row" style="margin-bottom:60px;">
|
||||
<div class="col-lg-12">
|
||||
<table class="table table-hover table-bordered table-condensed">
|
||||
<?php
|
||||
$page->print_table_headers(array("Name", "Kicked By", "Reason", "Date"));
|
||||
$result = $page->run_query($page->settings->table_kicks);
|
||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
$player_name = $page->get_name($row['uuid']);
|
||||
if ($player_name === null) continue;
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $page->get_avatar($player_name); ?></td>
|
||||
<td><?php echo $page->get_avatar($page->get_banner_name($row)); ?></td>
|
||||
<td style="width: 30%;"><?php echo $page->clean($row['reason']); ?></td>
|
||||
<td><?php echo $page->millis_to_date($row['time']); ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</table>
|
||||
<?php $page->print_pager("kicks.php", $page->settings->table_kicks); ?>
|
||||
<?php
|
||||
$page->table_begin();
|
||||
$page->table_print_headers($headers);
|
||||
$result = $page->run_query();
|
||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
$player_name = $page->get_name($row['uuid']);
|
||||
if ($player_name === null) continue;
|
||||
|
||||
$page->print_table_rows($row, array(
|
||||
'Name' => $page->get_avatar($player_name),
|
||||
'Kicked By' => $page->get_avatar($page->get_banner_name($row)),
|
||||
'Reason' => $page->clean($row['reason']),
|
||||
'Date' => $page->millis_to_date($row['time']),
|
||||
));
|
||||
}
|
||||
$page->table_end();
|
||||
$page->print_pager();
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php $page->print_footer(); ?>
|
||||
|
57
mutes.php
57
mutes.php
@ -1,42 +1,37 @@
|
||||
<?php
|
||||
namespace litebans;
|
||||
use PDO;
|
||||
|
||||
require_once './includes/page.php';
|
||||
$page = new Page();
|
||||
$page = new Page("mutes");
|
||||
$page->print_title();
|
||||
$headers = array("Name", "Muted By", "Reason", "Muted On", "Muted Until");
|
||||
?>
|
||||
<title>Mutes - <?php echo $page->settings->name; ?></title>
|
||||
<div class="container">
|
||||
<?php
|
||||
$page->print_page_header("Mutes");
|
||||
$page->print_page_header();
|
||||
?>
|
||||
<div class="row" style="margin-bottom:60px;">
|
||||
<div class="col-lg-12">
|
||||
<table class="table table-hover table-bordered table-condensed">
|
||||
<?php
|
||||
$page->print_table_headers(array("Name", "Muted By", "Reason", "Muted On", "Muted Until"));
|
||||
$result = $page->run_query($page->settings->table_mutes);
|
||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
$player_name = $page->get_name($row['uuid']);
|
||||
if ($player_name === null) continue;
|
||||
$until = $page->millis_to_date($row['until']);
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $page->get_avatar($player_name); ?></td>
|
||||
<td><?php echo $page->get_avatar($page->get_banner_name($row)); ?></td>
|
||||
<td style="width: 30%;"><?php echo $page->clean($row['reason']); ?></td>
|
||||
<td><?php echo $page->millis_to_date($row['time']); ?></td>
|
||||
<td>
|
||||
<?php if ($row['until'] <= 0) {
|
||||
$until = 'Permanent Mute';
|
||||
}
|
||||
if ($page->settings->show_inactive_bans && !$row['active']) {
|
||||
$until .= ' (Unmuted)';
|
||||
}
|
||||
echo $until;
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</table>
|
||||
<?php $page->print_pager("mutes.php", $page->settings->table_mutes); ?>
|
||||
<?php
|
||||
$page->table_begin();
|
||||
$page->table_print_headers($headers);
|
||||
$result = $page->run_query();
|
||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
$player_name = $page->get_name($row['uuid']);
|
||||
if ($player_name === null) continue;
|
||||
|
||||
$page->print_table_rows($row, array(
|
||||
'Name' => $page->get_avatar($player_name),
|
||||
'Muted By' => $page->get_avatar($page->get_banner_name($row)),
|
||||
'Reason' => $page->clean($row['reason']),
|
||||
'Muted On' => $page->millis_to_date($row['time']),
|
||||
'Muted Until' => $page->expiry($row),
|
||||
));
|
||||
}
|
||||
$page->table_end();
|
||||
$page->print_pager();
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php $page->print_footer(); ?>
|
||||
|
59
warnings.php
59
warnings.php
@ -1,44 +1,37 @@
|
||||
<?php
|
||||
namespace litebans;
|
||||
use PDO;
|
||||
|
||||
require_once './includes/page.php';
|
||||
$page = new Page();
|
||||
$page = new Page("warnings");
|
||||
$page->print_title();
|
||||
$headers = array("Name", "Warned By", "Reason", "Warned Until", "Received Warning?");
|
||||
?>
|
||||
<title>Warnings - <?php echo $page->settings->name; ?></title>
|
||||
<div class="container">
|
||||
<?php
|
||||
$page->print_page_header("Warnings");
|
||||
$page->print_page_header();
|
||||
?>
|
||||
<div class="row" style="margin-bottom:60px;">
|
||||
<div class="col-lg-12">
|
||||
<table class="table table-hover table-bordered table-condensed">
|
||||
<?php
|
||||
$page->print_table_headers(array("Name", "Warned By", "Reason", "Warned Until", "Received Warning?"));
|
||||
$result = $page->run_query($page->settings->table_warnings);
|
||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
$player_name = $page->get_name($row['uuid']);
|
||||
if ($player_name === null) continue;
|
||||
$until = $page->millis_to_date($row['until']);
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $page->get_avatar($player_name); ?></td>
|
||||
<td><?php echo $page->get_avatar($page->get_banner_name($row)); ?></td>
|
||||
<td style="width: 30%;"><?php echo $page->clean($row['reason']); ?></td>
|
||||
<td>
|
||||
<?php if ($row['until'] <= 0) {
|
||||
$until = 'Permanent Warning';
|
||||
}
|
||||
if ($page->settings->show_inactive_bans && !$row['active']) {
|
||||
$until .= ' (Expired)';
|
||||
}
|
||||
echo $until;
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $row['warned'] ? "Yes" : "No"; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</table>
|
||||
<?php $page->print_pager("warnings.php", $page->settings->table_warnings); ?>
|
||||
<?php
|
||||
$page->table_begin();
|
||||
$page->table_print_headers($headers);
|
||||
$result = $page->run_query();
|
||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
$player_name = $page->get_name($row['uuid']);
|
||||
if ($player_name === null) continue;
|
||||
|
||||
$page->print_table_rows($row, array(
|
||||
'Name' => $page->get_avatar($player_name),
|
||||
'Warned By' => $page->get_avatar($page->get_banner_name($row)),
|
||||
'Reason' => $page->clean($row['reason']),
|
||||
'Warned Until' => $page->expiry($row),
|
||||
'Received Warning?' => $row['warned'] ? "Yes" : "No",
|
||||
));
|
||||
}
|
||||
$page->table_end();
|
||||
$page->print_pager();
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php $page->print_footer(); ?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user