Author: Christoph M. Becker (cmb69)
Date: 2022-10-24T17:21:02+02:00

Commit: 
https://github.com/php/web-master/commit/0762e6a1b5bf08fe8cf4dbae9ade83dc48062563
Raw diff: 
https://github.com/php/web-master/commit/0762e6a1b5bf08fe8cf4dbae9ade83dc48062563.diff

Treat note starting with https:// as spam

We recently got a lot of these, and it is rather uncommon for a non-spam
user note to immediately start with an URL.

Closes GH-16.

Changed paths:
  M  include/spam-lib.inc


Diff:

diff --git a/include/spam-lib.inc b/include/spam-lib.inc
index e2f723e..9f4b31e 100644
--- a/include/spam-lib.inc
+++ b/include/spam-lib.inc
@@ -78,6 +78,7 @@ function check_spam_words ($text, $badwords) {
 // * BBCode links (a common spam technique)
 // * HTML anchors
 // * Too many http://'s
+// * post is starting with an URL
 function check_spam_urls ($text, $httplimit = 4) {
     if (preg_match('/\[(url|link)=[^]]+\]/', $text)) {
         return true;
@@ -88,6 +89,9 @@ function check_spam_urls ($text, $httplimit = 4) {
     if ((int) preg_match_all('~http(?:s)?://~', $text) >= $httplimit) {
         return true;
     }
+    if (preg_match('^https://', $text)) {
+        return true;
+    }
     return false;
 }
 

-- 
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to