Optionally enable spam filter for forwarding hosts

This commit is contained in:
Michael Kuron
2017-05-07 08:50:28 +02:00
parent 8c8bfc0108
commit ae6d7d63fc
6 changed files with 60 additions and 13 deletions

View File

@@ -31,19 +31,52 @@ catch (PDOException $e) {
?>
settings {
<?php
/*
// Start whitelist for forwarding hosts
*/
<?php
try {
$stmt = $pdo->query("SELECT `host` FROM `forwarding_hosts`");
$stmt = $pdo->query("SELECT `host` FROM `forwarding_hosts` WHERE `filter_spam` = 1");
$rows = $stmt->fetchAll(PDO::FETCH_COLUMN);
}
catch (PDOException $e) {
$rows = array();
}
if (!empty($rows)) {
?>
whitelist_forwarding_hosts_with_spam_filter {
priority = high;
<?php
foreach ($rows as $host):
?>
ip = "<?=$host;?>";
<?php
endforeach;
?>
apply "default" {
actions {
reject = 999.9;
greylist = 999.8;
}
}
symbols [
"WHITELIST_FORWARDING_HOST"
]
}
<?php
}
try {
$stmt = $pdo->query("SELECT `host` FROM `forwarding_hosts` WHERE `filter_spam` = 0");
$rows = $stmt->fetchAll(PDO::FETCH_COLUMN);
}
catch (PDOException $e) {
$rows = array();
}
if (!empty($rows)) {
?>
whitelist_forwarding_hosts {