|
|
|
@ -294,7 +294,7 @@
|
|
|
|
|
$this->tags = [...$this->tags, ...$tags];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function has_nsfw_keywords(): bool {
|
|
|
|
|
private function has_nsfw_keywords(): bool {
|
|
|
|
|
// Description not included due to false positives.
|
|
|
|
|
$blob =
|
|
|
|
|
strtolower($this->name) . " " .
|
|
|
|
@ -309,6 +309,35 @@
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function matched_by_list(array $filter): bool {
|
|
|
|
|
return in_array($this->get_room_identifier(), $filter) ||
|
|
|
|
|
in_array($this->server->get_pubkey(), $filter) ||
|
|
|
|
|
in_array($this->server->get_hostname(), $filter);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function rated_nsfw(): bool {
|
|
|
|
|
global $NSFW_INCLUDE, $NSFW_EXCLUDE;
|
|
|
|
|
|
|
|
|
|
if ($this->matched_by_list($NSFW_EXCLUDE)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $this->has_nsfw_keywords() || $this->matched_by_list($NSFW_INCLUDE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function icon_safety(): int {
|
|
|
|
|
global $ICON_ALLOWLIST, $ICON_BLOCKLIST;
|
|
|
|
|
|
|
|
|
|
if ($this->matched_by_list($ICON_ALLOWLIST)) {
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
if ($this->rated_nsfw() || $this->matched_by_list($ICON_BLOCKLIST)) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public const USERS_PER_STAFF = 50;
|
|
|
|
|
public const USERS_PER_STAFF_WARNING = 200;
|
|
|
|
|
|
|
|
|
@ -359,7 +388,7 @@
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($this->has_nsfw_keywords()) {
|
|
|
|
|
if ($this->rated_nsfw()) {
|
|
|
|
|
$derived_tags[] =
|
|
|
|
|
new CommunityTag(
|
|
|
|
|
"nsfw",
|
|
|
|
|