Add options to show server scope/origin in info.php.

Disable server scope column by default, since most people only use global bans.
This commit is contained in:
ruan 2020-08-17 08:37:54 +02:00
parent 8eb8ddac52
commit 205df0e285
2 changed files with 20 additions and 10 deletions

View File

@ -36,6 +36,12 @@ class Settings {
// Show server origin column? // Show server origin column?
$this->show_server_origin = false; $this->show_server_origin = false;
// Show server scope column in info.php?
$this->info_show_server_scope = false;
// Show server origin column in info.php?
$this->info_show_server_origin = true;
// Show inactive bans? Removed bans will show (Unbanned), mutes will show (Unmuted), warnings will show (Expired). // Show inactive bans? Removed bans will show (Unbanned), mutes will show (Unmuted), warnings will show (Expired).
$this->show_inactive_bans = true; $this->show_inactive_bans = true;

View File

@ -48,19 +48,23 @@ abstract class Info {
function moderator_avatar() { function moderator_avatar() {
$row = $this->row; $row = $this->row;
$banner_name = $this->page->get_banner_name($row); $banner_name = $this->page->get_banner_name($row);
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); 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 basic_info() {
return array( $settings = $this->page->settings;
"table.player" => function (Info $info) { return $info->punished_avatar(); }, $table = array(
"table.executor" => function (Info $info) { return $info->moderator_avatar(); }, 'table.player' => function (Info $info) { return $info->punished_avatar(); },
"table.reason" => function (Info $info) { return $info->page->clean($info->row['reason']); }, 'table.executor' => function (Info $info) { return $info->moderator_avatar(); },
"table.date" => function (Info $info) { return $info->page->millis_to_date($info->row['time']); }, 'table.reason' => function (Info $info) { return $info->page->clean($info->row['reason']); },
"table.expires" => function (Info $info) { return $info->page->expiry($info->row); }, 'table.date' => function (Info $info) { return $info->page->millis_to_date($info->row['time']); },
"table.server.scope" => function (Info $info) { return $info->page->server($info->row); }, 'table.expires' => function (Info $info) { return $info->page->expiry($info->row); },
"table.server.origin" => function (Info $info) { return $info->page->server($info->row, "server_origin"); }, 'table.server.scope' => function (Info $info) { return $info->page->server($info->row); },
'table.server.origin' => function (Info $info) { return $info->page->server($info->row, "server_origin"); },
); );
if (!$settings->info_show_server_scope) unset($table['table.server.scope']);
if (!$settings->info_show_server_origin) unset($table['table.server.origin']);
return $table;
} }
} }
@ -73,7 +77,7 @@ class WarnInfo extends Info {}
class KickInfo extends Info { class KickInfo extends Info {
function basic_info() { function basic_info() {
$array = parent::basic_info(); $array = parent::basic_info();
unset($array["table.expires"]); // kicks do not expire unset($array['table.expires']); // kicks do not expire
return $array; return $array;
} }
} }