cvs: php-master-web /entry user-note.php
| From: | Nuno Lopes | Date: | Sun, 26 Feb 2006 00:19:10 +0000 |
| Subject: | cvs: php-master-web /entry user-note.php | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-30676@lists.php.net to get a copy of this message | ||
nlopess Sun Feb 26 00:19:10 2006 UTC
Modified files:
/php-master-web/entry user-note.php
Log:
add experimental support for SpamAssassin. this won't reject notes automatically (yet). its
just for testing purposes
http://cvs.php.net/viewcvs.cgi/php-master-web/entry/user-note.php?r1=1.48&r2=1.49&diff_format=u
Index: php-master-web/entry/user-note.php
diff -u php-master-web/entry/user-note.php:1.48 php-master-web/entry/user-note.php:1.49
--- php-master-web/entry/user-note.php:1.48 Sun Feb 26 00:11:26 2006
+++ php-master-web/entry/user-note.php Sun Feb 26 00:19:10 2006
@@ -3,6 +3,8 @@
//require_once 'alert_lib.inc';
include_once 'note-reasons.inc';
+$spamassassin = '/opt/ecelerity/3rdParty/bin/spamassassin';
+
$mailto = 'php-notes@lists.php.net';
$failto = 'jimw@php.net, alindeman@php.net';
@@ -57,6 +59,16 @@
}
}
+// check with spamassassin if the note is spam or not
+$spam = shell_exec('echo ' . escapeshellarg($note) . " | $spamassassin -L -e
8");
+
+if (preg_match('/^X-Spam-Status:.+(?:\n\t.+)*/m', $spam, $match)) {
+ $spam_data = $match[0];
+} else {
+ $spam_data = 'error matching the SpamAssassin data';
+}
+
+
@mysql_connect("localhost","nobody", "")
or die("failed to connect to database");
@mysql_select_db("phpmasterdb")
@@ -129,6 +141,9 @@
$msg .= "\nProbable Submitter: {$ip}" . ($redirip ? ' (proxied:
'.htmlspecialchars($redirip).')' : '');
$msg .= "\n----\n";
+ $msg .= $spam_data;
+ $msg .= "\n----\n";
+
$msg .= "Manual Page -- http://www.php.net/manual/en/$sect.php\n";
$msg .= "Edit -- http://master.php.net/note/edit/$new_id\n";
//$msg .= "Approve -- http://master.php.net/manage/user-notes.php?action=approve+$new_id&report=yes\n";