diff --git a/inc/page.php b/inc/page.php index b86ead2..acc4991 100644 --- a/inc/page.php +++ b/inc/page.php @@ -44,7 +44,13 @@ class Page { $this->expired = array( 'ban' => $this->lang->page_expire_ban, '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, ); @@ -142,7 +148,7 @@ class Page { $selection .= ",CAST(warned AS UNSIGNED) AS warned"; } if ($table !== $this->settings->table['kicks']) { - $selection .= ",removed_by_name"; + $selection .= ",removed_by_uuid,removed_by_name"; } return $selection; } @@ -223,9 +229,10 @@ class Page { * Prepares text to be displayed on the web interface. * Removes chat colours, replaces newlines with proper HTML, and sanitizes the text. * @param string - * @return string + * @return string|null */ function clean($text) { + if ($text === null) return null; if (strstr($text, "\xa7") || strstr($text, "&")) { $text = preg_replace("/(?i)(\xa7|&)[0-9A-FK-OR]/", "", $text); } @@ -252,8 +259,30 @@ class Page { } else { $until = $this->millis_to_date($row['until']); } - if ($this->settings->show_inactive_bans && $this->active($row) === false) { - $until .= ' ' . $this->expired[$this->type]; + if ($this->active($row) === false) { + $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; } diff --git a/lang/cs_CZ.utf8.php b/lang/cs_CZ.utf8.php index bcefcc2..2e3cf82 100644 --- a/lang/cs_CZ.utf8.php +++ b/lang/cs_CZ.utf8.php @@ -14,8 +14,10 @@ class Lang { $this->page_perm_mute = 'Umlčen navždy'; $this->page_perm_warn = 'Trvalé varová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_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_mute = 'Umlčení'; $this->page_title_warn = 'Varování'; diff --git a/lang/en_US.utf8.php b/lang/en_US.utf8.php index c10a7b6..a00e67f 100644 --- a/lang/en_US.utf8.php +++ b/lang/en_US.utf8.php @@ -16,8 +16,10 @@ class Lang { $this->page_perm_mute = 'Permanent Mute'; $this->page_perm_warn = 'Permanent'; $this->page_expire_ban = '(Unbanned)'; + $this->page_expire_ban_by = '(Unbanned by $name)'; $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_mute = 'Mutes'; $this->page_title_warn = 'Warnings'; diff --git a/lang/es_ES.utf8.php b/lang/es_ES.utf8.php index 6739d89..33ce7b3 100644 --- a/lang/es_ES.utf8.php +++ b/lang/es_ES.utf8.php @@ -13,8 +13,10 @@ class Lang { $this->page_perm_mute = 'Muteo Permanente'; $this->page_perm_warn = 'Permanente'; $this->page_expire_ban = '(Desbaneado)'; + $this->page_expire_ban_by = '(Desbaneado por $name)'; $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_mute = 'Muteos'; $this->page_title_warn = 'Advertencias';