Add unban & unmute reasons

This commit is contained in:
ruan 2021-06-12 21:17:24 +02:00
parent ac2447040f
commit 7706ee7284
4 changed files with 38 additions and 13 deletions

View File

@ -121,7 +121,7 @@ if ($page->settings->header_show_totals) {
</header>
<?php
if ($page->lang->version <= 0) {
if ($page->lang->version <= 1) {
?>
<div class="col-lg-6 container modal-header alert alert-dismissible alert-light">
<button type="button" class="close text-dark" data-dismiss="alert">×</button>

View File

@ -213,7 +213,7 @@ class Page {
}
if ($table !== $this->settings->table['kicks']) {
array_push($columns, "removed_by_uuid", "removed_by_name", "removed_by_date");
array_push($columns, "removed_by_uuid", "removed_by_name", "removed_by_date", "removed_by_reason");
}
// Under certain versions of PHP, there is a bug with BIT columns.

View File

@ -51,7 +51,7 @@ abstract class Info {
return $this->page->get_avatar($banner_name, $row['banned_by_uuid'], true, $this->history_link($banner_name, $row['banned_by_uuid'], ':issued'), $name_left = false);
}
function basic_info() {
function get_info() {
$settings = $this->page->settings;
$table = array(
'table.player' => function (Info $info) { return $info->punished_avatar(); },
@ -69,14 +69,30 @@ abstract class Info {
}
//-
class BanInfo extends Info {}
class MuteInfo extends Info {}
class BanInfo extends Info {
function get_info() {
$array = parent::get_info();
if ($this->page->active($this->row) === false) {
$array["table.reason.unban"] = function (Info $info) { return $info->page->clean($info->row['removed_by_reason']); };
}
return $array;
}
}
class MuteInfo extends Info {
function get_info() {
$array = parent::get_info();
if ($this->page->active($this->row) === false) {
$array["table.reason.unmute"] = function (Info $info) { return $info->page->clean($info->row['removed_by_reason']); };
}
return $array;
}
}
class WarnInfo extends Info {}
//+
class KickInfo extends Info {
function basic_info() {
$array = parent::basic_info();
function get_info() {
$array = parent::get_info();
unset($array['table.expires']); // kicks do not expire
return $array;
}
@ -161,7 +177,7 @@ if ($st->execute()) {
}
$page->print_header(true, $header . "<div class=\"noalign-w litebans-label-container\">$badges</div>");
$map = $info->basic_info($row, $player_name);
$map = $info->get_info($row, $player_name);
$page->table_begin();

View File

@ -2,7 +2,7 @@
class en_US {
public function __construct() {
$this->version = 1;
$this->version = 2;
$array = array();
$this->array = &$array;
@ -23,11 +23,17 @@ class en_US {
$array["generic.warn"] = "Warning";
$array["generic.kick"] = "Kick";
$array["generic.unban"] = "Unban";
$array["generic.unmute"] = "Unmute";
$array["generic.banned"] = "Banned";
$array["generic.muted"] = "Muted";
$array["generic.warned"] = "Warned";
$array["generic.kicked"] = "Kicked";
$array["generic.unbanned"] = "Unbanned";
$array["generic.unmuted"] = "Unmuted";
$array["generic.banned.by"] = $array["generic.banned"] . " By";
$array["generic.muted.by"] = $array["generic.muted"] . " By";
$array["generic.warned.by"] = $array["generic.warned"] . " By";
@ -47,20 +53,23 @@ class en_US {
$array["generic.expired.kick"] = "N/A";
$array["generic.player-name"] = "Player";
$array["page.expired.ban"] = '(Unbanned)';
$array["page.expired.ban-by"] = '(Unbanned by {name})';
$array["page.expired.mute"] = '(Unmuted)';
$array["page.expired.mute-by"] = '(Unmuted by {name})';
$array["page.expired.ban"] = '(' . $array["generic.unbanned"] . ')';
$array["page.expired.ban-by"] = '(' . $array["generic.unbanned"] . ' by {name})';
$array["page.expired.mute"] = '(' . $array["generic.unmuted"] . ')';
$array["page.expired.mute-by"] = '(' . $array["generic.unmuted"] . ' by {name})';
$array["page.expired.warning"] = '(' . $array["generic.expired"] . ')';
$array["table.player"] = $array["generic.player-name"];
$array["table.type"] = $array["generic.type"];
$array["table.executor"] = "Moderator";
$array["table.reason"] = "Reason";
$array["table.reason.unban"] = $array["generic.unban"] . " " . $array["table.reason"];
$array["table.reason.unmute"] = $array["generic.unmute"] . " " . $array["table.reason"];
$array["table.date"] = "Date";
$array["table.expires"] = "Expires";
$array["table.received-warning"] = "Received Warning";
$array["table.server.name"] = "Server";
$array["table.server.scope"] = "Server Scope";
$array["table.server.origin"] = "Origin Server";