aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/spamd/spamd.inc19
-rw-r--r--config/spamd/spamd_whitelist.xml21
2 files changed, 20 insertions, 20 deletions
diff --git a/config/spamd/spamd.inc b/config/spamd/spamd.inc
index 256ec08b..18b4e241 100644
--- a/config/spamd/spamd.inc
+++ b/config/spamd/spamd.inc
@@ -165,6 +165,25 @@ function sync_package_spamd() {
log_error("SpamD setup completed");
}
+function sync_package_spamd_whitelist() {
+ global $config;
+ conf_mount_rw();
+ config_lock();
+ /* write out ip to the whitelist db */
+ $fd = fopen("/var/db/whitelist.txt","w");
+ if($config['installedpackages']['spamdwhitelist']['config'] != "") {
+ foreach($config['installedpackages']['spamdwhitelist']['config'] as $spamd) {
+ fwrite($fd, $spamd['ip'] . "\n");
+ }
+ }
+ fclose($fd);
+ /* signal a reload of all files */
+ mwexec("/usr/bin/killall -HUP spamlogd");
+ mwexec("/sbin/pfctl -t spamd-white -T add {$spamd['ip']}");
+ conf_mount_ro();
+ config_unlock();
+}
+
function spamd_generate_rules($type) {
global $config;
diff --git a/config/spamd/spamd_whitelist.xml b/config/spamd/spamd_whitelist.xml
index f7b3f4fe..8a916fb7 100644
--- a/config/spamd/spamd_whitelist.xml
+++ b/config/spamd/spamd_whitelist.xml
@@ -48,6 +48,7 @@
<name>spamd-whitelist</name>
<version>0.1.0</version>
<title>SpamD: Whitelist</title>
+ <include_file>/usr/local/pkg/spamd.inc</include_file>
<!-- Menu is where this packages menu will appear -->
<menu>
<name>SpamD Whitelist</name>
@@ -103,26 +104,6 @@
<type>input</type>
</field>
</fields>
- <custom_php_command_before_form>
- function sync_package_spamd_whitelist() {
- global $config;
- conf_mount_rw();
- config_lock();
- /* write out ip to the whitelist db */
- $fd = fopen("/var/db/whitelist.txt","w");
- if($config['installedpackages']['spamdwhitelist']['config'] != "") {
- foreach($config['installedpackages']['spamdwhitelist']['config'] as $spamd) {
- fwrite($fd, $spamd['ip'] . "\n");
- }
- }
- fclose($fd);
- /* signal a reload of all files */
- mwexec("/usr/bin/killall -HUP spamlogd");
- mwexec("/sbin/pfctl -t spamd-white -T add {$spamd['ip']}");
- conf_mount_ro();
- config_unlock();
- }
- </custom_php_command_before_form>
<custom_delete_php_command>
sync_package_spamd_whitelist();
</custom_delete_php_command>