*
* Licensed under the GNU GPL. For full terms see the file COPYING that came
* with the Squirrelmail distribution.
*
* $Id: addspamrule.php,v 1.6 2004/05/12 14:16:09 avel Exp $
*/
/**
* Wizard-like form for adding new spam rule.
*/
define('SM_PATH','../../');
require_once(SM_PATH . 'include/validate.php');
require_once(SM_PATH . 'include/load_prefs.php');
require_once(SM_PATH . 'functions/page_header.php');
require_once(SM_PATH . 'functions/imap.php');
include "config.php";
require_once "avelsieve_support.inc.php";
require_once "table_html.php";
require_once "addrule_html.php";
require_once "buildrule.php";
require_once "sieve.php";
sqsession_is_active();
if(isset($_POST['cancel'])) {
header("Location: ./table.php");
exit;
}
if(isset($_GET['edit'])) {
$edit = $_GET['edit'];
} elseif(isset($_POST['edit'])) {
$edit = $_POST['edit'];
}
if(isset($edit)) {
/* Have this handy: type of current rule */
$type = $_SESSION['rules'][$edit]['type'];
/* and the rule itself */
$rule = $_SESSION['rules'][$edit];
if($type != 10) {
header("Location: edit.php?edit=$edit");
}
if(isset($_GET['dup'])) {
$dup = true;
}
}
if(isset($_POST['spamrule_advanced'])) {
$spamrule_advanced = true;
} elseif (isset($edit) && isset($rule['advanced'])) {
$spamrule_advanced = true;
} else {
$spamrule_advanced = false;
}
$spamrule = true;
global $spamrule;
/* Spam Rule variables */
/* If we need to get spamrule RBLs from LDAP, then do so now. */
if(isset($_SESSION['spamrule_rbls'])) {
$spamrule_rbls = $_SESSION['spamrule_rbls'];
} elseif(isset($spamrule_tests_ldap) && $spamrule_tests_ldap == true &&
!isset($_SESSION['spamrule_rbls'])) {
include_once('spamrulefunctions.php');
$spamrule_rbls = avelsieve_askldapforrbls();
$_SESSION['spamrule_rbls'] = $spamrule_rbls;
}
if(isset($_POST['tests'])) {
$tests = $_POST['tests'];
} elseif (isset($edit) && isset($rule['tests'])) {
$tests = $rule['tests'];
} else {
$tests = array_keys($spamrule_tests);
}
if(isset($_POST['score'])) {
$score = $_POST['score'];
} elseif (isset($edit) && isset($rule['score'])) {
$score = $rule['score'];
} else {
$score = $spamrule_score_default;
}
if(isset($_POST['whitelist_add']) || isset($_POST['whitelistvalue'])) {
$j=0;
for($i=0; $i
'. sprintf( _("Select %s to add the predefined rule, or select the advanced SPAM filter to customize the rule."), '' . _("Add Spam Rule") . '' ) . '
'; print ''; } else { /* include_once(SM_PATH . 'plugins/filters/filters.php'); $spamfilters = load_spam_filters(); */ print ''; print '
'. sprintf( _("Messages with SPAM-Score higher than the target value, the maximum value being %s, will be considered SPAM.") , $spamrule_score_max ) . '
';
print _("Target Score") . ':
';
/**
* Print RBLs that are available in this system.
* 1) Check for RBLs in LDAP Sendmail configuration
* 2) Use RBLs supplied in config.php
*/
if(isset($spamrule_rbls)) {
/* from LDAP */
foreach($spamrule_rbls as $no=>$info) {
print ' ';
print '
';
}
} elseif(isset($spamrule_tests)) {
/* from config.php */
foreach($spamrule_tests as $st=>$txt) {
print ' ';
print '
';
}
/* TODO: Import spamrule_filters from Filters plugin */
/*
} elseif(isset($spamrule_filters)) {
foreach($spamrule_filters as $st=>$fi) {
print ' ';
print '
';
}
*/
}
print '
'. _("Messages that match any of these header rules will never end up in Junk Folders or regarded as SPAM.") . '
'; print '';
$i=0;
if(isset($whitelist) && sizeof($whitelist) >0 ){
for($i =0; $i
';
}
}
print_header_listbox('From', $i);
print_matchtype_listbox('', $i, 'whitelistmatch');
print '';
print '
';
print '';
print '