Commit a0918854 authored by Marius Burkard's avatar Marius Burkard

- ported rspamd support

parent cb67fdf9
......@@ -151,4 +151,38 @@ UPDATE `web_domain` as d INNER JOIN `server` as s ON (s.server_id = d.server_id)
UPDATE `web_domain` SET `php` = 'php-fpm' WHERE `php` = 'hhvm';
UPDATE `web_domain` SET `php` = 'fast-cgi' WHERE `php` = 'cgi';
UPDATE `web_domain` SET `php` = 'mod' WHERE `php` = 'suphp';
\ No newline at end of file
UPDATE `web_domain` SET `php` = 'mod' WHERE `php` = 'suphp';
-- rspamd
ALTER TABLE `spamfilter_policy` ADD `rspamd_greylisting` ENUM('n','y') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'n' AFTER `policyd_greylist`;
ALTER TABLE `spamfilter_policy` ADD `rspamd_spam_greylisting_level` DECIMAL(5,2) NULL DEFAULT NULL AFTER `rspamd_greylisting`;
ALTER TABLE `spamfilter_policy` ADD `rspamd_spam_tag_level` DECIMAL(5,2) NULL DEFAULT NULL AFTER `rspamd_spam_greylisting_level`;
ALTER TABLE `spamfilter_policy` ADD `rspamd_spam_tag_method` ENUM('add_header','rewrite_subject') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'rewrite_subject' AFTER `rspamd_spam_tag_level`;
ALTER TABLE `spamfilter_policy` ADD `rspamd_spam_kill_level` DECIMAL(5,2) NULL DEFAULT NULL AFTER `rspamd_spam_tag_method`;
UPDATE `spamfilter_policy` SET `rspamd_greylisting` = 'y' WHERE id = 4;
UPDATE `spamfilter_policy` SET `rspamd_greylisting` = 'y' WHERE id = 5;
UPDATE `spamfilter_policy` SET `rspamd_greylisting` = 'y' WHERE id = 6;
UPDATE `spamfilter_policy` SET `rspamd_spam_greylisting_level` = '4.00';
UPDATE `spamfilter_policy` SET `rspamd_spam_greylisting_level` = '6.00' WHERE id = 1;
UPDATE `spamfilter_policy` SET `rspamd_spam_greylisting_level` = '999.00' WHERE id = 2;
UPDATE `spamfilter_policy` SET `rspamd_spam_greylisting_level` = '999.00' WHERE id = 3;
UPDATE `spamfilter_policy` SET `rspamd_spam_greylisting_level` = '2.00' WHERE id = 6;
UPDATE `spamfilter_policy` SET `rspamd_spam_greylisting_level` = '7.00' WHERE id = 7;
UPDATE `spamfilter_policy` SET `rspamd_spam_tag_level` = '6.00';
UPDATE `spamfilter_policy` SET `rspamd_spam_tag_level` = '8.00' WHERE id = 1;
UPDATE `spamfilter_policy` SET `rspamd_spam_tag_level` = '999.00' WHERE id = 2;
UPDATE `spamfilter_policy` SET `rspamd_spam_tag_level` = '999.00' WHERE id = 3;
UPDATE `spamfilter_policy` SET `rspamd_spam_tag_level` = '4.00' WHERE id = 6;
UPDATE `spamfilter_policy` SET `rspamd_spam_tag_level` = '10.00' WHERE id = 7;
UPDATE `spamfilter_policy` SET `rspamd_spam_kill_level` = '10.00';
UPDATE `spamfilter_policy` SET `rspamd_spam_kill_level` = '12.00' WHERE id = 1;
UPDATE `spamfilter_policy` SET `rspamd_spam_kill_level` = '999.00' WHERE id = 2;
UPDATE `spamfilter_policy` SET `rspamd_spam_kill_level` = '999.00' WHERE id = 3;
UPDATE `spamfilter_policy` SET `rspamd_spam_kill_level` = '8.00' WHERE id = 6;
UPDATE `spamfilter_policy` SET `rspamd_spam_kill_level` = '20.00' WHERE id = 7;
-- end of rspamd
This diff is collapsed.
#
# Import variables
#
LOGNAME=tolower("$LOGNAME")
EXTENSION="$1"
RECIPIENT=tolower("$2")
USER=tolower("$3")
HOST=tolower("$4")
SENDER="$5"
DEFAULT="{dist_postfix_vmail_mailbox_base}/$HOST/$USER/."
# Workaround for broken tolower function in some current fedora releases
if(!$USER)
{
USER=$3
}
if(!$HOST)
{
HOST=$4
}
if ( "$EXTENSION" ne "" )
{
DELIMITER="+"
}
if (!$SENDER)
{
SENDER = "<>"
}
#
# Autocreate maildir, if not existant
#
#`test -e {dist_postfix_vmail_mailbox_base}/$HOST`
#if ( $RETURNCODE != 0 )
#{
# `mkdir {dist_postfix_vmail_mailbox_base}/$HOST`
#}
#`test -e {dist_postfix_vmail_mailbox_base}/$HOST/$USER`
#if ( $RETURNCODE != 0 )
#{
# `maildirmake {dist_postfix_vmail_mailbox_base}/$HOST/$USER`
# `chmod -R 0700 {dist_postfix_vmail_mailbox_base}/$HOST`
#}
# Check if the user has a autoresponder enabled
`test -f {dist_postfix_vmail_mailbox_base}/mailfilters/$HOST/$USER/.autoresponder`
if ( $RETURNCODE == 0 )
{
include "{dist_postfix_vmail_mailbox_base}/mailfilters/$HOST/$USER/.autoresponder"
}
# Create a mailsize file
`test -e {dist_postfix_vmail_mailbox_base}/$HOST/$USER`
if ( $RETURNCODE == 0 )
{
`echo $SIZE >> {dist_postfix_vmail_mailbox_base}/$HOST/$USER/ispconfig_mailsize`
}
#
# Test if the user has his own maildrop include,
# if not available, check if $DEFAULT is set
# (newer maildrop get's that from the DB and updates
# it) and deliver or fail temporarily if not available
#
`test -f {dist_postfix_vmail_mailbox_base}/mailfilters/$HOST/$USER/.mailfilter`
if ( $RETURNCODE == 0 )
{
include "{dist_postfix_vmail_mailbox_base}/mailfilters/$HOST/$USER/.mailfilter"
}
else
{
if ( "$DEFAULT" ne "" )
{
to "$DEFAULT"
}
else
{
EXITCODE=75
exit
}
}
\ No newline at end of file
......@@ -38,6 +38,8 @@ homedir_path=/var/vmail
maildir_format=maildir
dkim_path=/var/lib/amavis/dkim
dkim_strength=1024
content_filter=rspamd
rspamd_password=
mailuser_uid=5000
mailuser_gid=5000
mailuser_name=vmail
......
......@@ -331,7 +331,12 @@ $form["tabs"]['server'] = array(
),
'value' => '',
'width' => '40',
'maxlength' => '255'
'maxlength' => '255',
'filters' => array( 0 => array(
'event' => 'SAVE',
'type' => 'TRIM'
),
)
),
'monit_user' => array(
'datatype' => 'VARCHAR',
......@@ -345,7 +350,12 @@ $form["tabs"]['server'] = array(
'default' => '',
'value' => '',
'width' => '40',
'maxlength' => '255'
'maxlength' => '255',
'filters' => array( 0 => array(
'event' => 'SAVE',
'type' => 'TRIM'
),
)
),
'monit_password' => array(
'datatype' => 'VARCHAR',
......@@ -353,7 +363,12 @@ $form["tabs"]['server'] = array(
'default' => '',
'value' => '',
'width' => '40',
'maxlength' => '255'
'maxlength' => '255',
'filters' => array( 0 => array(
'event' => 'SAVE',
'type' => 'TRIM'
),
)
),
'munin_url' => array(
'datatype' => 'VARCHAR',
......@@ -365,7 +380,12 @@ $form["tabs"]['server'] = array(
),
'value' => '',
'width' => '40',
'maxlength' => '255'
'maxlength' => '255',
'filters' => array( 0 => array(
'event' => 'SAVE',
'type' => 'TRIM'
),
)
),
'munin_user' => array(
'datatype' => 'VARCHAR',
......@@ -379,7 +399,12 @@ $form["tabs"]['server'] = array(
'default' => '',
'value' => '',
'width' => '40',
'maxlength' => '255'
'maxlength' => '255',
'filters' => array( 0 => array(
'event' => 'SAVE',
'type' => 'TRIM'
),
)
),
'munin_password' => array(
'datatype' => 'VARCHAR',
......@@ -387,7 +412,12 @@ $form["tabs"]['server'] = array(
'default' => '',
'value' => '',
'width' => '40',
'maxlength' => '255'
'maxlength' => '255',
'filters' => array( 0 => array(
'event' => 'SAVE',
'type' => 'TRIM'
),
)
),
'nagios_url' => array(
'datatype' => 'VARCHAR',
......@@ -399,7 +429,12 @@ $form["tabs"]['server'] = array(
),
'value' => '',
'width' => '40',
'maxlength' => '255'
'maxlength' => '255',
'filters' => array( 0 => array(
'event' => 'SAVE',
'type' => 'TRIM'
),
)
),
'nagios_user' => array(
'datatype' => 'VARCHAR',
......@@ -407,7 +442,12 @@ $form["tabs"]['server'] = array(
'default' => '',
'value' => '',
'width' => '40',
'maxlength' => '255'
'maxlength' => '255',
'filters' => array( 0 => array(
'event' => 'SAVE',
'type' => 'TRIM'
),
)
),
'nagios_password' => array(
'datatype' => 'VARCHAR',
......@@ -415,7 +455,12 @@ $form["tabs"]['server'] = array(
'default' => '',
'value' => '',
'width' => '40',
'maxlength' => '255'
'maxlength' => '255',
'filters' => array( 0 => array(
'event' => 'SAVE',
'type' => 'TRIM'
),
)
),
'monitor_system_updates' => array(
'datatype' => 'VARCHAR',
......@@ -494,6 +539,23 @@ $form["tabs"]['mail'] = array(
'width' => '40',
'maxlength' => '255'
),
'content_filter' => array(
'datatype' => 'VARCHAR',
'formtype' => 'SELECT',
'default' => 'rspamd',
'value' => array('amavisd' => 'Amavisd', 'rspamd' => 'Rspamd')
),
'rspamd_password' => array(
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'default' => '',
'value' => '',
'width' => '40',
'maxlength' => '255',
'filters' => array( 0 => array( 'event' => 'SAVE',
'type' => 'TRIM'),
),
),
'dkim_path' => array(
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
......
......@@ -299,4 +299,7 @@ $wb['log_retention_txt'] = 'Log retention (days)';
$wb['log_retention_error_ispositive'] = 'Log retention must be a number > 0';
$wb['php_default_name_txt'] = 'Beschreibung Standard PHP';
$wb['php_default_name_error_empty'] = 'Beschreibung Standard PHP ist leer.';
?>
$wb['content_filter_txt'] = 'Content-Filter';
$wb['rspamd_url_txt'] = 'Rspamd-URL';
$wb['rspamd_user_txt'] = 'Rspamd-Benutzer';
$wb['rspamd_password_txt'] = 'Rspamd-Passwort';
\ No newline at end of file
......@@ -301,4 +301,8 @@ $wb['log_retention_txt'] = 'Log retention (days)';
$wb['log_retention_error_ispositive'] = 'Log retention must be a number > 0';
$wb['php_default_name_txt'] = 'Description Default PHP-Version';
$wb['php_default_name_error_empty'] = 'Description Default PHP-Version must not be empty';
?>
$wb['content_filter_txt'] = 'Content Filter';
$wb['rspamd_url_txt'] = 'Rspamd URL';
$wb['rspamd_user_txt'] = 'Rspamd User';
$wb['rspamd_password_txt'] = 'Rspamd Password';
......@@ -52,6 +52,21 @@ $app->load('tform_actions');
class page_action extends tform_actions {
function onShow() {
global $app, $conf;
// get the config
$app->uses('getconf');
$web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
if($web_config['server_type'] == 'nginx'){
unset($app->tform->formDef["tabs"]["fastcgi"]);
unset($app->tform->formDef["tabs"]["vlogger"]);
}
parent::onShow();
}
function onShowEdit() {
global $app, $conf;
......@@ -64,11 +79,17 @@ class page_action extends tform_actions {
$server_id = $this->id;
$this->dataRecord = $app->getconf->get_server_config($server_id, $section);
if($section == 'mail'){
$server_config = $app->getconf->get_server_config($server_id, 'server');
$rspamd_url = 'https://'.$server_config['hostname'].':8081/rspamd/';
}
}
$record = $app->tform->getHTML($this->dataRecord, $this->active_tab, 'EDIT');
$record['id'] = $this->id;
if(isset($rspamd_url)) $record['rspamd_url'] = $rspamd_url;
$app->tpl->setVar($record);
}
......@@ -112,6 +133,49 @@ class page_action extends tform_actions {
}
}
function onAfterUpdate() {
global $app;
if(isset($this->dataRecord['content_filter'])){
$app->uses('ini_parser');
$old_config = $app->ini_parser->parse_ini_string(stripslashes($this->oldDataRecord['config']));
if($this->dataRecord['content_filter'] == 'rspamd' && $old_config['mail']['content_filter'] != $this->dataRecord['content_filter']){
$spamfilter_users = $app->db->queryAllRecords("SELECT * FROM spamfilter_users WHERE server_id = ?", intval($this->id));
if(is_array($spamfilter_users) && !empty($spamfilter_users)){
foreach($spamfilter_users as $spamfilter_user){
$app->db->datalogUpdate('spamfilter_users', $spamfilter_user, 'id', $spamfilter_user["id"], true);
}
}
$spamfilter_wblists = $app->db->queryAllRecords("SELECT * FROM spamfilter_wblist WHERE server_id = ?", intval($this->id));
if(is_array($spamfilter_wblists) && !empty($spamfilter_wblists)){
foreach($spamfilter_wblists as $spamfilter_wblist){
$app->db->datalogUpdate('spamfilter_wblist', $spamfilter_wblist, 'wblist_id', $spamfilter_wblist["wblist_id"], true);
}
}
$mail_users = $app->db->queryAllRecords("SELECT * FROM mail_user WHERE server_id = ? AND (autoresponder = 'y' OR move_junk = 'y')", intval($this->id));
if(is_array($mail_users) && !empty($mail_users)){
foreach($mail_users as $mail_user){
if($mail_user['autoresponder'] == 'y'){
$mail_user['autoresponder'] = 'n';
$app->db->datalogUpdate('mail_user', $mail_user, 'mailuser_id', $mail_user["mailuser_id"], true);
$mail_user['autoresponder'] = 'y';
$app->db->datalogUpdate('mail_user', $mail_user, 'mailuser_id', $mail_user["mailuser_id"], true);
} else {
$mail_user['move_junk'] = 'n';
$app->db->datalogUpdate('mail_user', $mail_user, 'mailuser_id', $mail_user["mailuser_id"], true);
$mail_user['move_junk'] = 'y';
$app->db->datalogUpdate('mail_user', $mail_user, 'mailuser_id', $mail_user["mailuser_id"], true);
}
}
}
}
}
}
}
$app->tform_actions = new page_action;
......
......@@ -32,6 +32,20 @@
{tmpl_var name='dkim_strength'}
</select></div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">{tmpl_var name='content_filter_txt'}</label>
<div class="col-sm-9"><select name="content_filter" id="content_filter" class="form-control">
{tmpl_var name='content_filter'}
</select></div>
</div>
<div class="form-group rspamd">
<label for="rspamd_url" class="col-sm-3 control-label col-text">{tmpl_var name='rspamd_url_txt'}</label>
<div class="col-sm-6"><a href="{tmpl_var name='rspamd_url'}" target="_blank">{tmpl_var name='rspamd_url'}</a><a href="{tmpl_var name='rspamd_url'}" target="_blank" class="btn btn-default formbutton-default formbutton-narrow" style="margin-left:20px"><span class="icon icon-link"></span></a></div>
</div>
<div class="form-group rspamd">
<label for="rspamd_password" class="col-sm-3 control-label">{tmpl_var name='rspamd_password_txt'}</label>
<div class="col-sm-9"><input type="text" name="rspamd_password" id="rspamd_password" value="{tmpl_var name='rspamd_password'}" class="form-control" /></div>
</div>
<div class="form-group">
<label for="mailuser_uid" class="col-sm-3 control-label">{tmpl_var name='mailuser_uid_txt'}</label>
<div class="col-sm-9"><input type="text" name="mailuser_uid" id="mailuser_uid" value="{tmpl_var name='mailuser_uid'}" class="form-control" /></div></div>
......@@ -119,3 +133,24 @@
<button class="btn btn-default formbutton-success" type="button" value="{tmpl_var name='btn_save_txt'}" data-submit-form="pageForm" data-form-action="admin/server_config_edit.php">{tmpl_var name='btn_save_txt'}</button>
<button class="btn btn-default formbutton-default" type="button" value="{tmpl_var name='btn_cancel_txt'}" data-load-content="admin/server_config_list.php">{tmpl_var name='btn_cancel_txt'}</button>
</div></div>
<script>
if($('#rspamd_password').val() == ''){
var pword = password(8, false, 1);
jQuery('#rspamd_password').val(pword);
}
if($('#content_filter').val() === 'rspamd'){
$('.rspamd').show();
} else {
$('.rspamd').hide();
}
$('#content_filter').change(function(){
if($(this).val() === 'rspamd'){
$('.rspamd').show();
} else {
$('.rspamd').hide();
}
});
</script>
......@@ -216,6 +216,42 @@ $form["tabs"]['quarantine'] = array (
'width' => '30',
'maxlength' => '255'
),
'rspamd_greylisting' => array (
'datatype' => 'VARCHAR',
'formtype' => 'CHECKBOX',
'default' => 'y',
'value' => array(0 => 'n', 1 => 'y')
),
'rspamd_spam_greylisting_level' => array (
'datatype' => 'DOUBLE',
'formtype' => 'TEXT',
'default' => '0',
'value' => '',
'width' => '10',
'maxlength' => '255'
),
'rspamd_spam_tag_level' => array (
'datatype' => 'DOUBLE',
'formtype' => 'TEXT',
'default' => '0',
'value' => '',
'width' => '10',
'maxlength' => '255'
),
'rspamd_spam_tag_method' => array (
'datatype' => 'VARCHAR',
'formtype' => 'SELECT',
'default' => 'rewrite_subject',
'value' => array('add_header' => $app->lng('add_header_txt'), 'rewrite_subject' => $app->lng('rewrite_subject_txt'))
),
'rspamd_spam_kill_level' => array (
'datatype' => 'DOUBLE',
'formtype' => 'TEXT',
'default' => '0',
'value' => '',
'width' => '10',
'maxlength' => '255'
),
//#################################
// ENDE Datatable fields
//#################################
......
......@@ -45,4 +45,6 @@ $wb['Global Filters'] = 'Globale Filter';
$wb['Domain Alias'] = 'E-Mail Domain Alias';
$wb['Relay Recipients'] = 'Relay Empfänger';
$wb['Mailbox quota'] = 'E-Mail Konto Speichernutzung';
?>
$wb['add_header_txt'] = 'Header (fügt "X-Spam: Yes" hinzu)';
$wb['rewrite_subject_txt'] = 'Betreff (fügt "***SPAM***" am Anfang hinzu)';
......@@ -35,4 +35,11 @@ $wb['bad_header_admin_txt'] = 'Bad Header Administrator';
$wb['spam_admin_txt'] = 'SPAM Administrator';
$wb['message_size_limit_txt'] = 'Nachrichtengrößen Limit';
$wb['banned_rulenames_txt'] = 'Banned Richtliniennamen';
?>
$wb['rspamd_greylisting_txt'] = 'Greylisting nutzen';
$wb['rspamd_spam_greylisting_level_txt'] = 'Greylisting-Level';
$wb['rspamd_spam_tag_level_txt'] = 'SPAM-Markierungslevel';
$wb['rspamd_spam_tag_method_txt'] = 'SPAM-Markierungsmethode';
$wb['rspamd_spam_kill_level_txt'] = 'SPAM-Reject-Level';
$wb['btn_save_txt'] = 'Speichern';
$wb['btn_cancel_txt'] = 'Abbrechen';
......@@ -45,4 +45,5 @@ $wb['Global Filters'] = 'Global Filters';
$wb['Domain Alias'] = 'Domain Alias';
$wb["Relay Recipients"] = 'Relay Recipients';
$wb['Mailbox quota'] = 'Mailbox quota';
?>
$wb['add_header_txt'] = 'Header (adds "X-Spam: Yes")';
$wb['rewrite_subject_txt'] = 'Subject (adds "***SPAM***" at the beginning)';
......@@ -35,4 +35,11 @@ $wb["bad_header_admin_txt"] = 'Bad header admin';
$wb["spam_admin_txt"] = 'SPAM admin';
$wb["message_size_limit_txt"] = 'Message size limit';
$wb["banned_rulenames_txt"] = 'Banned rulenames';
?>
$wb['rspamd_greylisting_txt'] = 'Use greylisting';
$wb['rspamd_spam_greylisting_level_txt'] = 'Greylisting level';
$wb['rspamd_spam_tag_level_txt'] = 'SPAM tag level';
$wb['rspamd_spam_tag_method_txt'] = 'SPAM tag method';
$wb['rspamd_spam_kill_level_txt'] = 'SPAM reject level';
$wb['btn_save_txt'] = 'Save';
$wb['btn_cancel_txt'] = 'Cancel';
?>
\ No newline at end of file
......@@ -273,7 +273,10 @@ class page_action extends tform_actions {
}
//* make sure that the email domain is lowercase
if(isset($this->dataRecord["domain"])) $this->dataRecord["domain"] = strtolower($this->dataRecord["domain"]);
if(isset($this->dataRecord["domain"])){
$this->dataRecord["domain"] = $app->functions->idn_encode($this->dataRecord["domain"]);
$this->dataRecord["domain"] = strtolower($this->dataRecord["domain"]);
}
parent::onSubmit();
......
......@@ -295,7 +295,7 @@ class page_action extends tform_actions {
"priority" => 10,
"policy_id" => $policy_id,
"email" => $this->dataRecord["email"],
"fullname" => $this->dataRecord["email"],
"fullname" => $app->functions->idn_decode($this->dataRecord["email"]),
"local" => 'Y'
);
$app->db->datalogInsert('spamfilter_users', $insert_data, 'id');
......@@ -342,7 +342,7 @@ class page_action extends tform_actions {
"priority" => 10,
"policy_id" => $policy_id,
"email" => $this->dataRecord["email"],
"fullname" => $this->dataRecord["email"],
"fullname" => $app->functions->idn_decode($this->dataRecord["email"]),
"local" => 'Y'
);
$app->db->datalogInsert('spamfilter_users', $insert_data, 'id');
......
......@@ -49,6 +49,46 @@ $app->uses('tpl,tform,tform_actions');
$app->load('tform_actions');
class page_action extends tform_actions {
function onShow() {
global $app, $conf;
// get the config
$app->uses('getconf');
$mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail');
$content_filter = 'amavisd';
if($mail_config['content_filter'] == 'rspamd'){
$content_filter = 'rspamd';
unset($app->tform->formDef["tabs"]["policy"]['fields']['banned_files_lover']);
unset($app->tform->formDef["tabs"]["policy"]['fields']['bad_header_lover']);
unset($app->tform->formDef["tabs"]["policy"]['fields']['bypass_virus_checks']);
unset($app->tform->formDef["tabs"]["policy"]['fields']['bypass_banned_checks']);
unset($app->tform->formDef["tabs"]["policy"]['fields']['bypass_header_checks']);
unset($app->tform->formDef["tabs"]["taglevel"]['fields']['spam_tag_level']);
unset($app->tform->formDef["tabs"]["taglevel"]['fields']['spam_tag2_level']);
unset($app->tform->formDef["tabs"]["taglevel"]['fields']['spam_kill_level']);
unset($app->tform->formDef["tabs"]["taglevel"]['fields']['spam_dsn_cutoff_level']);
unset($app->tform->formDef["tabs"]["taglevel"]['fields']['spam_quarantine_cutoff_level']);
unset($app->tform->formDef["tabs"]["taglevel"]['fields']['spam_modifies_subj']);
unset($app->tform->formDef["tabs"]["taglevel"]['fields']['spam_subject_tag']);
unset($app->tform->formDef["tabs"]["taglevel"]['fields']['spam_subject_tag2']);
unset($app->tform->formDef["tabs"]["quarantine"]);
unset($app->tform->formDef["tabs"]["other"]);
} else {
unset($app->tform->formDef["tabs"]["taglevel"]['fields']['rspamd_greylisting']);
unset($app->tform->formDef["tabs"]["taglevel"]['fields']['rspamd_spam_greylisting_level']);
unset($app->tform->formDef["tabs"]["taglevel"]['fields']['rspamd_spam_tag_level']);
unset($app->tform->formDef["tabs"]["taglevel"]['fields']['rspamd_spam_tag_method']);
unset($app->tform->formDef["tabs"]["taglevel"]['fields']['rspamd_spam_kill_level']);
}
$app->tpl->setVar("content_filter", $content_filter);
parent::onShow();
}
function onShowNew() {
global $app, $conf;
......@@ -86,11 +126,37 @@ class page_action extends tform_actions {
parent::onSubmit();
}
function onAfterUpdate() {
global $app, $conf;
$app->uses('getconf');
$mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail');
if($mail_config['content_filter'] == 'rspamd'){
$record_has_changed = false;
if(isset($this->dataRecord['rspamd_spam_greylisting_level']) && !isset($this->dataRecord['rspamd_greylisting'])) $this->dataRecord['rspamd_greylisting'] = 'n';
foreach($this->dataRecord as $key => $val) {
if(isset($this->oldDataRecord[$key]) && @$this->oldDataRecord[$key] != $val) {
// Record has changed
$record_has_changed = true;
}
}
if($record_has_changed){
$spamfilter_users = $app->db->queryAllRecords("SELECT * FROM spamfilter_users WHERE policy_id = ?", intval($this->id));
if(is_array($spamfilter_users) && !empty($spamfilter_users)){
foreach($spamfilter_users as $spamfilter_user){
$app->db->datalogUpdate('spamfilter_users', $spamfilter_user, 'id', $spamfilter_user["id"], true);
}
}
}
}
}
}
$app->tform_actions = new page_action;
$app->tform_actions->onLoad();
?>
?>
\ No newline at end of file
......@@ -16,9 +16,28 @@ $list_def_file = "list/spamfilter_policy.list.php";
$app->auth->check_module_permissions('mail');
$app->uses('listform_actions');
//$app->listform_actions->SQLExtWhere = "wb = 'W'";
$app->listform_actions->onLoad();
?>
class list_action extends listform_actions {
function onShow() {
global $app, $conf;
// get the config
$app->uses('getconf');
$mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail');
$content_filter = 'amavisd';
if($mail_config['content_filter'] == 'rspamd'){
$content_filter = 'rspamd';
}
$app->tpl->setVar("content_filter", $content_filter);
parent::onShow();
}
}
$list = new list_action;
//$list->SQLExtWhere = "wb = 'W'";
$list->onLoad();
?>
\ No newline at end of file
......@@ -20,6 +20,7 @@
{tmpl_var name='spam_lover'}
</select></div>
</div>
<tmpl_if name='content_filter' op='==' value='amavisd'>
<div class="form-group">
<label for="banned_files_lover" class="col-sm-3 control-label">{tmpl_var name='banned_files_lover_txt'}</label>
<div class="col-sm-9"><select name="banned_files_lover" id="banned_files_lover" class="form-control">