From 5717163bffb113333fba51c2775cb07564a5b081 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Wed, 8 Feb 2006 03:48:51 +0000 Subject: Add Outlook plugin config tab --- packages/spamd_db_ext.php | 137 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 packages/spamd_db_ext.php (limited to 'packages/spamd_db_ext.php') diff --git a/packages/spamd_db_ext.php b/packages/spamd_db_ext.php new file mode 100644 index 00000000..f94fc5b2 --- /dev/null +++ b/packages/spamd_db_ext.php @@ -0,0 +1,137 @@ + $username) { + echo "550. INVALID USERNAME {$username}."; + exit; + } + if($outlook['password'] <> $password) { + echo "550. INVALID PASSWORD {$password}."; + exit; + } +} + +/* handle AJAX operations */ +if($_GET['action'] or $_POST['action']) { + /* echo back buttonid so it can be turned + * back off when request is completed. + */ + echo $_GET['buttonid'] . "|"; + if($_GET['action']) + $action = $_GET['action']; + if($_POST['action']) + $action = $_POST['action']; + if($_GET['srcip']) + $srcip = $_GET['srcip']; + if($_POST['srcip']) + $srcip = $_POST['srcip']; + /* execute spamdb command */ + if($action == "whitelist") { + exec("/usr/local/sbin/spamdb -a {$srcip}"); + } else if($action == "delete") { + exec("/usr/local/sbin/spamdb -d {$srcip}"); + exec("/usr/local/sbin/spamdb -d -T \"<{$srcip}>\""); + exec("/usr/local/sbin/spamdb -d -t \"<{$srcip}>\""); + } else if($action == "spamtrap") { + exec("/usr/local/sbin/spamdb -a {$srcip} -T"); + } else if($action == "trapped") { + exec("/usr/local/sbin/spamdb -a {$srcip} -t"); + } + /* signal a reload for real time effect. */ + mwexec("killall -HUP spamlogd"); + exit; +} + +/* spam trap e-mail address */ +if($_POST['spamtrapemail'] <> "") { + mwexec("/usr/local/sbin/spamdb -T -a \"<{$_POST['spamtrapemail']}>\""); + mwexec("killall -HUP spamlogd"); + $savemsg = $_POST['spamtrapemail'] . " added to spam trap database."; +} + +if($_GET['getstatus'] <> "") { + $status = exec("/usr/local/sbin/spamdb | grep \"{$_GET['getstatus']}\""); + if(stristr($status, "WHITE") == true) { + echo "WHITE"; + } else if(stristr($status, "TRAPPED") == true) { + echo "TRAPPED"; + } else if(stristr($status, "GREY") == true) { + echo "GREY"; + } else if(stristr($status, "SPAMTRAP") == true) { + echo "SPAMTRAP"; + } else { + echo "NOT FOUND"; + } + exit; +} + +/* spam trap e-mail address */ +if($_GET['spamtrapemail'] <> "") { + $status = exec("spamdb -T -a \"<{$_GET['spamtrapemail']}>\""); + mwexec("killall -HUP spamlogd"); + if($status) + echo $status; + else + echo $_POST['spamtrapemail'] . " added to spam trap database."; + exit; +} + +/* spam trap e-mail address */ +if($_GET['whitelist'] <> "") { + $status = exec("spamdb -a \"<{$_GET['spamtrapemail']}>\""); + mwexec("killall -HUP spamlogd"); + if($status) + echo $status; + else + echo $_POST['spamtrapemail'] . " added to whitelist database."; + exit; +} + +function basic_auth_prompt(){ + header("WWW-Authenticate: Basic realm=\".\""); + header("HTTP/1.0 401 Unauthorized"); + echo "You must enter valid credentials to access this resource."; + exit; +} + +exit; + +?> \ No newline at end of file -- cgit v1.2.3