svn: /pear/packages/Bugtracker/trunk/ include/functions.php site/bug.php
| From: | Jani Taskinen | Date: | Thu, 18 Feb 2010 12:03:05 +0000 |
| Subject: | svn: /pear/packages/Bugtracker/trunk/ include/functions.php site/bug.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-cvs+get-58798@lists.php.net to get a copy of this message | ||
jani Thu, 18 Feb 2010 12:03:05 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=295235
Log:
MFOBT: Primitive spam prevention. Gotta love the non-existant co-operation we have...
Changed paths:
U pear/packages/Bugtracker/trunk/include/functions.php
U pear/packages/Bugtracker/trunk/site/bug.php
Modified: pear/packages/Bugtracker/trunk/include/functions.php
===================================================================
--- pear/packages/Bugtracker/trunk/include/functions.php 2010-02-18 11:49:34 UTC (rev 295234)
+++ pear/packages/Bugtracker/trunk/include/functions.php 2010-02-18 12:03:05 UTC (rev 295235)
@@ -194,7 +194,22 @@
return $pseudo_pkgs;
}
+/* Primitive check for SPAM. Add more later. */
+function is_spam($string)
+{
+ if (substr_count(strtolower($string), 'http://') > 5) {
+ return true;
+ }
+ if
(preg_match("/(asian)|(spy)|(bdsm)|(massage)|(mortage)|(sex)|(11nong)|(oxycontin)|(distance-education)|(sismatech)|(justiceplan)|(prednisolone)|(baclofen)|(diflucan)|(unbra.se)|(objectis)/i",
$string)) {
+ return true;
+ }
+ if (preg_match("~/Members/~", $string)) {
+ return true;
+ }
+ return false;
+}
+
/**
* Obfuscates email addresses to hinder spammer's spiders
*
Modified: pear/packages/Bugtracker/trunk/site/bug.php
===================================================================
--- pear/packages/Bugtracker/trunk/site/bug.php 2010-02-18 11:49:34 UTC (rev 295234)
+++ pear/packages/Bugtracker/trunk/site/bug.php 2010-02-18 12:03:05 UTC (rev 295235)
@@ -233,6 +233,11 @@
}
}
+ // primitive spam detection
+ if ($ncomment && is_spam($ncomment)) {
+ $errors[] = "Please do not SPAM our bug system.";
+ }
+
if (!empty($_POST['in']['email']) &&
$bug['email'] != $_POST['in']['email']
) {
@@ -288,6 +293,11 @@
$ncomment = trim($_POST['ncomment']);
}
+ // primitive spam detection
+ if ($ncomment && is_spam($ncomment)) {
+ $errors[] = "Please do not SPAM our bug system.";
+ }
+
// Require comment for open bugs only
if ($_POST['in']['status'] == 'Bogus' &&
!in_array($bug['status'], array ('Bogus', 'Closed',
'Duplicate', 'No feedback', 'Wont fix')) &&