X-Git-Url: http://git.datanom.net/qtadmin.git/blobdiff_plain/5ee144945eda9e1688bf8af140e7fee937380eaf..91da83b50276678ae60a1f6016d25f88072b7abb:/quarantine.php diff --git a/quarantine.php b/quarantine.php index dd7fa1a..70f271b 100644 --- a/quarantine.php +++ b/quarantine.php @@ -25,6 +25,7 @@ if (is_object($mail) && true == $util->authorized($mail->recipient)) { $secret_id = $mail->secret_id; $recipient = $mail->recipient; + $sender = $mail->sender; if ($request == 'release') { $amavisserver = $CFG->amavisd_db_host; @@ -55,6 +56,8 @@ $query[] = "UPDATE msgrcpt SET rs = 'R' WHERE mail_id = '$mail_id'"; } else if ($request == 'delete') { $query[] = "UPDATE msgrcpt SET rs = 'D' WHERE mail_id = '$mail_id'"; + } else if ($request == 'block') { + $query[] = $sender; } else { error("Unknown operation [$request]"); exit; @@ -70,10 +73,26 @@ $request = isset($_GET['op']) ? $_GET['op'] : ''; if ($loggedIn && isset($_GET['id'])) { $ids = explode(',', $_GET['id']); - $query = handleRequest($util, $request, $ids); - $success = $DB->update($query); + if ($request == 'block') { + // /add/(whitelist|blacklist)/(.+) + $query = handleRequest($util, $request, $ids); + $data = json_encode($query); + if ($util->isAdmin()) { + $method = '/add/blacklist'; + } else { + $method = '/add/blacklist/' . $util->getUser(); + } + $success = $util->makeRestCall($method, $data); + } else { + $query = handleRequest($util, $request, $ids); + $success = $DB->update($query); + } if (! $success) { - error("Message not released, contact administrator [$query]"); + if ($request == 'block') { + error("Could not blacklist sender"); + } else { + error("Message not released, contact administrator [$query]"); + } exit; } header('Location: index.php');