Added (Unbanned by $name) to ban and mute listings

Hope I got the translations right.
This commit is contained in:
ruan 2016-07-06 18:01:30 +02:00
parent 835152be95
commit 7bdd2a9b75
4 changed files with 43 additions and 8 deletions

View File

@ -44,7 +44,13 @@ class Page {
$this->expired = array( $this->expired = array(
'ban' => $this->lang->page_expire_ban, 'ban' => $this->lang->page_expire_ban,
'mute' => $this->lang->page_expire_mute, 'mute' => $this->lang->page_expire_mute,
'warn' => $this->lang->page_expire_warn, 'warn' => $this->lang->page_expire,
'kick' => null,
);
$this->expired_by = array(
'ban' => $this->lang->page_expire_ban_by,
'mute' => $this->lang->page_expire_mute_by,
'warn' => $this->lang->page_expire,
'kick' => null, 'kick' => null,
); );
@ -142,7 +148,7 @@ class Page {
$selection .= ",CAST(warned AS UNSIGNED) AS warned"; $selection .= ",CAST(warned AS UNSIGNED) AS warned";
} }
if ($table !== $this->settings->table['kicks']) { if ($table !== $this->settings->table['kicks']) {
$selection .= ",removed_by_name"; $selection .= ",removed_by_uuid,removed_by_name";
} }
return $selection; return $selection;
} }
@ -223,9 +229,10 @@ class Page {
* Prepares text to be displayed on the web interface. * Prepares text to be displayed on the web interface.
* Removes chat colours, replaces newlines with proper HTML, and sanitizes the text. * Removes chat colours, replaces newlines with proper HTML, and sanitizes the text.
* @param string * @param string
* @return string * @return string|null
*/ */
function clean($text) { function clean($text) {
if ($text === null) return null;
if (strstr($text, "\xa7") || strstr($text, "&")) { if (strstr($text, "\xa7") || strstr($text, "&")) {
$text = preg_replace("/(?i)(\xa7|&)[0-9A-FK-OR]/", "", $text); $text = preg_replace("/(?i)(\xa7|&)[0-9A-FK-OR]/", "", $text);
} }
@ -252,8 +259,30 @@ class Page {
} else { } else {
$until = $this->millis_to_date($row['until']); $until = $this->millis_to_date($row['until']);
} }
if ($this->settings->show_inactive_bans && $this->active($row) === false) { if ($this->active($row) === false) {
$until .= ' ' . $this->expired[$this->type]; $until .= ' ';
$done = false;
// Unbanned by $name
$removed_by_uuid = $row['removed_by_uuid'];
if ($removed_by_uuid !== null) {
// Player has been unbanned
// Check if uuid can be converted to name
$name = $this->get_name($removed_by_uuid);
if ($name === null) {
// Couldn't find name in history table, use removed_by_name instead
$name = $this->clean($row['removed_by_name']);
}
if ($name !== null) {
$until .= str_replace('$name', $name, $this->expired_by[$this->type]);
$done = true;
}
}
if (!$done) {
$until .= $this->expired[$this->type];
}
} }
return $until; return $until;
} }

View File

@ -14,8 +14,10 @@ class Lang {
$this->page_perm_mute = 'Umlčen navždy'; $this->page_perm_mute = 'Umlčen navždy';
$this->page_perm_warn = 'Trvalé varování'; $this->page_perm_warn = 'Trvalé varování';
$this->page_expire_ban = '(Odbanován)'; $this->page_expire_ban = '(Odbanován)';
$this->page_expire_ban_by = '(Odbanován kým $name)';
$this->page_expire_mute = '(Odmlčen)'; $this->page_expire_mute = '(Odmlčen)';
$this->page_expire_warn = '(Vypršel)'; $this->page_expire_mute_by = '(Odmlčen kým $name)';
$this->page_expire = '(Vypršel)';
$this->page_title_ban = 'Bany'; $this->page_title_ban = 'Bany';
$this->page_title_mute = 'Umlčení'; $this->page_title_mute = 'Umlčení';
$this->page_title_warn = 'Varování'; $this->page_title_warn = 'Varování';

View File

@ -16,8 +16,10 @@ class Lang {
$this->page_perm_mute = 'Permanent Mute'; $this->page_perm_mute = 'Permanent Mute';
$this->page_perm_warn = 'Permanent'; $this->page_perm_warn = 'Permanent';
$this->page_expire_ban = '(Unbanned)'; $this->page_expire_ban = '(Unbanned)';
$this->page_expire_ban_by = '(Unbanned by $name)';
$this->page_expire_mute = '(Unmuted)'; $this->page_expire_mute = '(Unmuted)';
$this->page_expire_warn = '(Expired)'; $this->page_expire_mute_by = '(Unmuted by $name)';
$this->page_expire = '(Expired)';
$this->page_title_ban = 'Bans'; $this->page_title_ban = 'Bans';
$this->page_title_mute = 'Mutes'; $this->page_title_mute = 'Mutes';
$this->page_title_warn = 'Warnings'; $this->page_title_warn = 'Warnings';

View File

@ -13,8 +13,10 @@ class Lang {
$this->page_perm_mute = 'Muteo Permanente'; $this->page_perm_mute = 'Muteo Permanente';
$this->page_perm_warn = 'Permanente'; $this->page_perm_warn = 'Permanente';
$this->page_expire_ban = '(Desbaneado)'; $this->page_expire_ban = '(Desbaneado)';
$this->page_expire_ban_by = '(Desbaneado por $name)';
$this->page_expire_mute = '(Desmuteado)'; $this->page_expire_mute = '(Desmuteado)';
$this->page_expire_warn = '(Expirado)'; $this->page_expire_mute_by = '(Desmuteado por $name)';
$this->page_expire = '(Expirado)';
$this->page_title_ban = 'Baneos'; $this->page_title_ban = 'Baneos';
$this->page_title_mute = 'Muteos'; $this->page_title_mute = 'Muteos';
$this->page_title_warn = 'Advertencias'; $this->page_title_warn = 'Advertencias';