|
From: <ton...@us...> - 2003-12-08 18:28:06
|
Update of /cvsroot/serverfilters
In directory sc8-pr-cvs1:/tmp/cvs-serv31909
Modified Files:
backend.php config.php config.php.sample options.php
recipie_functions.php
Log Message:
Spam filter additions: ability to add unsure rule, filter command line
parameterized by [USERNAME], header names and spam/unsure values
controlled by config settings.
Index: config.php
===================================================================
RCS file: /cvsroot/serverfilters/config.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** config.php 4 Dec 2003 23:15:06 -0000 1.1.1.1
--- config.php 8 Dec 2003 18:28:03 -0000 1.2
***************
*** 8,15 ****
global $STORAGE_DIR, $ADMIN, $ALWAYS_CREATE, $FILE_BACKEND, $FILTERDIR, $FILTERFILE,
! $FILTER_APP, $FILTER_APP_PATH, $DEFAULT_DELIVERY, $SPAMFILTER, $VIRTUAL_DOMAINS,
! $LOCAL_MAILDIR, $USE_MAILDIRS, $VD_BACKEND, $SEPERATOR, $CREATE_DOT_QMAIL;
/**
! * STOARAGE_DIR
* If you are using virtual domains, then the domain password
* will need to be stored in an encrypted file. This is the location
--- 8,16 ----
global $STORAGE_DIR, $ADMIN, $ALWAYS_CREATE, $FILE_BACKEND, $FILTERDIR, $FILTERFILE,
! $FILTER_APP, $FILTER_APP_PATH, $DEFAULT_DELIVERY, $SPAMFILTER, $SPAMHEADER,
! $SPAMVALUE, $UNSUREVALUE, $VIRTUAL_DOMAINS, $LOCAL_MAILDIR,
! $USE_MAILDIRS, $VD_BACKEND, $SEPERATOR, $CREATE_DOT_QMAIL;
/**
! * STORAGE_DIR
* If you are using virtual domains, then the domain password
* will need to be stored in an encrypted file. This is the location
***************
*** 97,101 ****
* based on a spam header, set this to the location of the spam filter, otherwise comment out.
*/
! $SPAMFILTER = '/usr/bin/spamc';
/**** Virtual Domain Settings ****/
--- 98,108 ----
* based on a spam header, set this to the location of the spam filter, otherwise comment out.
*/
! $SPAMFILTER = '/usr/bin/spamc -u [USERNAME] -f';
! $SPAMHEADER = 'X-Spam-Flag';
! $SPAMVALUE = 'YES';
! //$SPAMFILTER= '/usr/bin/sb_filter.py';
! //$SPAMHEADER = 'X-SpamBayes-Classification';
! //$SPAMVALUE = 'spam';
! //$UNSUREVALUE = 'unsure';
/**** Virtual Domain Settings ****/
Index: config.php.sample
===================================================================
RCS file: /cvsroot/serverfilters/config.php.sample,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** config.php.sample 4 Dec 2003 23:15:06 -0000 1.1.1.1
--- config.php.sample 8 Dec 2003 18:28:03 -0000 1.2
***************
*** 8,15 ****
global $STORAGE_DIR, $ADMIN, $ALWAYS_CREATE, $FILE_BACKEND, $FILTERDIR, $FILTERFILE,
! $FILTER_APP, $FILTER_APP_PATH, $DEFAULT_DELIVERY, $SPAMFILTER, $VIRTUAL_DOMAINS,
! $LOCAL_MAILDIR, $USE_MAILDIRS, $VD_BACKEND, $SEPERATOR, $CREATE_DOT_QMAIL;
/**
! * STOARAGE_DIR
* If you are using virtual domains, then the domain password
* will need to be stored in an encrypted file. This is the location
--- 8,16 ----
global $STORAGE_DIR, $ADMIN, $ALWAYS_CREATE, $FILE_BACKEND, $FILTERDIR, $FILTERFILE,
! $FILTER_APP, $FILTER_APP_PATH, $DEFAULT_DELIVERY, $SPAMFILTER, $SPAMHEADER,
! $SPAMVALUE, $UNSUREVALUE, $VIRTUAL_DOMAINS, $LOCAL_MAILDIR,
! $USE_MAILDIRS, $VD_BACKEND, $SEPERATOR, $CREATE_DOT_QMAIL;
/**
! * STORAGE_DIR
* If you are using virtual domains, then the domain password
* will need to be stored in an encrypted file. This is the location
***************
*** 97,101 ****
* based on a spam header, set this to the location of the spam filter, otherwise comment out.
*/
! $SPAMFILTER = '/usr/bin/spamc';
/**** Virtual Domain Settings ****/
--- 98,108 ----
* based on a spam header, set this to the location of the spam filter, otherwise comment out.
*/
! $SPAMFILTER = '/usr/bin/spamc -u [USERNAME] -f';
! $SPAMHEADER = 'X-Spam-Flag';
! $SPAMVALUE = 'YES';
! //$SPAMFILTER= '/usr/bin/sb_filter.py';
! //$SPAMHEADER = 'X-SpamBayes-Classification';
! //$SPAMVALUE = 'spam';
! //$UNSUREVALUE = 'unsure';
/**** Virtual Domain Settings ****/
Index: options.php
===================================================================
RCS file: /cvsroot/serverfilters/options.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** options.php 4 Dec 2003 23:15:05 -0000 1.1.1.1
--- options.php 8 Dec 2003 18:28:03 -0000 1.2
***************
*** 44,48 ****
global $username, $key, $imapServerAddress, $imapPort;
global $fields, $folders, $imapConnection, $imap_stream;
! global $recipies;
compatibility_sqextractGlobalVar('onetimepad');
--- 44,48 ----
global $username, $key, $imapServerAddress, $imapPort;
global $fields, $folders, $imapConnection, $imap_stream;
! global $recipies, $SPAMHEADER, $SPAMVALUE, $UNSUREVALUE;
compatibility_sqextractGlobalVar('onetimepad');
***************
*** 61,64 ****
--- 61,65 ----
$fields = array("From", "Subject", "To", "Cc", "TO_");
$spamrule_set = false;
+ $unsurerule_set = false;
// figure out if we're already connected to IMAP server
***************
*** 92,97 ****
// Create a new entry
! if ($_POST['field'] == 'X-Spam-Flag')
! $new['field'] = 'X-Spam-Flag';
else
$new['field'] = $fields[$_POST['field']];
--- 93,98 ----
// Create a new entry
! if ($_POST['field'] == $SPAMHEADER)
! $new['field'] = $SPAMHEADER;
else
$new['field'] = $fields[$_POST['field']];
***************
*** 120,125 ****
} elseif (array_key_exists('modify_x', $_POST)) {
// Modify an existing entry
! if ($_POST['field'] == 'X-Spam-Flag')
! $recipies[$_POST['rule']]['field'] = 'X-Spam-Flag';
else
$recipies[$_POST['rule']]['field'] = $fields[$_POST['field']];
--- 121,126 ----
} elseif (array_key_exists('modify_x', $_POST)) {
// Modify an existing entry
! if ($_POST['field'] == $SPAMHEADER)
! $recipies[$_POST['rule']]['field'] = $SPAMHEADER;
else
$recipies[$_POST['rule']]['field'] = $fields[$_POST['field']];
***************
*** 237,246 ****
</form>
<?php
! if (!$spamrule_set && isset($SPAMFILTER) && $SPAMFILTER != '') {
echo '<form method=post action="options.php">'
! .'<input type=hidden name="create.x" value="'.$value.'">'
.'<tr><td align=right valign=top>'
! .'<input type=hidden name=field value="X-Spam-Flag">'
! .'<input type=hidden name=string value="YES">'
._("if message is marked as").' <b>'._("SPAM").'</b> '._("then")
.' <select name=action>'
--- 238,248 ----
</form>
<?php
! if (isset($SPAMFILTER) && $SPAMFILTER != '') {
! if (!$spamrule_set) {
echo '<form method=post action="options.php">'
! .'<input type=hidden name="create.x" value="'.$value++.'">'
.'<tr><td align=right valign=top>'
! .'<input type=hidden name=field value="' . $SPAMHEADER . '">'
! .'<input type=hidden name=string value="' . $SPAMVALUE . '">'
._("if message is marked as").' <b>'._("SPAM").'</b> '._("then")
.' <select name=action>'
***************
*** 257,260 ****
--- 259,284 ----
.'<td colspan=4 align=center valign=top><input type=image src="images/saveas.gif" border=0 name=create alt="save new"></td></tr>'
.'</form>';
+ }
+ if (!$unsurerule_set && isset($UNSUREVALUE) && $UNSUREVALUE != '' ) {
+ echo '<form method=post action="options.php">'
+ .'<input type=hidden name="create.x" value="'.$value++.'">'
+ .'<tr><td align=right valign=top>'
+ .'<input type=hidden name=field value="' . $SPAMHEADER . '">'
+ .'<input type=hidden name=string value="' . $UNSUREVALUE . '">'
+ ._("if message is marked as").' <b>'._("UNSURE").'</b> '._("then")
+ .' <select name=action>'
+ .'<option value=m>move</option>'
+ .'<option value=c>copy</option>'
+ .'</select>'
+ .' '._("to").'</td><td><table border=0 cellpadding=0 cellspacing=0>'
+ .'<tr><td><input type=checkbox name=toFolder checked>' . _("Folder") . ' </td><td>';
+ folderDropdown('');
+ echo '</td></tr>'
+ .'<td><input type=checkbox name=toAddress>' ._("Email") . ' </td>'
+ .'<td><input type=text name=add_string></td>'
+ .'</tr></table></td>'
+ .'<td colspan=4 align=center valign=top><input type=image src="images/saveas.gif" border=0 name=create alt="save new"></td></tr>'
+ .'</form>';
+ }
}
echo "</table></td></tr>";
Index: recipie_functions.php
===================================================================
RCS file: /cvsroot/serverfilters/recipie_functions.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** recipie_functions.php 4 Dec 2003 23:15:06 -0000 1.1.1.1
--- recipie_functions.php 8 Dec 2003 18:28:03 -0000 1.2
***************
*** 60,64 ****
function read_recipies($file) {
! global $recipies, $spamrule_set;
$buf = '';
--- 60,64 ----
function read_recipies($file) {
! global $recipies, $spamrule_set, $unsurerule_set, $SPAMHEADER, $SPAMVALUE, $UNSUREVALUE;
$buf = '';
***************
*** 73,79 ****
$tmp = explode(" '' ", substr($buf, 3));
$new['field'] = stripslashes($tmp[0]);
- if ($new['field'] == 'X-Spam-Flag')
- $spamrule_set = true;
$new['string'] = stripslashes($tmp[1]);
$new['folder'] = stripslashes($tmp[2]);
$new['action'] = stripslashes($tmp[3]);
--- 73,81 ----
$tmp = explode(" '' ", substr($buf, 3));
$new['field'] = stripslashes($tmp[0]);
$new['string'] = stripslashes($tmp[1]);
+ if ($new['field'] == $SPAMHEADER) {
+ if ($new['string'] == $SPAMVALUE) $spamrule_set = true;
+ if ($new['string'] == $UNSUREVALUE) $unsurerule_set = true;
+ }
$new['folder'] = stripslashes($tmp[2]);
$new['action'] = stripslashes($tmp[3]);
***************
*** 94,98 ****
function write_recipies($oldfile, $newfile) {
! global $username, $recipies, $SEPERATOR, $SPAMFILTER,
$VIRTUAL_DOMAINS, $LOCAL_MAILDIR, $FILE_BACKEND, $CREATE_DOT_QMAIL;
--- 96,100 ----
function write_recipies($oldfile, $newfile) {
! global $username, $recipies, $SEPERATOR, $SPAMFILTER, $SPAMHEADER, $UNSUREVALUE, $SPAMVALUE,
$VIRTUAL_DOMAINS, $LOCAL_MAILDIR, $FILE_BACKEND, $CREATE_DOT_QMAIL;
***************
*** 200,204 ****
function print_recipies() {
! global $recipies, $color;
$bgcolor = $color[0];
--- 202,206 ----
function print_recipies() {
! global $recipies, $color, $SPAMHEADER, $SPAMVALUE, $UNSUREVALUE;
$bgcolor = $color[0];
***************
*** 213,220 ****
print("<form method=post action=\"options.php\"><input type=hidden name=rule value=\"$i\">\n");
print("<tr><td align=right valign=top>");
! if ($recipies[$i]['field'] == 'X-Spam-Flag') {
! print('<input type=hidden name=field value="X-Spam-Flag">');
! print('<input type=hidden name=string value="Yes">');
! print(_("If message is marked as") . ' <b>' . _("SPAM") . '</b> ' . _("then") . " ");
} else {
print(_("If") . " ");
--- 215,227 ----
print("<form method=post action=\"options.php\"><input type=hidden name=rule value=\"$i\">\n");
print("<tr><td align=right valign=top>");
! if ($recipies[$i]['field'] == $SPAMHEADER) {
! print('<input type=hidden name=field value="' . $SPAMHEADER . '">');
! if ($recipies[$i]['string'] == $UNSUREVALUE) {
! print('<input type=hidden name=string value="'.$UNSUREVALUE.'">');
! print(_("If message is marked as") . ' <b>' . _("UNSURE") . '</b> ' . _("then") . " ");
! } else {
! print('<input type=hidden name=string value="'.$SPAMVALUE.'">');
! print(_("If message is marked as") . ' <b>' . _("SPAM") . '</b> ' . _("then") . " ");
! }
} else {
print(_("If") . " ");
|