[web-master] main: Also count https:// URLs
| From: | Christoph M. Becker | Date: | Fri, 05 Aug 2022 16:36:44 +0000 |
| Subject: | [web-master] main: Also count https:// URLs | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-30475@lists.php.net to get a copy of this message | ||
Author: Christoph M. Becker (cmb69)
Date: 2022-08-05T18:29:15+02:00
Commit: https://github.com/php/web-master/commit/b056f4275ad8259269c6d419d4589cbd3e3071c1
Raw diff: https://github.com/php/web-master/commit/b056f4275ad8259269c6d419d4589cbd3e3071c1.diff
Also count https:// URLs
Might not make much sense nowadays to count
http://` URLs, but
not
checking https://` is certainly unhelpful.
Changed paths:
M include/spam-lib.inc
Diff:
diff --git a/include/spam-lib.inc b/include/spam-lib.inc
index c6fee11..14eeb1f 100644
--- a/include/spam-lib.inc
+++ b/include/spam-lib.inc
@@ -73,7 +73,7 @@ function check_spam_urls ($text, $httplimit = 4) {
if (preg_match('/\[(url|link)=[^]]+\]/', $text)) {
return true;
}
- if (substr_count($text, 'http://') >= $httplimit) {
+ if ((int) preg_match_all('~http(?:s)?://~', $text) >= $httplimit) {
return true;
}
return false;