Add [IP Ban], [IP Mute] labels for info.php

This commit is contained in:
ruan 2018-03-09 09:01:11 +02:00
parent 2b78e68729
commit 73eb0e152f
No known key found for this signature in database
GPG Key ID: 0D2EC1C52E469C0B
3 changed files with 15 additions and 1 deletions

View File

@ -165,7 +165,7 @@ class Page {
// Under certain versions of PHP, there is a bug with BIT columns.
// An empty string is returned no matter what the value is.
// Workaround: cast to unsigned.
$selection = "id,uuid,reason,banned_by_name,banned_by_uuid,time,until,server_origin,server_scope,CAST(active AS UNSIGNED) AS active";
$selection = "id,uuid,reason,banned_by_name,banned_by_uuid,time,until,server_origin,server_scope,CAST(active AS UNSIGNED) AS active,CAST(ipban AS UNSIGNED) AS ipban";
if ($table === $this->settings->table['warnings']) {
$selection .= ",CAST(warned AS UNSIGNED) AS warned";
}

View File

@ -154,6 +154,18 @@ if ($st->execute(array($id))) {
if (!($info instanceof KickInfo)) {
$style = 'style="margin-left: 13px; font-size: 16px;"';
$active = $page->active($row);
$ipban = $page->active($row, 'ipban');
if ($ipban === true) {
$idx = null;
if ($info instanceof BanInfo) {
$idx = "generic.ipban";
} else if ($info instanceof MuteInfo) {
$idx = "generic.ipmute";
}
if ($idx !== null) {
$header .= "<span $style class='label label-danger'>" . $page->t($idx) . "</span>";
}
}
if ($active === true) {
$header .= "<span $style class='label label-danger'>" . $page->t("generic.active") . "</span>";
if ($permanent) {

View File

@ -23,6 +23,8 @@ class DefaultLang {
$array["generic.ban"] = "Ban";
$array["generic.mute"] = "Mute";
$array["generic.ipban"] = "IP " . $array["generic.ban"];
$array["generic.ipmute"] = "IP " . $array["generic.mute"];
$array["generic.warn"] = "Warning";
$array["generic.kick"] = "Kick";
$array["generic.type"] = "Type";