- $query = handleRequest($request, $ids);
-/* exit;
- $mail_id = urldecode($_GET['id']);
- $mail = unserialize($_SESSION['mailInfo']["$mail_id"]);
- $secret_id = $mail->secret_id;
- $recipient = $mail->recipient;
-
- $query = array();
- if ($request == 'release') {
- $amavisserver = $CFG->amavisd_db_host;
- $policy_port = $CFG->amavis_policy_port;
-
- $fp = fsockopen($amavisserver, $policy_port, $errno, $errstr, 30);
- if (!$fp) {
- error("$errstr ($errno)");
- exit;
- }
- $out = "request=" . $request . "\r\n";
- $out .= "mail_id=" . $mail_id . "\r\n";
- $out .= "recipient=" . $recipient . "\r\n";
- $out .= "secret_id=" . $secret_id . "\r\n\r\n";
- fwrite($fp, $out);
- $response = fread($fp, 8192);
- fclose($fp);
- $response = urldecode($response);
- if (! preg_match("/^setreply=250\s+([\d\.]+)\s+(.*)/", $response, $matches)) {
- error("Request to release failed [$out][$response]");
- exit;
- }
- if ($matches[1] != '2.0.0') {
- error($matches[2]);
- exit;
+ 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();