[Web, Quarantine] Allow to set the max score of a message up to which a quarantine notification will be sent

This commit is contained in:
andryyy
2020-10-27 21:34:02 +01:00
parent 1cb4d59e84
commit 6c697f3f3f
5 changed files with 26 additions and 6 deletions

View File

@@ -821,6 +821,12 @@ if (!isset($_SESSION['gal']) && $license_cache = $redis->Get('LICENSE_STATUS_CAC
<input type="number" class="form-control" name="max_size" value="<?=$q_data['max_size'];?>" placeholder="0" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" for="max_score"><?=$lang['admin']['quarantine_max_score'];?></label>
<div class="col-sm-8">
<input type="number" class="form-control" name="max_score" value="<?=$q_data['max_score'];?>" placeholder="9999.0">
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" for="max_age"><?=$lang['admin']['quarantine_max_age'];?></label>
<div class="col-sm-8">

View File

@@ -299,6 +299,12 @@ function quarantine($_action, $_data = null) {
$release_format = 'raw';
}
$max_size = $_data['max_size'];
if ($_data['max_score'] == "") {
$max_score = '';
}
else {
$max_score = floatval($_data['max_score']);
}
$max_age = intval($_data['max_age']);
$subject = $_data['subject'];
if (!filter_var($_data['bcc'], FILTER_VALIDATE_EMAIL)) {
@@ -327,6 +333,7 @@ function quarantine($_action, $_data = null) {
try {
$redis->Set('Q_RETENTION_SIZE', intval($retention_size));
$redis->Set('Q_MAX_SIZE', intval($max_size));
$redis->Set('Q_MAX_SCORE', $max_score);
$redis->Set('Q_MAX_AGE', $max_age);
$redis->Set('Q_EXCLUDE_DOMAINS', json_encode($exclude_domains));
$redis->Set('Q_RELEASE_FORMAT', $release_format);
@@ -794,6 +801,7 @@ function quarantine($_action, $_data = null) {
$settings['exclude_domains'] = json_decode($redis->Get('Q_EXCLUDE_DOMAINS'), true);
}
$settings['max_size'] = $redis->Get('Q_MAX_SIZE');
$settings['max_score'] = $redis->Get('Q_MAX_SCORE');
$settings['max_age'] = $redis->Get('Q_MAX_AGE');
$settings['retention_size'] = $redis->Get('Q_RETENTION_SIZE');
$settings['release_format'] = $redis->Get('Q_RELEASE_FORMAT');

View File

@@ -226,6 +226,7 @@
"quarantine_exclude_domains": "Domains und Alias-Domains ausschließen",
"quarantine_max_age": "Maximales Alter in Tagen<br><small>Wert muss größer oder gleich 1 Tag sein.</small>",
"quarantine_max_size": "Maximale Größe in MiB (größere Elemente werden verworfen):<br><small>0 bedeutet <b>nicht</b> unlimitiert.</small>",
"quarantine_max_score": "Nicht benachrichtigen, wenn der Spam-Score höher ist als der folgende Wert:<br><small>Standardwert 9999.0</small>",
"quarantine_notification_html": "Benachrichtigungs-E-Mail Inhalt:<br><small>Leer lassen, um Standard-Template wiederherzustellen.</small>",
"quarantine_notification_sender": "Benachrichtigungs-E-Mail Absender",
"quarantine_notification_subject": "Benachrichtigungs-E-Mail Betreff",

View File

@@ -226,6 +226,7 @@
"quarantine_exclude_domains": "Exclude domains and alias-domains",
"quarantine_max_age": "Maximum age in days<br><small>Value must be equal to or greater than 1 day.</small>",
"quarantine_max_size": "Maximum size in MiB (larger elements are discarded):<br><small>0 does <b>not</b> indicate unlimited.</small>",
"quarantine_max_score": "Discard notification if spam score of a mail is higher than this value:<br><small>Defaults to 9999.0</small>",
"quarantine_notification_html": "Notification email template:<br><small>Leave empty to restore default template.</small>",
"quarantine_notification_sender": "Notification email sender",
"quarantine_notification_subject": "Notification email subject",