From: <jgs...@us...> - 2004-02-23 21:12:48
|
Update of /cvsroot/serverfilters In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19085 Modified Files: backend.php functions.php options.php recipie_functions.php Log Message: Added more advanced filtering options. Index: functions.php =================================================================== RCS file: /cvsroot/serverfilters/functions.php,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** functions.php 22 Feb 2004 22:14:41 -0000 1.11 --- functions.php 23 Feb 2004 20:59:05 -0000 1.12 *************** *** 19,29 **** */ function filter_get() { ! global $username; $localfile = "/tmp/serversidefilter/"; mkdirs($localfile, 0777); chmod($localfile, 0777); $localfile .= "$FILTERFILE.$username"; ! if (filter_exists($file)) { $result = invoke_filtercmd("getrc filter", "", $localfile); } else --- 19,30 ---- */ function filter_get() { ! global $username, $FILTERFILE; $localfile = "/tmp/serversidefilter/"; mkdirs($localfile, 0777); chmod($localfile, 0777); + $localfile .= "$FILTERFILE.$username"; ! if (filter_exists()) { $result = invoke_filtercmd("getrc filter", "", $localfile); } else *************** *** 97,106 **** function write_filter_recipie($fd, $action, $field, $string, $folder, ! $toFolder, $toAddress, $add_string) { global $FILTER_APP; $wr_filter = $FILTER_APP.'_write_filter_recipie'; $wr_filter($fd, $action, $field, $string, $folder, ! $toFolder, $toAddress, $add_string); } --- 98,107 ---- function write_filter_recipie($fd, $action, $field, $string, $folder, ! $toFolder, $toAddress, $add_string, $matching) { global $FILTER_APP; $wr_filter = $FILTER_APP.'_write_filter_recipie'; $wr_filter($fd, $action, $field, $string, $folder, ! $toFolder, $toAddress, $add_string, $matching); } Index: options.php =================================================================== RCS file: /cvsroot/serverfilters/options.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** options.php 22 Feb 2004 21:50:32 -0000 1.9 --- options.php 23 Feb 2004 20:59:05 -0000 1.10 *************** *** 60,64 **** $fields = array("From", "Subject", "To", "Cc", "TO_"); ! $matching = array("Contains", "Begins with", "Ends With", "Is Exactly"); $spamrule_set = false; $unsurerule_set = false; --- 60,64 ---- $fields = array("From", "Subject", "To", "Cc", "TO_"); ! $matching = array("Contains", "Begins With", "Ends With", "Is Exactly", "Custom"); $spamrule_set = false; $unsurerule_set = false; *************** *** 107,110 **** --- 107,111 ---- $new['folder'] = $folders[$_POST['folder']]; $new['action'] = $_POST['action']; + $new['matching'] = $matching[$_POST['matching']]; if (isset($_POST['toFolder'])) $new['toFolder'] = 'on'; *************** *** 134,137 **** --- 135,139 ---- $recipies[$_POST['rule']]['folder'] = $folders[$_POST['folder']]; $recipies[$_POST['rule']]['action'] = $_POST['action']; + $recipies[$_POST['rule']]['matching'] = $matching[$_POST['matching']]; if (isset($_POST['toFolder'])) $recipies[$_POST['rule']]['toFolder'] = 'on'; *************** *** 191,195 **** <input type=hidden name="create.x" value="<?php print($value++)?>"> <tr><td align=right valign=top> ! <?php echo _("If") . " " . fieldDropdown('') . " " . matchingDropdown('') . " <input type=text name=string size=10> " . _("then") . " " ?> <select name=action> <option value=m>move</option> --- 193,202 ---- <input type=hidden name="create.x" value="<?php print($value++)?>"> <tr><td align=right valign=top> ! <?php ! print(_("If") . " "); ! fieldDropdown(''); ! matchingDropdown(''); ! print("* <input type=text name=string size=10> " . _("then") . " ") ! ?> <select name=action> <option value=m>move</option> *************** *** 210,213 **** --- 217,223 ---- <td align=center valign=top><input type=image src="images/saveas.gif" border=0 name=create alt="save new"></td> </tr> + <tr> + <td colspan=8>* Selecting "Custom" allows you to enter your own Regular Expression (ie: you use wildcard characters such as *)</td> + </tr> </form> <?php Index: recipie_functions.php =================================================================== RCS file: /cvsroot/serverfilters/recipie_functions.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** recipie_functions.php 22 Feb 2004 21:20:16 -0000 1.5 --- recipie_functions.php 23 Feb 2004 20:59:05 -0000 1.6 *************** *** 100,105 **** if (isset($tmp[5])) $new['toAddress'] = stripslashes($tmp[5]); else $new['toAddress'] = 'off'; ! if (isset($tmp[6])) $new['add_string'] = stripslashes(trim($tmp[6])); else $new['add_string'] = ""; array_push($recipies, $new); } --- 100,107 ---- if (isset($tmp[5])) $new['toAddress'] = stripslashes($tmp[5]); else $new['toAddress'] = 'off'; ! if (isset($tmp[6])) $new['add_string'] = stripslashes($tmp[6]); else $new['add_string'] = ""; + if (isset($tmp[7])) $new['matching'] = stripslashes(trim($tmp[7])); + else $new['matching'] = "Contains"; array_push($recipies, $new); } *************** *** 148,151 **** --- 150,154 ---- $toAddress = $recipies[$i]['toAddress']; $add_string = $recipies[$i]['add_string']; + $matching = $recipies[$i]['matching']; $ssfield = addslashes($recipies[$i]['field']); *************** *** 156,163 **** $sstoAddress = addslashes($recipies[$i]['toAddress']); $ssadd_string = addslashes($recipies[$i]['add_string']); ! ! fputs($nf, "\n###${ssfield} '' ${ssstring} '' ${ssfolder} '' ${ssaction} '' ${sstoFolder} '' ${sstoAddress} '' ${ssadd_string} \n"); write_filter_recipie($nf, $action, $field, $string, $folder, ! $toFolder, $toAddress, $add_string); } --- 159,167 ---- $sstoAddress = addslashes($recipies[$i]['toAddress']); $ssadd_string = addslashes($recipies[$i]['add_string']); ! $ssmatching = addslashes($recipies[$i]['matching']); ! ! fputs($nf, "\n###${ssfield} '' ${ssstring} '' ${ssfolder} '' ${ssaction} '' ${sstoFolder} '' ${sstoAddress} '' ${ssadd_string} '' ${ssmatching} \n"); write_filter_recipie($nf, $action, $field, $string, $folder, ! $toFolder, $toAddress, $add_string, $matching); } *************** *** 246,250 **** print(_("If") . " "); fieldDropdown($recipies[$i]['field']); ! print(_("contains") . " <input type=text name=string size=10 value=\"$str\"> " . _("then") . " "); } print("<select name=action>\n"); --- 250,255 ---- print(_("If") . " "); fieldDropdown($recipies[$i]['field']); ! matchingDropdown($recipies[$i]['matching']); ! print(" <input type=text name=string size=10 value=\"$str\"> " . _("then") . " "); } print("<select name=action>\n"); |