ghost bans
This commit is contained in:
parent
3ed3ea7234
commit
358f6d7abc
2 changed files with 16 additions and 5 deletions
|
@ -156,6 +156,12 @@ new UserClass("base", null, [
|
||||||
Permissions::APPROVE_COMMENT => false,
|
Permissions::APPROVE_COMMENT => false,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
// Ghost users can't do anything
|
||||||
|
new UserClass("ghost", "base", [
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Anonymous users can't do anything by default, but
|
||||||
|
// the admin might grant them some permissions
|
||||||
new UserClass("anonymous", "base", [
|
new UserClass("anonymous", "base", [
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ class IPBanTable extends Table
|
||||||
$this->size = 10;
|
$this->size = 10;
|
||||||
$this->columns = [
|
$this->columns = [
|
||||||
new InetColumn("ip", "IP"),
|
new InetColumn("ip", "IP"),
|
||||||
new EnumColumn("mode", "Mode", ["Block"=>"block", "Firewall"=>"firewall"]),
|
new EnumColumn("mode", "Mode", ["Block"=>"block", "Firewall"=>"firewall", "Ghost"=>"ghost"]),
|
||||||
new TextColumn("reason", "Reason"),
|
new TextColumn("reason", "Reason"),
|
||||||
new StringColumn("banner", "Banner"),
|
new StringColumn("banner", "Banner"),
|
||||||
new DateColumn("added", "Added"),
|
new DateColumn("added", "Added"),
|
||||||
|
@ -273,7 +273,7 @@ class IPBan extends Extension
|
||||||
|
|
||||||
private function block(int $ban_id)
|
private function block(int $ban_id)
|
||||||
{
|
{
|
||||||
global $config, $database;
|
global $config, $database, $user, $page, $_shm_user_classes;
|
||||||
|
|
||||||
$row = $database->get_row("SELECT * FROM bans WHERE id=:id", ["id"=>$ban_id]);
|
$row = $database->get_row("SELECT * FROM bans WHERE id=:id", ["id"=>$ban_id]);
|
||||||
|
|
||||||
|
@ -289,9 +289,14 @@ class IPBan extends Extension
|
||||||
$msg = str_replace('$CONTACT', "", $msg);
|
$msg = str_replace('$CONTACT', "", $msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
header("HTTP/1.0 403 Forbidden");
|
if($row["mode"] == "ghost") {
|
||||||
print "$msg";
|
$page->add_block(new Block(null, $msg, "main", 0));
|
||||||
exit;
|
$user->class = $_shm_user_classes["ghost"];
|
||||||
|
} else {
|
||||||
|
header("HTTP/1.0 403 Forbidden");
|
||||||
|
print "$msg";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns [ips, nets]
|
// returns [ips, nets]
|
||||||
|
|
Reference in a new issue