Added option to hide silent bans

This commit is contained in:
ruan 2018-01-20 12:40:51 +02:00
parent 55ff0bebb5
commit f9f3ffde8c
No known key found for this signature in database
GPG Key ID: 0D2EC1C52E469C0B

View File

@ -31,6 +31,9 @@ final class Settings {
// Show inactive bans? Removed bans will show (Unbanned), mutes will show (Unmuted), warnings will show (Expired).
$this->show_inactive_bans = true;
// Show silent bans?
$this->show_silent_bans = true;
// Show pager? This allows users to page through the list of bans.
$this->show_pager = true;
@ -113,7 +116,11 @@ final class Settings {
}
if (!$this->show_inactive_bans) {
$this->active_query = "WHERE active=" . Settings::$TRUE;
$this->active_query = self::append_query($this->active_query, "active=" . Settings::$TRUE);
}
if (!$this->show_silent_bans) {
$this->active_query = self::append_query($this->active_query, "silent=" . Settings::$FALSE);
}
@ -194,6 +201,12 @@ final class Settings {
}
}
static function append_query($existing, $new) {
if ($existing !== "") {
return $existing . " AND $new";
}
return "WHERE $new";
}
/**
* @param $settings Settings