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,
|
||||
]);
|
||||
|
||||
// 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", [
|
||||
]);
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ class IPBanTable extends Table
|
|||
$this->size = 10;
|
||||
$this->columns = [
|
||||
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 StringColumn("banner", "Banner"),
|
||||
new DateColumn("added", "Added"),
|
||||
|
@ -273,7 +273,7 @@ class IPBan extends Extension
|
|||
|
||||
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]);
|
||||
|
||||
|
@ -289,9 +289,14 @@ class IPBan extends Extension
|
|||
$msg = str_replace('$CONTACT', "", $msg);
|
||||
}
|
||||
|
||||
header("HTTP/1.0 403 Forbidden");
|
||||
print "$msg";
|
||||
exit;
|
||||
if($row["mode"] == "ghost") {
|
||||
$page->add_block(new Block(null, $msg, "main", 0));
|
||||
$user->class = $_shm_user_classes["ghost"];
|
||||
} else {
|
||||
header("HTTP/1.0 403 Forbidden");
|
||||
print "$msg";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// returns [ips, nets]
|
||||
|
|
Reference in a new issue