custom ipban message

This commit is contained in:
Shish 2019-02-22 19:58:04 +00:00
parent d918f058bf
commit 7abf1aa591

View File

@ -43,6 +43,7 @@ class IPBan extends Extension {
if($config->get_int("ext_ipban_version") < 8) {
$this->install();
}
$config->set_default_string("ipban_message", "If you couldn't possibly be guilty of what you're banned for, the person we banned probably had a dynamic IP address and so do you. See <a href='http://whatismyipaddress.com/dynamic-static'>http://whatismyipaddress.com/dynamic-static</a> for more information.\n");
$this->check_ip_ban();
}
@ -81,6 +82,12 @@ class IPBan extends Extension {
}
}
public function onSetupBuilding(SetupBuildingEvent $event) {
$sb = new SetupBlock("IP Ban");
$sb->add_longtext_option("ipban_message", 'Message to show to banned users:');
$event->panel->add_block($sb);
}
public function onUserBlockBuilding(UserBlockBuildingEvent $event) {
global $user;
if($user->can("ban_ip")) {
@ -218,9 +225,10 @@ class IPBan extends Extension {
$reason = $row[$prefix.'reason'];
$admin = User::by_id($row[$prefix.'banner_id']);
$date = date("Y-m-d", $row[$prefix.'end_timestamp']);
$msg = $config->get_string("ipban_message");
header("HTTP/1.0 403 Forbidden");
print "IP <b>$ip</b> has been banned until <b>$date</b> by <b>{$admin->name}</b> because of <b>$reason</b>\n";
print "<p>If you couldn't possibly be guilty of what you're banned for, the person we banned probably had a dynamic IP address and so do you. See <a href='http://whatismyipaddress.com/dynamic-static'>http://whatismyipaddress.com/dynamic-static</a> for more information.\n";
print "<p>$msg";
$contact_link = contact_link();
if(!empty($contact_link)) {