[web-bugs] master: Make spam filter stricter
| From: | Nikita Popov | Date: | Sat, 24 Jun 2023 19:33:24 +0000 |
| Subject: | [web-bugs] master: Make spam filter stricter | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-30900@lists.php.net to get a copy of this message | ||
Author: Nikita Popov (nikic)
Date: 2023-06-24T21:19:47+02:00
Commit: https://github.com/php/web-bugs/commit/717f16a6d9c1a309a5ea5dad78a7a0ab0ce97429
Raw diff: https://github.com/php/web-bugs/commit/717f16a6d9c1a309a5ea5dad78a7a0ab0ce97429.diff
Make spam filter stricter
Require that php.net/github.com is in the host portion.
Changed paths:
M include/functions.php
Diff:
diff --git a/include/functions.php b/include/functions.php
index 9b37d60b..2f70bb7b 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -197,7 +197,7 @@ function is_spam($string)
if (preg_match_all('/https?:\/\/(\S+)/', $string, $matches)) {
foreach ($matches[1] as $match) {
- if (strpos($match, 'php.net') === false && strpos($match,
'github.com') === false) {
+ if (!preg_match('/^[^\/]*(php\.net|github\.com)/', $match)) {
return "Due to large amounts of spam, only links to php.net and github.com
(including subdomains like gist.github.com) are allowed.";
}
}