diff --git a/data/conf/rspamd/dynmaps/settings.php b/data/conf/rspamd/dynmaps/settings.php index edd069d5..e6a7923b 100644 --- a/data/conf/rspamd/dynmaps/settings.php +++ b/data/conf/rspamd/dynmaps/settings.php @@ -80,15 +80,15 @@ function ucl_rcpts($object, $type) { } elseif ($type == 'domain') { // Domain self - $rcpt[] = '/.*@' . $object . '/i'; - $stmt = $pdo->prepare("SELECT `alias_domain` FROM `alias_domain` - WHERE `target_domain` = :object"); - $stmt->execute(array(':object' => $object)); - $alias_domains = $stmt->fetchAll(PDO::FETCH_ASSOC); - array_filter($alias_domains); - while ($row = array_shift($alias_domains)) { + $rcpt[] = '/.*@' . $object . '/i'; + $stmt = $pdo->prepare("SELECT `alias_domain` FROM `alias_domain` + WHERE `target_domain` = :object"); + $stmt->execute(array(':object' => $object)); + $alias_domains = $stmt->fetchAll(PDO::FETCH_ASSOC); + array_filter($alias_domains); + while ($row = array_shift($alias_domains)) { $rcpt[] = '/.*@' . $row['alias_domain'] . '/i'; - } + } } if (!empty($rcpt)) { return $rcpt; @@ -97,18 +97,18 @@ function ucl_rcpts($object, $type) { } ?> settings { - watchdog { - priority = 10; - rcpt = "/null@localhost/i"; - from = "/watchdog@localhost/i"; - apply "default" { - actions { - reject = 9999.0; - greylist = 9998.0; - "add header" = 9997.0; - } - } - } + watchdog { + priority = 10; + rcpt = "/null@localhost/i"; + from = "/watchdog@localhost/i"; + apply "default" { + actions { + reject = 9999.0; + greylist = 9998.0; + "add header" = 9997.0; + } + } + } query("SELECT DISTINCT `object` FROM `filterconf` WHERE `option` = $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); while ($row = array_shift($rows)) { - $username_sane = preg_replace("/[^a-zA-Z0-9]+/", "", $row['object']); + $username_sane = preg_replace("/[^a-zA-Z0-9]+/", "", $row['object']); ?> - score_ { - priority = 4; + score_ { + priority = 4; - rcpt = ; + rcpt = ; prepare("SELECT `option`, `value` FROM `filterconf` - WHERE (`option` = 'highspamlevel' OR `option` = 'lowspamlevel') - AND `object`= :object"); - $stmt->execute(array(':object' => $row['object'])); - $spamscore = $stmt->fetchAll(PDO::FETCH_COLUMN|PDO::FETCH_GROUP); + $stmt = $pdo->prepare("SELECT `option`, `value` FROM `filterconf` + WHERE (`option` = 'highspamlevel' OR `option` = 'lowspamlevel') + AND `object`= :object"); + $stmt->execute(array(':object' => $row['object'])); + $spamscore = $stmt->fetchAll(PDO::FETCH_COLUMN|PDO::FETCH_GROUP); ?> - apply "default" { - actions { - reject = ; - greylist = ; - "add header" = ; - } - } - } + apply "default" { + actions { + reject = ; + greylist = ; + "add header" = ; + } + } + } query("SELECT DISTINCT `object` FROM `filterconf` WHERE `option` = 'whitelist_from'"); $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); while ($row = array_shift($rows)) { - $username_sane = preg_replace("/[^a-zA-Z0-9]+/", "", $row['object']); + $username_sane = preg_replace("/[^a-zA-Z0-9]+/", "", $row['object']); ?> - whitelist_ { + whitelist_ { prepare("SELECT GROUP_CONCAT(REPLACE(CONCAT('^', `value`, '$'), '*', '.*') SEPARATOR '|') AS `value` FROM `filterconf` - WHERE `object`= :object - AND `option` = 'whitelist_from'"); - $stmt->execute(array(':object' => $row['object'])); - $grouped_lists = $stmt->fetchAll(PDO::FETCH_COLUMN); - $value_sane = preg_replace("/\.\./", ".", (preg_replace("/\*/", ".*", $grouped_lists[0]))); + $stmt = $pdo->prepare("SELECT GROUP_CONCAT(REPLACE(CONCAT('^', `value`, '$'), '*', '.*') SEPARATOR '|') AS `value` FROM `filterconf` + WHERE `object`= :object + AND `option` = 'whitelist_from'"); + $stmt->execute(array(':object' => $row['object'])); + $grouped_lists = $stmt->fetchAll(PDO::FETCH_COLUMN); + $value_sane = preg_replace("/\.\./", ".", (preg_replace("/\*/", ".*", $grouped_lists[0]))); ?> - from = "/()/i"; + from = "/()/i"; - priority = 5; + priority = 5; - rcpt = ; + rcpt = ; - priority = 6; + priority = 6; - rcpt = ; + rcpt = ; - apply "default" { - MAILCOW_WHITE = -999.0; - } - symbols [ - "MAILCOW_WHITE" - ] - } - whitelist_header_ { + apply "default" { + MAILCOW_WHITE = -999.0; + } + symbols [ + "MAILCOW_WHITE" + ] + } + whitelist_header_ { prepare("SELECT GROUP_CONCAT(REPLACE(CONCAT('\<', `value`, '\>'), '*', '.*') SEPARATOR '|') AS `value` FROM `filterconf` - WHERE `object`= :object - AND `option` = 'whitelist_from'"); - $stmt->execute(array(':object' => $row['object'])); - $grouped_lists = $stmt->fetchAll(PDO::FETCH_COLUMN); - $value_sane = preg_replace("/\.\./", ".", (preg_replace("/\*/", ".*", $grouped_lists[0]))); + $stmt = $pdo->prepare("SELECT GROUP_CONCAT(REPLACE(CONCAT('\<', `value`, '\>'), '*', '.*') SEPARATOR '|') AS `value` FROM `filterconf` + WHERE `object`= :object + AND `option` = 'whitelist_from'"); + $stmt->execute(array(':object' => $row['object'])); + $grouped_lists = $stmt->fetchAll(PDO::FETCH_COLUMN); + $value_sane = preg_replace("/\.\./", ".", (preg_replace("/\*/", ".*", $grouped_lists[0]))); ?> - header = { - "From" = "/()/i"; - } + header = { + "From" = "/()/i"; + } - priority = 5; + priority = 5; - rcpt = ; + rcpt = ; - priority = 6; + priority = 6; - rcpt = ; + rcpt = ; - apply "default" { - MAILCOW_WHITE = -999.0; - } - symbols [ - "MAILCOW_WHITE" - ] - } + apply "default" { + MAILCOW_WHITE = -999.0; + } + symbols [ + "MAILCOW_WHITE" + ] + } query("SELECT DISTINCT `object` FROM `filterconf` WHERE `option` = 'blacklist_from'"); $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); while ($row = array_shift($rows)) { - $username_sane = preg_replace("/[^a-zA-Z0-9]+/", "", $row['object']); + $username_sane = preg_replace("/[^a-zA-Z0-9]+/", "", $row['object']); ?> - blacklist_ { + blacklist_ { prepare("SELECT GROUP_CONCAT(REPLACE(CONCAT('^', `value`, '$'), '*', '.*') SEPARATOR '|') AS `value` FROM `filterconf` - WHERE `object`= :object - AND `option` = 'blacklist_from'"); - $stmt->execute(array(':object' => $row['object'])); - $grouped_lists = $stmt->fetchAll(PDO::FETCH_COLUMN); - $value_sane = preg_replace("/\.\./", ".", (preg_replace("/\*/", ".*", $grouped_lists[0]))); + $stmt = $pdo->prepare("SELECT GROUP_CONCAT(REPLACE(CONCAT('^', `value`, '$'), '*', '.*') SEPARATOR '|') AS `value` FROM `filterconf` + WHERE `object`= :object + AND `option` = 'blacklist_from'"); + $stmt->execute(array(':object' => $row['object'])); + $grouped_lists = $stmt->fetchAll(PDO::FETCH_COLUMN); + $value_sane = preg_replace("/\.\./", ".", (preg_replace("/\*/", ".*", $grouped_lists[0]))); ?> - from = "/()/i"; + from = "/()/i"; - priority = 5; + priority = 5; - rcpt = ; + rcpt = ; - priority = 6; + priority = 6; - rcpt = ; + rcpt = ; - apply "default" { - MAILCOW_BLACK = 999.0; - } - symbols [ - "MAILCOW_BLACK" - ] - } - blacklist_header_ { + apply "default" { + MAILCOW_BLACK = 999.0; + } + symbols [ + "MAILCOW_BLACK" + ] + } + blacklist_header_ { prepare("SELECT GROUP_CONCAT(REPLACE(CONCAT('\<', `value`, '\>'), '*', '.*') SEPARATOR '|') AS `value` FROM `filterconf` - WHERE `object`= :object - AND `option` = 'blacklist_from'"); - $stmt->execute(array(':object' => $row['object'])); - $grouped_lists = $stmt->fetchAll(PDO::FETCH_COLUMN); - $value_sane = preg_replace("/\.\./", ".", (preg_replace("/\*/", ".*", $grouped_lists[0]))); + $stmt = $pdo->prepare("SELECT GROUP_CONCAT(REPLACE(CONCAT('\<', `value`, '\>'), '*', '.*') SEPARATOR '|') AS `value` FROM `filterconf` + WHERE `object`= :object + AND `option` = 'blacklist_from'"); + $stmt->execute(array(':object' => $row['object'])); + $grouped_lists = $stmt->fetchAll(PDO::FETCH_COLUMN); + $value_sane = preg_replace("/\.\./", ".", (preg_replace("/\*/", ".*", $grouped_lists[0]))); ?> - header = { - "From" = "/()/i"; - } + header = { + "From" = "/()/i"; + } - priority = 5; + priority = 5; - rcpt = ; + rcpt = ; - priority = 6; + priority = 6; - rcpt = ; + rcpt = ; - apply "default" { - MAILCOW_BLACK = 999.0; - } - symbols [ - "MAILCOW_BLACK" - ] - } + apply "default" { + MAILCOW_BLACK = 999.0; + } + symbols [ + "MAILCOW_BLACK" + ] + } query("SELECT `id`, `content` FROM `settingsmap` WHERE `active` = '1'"); +$rows = $stmt->fetchAll(PDO::FETCH_ASSOC); +while ($row = array_shift($rows)) { + $username_sane = preg_replace("/[^a-zA-Z0-9]+/", "", $row['id']); +?> + additional_settings_ { + }