Add the ability to filter by user-agent

This commit is contained in:
Mike Macgirvin 2023-12-27 07:07:57 +11:00
parent 40114c6045
commit 645f5d0a0a

View file

@ -74,9 +74,12 @@ class MessageFilter
return false;
}
} elseif (str_starts_with($word, '?')) {
$item['ua'] = $_SERVER['HTTP_USER_AGENT'] ?? '';
if (self::test_condition(substr($word, 1), $item)) {
unset($item['ua']);
return false;
}
unset($item['ua']);
} elseif ((str_starts_with($word, '/')) && preg_match($word, $item['body'])) {
return false;
} elseif (stristr($item['body'], $word) !== false) {
@ -127,9 +130,12 @@ class MessageFilter
}
} elseif (str_starts_with($word, '?')) {
// ?item match
$item['ua'] = $_SERVER['HTTP_USER_AGENT'] ?? '';
if (self::test_condition(substr($word, 1), $item)) {
unset($item['ua']);
return true;
}
unset($item['ua']);
} elseif ((str_starts_with($word, '/')) && preg_match($word, $text)) {
// /regular expression match/
return true;